From 05e501acfc436a49849fa6fb4511d367ce8f03a3 Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 13:33:33 -0400 Subject: [PATCH 01/15] avoid complex :not selectors in css --- src/partials/sidebar.css | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/partials/sidebar.css b/src/partials/sidebar.css index dd5db7ae..1b4872b3 100644 --- a/src/partials/sidebar.css +++ b/src/partials/sidebar.css @@ -228,13 +228,25 @@ body.saving #sidebar .script { } /* show disabled css scripts */ -#scripts.show-css.show-disabled .script:not([data-type="css"].disabled), +/* #scripts.show-css.show-disabled .script:not([data-type="css"].disabled), */ +#scripts.show-css.show-disabled .script[data-type="css"].enabled, +#scripts.show-css.show-disabled .script[data-type="js"].enabled, +#scripts.show-css.show-disabled .script[data-type="js"].disabled, /* show enabled css scripts */ -#scripts.show-css.show-enabled .script:not([data-type="css"].enabled), +/* #scripts.show-css.show-enabled .script:not([data-type="css"].enabled), */ +#scripts.show-css.show-enabled .script[data-type="css"].disabled, +#scripts.show-css.show-enabled .script[data-type="js"].disabled, +#scripts.show-css.show-enabled .script[data-type="js"].enabled, /* show disabled js scripts */ -#scripts.show-js.show-disabled .script:not([data-type="js"].disabled), +/* #scripts.show-js.show-disabled .script:not([data-type="js"].disabled), */ +#scripts.show-js.show-disabled .script[data-type="js"].enabled, +#scripts.show-js.show-disabled .script[data-type="css"].enabled, +#scripts.show-js.show-disabled .script[data-type="css"].disabled, /* show enabled js scripts */ -#scripts.show-js.show-enabled .script:not([data-type="js"].enabled) { +/* #scripts.show-js.show-enabled .script:not([data-type="js"].enabled), */ +#scripts.show-js.show-enabled .script[data-type="js"].disabled, +#scripts.show-js.show-enabled .script[data-type="css"].disabled, +#scripts.show-js.show-enabled .script[data-type="css"].enabled { display: none; } From db45bb2425ff51c2e9de7e93747dbe776df4e098 Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 13:33:53 -0400 Subject: [PATCH 02/15] absolutely position checkbox to hide better --- src/macros/toggle.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/macros/toggle.css b/src/macros/toggle.css index 9603c0c7..c71815c8 100644 --- a/src/macros/toggle.css +++ b/src/macros/toggle.css @@ -11,9 +11,8 @@ .toggle input[type=checkbox] { display: block; - height: 0; + position: absolute; visibility: hidden; - width: 0; } .toggle span { From d8e0bc7295633a7a5697071d631d8bf05b321cd2 Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 13:36:50 -0400 Subject: [PATCH 03/15] use scrollIntoView over scrollIntoViewIfNeeded --- src/js/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/main.js b/src/js/main.js index 3c05f36c..60d02e9e 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -731,7 +731,7 @@ const ___s = { el.classList.add("temp"); loc.insertAdjacentElement("afterend", el); this.updateScriptCount(); - el.scrollIntoViewIfNeeded(); + el.scrollIntoView(); ___a.log(`Created temporary script, ${filename}`, "darkorchid"); ___e.loadScript(loadData); }, @@ -907,7 +907,7 @@ const ___s = { document.querySelector(".active").classList.remove("active"); } el.classList.add("active"); - el.scrollIntoViewIfNeeded(); + el.scrollIntoView(); }, scriptToggle: function(e) { // prevent default checkbox behaviour, checking happens programatically @@ -948,7 +948,7 @@ const ___s = { }); // scroll to activ script if (document.querySelector(".active")) { - document.querySelector(".active").scrollIntoViewIfNeeded(); + document.querySelector(".active").scrollIntoView(); } }, updateScriptCount: function() { From 0ddeed543285614177d1df02579f8644ed561aee Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 14:18:25 -0400 Subject: [PATCH 04/15] more style updates --- src/partials/sidebar.css | 4 ++-- src/stylesheets/_main.css | 2 +- src/stylesheets/global.css | 33 ++------------------------------- 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/src/partials/sidebar.css b/src/partials/sidebar.css index 1b4872b3..4f427348 100644 --- a/src/partials/sidebar.css +++ b/src/partials/sidebar.css @@ -106,7 +106,7 @@ #scripts { border-top: 1px solid var(--border-dark); - flex: 1; + flex-basis: calc(100vh - 162px); /* .sidebar-header @ 106px and .sidebar-footer @ 56px */ overflow-y: auto; position: relative; } @@ -141,7 +141,7 @@ } .script-header .title { - flex: 1; + flex-grow: 1; font: var(--fs3); letter-spacing: var(--ls3); padding-right: 8px; diff --git a/src/stylesheets/_main.css b/src/stylesheets/_main.css index a210d416..fb1bbcb2 100644 --- a/src/stylesheets/_main.css +++ b/src/stylesheets/_main.css @@ -20,7 +20,7 @@ /* z-indexes */ noscript { z-index: 99; } -#notify { z-index: 99;} +#notify, .warn { z-index: 99;} #appLoader { z-index: 98; } #settings { z-index: 97; } #progress {z-index: 96; } diff --git a/src/stylesheets/global.css b/src/stylesheets/global.css index 81586012..031713a0 100644 --- a/src/stylesheets/global.css +++ b/src/stylesheets/global.css @@ -20,7 +20,7 @@ body { #wrapper { display: flex; - flex: 1; + overflow: hidden; } a { @@ -58,6 +58,7 @@ body:not(.init) #appLoader { white-space: nowrap; } +.warn, #notify, noscript { background-color: var(--color-red); @@ -71,36 +72,6 @@ noscript { display: none; } -#progress { - display: none; - background-color: var(--border-dark); - height: 3px; - left: 0; - position: absolute; - top: 0; - width: 100%; -} - -#progress::before { - animation: fill 3.5s infinite; - background-color: var(--link-color); - content: ""; - height: 3px; - left: 0; - margin-left: 0; - position: absolute; - top: 0; - width: 0; -} - -@keyframes fill { - 0% {width: 0; margin-left: 0;} - 50% {width: 100%;} - 55% {margin-left: 100%;} - 95% {margin-left: 0;} - 100% {width: 0;} -} - .link { color: var(--link-color); cursor: pointer; From d612894701ed8cb5adc3c7a48ce35af337b019ec Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 14:27:30 -0400 Subject: [PATCH 05/15] add demo warning --- src/index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.html b/src/index.html index b921eabf..9293b869 100644 --- a/src/index.html +++ b/src/index.html @@ -18,8 +18,10 @@ + {% if demo %} +
App optimized for Safari - other browser support limited
+ {% endif %}
-
{% include "sidebar.html" %} {% include "editor.html" %} From 0e9021390b47fa73369e0a0bf3a3f5d6abd8f797 Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 14:28:13 -0400 Subject: [PATCH 06/15] disabled spell check and autocomplete on filter input --- src/partials/sidebar.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/partials/sidebar.html b/src/partials/sidebar.html index d6acfe07..24016495 100644 --- a/src/partials/sidebar.html +++ b/src/partials/sidebar.html @@ -16,7 +16,7 @@
- + {{ icon("loupe", "filterLoupe") }}
From 366481e05b6b076a54f829fdd7fef179194b6bd4 Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 14:53:28 -0400 Subject: [PATCH 07/15] style edits on code container --- src/partials/editor.css | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/partials/editor.css b/src/partials/editor.css index 88c9da22..5eff5511 100644 --- a/src/partials/editor.css +++ b/src/partials/editor.css @@ -9,8 +9,10 @@ #code { display: flex; - flex: 1; + flex-basis: calc(100% - 112px); /* .editor-header @ 56px .editor-footer @ 56px */ + flex-grow: 1; flex-direction: column; + overflow: hidden; } .editor-header { From 33f6136dafdd2ced9db8eb70e4821327e46b6089 Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 15:11:01 -0400 Subject: [PATCH 08/15] update button state on script load --- src/js/main.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/js/main.js b/src/js/main.js index 60d02e9e..de4d5004 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -562,6 +562,8 @@ const ___e = { // enable the save button for temp scripts this.buttonSave.removeAttribute("disabled"); } else { + // ensure discard and save button are disabled after loading + this.toggleButtonState("disable"); status = ___a.getString("lastModified") + " " + lastModified; } this.setStatus(status); From a4c19f289f1b81f826f0f0ff88d67a7a54796a55 Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 15:53:21 -0400 Subject: [PATCH 09/15] add scrollIntoView options --- src/js/main.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/js/main.js b/src/js/main.js index de4d5004..9ef9fc83 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -698,6 +698,11 @@ const ___s = { buttonSettingsHide: document.getElementById("settingsHide"), filterBar: document.querySelector("#filter input"), scriptsContainer: document.getElementById("scripts"), + scrollOptions: { // options description: https://stackoverflow.com/a/48635751 + behavior: "auto", + block: "nearest", + inline: "start" + }, settingsOverlay: document.getElementById("settings"), createNewScript: function(type) { // check if editor has unsaved changed OR there's an unsaved temp script @@ -733,7 +738,7 @@ const ___s = { el.classList.add("temp"); loc.insertAdjacentElement("afterend", el); this.updateScriptCount(); - el.scrollIntoView(); + el.scrollIntoView(this.scrollOptions); ___a.log(`Created temporary script, ${filename}`, "darkorchid"); ___e.loadScript(loadData); }, @@ -909,7 +914,7 @@ const ___s = { document.querySelector(".active").classList.remove("active"); } el.classList.add("active"); - el.scrollIntoView(); + el.scrollIntoView(this.scrollOptions); }, scriptToggle: function(e) { // prevent default checkbox behaviour, checking happens programatically @@ -950,7 +955,7 @@ const ___s = { }); // scroll to activ script if (document.querySelector(".active")) { - document.querySelector(".active").scrollIntoView(); + document.querySelector(".active").scrollIntoView(this.scrollOptions); } }, updateScriptCount: function() { From 83546f5b1c5835ad6b1353d2df8b63a63a3125b5 Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 16:00:49 -0400 Subject: [PATCH 10/15] update demo banner --- src/index.html | 2 +- src/stylesheets/global.css | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/index.html b/src/index.html index 9293b869..7dfb3a36 100644 --- a/src/index.html +++ b/src/index.html @@ -19,7 +19,7 @@ {% if demo %} -
App optimized for Safari - other browser support limited
+
App optimized for Safari - other browser support limited
{% endif %}
diff --git a/src/stylesheets/global.css b/src/stylesheets/global.css index 031713a0..7bd87fe0 100644 --- a/src/stylesheets/global.css +++ b/src/stylesheets/global.css @@ -58,7 +58,7 @@ body:not(.init) #appLoader { white-space: nowrap; } -.warn, +.demo, #notify, noscript { background-color: var(--color-red); @@ -68,6 +68,12 @@ noscript { width: 100%; } +.demo { + font-size: 11.5px; + line-height: 1; + padding: 4px; +} + #notify { display: none; } From 6d118282371494a9d136f3f869a137200c1d36ad Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 16:01:39 -0400 Subject: [PATCH 11/15] rebuild demo & extension index files --- extension/Userscripts Extension/index.html | 4 ++-- index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extension/Userscripts Extension/index.html b/extension/Userscripts Extension/index.html index 97c35348..84f3755c 100644 --- a/extension/Userscripts Extension/index.html +++ b/extension/Userscripts Extension/index.html @@ -1,4 +1,4 @@ -Userscripts Safari
css
js
init
init
+Userscripts Safari
css
js
init
init
@@ -19,4 +19,4 @@ --> - \ No newline at end of file + \ No newline at end of file diff --git a/index.html b/index.html index 5f9befb1..34d749da 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ -Userscripts Safari
css
js
init
init
+Userscripts Safari
App optimized for Safari - other browser support limited
css
js
init
init
@@ -19,4 +19,4 @@ --> - \ No newline at end of file + \ No newline at end of file From 91263cee1d03aed814f6b1b7602ad9f6aa979a45 Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 16:05:32 -0400 Subject: [PATCH 12/15] bump to version 2.1.2 --- extension/Userscripts.xcodeproj/project.pbxproj | 16 ++++++++-------- index.html | 2 +- src/js/dev.js | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/extension/Userscripts.xcodeproj/project.pbxproj b/extension/Userscripts.xcodeproj/project.pbxproj index 2779e1f3..bb00442f 100644 --- a/extension/Userscripts.xcodeproj/project.pbxproj +++ b/extension/Userscripts.xcodeproj/project.pbxproj @@ -409,7 +409,7 @@ CODE_SIGN_ENTITLEMENTS = "Userscripts Extension/Userscripts Extension.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = J74Q8V8V8N; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "Userscripts Extension/Info.plist"; @@ -418,7 +418,7 @@ "@executable_path/../Frameworks", "@executable_path/../../../../Frameworks", ); - MARKETING_VERSION = 2.1.1; + MARKETING_VERSION = 2.1.2; PRODUCT_BUNDLE_IDENTIFIER = "com.userscripts.macos.Userscripts-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -432,7 +432,7 @@ CODE_SIGN_ENTITLEMENTS = "Userscripts Extension/Userscripts Extension.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = J74Q8V8V8N; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "Userscripts Extension/Info.plist"; @@ -441,7 +441,7 @@ "@executable_path/../Frameworks", "@executable_path/../../../../Frameworks", ); - MARKETING_VERSION = 2.1.1; + MARKETING_VERSION = 2.1.2; PRODUCT_BUNDLE_IDENTIFIER = "com.userscripts.macos.Userscripts-Extension"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -458,7 +458,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = J74Q8V8V8N; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = Userscripts/Info.plist; @@ -466,7 +466,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 2.1.1; + MARKETING_VERSION = 2.1.2; PRODUCT_BUNDLE_IDENTIFIER = com.userscripts.macos; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -482,7 +482,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 18; + CURRENT_PROJECT_VERSION = 19; DEVELOPMENT_TEAM = J74Q8V8V8N; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = Userscripts/Info.plist; @@ -490,7 +490,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 2.1.1; + MARKETING_VERSION = 2.1.2; PRODUCT_BUNDLE_IDENTIFIER = com.userscripts.macos; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; diff --git a/index.html b/index.html index 34d749da..d0ae5274 100644 --- a/index.html +++ b/index.html @@ -19,4 +19,4 @@ --> - \ No newline at end of file + \ No newline at end of file diff --git a/src/js/dev.js b/src/js/dev.js index 158ac325..962d82eb 100644 --- a/src/js/dev.js +++ b/src/js/dev.js @@ -195,7 +195,7 @@ const ___settings = { showInvisibles: "true", tabSize: "4", verbose: "true", - version: "2.1.1" + version: "2.1.2" }; const ___parse = { From 3c17a10016609e0ef23f88b78c1ef7bd336e54a0 Mon Sep 17 00:00:00 2001 From: quoid Date: Tue, 15 Sep 2020 16:11:11 -0400 Subject: [PATCH 13/15] add v2.1.2 entry --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index acda59af..2f85b0c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v2.1.2 (TBD) +- fixed a bug that caused discard & save buttons to remain active after loading a new script +- update styling code +- improve web demo experience + ## v2.1.1 (2020-09-14) - fixed an issue that caused extension to crash when text preceded opening userscript tag - #69 #68 #58 - improve sidebar tag filtering From 5b2d5798328d337331b67bbf0fa10e627bf16364 Mon Sep 17 00:00:00 2001 From: quoid Date: Wed, 16 Sep 2020 12:29:48 -0400 Subject: [PATCH 14/15] update changelog date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f85b0c2..09e81463 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## v2.1.2 (TBD) +## v2.1.2 (2020-09-16) - fixed a bug that caused discard & save buttons to remain active after loading a new script - update styling code - improve web demo experience From 3f8bf834be05d3b12e830a181248b3c9caec79b7 Mon Sep 17 00:00:00 2001 From: quoid Date: Wed, 16 Sep 2020 12:30:51 -0400 Subject: [PATCH 15/15] include demo link back in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ca24d1c..018d894b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Userscripts Safari -An open-source userscript editor for Safari +An open-source userscript editor for Safari - https://quoid.github.io/userscripts/ ![Userscripts Safari](/etc/screenshot.png)