From 5e5ea0fe73e9f76787bad0d84ad44d268c280bca Mon Sep 17 00:00:00 2001 From: Johnny Date: Sun, 2 Jun 2019 17:27:03 +1000 Subject: [PATCH 1/6] Apply initial style changes for Settings change --- src/css/style.css | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/css/style.css b/src/css/style.css index a4ce4b90f..fe08d15a1 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -190,7 +190,6 @@ audio.controls-added { /* fixed, z-index */ #overlay, -#fourchanx-settings, #qp, #ihover, #navlinks, .fixed #header-bar, :root.float #updater, @@ -198,11 +197,8 @@ audio.controls-added { #qr { position: fixed; } -#fourchanx-settings { - z-index: 999; -} #overlay { - z-index: 900; + z-index: 999; } #qp, #ihover { z-index: 60; @@ -513,6 +509,8 @@ audio.controls-added { } #overlay { background-color: rgba(0, 0, 0, .5); + display: -webkit-flex; + display: flex; top: 0; left: 0; height: 100%; @@ -528,11 +526,10 @@ audio.controls-added { max-width: 100%; margin: auto; padding: 3px; - top: 50%; - left: 50%; - -moz-transform: translate(-50%, -50%); - -webkit-transform: translate(-50%, -50%); - transform: translate(-50%, -50%); + display: -webkit-flex; + display: flex; + -webkit-flex-direction: column; + flex-direction: column; } #fourchanx-settings > nav { padding: 2px 2px 0; From d51b6027c2397bfb9421f3e68c6839e286abadca Mon Sep 17 00:00:00 2001 From: Johnny Date: Sun, 2 Jun 2019 17:27:54 +1000 Subject: [PATCH 2/6] Include the containing element --- src/General/Settings/Settings.html | 32 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/General/Settings/Settings.html b/src/General/Settings/Settings.html index 1f6d5f996..79d337643 100644 --- a/src/General/Settings/Settings.html +++ b/src/General/Settings/Settings.html @@ -1,15 +1,17 @@ - -
+
+ +
+
From c01d833ab0f814b50a7ee070fb32f016b99ae5cf Mon Sep 17 00:00:00 2001 From: Johnny Date: Sun, 2 Jun 2019 17:29:17 +1000 Subject: [PATCH 3/6] Update code for Settings change Clicking the overlay will close the element, and also adds back the `.unscroll` class --- src/General/Settings.coffee | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 535a3022e..a106a3567 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -4,7 +4,7 @@ Settings = link = $.el 'a', className: 'settings-link fa fa-wrench' textContent: 'Settings' - title: '<%= meta.name %> Settings' + title: '<%= meta.name %> Settings' href: 'javascript:;' $.on link, 'click', Settings.open @@ -41,13 +41,9 @@ Settings = return if Settings.overlay $.event 'CloseMenu' - Settings.dialog = dialog = $.el 'div', - id: 'fourchanx-settings' - className: 'dialog' - $.extend dialog, <%= readHTML('Settings.html') %> - - Settings.overlay = overlay = $.el 'div', - id: 'overlay' + Settings.dialog = overlay = $.el 'div', + id: 'overlay' + innerHTML: <%= readHTML('Settings.html') %> $.on $('.export', dialog), 'click', Settings.export $.on $('.import', dialog), 'click', Settings.import @@ -64,14 +60,16 @@ Settings = links.push link, $.tn ' | ' sectionToOpen = link if section.title is openSection links.pop() - $.add $('.sections-list', dialog), links + $.add $('.sections-list', overlay), links (if sectionToOpen then sectionToOpen else links[0]).click() unless openSection is 'none' - $.on $('.close', dialog), 'click', Settings.close + $.on $('.close', overlay), 'click', Settings.close $.on overlay, 'click', Settings.close $.on window, 'beforeunload', Settings.close + $.on overlay.firstElementChild, 'click', (e) -> e.stopPropagation() - $.add d.body, [overlay, dialog] + $.addClass d.body, 'unscroll' + $.add d.body, overlay $.event 'OpenSettings', null, dialog @@ -79,9 +77,8 @@ Settings = return unless Settings.dialog # Unfocus current field to trigger change event. d.activeElement?.blur() - $.rm Settings.overlay + $.rmClass d.body, 'unscroll' $.rm Settings.dialog - delete Settings.overlay delete Settings.dialog sections: [] From 6014566890b773f13852ece08f01da16da906609 Mon Sep 17 00:00:00 2001 From: Johnny Date: Tue, 16 Jul 2019 17:05:23 +1000 Subject: [PATCH 4/6] Further CSS edits Tries to keep the Settings looking visually the same as prior to changes. --- src/css/style.css | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/css/style.css b/src/css/style.css index fe08d15a1..5bbe1683c 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -525,15 +525,16 @@ audio.controls-added { width: 900px; max-width: 100%; margin: auto; - padding: 3px; + padding: 5px; display: -webkit-flex; display: flex; -webkit-flex-direction: column; flex-direction: column; } #fourchanx-settings > nav { - padding: 2px 2px 0; - height: 15px; + padding: 2px 2px 8px; + display: -webkit-flex; + display: flex; } #fourchanx-settings > nav a { text-decoration: underline; @@ -544,20 +545,15 @@ audio.controls-added { margin: 0; } .section-container { + -webkit-flex: 1; + flex: 1; overflow: auto; - position: absolute; - top: 2.1em; - right: 5px; - bottom: 5px; - left: 5px; + padding-top: 8px; padding-right: 5px; } .sections-list { - padding: 0 3px; - float: left; -} -.credits { - float: right; + -webkit-flex: 1; + flex: 1; } .export, .import, .reset { cursor: pointer; From 47405cf718e442c73264a886f05cb19bc0b0e1d7 Mon Sep 17 00:00:00 2001 From: Johnny Date: Tue, 16 Jul 2019 17:06:15 +1000 Subject: [PATCH 5/6] Update references to overlay and dialog --- src/General/Settings.coffee | 72 ++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index a106a3567..64883fd98 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -4,7 +4,7 @@ Settings = link = $.el 'a', className: 'settings-link fa fa-wrench' textContent: 'Settings' - title: '<%= meta.name %> Settings' + title: '<%= meta.name %> Settings' href: 'javascript:;' $.on link, 'click', Settings.open @@ -38,12 +38,13 @@ Settings = Object.defineProperty window, 'Config', {value: {disableAll: true}} open: (openSection) -> - return if Settings.overlay + return if Settings.dialog $.event 'CloseMenu' - Settings.dialog = overlay = $.el 'div', + Settings.dialog = dialog = $.el 'div', id: 'overlay' - innerHTML: <%= readHTML('Settings.html') %> + , + <%= readHTML('Settings.html') %> $.on $('.export', dialog), 'click', Settings.export $.on $('.import', dialog), 'click', Settings.import @@ -60,16 +61,16 @@ Settings = links.push link, $.tn ' | ' sectionToOpen = link if section.title is openSection links.pop() - $.add $('.sections-list', overlay), links + $.add $('.sections-list', dialog), links (if sectionToOpen then sectionToOpen else links[0]).click() unless openSection is 'none' - $.on $('.close', overlay), 'click', Settings.close - $.on overlay, 'click', Settings.close + $.on $('.close', dialog), 'click', Settings.close $.on window, 'beforeunload', Settings.close - $.on overlay.firstElementChild, 'click', (e) -> e.stopPropagation() + $.on dialog, 'click', Settings.close + $.on dialog.firstElementChild, 'click', (e) -> e.stopPropagation() $.addClass d.body, 'unscroll' - $.add d.body, overlay + $.add d.body, dialog $.event 'OpenSettings', null, dialog @@ -196,7 +197,7 @@ Settings = $.on button, 'click', -> @textContent = 'Hidden: 0' $.get 'hiddenThreads', {}, ({hiddenThreads}) -> - if $.hasStorage and Site.software is 'yotsuba' + if $.hasStorage and g.SITE.software is 'yotsuba' for boardID of hiddenThreads.boards localStorage.removeItem "4chan-hide-t-#{boardID}" ($.delete ['hiddenThreads', 'hiddenPosts']) @@ -385,7 +386,7 @@ Settings = if compareString < '00001.00011.00017.00006' if data['sauces']? set 'sauces', data['sauces'].replace(/^(#?\s*)http:\/\/iqdb\.org\//mg, '$1//iqdb.org/') - if compareString < '00001.00011.00019.00003' and not Settings.overlay + if compareString < '00001.00011.00019.00003' and not Settings.dialog $.queueTask -> Settings.warnings.ads (item) -> new Notice 'warning', [item.childNodes...] if compareString < '00001.00011.00020.00003' for key, value of {'Inline Cross-thread Quotes Only': false, 'Pass Link': true} @@ -480,6 +481,19 @@ Settings = /\/\/%\$1\.deviantart\.com\/gallery\/#\/d%\$2;regexp:\/\^\\w\+_by_\(\\w\+\)-d\(\[\\da-z\]\+\)\//g, '//www.deviantart.com/gallery/#/d%$1%$2;regexp:/^\\w+_by_\\w+[_-]d([\\da-z]{6})\\b|^d([\\da-z]{6})-[\\da-z]{8}-/' ) + if compareString < '00001.00014.00008.00000' + if data['sauces']? + set 'sauces', data['sauces'].replace( + /https:\/\/www\.yandex\.com\/images\/search/g, + 'https://yandex.com/images/search' + ) + if compareString < '00001.00014.00009.00000' + if data['sauces']? + set 'sauces', data['sauces'].replace(/^(#?\s*)(?:http:)?\/\/(www\.pixiv\.net|www\.deviantart\.com|imgur\.com|flickr\.com)\//mg, '$1https://$2/') + set 'sauces', data['sauces'].replace(/https:\/\/yandex\.com\/images\/search\?rpt=imageview&img_url=%IMG/g, 'https://yandex.com/images/search?rpt=imageview&url=%IMG') + if compareString < '00001.00014.00009.00001' + if data['Use Faster Image Host']? and not data['fourchanImageHost']? + set 'fourchanImageHost', (if data['Use Faster Image Host'] then 'i.4cdn.org' else '') changes loadSettings: (data, cb) -> @@ -546,7 +560,7 @@ Settings = $.id('lastarchivecheck').textContent = 'never' items = {} - for name in ['archiveLists', 'archiveAutoUpdate', 'captchaLanguage', 'boardnav', 'time', 'timeLocale', 'backlink', 'pastedname', 'fileInfo', 'QR.personas', 'favicon', 'usercss', 'customCooldown', 'jsWhitelist'] + for name in ['archiveLists', 'archiveAutoUpdate', 'fourchanImageHost', 'captchaLanguage', 'captchaServiceDomain', 'boardnav', 'time', 'timeLocale', 'backlink', 'pastedname', 'fileInfo', 'QR.personas', 'favicon', 'usercss', 'customCooldown', 'jsWhitelist'] items[name] = Conf[name] input = inputs[name] event = if name in ['archiveLists', 'archiveAutoUpdate', 'QR.personas', 'favicon', 'usercss'] then 'change' else 'input' @@ -562,6 +576,15 @@ Settings = Settings[key].call input return + listImageHost = $.id 'list-fourchanImageHost' + for textContent in ImageHost.suggestions + $.add listImageHost, $.el 'option', {textContent} + + $.on inputs['captchaServiceKey'], 'input', Settings.captchaServiceKey + $.get 'captchaServiceKey', Conf['captchaServiceKey'], ({captchaServiceKey}) -> + Conf['captchaServiceKey'] = captchaServiceKey + Settings.captchaServiceDomainList() + interval = inputs['Interval'] customCSS = inputs['Custom CSS'] applyCSS = $ '#apply-css', section @@ -693,6 +716,31 @@ Settings = Conf['selectedArchives'] = selectedArchives Redirect.selectArchives() + captchaServiceDomain: -> + $.get 'captchaServiceKey', Conf['captchaServiceKey'], ({captchaServiceKey}) => + keyInput = $('[name=captchaServiceKey]') + keyInput.value = captchaServiceKey[@value.trim()] or '' + keyInput.disabled = !@value.trim() + + captchaServiceKey: -> + domain = Conf['captchaServiceDomain'] + value = @value.trim() + Conf['captchaServiceKey'][domain] = value + $.get 'captchaServiceKey', Conf['captchaServiceKey'], ({captchaServiceKey}) -> + captchaServiceKey[domain] = value + delete captchaServiceKey[domain] unless value or (domain of Config['captchaServiceKey'][0]) + Conf['captchaServiceKey'] = captchaServiceKey + $.set 'captchaServiceKey', captchaServiceKey + Settings.captchaServiceDomainList() + + captchaServiceDomainList: -> + list = $.id 'list-captchaServiceDomain' + $.rmAll list + for domain of Conf['captchaServiceKey'] + $.add list, $.el 'option', + textContent: domain + return + boardnav: -> Header.generateBoardList @value From 65ad530d59556f7a0c678be5ba4e96abd580c2d4 Mon Sep 17 00:00:00 2001 From: Johnny Date: Tue, 16 Jul 2019 17:12:10 +1000 Subject: [PATCH 6/6] Minor fix For the archive's board select, with is absoluted. --- src/css/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/css/style.css b/src/css/style.css index 5bbe1683c..366b43fe4 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -547,6 +547,7 @@ audio.controls-added { .section-container { -webkit-flex: 1; flex: 1; + position: relative; overflow: auto; padding-top: 8px; padding-right: 5px;