From 2afd9919cca62d0e0b890dd56e8a574b34949ad4 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 18 Mar 2018 13:56:20 -0400 Subject: [PATCH 01/65] fix #3624 --- src/js/assets.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/js/assets.js b/src/js/assets.js index a15b06e3390cc..7c0ae6fd71f62 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -182,8 +182,7 @@ api.fetchFilterList = function(mainlistURL, onLoad, onError) { var onLocalLoadSuccess = function(details) { if ( errored ) { return; } - var isSublist = details.url !== mainlistURL, - sublistURL; + var isSublist = details.url !== mainlistURL; pendingSublistURLs.delete(details.url); loadedSublistURLs.add(details.url); @@ -194,27 +193,23 @@ api.fetchFilterList = function(mainlistURL, onLoad, onError) { parsedMainURL !== undefined && parsedMainURL.pathname.length > 0 ) { - var reInclude = /^!#include +(\S+)/gm, - match, subURL; + var reInclude = /^!#include +(\S+)/gm; for (;;) { - match = reInclude.exec(details.content); + var match = reInclude.exec(details.content); if ( match === null ) { break; } if ( toParsedURL(match[1]) !== undefined ) { continue; } if ( match[1].indexOf('..') !== -1 ) { continue; } - subURL = + var subURL = parsedMainURL.origin + parsedMainURL.pathname.replace(/[^/]+$/, match[1]); + if ( pendingSublistURLs.has(subURL) ) { continue; } if ( loadedSublistURLs.has(subURL) ) { continue; } pendingSublistURLs.add(subURL); + api.fetchText(subURL, onLocalLoadSuccess, onLocalLoadError); } } - if ( pendingSublistURLs.size !== 0 ) { - for ( sublistURL of pendingSublistURLs ) { - api.fetchText(sublistURL, onLocalLoadSuccess, onLocalLoadError); - } - return; - } + if ( pendingSublistURLs.size !== 0 ) { return; } details.url = mainlistURL; details.content = content.join('\n').trim(); From 96d4f987ac382b500b7b01ecc314d6532a953a13 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 18 Mar 2018 14:04:58 -0400 Subject: [PATCH 02/65] use default codemirror input style, `contenteditable` interferes with search widget --- src/js/asset-viewer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/js/asset-viewer.js b/src/js/asset-viewer.js index fc0aa90924925..70615291d6cf3 100644 --- a/src/js/asset-viewer.js +++ b/src/js/asset-viewer.js @@ -46,7 +46,6 @@ document.getElementById('content'), { autofocus: true, - inputStyle: 'contenteditable', lineNumbers: true, lineWrapping: true, readOnly: true, From 981f6692ef304f5e09311f578186770f7f38bf33 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 18 Mar 2018 14:05:50 -0400 Subject: [PATCH 03/65] new revision for dev build --- dist/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/version b/dist/version index 89a0baac65472..c5cfeaa8965ee 100644 --- a/dist/version +++ b/dist/version @@ -1 +1 @@ -1.15.18 +1.15.19.0 From 4e1ba3b12ae380fcc34d65d42d30843e10d720b4 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 18 Mar 2018 14:08:57 -0400 Subject: [PATCH 04/65] make Firefox dev build auto-update --- dist/firefox/updates.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/firefox/updates.json b/dist/firefox/updates.json index 7026e451b83a4..fa4cd77c6ef14 100644 --- a/dist/firefox/updates.json +++ b/dist/firefox/updates.json @@ -3,10 +3,10 @@ "uBlock0@raymondhill.net": { "updates": [ { - "version": "1.15.17b1", + "version": "1.15.19b0", "applications": { "gecko": { "strict_min_version": "52" } }, - "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.17b1", - "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.17b1/uBlock0.webext.signed.xpi" + "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b0", + "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b0/uBlock0.webext.signed.xpi" } ] } From 9ce1f8af08a1d3a74e732b627687b0416176c19d Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 19 Mar 2018 10:25:03 -0400 Subject: [PATCH 05/65] fix https://www.reddit.com/r/uBlockOrigin/comments/8524cf/my_custom_scriptlets_doesnt_work_what_am_i_doing/ --- src/js/messaging.js | 3 +-- src/js/redirect-engine.js | 2 ++ src/js/ublock.js | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/js/messaging.js b/src/js/messaging.js index 95e716751485c..a6e2f3c9b87e7 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -990,8 +990,7 @@ var onMessage = function(request, sender, callback) { break; case 'writeHiddenSettings': - µb.hiddenSettings = µb.hiddenSettingsFromString(request.content); - µb.saveHiddenSettings(); + µb.changeHiddenSettings(µb.hiddenSettingsFromString(request.content)); break; default: diff --git a/src/js/redirect-engine.js b/src/js/redirect-engine.js index b2ccda7dad4c5..bab57cda505e9 100644 --- a/src/js/redirect-engine.js +++ b/src/js/redirect-engine.js @@ -484,6 +484,8 @@ RedirectEngine.prototype.resourcesFromString = function(text) { } warResolve(); + + this.modifyTime = Date.now(); }; /******************************************************************************/ diff --git a/src/js/ublock.js b/src/js/ublock.js index 8f5698e5ec714..82b43c285aa46 100644 --- a/src/js/ublock.js +++ b/src/js/ublock.js @@ -379,6 +379,21 @@ var matchBucket = function(url, hostname, bucket, start) { /******************************************************************************/ +// https://www.reddit.com/r/uBlockOrigin/comments/8524cf/my_custom_scriptlets_doesnt_work_what_am_i_doing/ + +µBlock.changeHiddenSettings = function(hs) { + var mustReloadResources = + hs.userResourcesLocation !== this.hiddenSettings.userResourcesLocation; + this.hiddenSettings = hs; + this.saveHiddenSettings(); + if ( mustReloadResources ) { + this.redirectEngine.invalidateResourcesSelfie(); + this.loadRedirectResources(); + } +}; + +/******************************************************************************/ + µBlock.elementPickerExec = function(tabId, targetElement, zap) { if ( vAPI.isBehindTheSceneTabId(tabId) ) { return; From 4f2d071137d4843639a27c57e9c2aac5536ae7da Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 19 Mar 2018 10:28:17 -0400 Subject: [PATCH 06/65] new revision for dev build --- dist/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/version b/dist/version index c5cfeaa8965ee..804a886067c58 100644 --- a/dist/version +++ b/dist/version @@ -1 +1 @@ -1.15.19.0 +1.15.19.1 From 6871d9aed43273e1bd1714641539d403508ec0c9 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 21 Mar 2018 07:24:52 -0400 Subject: [PATCH 07/65] add ability to filter out rules in "My rules" pane --- src/css/dyna-rules.css | 2 +- src/dyna-rules.html | 3 +- src/js/codemirror/search.js | 2 +- src/js/dyna-rules.js | 187 +++++++++++++++++------- src/lib/codemirror/addon/merge/merge.js | 1 + 5 files changed, 139 insertions(+), 56 deletions(-) diff --git a/src/css/dyna-rules.css b/src/css/dyna-rules.css index cf1ba0bdfc296..bab91c51a85c1 100644 --- a/src/css/dyna-rules.css +++ b/src/css/dyna-rules.css @@ -34,7 +34,7 @@ body { font-weight: normal; margin: 0.5em 0; } -#diff .ruleFilter { +#ruleFilter { text-align: center; } body[dir="ltr"] #revertButton:after { diff --git a/src/dyna-rules.html b/src/dyna-rules.html index b9e156ce38166..7bd278892acde 100644 --- a/src/dyna-rules.html +++ b/src/dyna-rules.html @@ -5,7 +5,6 @@ uBlock — Dynamic filtering rules - @@ -33,7 +32,7 @@

- +
diff --git a/src/js/codemirror/search.js b/src/js/codemirror/search.js index e6a9627d6f617..a0c561adf350b 100644 --- a/src/js/codemirror/search.js +++ b/src/js/codemirror/search.js @@ -53,7 +53,7 @@ var searchWidgetHtml = '
' + - ' ' + + ' ' + '' + '' + '' + diff --git a/src/js/dyna-rules.js b/src/js/dyna-rules.js index ec2408f1588c3..ba29b816b8c8c 100644 --- a/src/js/dyna-rules.js +++ b/src/js/dyna-rules.js @@ -36,6 +36,7 @@ var mergeView = new CodeMirror.MergeView( { allowEditingOriginals: true, connect: 'align', + inputStyle: 'contenteditable', lineNumbers: true, lineWrapping: false, origLeft: '', @@ -47,46 +48,111 @@ mergeView.editor().setOption('styleActiveLine', true); mergeView.editor().setOption('lineNumbers', false); mergeView.leftOriginal().setOption('readOnly', 'nocursor'); -var cleanToken = 0; +var unfilteredRules = { + orig: { doc: mergeView.leftOriginal(), rules: [] }, + edit: { doc: mergeView.editor(), rules: [] } +}; + +var cleanEditToken = 0; var cleanEditText = ''; var differ; /******************************************************************************/ +// Borrowed from... +// https://github.com/codemirror/CodeMirror/blob/3e1bb5fff682f8f6cbfaef0e56c61d62403d4798/addon/search/search.js#L22 +// ... and modified as needed. + +var updateOverlay = (function() { + var reFilter; + var mode = { + token: function(stream) { + if ( reFilter !== undefined ) { + reFilter.lastIndex = stream.pos; + var match = reFilter.exec(stream.string); + if ( match !== null ) { + if ( match.index === stream.pos ) { + stream.pos += match[0].length || 1; + return 'searching'; + } + stream.pos = match.index; + return; + } + } + stream.skipToEnd(); + } + }; + return function(filter) { + reFilter = typeof filter === 'string' && filter !== '' ? + new RegExp(filter.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi') : + undefined; + return mode; + }; +})(); + +/******************************************************************************/ + // Incrementally update text in a CodeMirror editor for best user experience: // - Scroll position preserved // - Minimum amount of text updated -var rulesToDoc = function(doc, rules) { - if ( doc.getValue() === '' || rules.length === 0 ) { - doc.setValue(rules.length !== 0 ? rules.join('\n') : ''); - return; - } - if ( differ === undefined ) { differ = new diff_match_patch(); } - var beforeText = doc.getValue(); - var afterText = rules.join('\n'); - var diffs = differ.diff_main(beforeText, afterText); - doc.startOperation(); - var i = diffs.length, - iedit = beforeText.length; - while ( i-- ) { - var diff = diffs[i]; - if ( diff[0] === 0 ) { - iedit -= diff[1].length; +var rulesToDoc = function(clearHistory) { + for ( var key in unfilteredRules ) { + if ( unfilteredRules.hasOwnProperty(key) === false ) { continue; } + var doc = unfilteredRules[key].doc; + var rules = filterRules(key); + if ( doc.lineCount() === 1 && doc.getValue() === '' || rules.length === 0 ) { + doc.setValue(rules.length !== 0 ? rules.join('\n') : ''); continue; } - var end = doc.posFromIndex(iedit); - if ( diff[0] === 1 ) { - doc.replaceRange(diff[1], end, end); - continue; + if ( differ === undefined ) { differ = new diff_match_patch(); } + var beforeText = doc.getValue(); + var afterText = rules.join('\n'); + var diffs = differ.diff_main(beforeText, afterText); + doc.startOperation(); + var i = diffs.length, + iedit = beforeText.length; + while ( i-- ) { + var diff = diffs[i]; + if ( diff[0] === 0 ) { + iedit -= diff[1].length; + continue; + } + var end = doc.posFromIndex(iedit); + if ( diff[0] === 1 ) { + doc.replaceRange(diff[1], end, end); + continue; + } + /* diff[0] === -1 */ + iedit -= diff[1].length; + var beg = doc.posFromIndex(iedit); + doc.replaceRange('', beg, end); } - /* diff[0] === -1 */ - iedit -= diff[1].length; - var beg = doc.posFromIndex(iedit); - doc.replaceRange('', beg, end); + doc.endOperation(); } - doc.endOperation(); + cleanEditText = mergeView.editor().getValue().trim(); + cleanEditToken = mergeView.editor().changeGeneration(); + if ( clearHistory ) { + mergeView.editor().clearHistory(); + } +}; + +/******************************************************************************/ + +var filterRules = function(key) { + var rules = unfilteredRules[key].rules; + var filter = uDom('#ruleFilter input').val(); + if ( filter !== '' ) { + rules = rules.slice(); + var i = rules.length; + while ( i-- ) { + if ( rules[i].indexOf(filter) === -1 ) { + rules.splice(i, 1); + } + } + } + return rules; }; /******************************************************************************/ @@ -98,18 +164,16 @@ var renderRules = (function() { details.hnSwitches.sort(); details.permanentRules.sort(); details.sessionRules.sort(); - var orig = details.hnSwitches.concat(details.permanentRules), - edit = details.hnSwitches.concat(details.sessionRules); - rulesToDoc(mergeView.leftOriginal(), orig); - rulesToDoc(mergeView.editor(), edit); - cleanEditText = mergeView.editor().getValue().trim(); + unfilteredRules.orig.rules = + details.hnSwitches.concat(details.permanentRules); + unfilteredRules.edit.rules = + details.hnSwitches.concat(details.sessionRules); + rulesToDoc(firstVisit); if ( firstVisit ) { - mergeView.editor().clearHistory(); firstVisit = false; mergeView.editor().execCommand('goNextDiff'); } - cleanToken = mergeView.editor().changeGeneration(); - onChange(true); + onTextChanged(true); }; })(); @@ -157,19 +221,14 @@ mergeView.options.revertChunk = function( { line: toStart.line, ch: 0 }, { line: toEnd.line, ch: 0 } ); - applyDiff(from === mv.editor(), toAdd, toRemove); - to.replaceRange(toAdd, toStart, toEnd); - cleanToken = mergeView.editor().changeGeneration(); - cleanEditText = mergeView.editor().getValue().trim(); + applyDiff(from === mv.editor(), toAdd, toRemove, renderRules); }; /******************************************************************************/ function handleImportFilePicker() { var fileReaderOnLoadHandler = function() { - if ( typeof this.result !== 'string' || this.result === '' ) { - return; - } + if ( typeof this.result !== 'string' || this.result === '' ) { return; } // https://github.com/chrisaljoudi/uBlock/issues/757 // Support RequestPolicy rule syntax var result = this.result; @@ -217,41 +276,64 @@ function exportUserRulesToFile() { /******************************************************************************/ -/* -var onFilter = (function() { - var timer; +var onFilterChanged = (function() { + var timer, + overlay = null, + last = ''; var process = function() { timer = undefined; + if ( mergeView.editor().isClean(cleanEditToken) === false ) { return; } + if ( overlay !== null ) { + mergeView.leftOriginal().removeOverlay(overlay); + mergeView.editor().removeOverlay(overlay); + overlay = null; + } + var filter = uDom('#ruleFilter input').val(); + if ( filter === last ) { return; } + last = filter; + + if ( filter !== '' ) { + overlay = updateOverlay(filter); + mergeView.leftOriginal().addOverlay(overlay); + mergeView.editor().addOverlay(overlay); + } + rulesToDoc(true); }; return function() { if ( timer !== undefined ) { clearTimeout(timer); } - timer = vAPI.setTimeout(process, 577); + timer = vAPI.setTimeout(process, 773); }; })(); -*/ /******************************************************************************/ -var onChange = (function() { +var onTextChanged = (function() { var timer; var process = function(now) { timer = undefined; - var isClean = mergeView.editor().isClean(cleanToken); + var isClean = mergeView.editor().isClean(cleanEditToken); var diff = document.getElementById('diff'); if ( now && isClean === false && mergeView.editor().getValue().trim() === cleanEditText ) { - cleanToken = mergeView.editor().changeGeneration(); + cleanEditToken = mergeView.editor().changeGeneration(); isClean = true; } diff.classList.toggle('editing', isClean === false); diff.classList.toggle('dirty', mergeView.leftChunks().length !== 0); - CodeMirror.commands.save = isClean ? undefined : editSaveHandler; + var input = document.querySelector('#ruleFilter input'); + if ( isClean ) { + input.removeAttribute('disabled'); + CodeMirror.commands.save = undefined; + } else { + input.setAttribute('disabled', ''); + CodeMirror.commands.save = editSaveHandler; + } }; return function(now) { @@ -308,7 +390,7 @@ var editSaveHandler = function() { var editor = mergeView.editor(); var editText = editor.getValue().trim(); if ( editText === cleanEditText ) { - onChange(true); + onTextChanged(true); return; } if ( differ === undefined ) { differ = new diff_match_patch(); } @@ -354,9 +436,10 @@ uDom('#exportButton').on('click', exportUserRulesToFile); uDom('#revertButton').on('click', revertAllHandler); uDom('#commitButton').on('click', commitAllHandler); uDom('#editSaveButton').on('click', editSaveHandler); +uDom('#ruleFilter input').on('input', onFilterChanged); // https://groups.google.com/forum/#!topic/codemirror/UQkTrt078Vs -mergeView.editor().on('updateDiff', function() { onChange(); }); +mergeView.editor().on('updateDiff', function() { onTextChanged(); }); /******************************************************************************/ diff --git a/src/lib/codemirror/addon/merge/merge.js b/src/lib/codemirror/addon/merge/merge.js index 3a77f7a64c084..5b87b5e62a7e9 100644 --- a/src/lib/codemirror/addon/merge/merge.js +++ b/src/lib/codemirror/addon/merge/merge.js @@ -664,6 +664,7 @@ function getChunks(diff) { var chunks = []; + if (!diff.length) return chunks; var startEdit = 0, startOrig = 0; var edit = Pos(0, 0), orig = Pos(0, 0); for (var i = 0; i < diff.length; ++i) { From 431b40f8e45dbddc11020a3370c4ff3260b2ef5b Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 21 Mar 2018 08:42:21 -0400 Subject: [PATCH 08/65] code review for 6871d9aed432 --- src/css/dyna-rules.css | 3 +++ src/js/dyna-rules.js | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/css/dyna-rules.css b/src/css/dyna-rules.css index bab91c51a85c1..e71a398a51268 100644 --- a/src/css/dyna-rules.css +++ b/src/css/dyna-rules.css @@ -37,6 +37,9 @@ body { #ruleFilter { text-align: center; } +#ruleFilter .fa { + color: #888; + } body[dir="ltr"] #revertButton:after { content: '\2009\f061'; font-family: FontAwesome; diff --git a/src/js/dyna-rules.js b/src/js/dyna-rules.js index ba29b816b8c8c..15d05d89b10d1 100644 --- a/src/js/dyna-rules.js +++ b/src/js/dyna-rules.js @@ -284,15 +284,14 @@ var onFilterChanged = (function() { var process = function() { timer = undefined; if ( mergeView.editor().isClean(cleanEditToken) === false ) { return; } + var filter = uDom('#ruleFilter input').val(); + if ( filter === last ) { return; } + last = filter; if ( overlay !== null ) { mergeView.leftOriginal().removeOverlay(overlay); mergeView.editor().removeOverlay(overlay); overlay = null; } - var filter = uDom('#ruleFilter input').val(); - if ( filter === last ) { return; } - last = filter; - if ( filter !== '' ) { overlay = updateOverlay(filter); mergeView.leftOriginal().addOverlay(overlay); From fca714c12d752bd51c3693bf587b4fac43574f93 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 21 Mar 2018 09:04:08 -0400 Subject: [PATCH 09/65] code review for 6871d9aed432: mind rtl languages --- src/css/dyna-rules.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/css/dyna-rules.css b/src/css/dyna-rules.css index e71a398a51268..3c692000f529a 100644 --- a/src/css/dyna-rules.css +++ b/src/css/dyna-rules.css @@ -35,6 +35,7 @@ body { margin: 0.5em 0; } #ruleFilter { + direction: ltr; text-align: center; } #ruleFilter .fa { From a3daa804d4cb85a155df32599d6d3376b8f90e3d Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 21 Mar 2018 12:06:08 -0400 Subject: [PATCH 10/65] make Firefox dev build auto-update --- dist/firefox/updates.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/firefox/updates.json b/dist/firefox/updates.json index fa4cd77c6ef14..e9d2df2d64166 100644 --- a/dist/firefox/updates.json +++ b/dist/firefox/updates.json @@ -3,10 +3,10 @@ "uBlock0@raymondhill.net": { "updates": [ { - "version": "1.15.19b0", + "version": "1.15.19b1", "applications": { "gecko": { "strict_min_version": "52" } }, - "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b0", - "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b0/uBlock0.webext.signed.xpi" + "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b1", + "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b1/uBlock0.webext.signed.xpi" } ] } From d9161aeffa551b6154be395c7a86ed0650eecdb7 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 23 Mar 2018 15:03:29 -0400 Subject: [PATCH 11/65] fix #3636 --- src/js/redirect-engine.js | 2 +- tools/import-war.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/js/redirect-engine.js b/src/js/redirect-engine.js index bab57cda505e9..9ca363dd130e7 100644 --- a/src/js/redirect-engine.js +++ b/src/js/redirect-engine.js @@ -490,7 +490,7 @@ RedirectEngine.prototype.resourcesFromString = function(text) { /******************************************************************************/ -var resourcesSelfieVersion = 2; +var resourcesSelfieVersion = 3; RedirectEngine.prototype.selfieFromResources = function() { vAPI.cacheStorage.set({ diff --git a/tools/import-war.py b/tools/import-war.py index 6c296f3ab4e68..70f36570fabd9 100755 --- a/tools/import-war.py +++ b/tools/import-war.py @@ -20,6 +20,9 @@ if len(line) != 0 and line[0] != '#': to_import.add(line) +# https://github.com/gorhill/uBlock/issues/3636 +safe_exts = { 'javascript': 'js' } + imported = [] # scan the file until a resource to import is found @@ -40,7 +43,10 @@ def safe_filename_from_token(token, mime): # extract file extension from mime match = re.search('^[^/]+/([^\s;]+)', mime) if match: - name += '.' + match.group(1) + ext = match.group(1) + if ext in safe_exts: + ext = safe_exts[ext] + name += '.' + ext return name def import_resource(f, token, mime): From e35f6b3df6d5eaee5043d234f90c92a590fb934d Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 23 Mar 2018 15:05:35 -0400 Subject: [PATCH 12/65] code review: no need for callback arg --- src/js/dyna-rules.js | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/js/dyna-rules.js b/src/js/dyna-rules.js index 15d05d89b10d1..d4feef23a2519 100644 --- a/src/js/dyna-rules.js +++ b/src/js/dyna-rules.js @@ -179,7 +179,7 @@ var renderRules = (function() { /******************************************************************************/ -var applyDiff = function(permanent, toAdd, toRemove, callback) { +var applyDiff = function(permanent, toAdd, toRemove) { messaging.send( 'dashboard', { @@ -188,7 +188,7 @@ var applyDiff = function(permanent, toAdd, toRemove, callback) { toAdd: toAdd, toRemove: toRemove }, - callback + renderRules ); }; @@ -221,7 +221,7 @@ mergeView.options.revertChunk = function( { line: toStart.line, ch: 0 }, { line: toEnd.line, ch: 0 } ); - applyDiff(from === mv.editor(), toAdd, toRemove, renderRules); + applyDiff(from === mv.editor(), toAdd, toRemove); }; /******************************************************************************/ @@ -238,7 +238,7 @@ function handleImportFilePicker() { .replace(/\|/g, ' ') .replace(/\n/g, ' * noop\n'); } - applyDiff(false, result, '', renderRules); + applyDiff(false, result, ''); }; var file = this.files[0]; if ( file === undefined || file.name === '' ) { return; } @@ -359,7 +359,7 @@ var revertAllHandler = function() { toAdd.push(addedLines.trim()); toRemove.push(removedLines.trim()); } - applyDiff(false, toAdd.join('\n'), toRemove.join('\n'), renderRules); + applyDiff(false, toAdd.join('\n'), toRemove.join('\n')); }; /******************************************************************************/ @@ -380,7 +380,7 @@ var commitAllHandler = function() { toAdd.push(addedLines.trim()); toRemove.push(removedLines.trim()); } - applyDiff(true, toAdd.join('\n'), toRemove.join('\n'), renderRules); + applyDiff(true, toAdd.join('\n'), toRemove.join('\n')); }; /******************************************************************************/ @@ -402,28 +402,24 @@ var editSaveHandler = function() { toRemove.push(diff[1]); } } - applyDiff(false, toAdd.join(''), toRemove.join(''), renderRules); + applyDiff(false, toAdd.join(''), toRemove.join('')); }; /******************************************************************************/ -var getCloudData = function() { +self.cloud.onPush = function() { return mergeView.leftOriginal().getValue().trim(); }; -var setCloudData = function(data, append) { +self.cloud.onPull = function(data, append) { if ( typeof data !== 'string' ) { return; } applyDiff( false, data, - append ? '' : mergeView.editor().getValue().trim(), - renderRules + append ? '' : mergeView.editor().getValue().trim() ); }; -self.cloud.onPush = getCloudData; -self.cloud.onPull = setCloudData; - /******************************************************************************/ messaging.send('dashboard', { what: 'getRules' }, renderRules); From 9dbc657bdb62fc51966344776e36f9227871c3c3 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 23 Mar 2018 15:06:44 -0400 Subject: [PATCH 13/65] new revision for dev build --- dist/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/version b/dist/version index 804a886067c58..dbed7bb23ce30 100644 --- a/dist/version +++ b/dist/version @@ -1 +1 @@ -1.15.19.1 +1.15.19.2 From 198603487e1331071415841cc461055861938823 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 23 Mar 2018 15:10:30 -0400 Subject: [PATCH 14/65] make Firefox dev build auto-update --- dist/firefox/updates.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/firefox/updates.json b/dist/firefox/updates.json index e9d2df2d64166..c682b69aa74e2 100644 --- a/dist/firefox/updates.json +++ b/dist/firefox/updates.json @@ -3,10 +3,10 @@ "uBlock0@raymondhill.net": { "updates": [ { - "version": "1.15.19b1", + "version": "1.15.19b2", "applications": { "gecko": { "strict_min_version": "52" } }, - "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b1", - "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b1/uBlock0.webext.signed.xpi" + "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b2", + "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b2/uBlock0.webext.signed.xpi" } ] } From 1c9b2c9466d693242301be40b9059fa677b4e051 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 23 Mar 2018 16:22:16 -0400 Subject: [PATCH 15/65] revisit guideline for opening issues --- CONTRIBUTING.md | 81 +++++-------------------------------------------- 1 file changed, 8 insertions(+), 73 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8368c14da98df..bf1b4c5e550b5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,83 +1,18 @@ # Submitting issues -From now on, I will be quite less inclined to deal with issues for which little to no investigation to find the **actual cause** of a purported issue was made by the reporter. Positive contributions are those which are reported with efforts to find the actual cause of an issue, or at the very least efforts were made to narrow it as much as possible. This project is a hobby, do not expect "customer support"-style interaction. Requiring people to investigate as much as possible before opening an issue will more than likely avoid burdening the project with [invalid issues](https://github.com/gorhill/uBlock/issues?q=is%3Aissue+is%3Aclosed+label%3Ainvalid) or [issues unrelated](https://github.com/gorhill/uBlock/issues?q=is%3Aissue+is%3Aclosed+label%3Aexternal) to uBO. +Despite all the guidelines and warnings I added over the years about how to use it, the GitHub issue tracker always end up being used as a [help desk](https://en.wikipedia.org/wiki/Help_desk) rather than a place to report actual, real and proven issues. -For **support/discussions/help**, there is [/r/uBlockOrigin](https://www.reddit.com/r/uBlockOrigin/) on Reddit -- this is where I see the most activity for people helping each other regarding uBlock Origin. +Typically help desk are best handled by enthusiast volunteers rather than by developers -- so hopefully this is what will happen. -For **filter-related issues**, report on the respective filter list support site, or at [uBlockOrigin/uAssets](https://github.com/uBlockOrigin/uAssets/issues). Use [the logger](https://github.com/gorhill/uBlock/wiki/The-logger) to diagnose/confirm filter-related issues. If something does not work properly with uBO enabled, the **first step** is to rule out filter-related issues. +Given this, from now on I will consider GitHub issue tracker as a help desk one for uBlock Origin. I unsubscribed from being notified from issues being opened, I will visit once in a while as time and mood allow. -Ignorance of the above rules is no excuse: **Opening an issue for purpose of support or discussion, or opening a filter-related issue will result in the user being immediately blocked.** Given the [amount of invalid issues being opened](https://github.com/gorhill/uBlock/issues?q=is%3Aissue+label%3Ainvalid+is%3Aclosed), I have no choice but to resort to such a drastic measure. You will still be able to open filter list issues at [uBlockOrigin/uAssets](https://github.com/uBlockOrigin/uAssets/issues). +When I will be visiting the "help desk", I will focus **only** on issues which I have good reasons to believe to be valid issues with uBlock Origin itself. -**The issue tracker is for provable issues only:** You will have to make the case that the issue is really with uBlock Origin and not something else on your side. To make a case means to provide detailed steps so that anybody can reproduce the issue. Be sure to rule out that the issue is not caused by something specific on your side. Specifically, _speculated_ performance issues will be marked as invalid and closed if they do not come with **actual profiling data + analysis** supporting the claim. - -**Any issue opened without effort to provide the required details for me (or anybody else) to reproduce the problem will be closed as _invalid_.** If you provide more details thereafter for me to reproduce the issue, I will reopen it if I can confirm there is indeed an issue with uBlock Origin. Example of detailed steps: - -> 1. browser version/ublock version -> 1. these settings, these filter lists, these custom filters. -> 1. do this. -> 1. open this exact URL. -> 1. do this. -> 1. observe this. -> 1. click this. -> 1. observe such and such issue -> 1. see screenshot -> 1. etc. - -The most important part when opening an issue: **detailed steps**. - -**Important:** I simply do not have the time to take care of filter-related issues, you will have to find help elsewhere for this. The mere need to have to respond to filter-related issues can quickly become a burden. Consider that writing code/doc occupies all my free time. Surely there are other people out there ready to help with filter-related issues, it does not have to be me. +Valid issues typically comes with minimal but detailed steps to reproduce (i.e. no guesswork whatsoever required for others to reproduce), and especially genuine efforts to investigate the cause of an issue **as far as possible** using all the browser tools (uBO is HTML/CSS/JS, the browser has all the tools to investigate all of this). These will have my attention. In case I am really needed for a given issue, you can mention me using `@gorhill` so that GitHub will notify me. *** -### Before you submit - -1. Submit **bugs/issues only**. - - Bugs occur, I will fix them. -1. _One specific_ issue per submission. -1. The logger is the tool of choice to use to help diagnose issues. -1. Do **NOT**: - - Submit pull requests. - - Submit design ideas. - - Submit feature requests. - - Submit "revolutionary ideas". - - Post comments like "+1" or "me too!" without providing new relevant info on the issue. - - Use issues as replacement for threads on a bulletin board. - - Any such issue will be closed without comment. - - Ask me to publish the latest version to AMO/Chrome store: In all likelihood it is already published, but pending review, something which is out of my control. -1. Make sure your issue [hasn't already been fixed in a recent release](https://github.com/gorhill/uBlock/releases). -1. Verify that the issue does **not** occur with uBlock disabled. -1. **Verify that the issue is not related to a 3rd-party filter lists.** - - Issues with 3rd-party filter lists are the responsibility of their respective maintainers. -1. Verify that the issue is not caused by another extension. -1. Do not submit issues which can be reproduced **only** on Chrome Canary or Firefox Nightly: these are not stable browser versions and in all likelihood, whatever issue is not within uBO. - - Report **only** if you can reproduce in an official stable release, or a beta release. - -*** - -### What to include - -To help diagnose and fix the bug/issue, please always include the following in your report: - -* A clear list of steps to reproduce the problem - * **ALWAYS INCLUDE A SPECIFIC URL WHERE THE ISSUE OCCURS**, _even_ if "it happens everywhere". -* Symptoms of the issue - * Describe what you observe and consider broken behavior; this is what we'll be looking for after executing the steps - * Example: video doesn't start playing, page layout broken -* Include whatever relevant the logger reports. -* A screenshot or transcription of **any of uBlock's preferences that differ from the defaults** - * This includes a whitelisted website, enabled/disabled filter list, anything - * Please do include everything different from the defaults whether or not it seems relevant to your issue -* The version of uBlock you're having the issue with; you can find this in [uBlock's popup UI](https://github.com/gorhill/uBlock/wiki/Quick-guide:-popup-user-interface) - * Example: `uBlock 0.9.0.0` -* The browser you're using and its version - * Examples: `Firefox 36`, `Chrome 41.0.2272` -* The OS you're using and its version - * Examples: `Windows 8.1`, `Linux Mint 17.1` -* A list of other extensions you have installed - * Tip: try disabling them and see if your issue still occurs - -Otherwise, we've noticed that a lot of **your** time (and the developers') gets thrown away on exchanging back and forth to get this information. - -*** +Good readings: -**Good read:** [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html). +- [How to Report Bugs Effectively](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html) +- [Why I didn’t fix your bug](http://magnusmanske.de/wordpress/?p=518) From 4e3838002c57ef737c3547e99e0407a1a6c20043 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 23 Mar 2018 16:22:55 -0400 Subject: [PATCH 16/65] revisit guideline for opening issues --- CONTRIBUTING.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bf1b4c5e550b5..0fb8fcd58fe3f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,13 +2,15 @@ Despite all the guidelines and warnings I added over the years about how to use it, the GitHub issue tracker always end up being used as a [help desk](https://en.wikipedia.org/wiki/Help_desk) rather than a place to report actual, real and proven issues. -Typically help desk are best handled by enthusiast volunteers rather than by developers -- so hopefully this is what will happen. +Typically help desk are best handled by enthusiast volunteers -- so hopefully this is what will happen. -Given this, from now on I will consider GitHub issue tracker as a help desk one for uBlock Origin. I unsubscribed from being notified from issues being opened, I will visit once in a while as time and mood allow. +Given this, from now on I will consider GitHub issue tracker as a help desk one for uBlock Origin. I unsubscribed from being notified from all issues being opened, I will visit once in a while as time and mood allow. -When I will be visiting the "help desk", I will focus **only** on issues which I have good reasons to believe to be valid issues with uBlock Origin itself. +When I will be visiting the "help desk", I will focus **only** on issues which I have good reasons to believe to be valid issues with uBlock Origin **itself**. -Valid issues typically comes with minimal but detailed steps to reproduce (i.e. no guesswork whatsoever required for others to reproduce), and especially genuine efforts to investigate the cause of an issue **as far as possible** using all the browser tools (uBO is HTML/CSS/JS, the browser has all the tools to investigate all of this). These will have my attention. In case I am really needed for a given issue, you can mention me using `@gorhill` so that GitHub will notify me. +Valid issues typically comes with minimal but detailed steps to reproduce (i.e. no guesswork whatsoever required for others to reproduce), and especially genuine efforts to investigate the cause of an issue **as far as possible** using all the browser tools (uBO is HTML/CSS/JS, the browser has all the tools to investigate all of this). These will have my attention, and I will address them. + +In case I am really needed for a given issue, you can mention me using `@gorhill` so that GitHub will notify me. *** From 376c95bcc98ea2516428435e763856807b1ac781 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 27 Mar 2018 14:11:06 -0400 Subject: [PATCH 17/65] #3646: find out if this makes a difference --- src/js/1p-filters.js | 1 + src/js/whitelist.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/js/1p-filters.js b/src/js/1p-filters.js index 1e2345cecd0a8..884404d85bf0e 100644 --- a/src/js/1p-filters.js +++ b/src/js/1p-filters.js @@ -36,6 +36,7 @@ var cmEditor = new CodeMirror( document.getElementById('userFilters'), { autofocus: true, + inputStyle: 'textarea', lineNumbers: true, lineWrapping: true, styleActiveLine: true diff --git a/src/js/whitelist.js b/src/js/whitelist.js index 18ea4a9339b01..55fbac1d01d7e 100644 --- a/src/js/whitelist.js +++ b/src/js/whitelist.js @@ -72,6 +72,7 @@ var cmEditor = new CodeMirror( document.getElementById('whitelist'), { autofocus: true, + inputStyle: 'textarea', lineNumbers: true, lineWrapping: true, styleActiveLine: true From 6baded110ed04df8bc21debbc4d154aef4796813 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 27 Mar 2018 14:11:45 -0400 Subject: [PATCH 18/65] new revision for dev build --- dist/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/version b/dist/version index dbed7bb23ce30..621af64a1be87 100644 --- a/dist/version +++ b/dist/version @@ -1 +1 @@ -1.15.19.2 +1.15.19.3 From aa20a86b94bbe038d3f28ece82ba7b9971f2f78c Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 27 Mar 2018 14:24:57 -0400 Subject: [PATCH 19/65] make Firefox dev build auto-update --- dist/firefox/updates.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/firefox/updates.json b/dist/firefox/updates.json index c682b69aa74e2..54345ed8a5201 100644 --- a/dist/firefox/updates.json +++ b/dist/firefox/updates.json @@ -3,10 +3,10 @@ "uBlock0@raymondhill.net": { "updates": [ { - "version": "1.15.19b2", + "version": "1.15.19b3", "applications": { "gecko": { "strict_min_version": "52" } }, - "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b2", - "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b2/uBlock0.webext.signed.xpi" + "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b3", + "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b3/uBlock0.webext.signed.xpi" } ] } From 827732a9910b39341f7d906cc0b0ccca7ea20bfe Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 27 Mar 2018 15:03:24 -0400 Subject: [PATCH 20/65] revert attempted fix for #3646 --- dist/version | 2 +- src/js/1p-filters.js | 1 - src/js/whitelist.js | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dist/version b/dist/version index 621af64a1be87..a24fabd1fa520 100644 --- a/dist/version +++ b/dist/version @@ -1 +1 @@ -1.15.19.3 +1.15.19.4 diff --git a/src/js/1p-filters.js b/src/js/1p-filters.js index 884404d85bf0e..1e2345cecd0a8 100644 --- a/src/js/1p-filters.js +++ b/src/js/1p-filters.js @@ -36,7 +36,6 @@ var cmEditor = new CodeMirror( document.getElementById('userFilters'), { autofocus: true, - inputStyle: 'textarea', lineNumbers: true, lineWrapping: true, styleActiveLine: true diff --git a/src/js/whitelist.js b/src/js/whitelist.js index 55fbac1d01d7e..18ea4a9339b01 100644 --- a/src/js/whitelist.js +++ b/src/js/whitelist.js @@ -72,7 +72,6 @@ var cmEditor = new CodeMirror( document.getElementById('whitelist'), { autofocus: true, - inputStyle: 'textarea', lineNumbers: true, lineWrapping: true, styleActiveLine: true From 222722caaddd245f0b4bcb380fcb957017720146 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 27 Mar 2018 15:12:25 -0400 Subject: [PATCH 21/65] make Firefox dev build auto-update --- dist/firefox/updates.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/firefox/updates.json b/dist/firefox/updates.json index 54345ed8a5201..1d7654c113d54 100644 --- a/dist/firefox/updates.json +++ b/dist/firefox/updates.json @@ -3,10 +3,10 @@ "uBlock0@raymondhill.net": { "updates": [ { - "version": "1.15.19b3", + "version": "1.15.19b4", "applications": { "gecko": { "strict_min_version": "52" } }, - "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b3", - "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b3/uBlock0.webext.signed.xpi" + "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b4", + "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b4/uBlock0.webext.signed.xpi" } ] } From 782faf4f44d90355eddd184f615775d1b270c10a Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 27 Mar 2018 19:10:31 -0400 Subject: [PATCH 22/65] fix #3646 --- src/js/1p-filters.js | 2 ++ src/js/dashboard-common.js | 27 +++++++++++++++++++++++++++ src/js/dyna-rules.js | 2 ++ src/js/whitelist.js | 2 ++ 4 files changed, 33 insertions(+) diff --git a/src/js/1p-filters.js b/src/js/1p-filters.js index 1e2345cecd0a8..73682aedbccaa 100644 --- a/src/js/1p-filters.js +++ b/src/js/1p-filters.js @@ -42,6 +42,8 @@ var cmEditor = new CodeMirror( } ); +uBlockDashboard.patchCodeMirrorEditor(cmEditor); + /******************************************************************************/ // This is to give a visual hint that the content of user blacklist has changed. diff --git a/src/js/dashboard-common.js b/src/js/dashboard-common.js index 47e04c5ca03de..db28b6b8a2a02 100644 --- a/src/js/dashboard-common.js +++ b/src/js/dashboard-common.js @@ -112,6 +112,33 @@ self.uBlockDashboard.dateNowToSensibleString = function() { /******************************************************************************/ +self.uBlockDashboard.patchCodeMirrorEditor = (function() { + // https://github.com/gorhill/uBlock/issues/3646 + var patchSelectAll = function(cm, details) { + var vp = cm.getViewport(); + if ( details.ranges.length !== 1 ) { return; } + var range = details.ranges[0], + lineFrom = range.anchor.line, + lineTo = range.head.line; + if ( range.head.ch !== 0 ) { lineTo += 1; } + if ( lineFrom !== vp.from || lineTo !== vp.to ) { return; } + details.update([ + { + anchor: { line: 0, ch: 0 }, + head: { line: cm.lineCount(), ch: 0 } + } + ]); + }; + + return function(cm) { + if ( cm.options.inputStyle === 'contenteditable' ) { + cm.on('beforeSelectionChange', patchSelectAll); + } + }; +})(); + +/******************************************************************************/ + // Open links in the proper window uDom('a').attr('target', '_blank'); uDom('a[href*="dashboard.html"]').attr('target', '_parent'); diff --git a/src/js/dyna-rules.js b/src/js/dyna-rules.js index d4feef23a2519..00036efb427f2 100644 --- a/src/js/dyna-rules.js +++ b/src/js/dyna-rules.js @@ -48,6 +48,8 @@ mergeView.editor().setOption('styleActiveLine', true); mergeView.editor().setOption('lineNumbers', false); mergeView.leftOriginal().setOption('readOnly', 'nocursor'); +uBlockDashboard.patchCodeMirrorEditor(mergeView.editor()); + var unfilteredRules = { orig: { doc: mergeView.leftOriginal(), rules: [] }, edit: { doc: mergeView.editor(), rules: [] } diff --git a/src/js/whitelist.js b/src/js/whitelist.js index 18ea4a9339b01..13456f010a75d 100644 --- a/src/js/whitelist.js +++ b/src/js/whitelist.js @@ -78,6 +78,8 @@ var cmEditor = new CodeMirror( } ); +uBlockDashboard.patchCodeMirrorEditor(cmEditor); + /******************************************************************************/ var whitelistChanged = function() { From 84ec50c43f69044437ccc2c26ea54862889d0b05 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 27 Mar 2018 19:11:08 -0400 Subject: [PATCH 23/65] new revision for dev build --- dist/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/version b/dist/version index a24fabd1fa520..3545dad966c5f 100644 --- a/dist/version +++ b/dist/version @@ -1 +1 @@ -1.15.19.4 +1.15.19.5 From 25512b981cb068d1f9505983a1598d2c03a5e584 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 27 Mar 2018 19:18:05 -0400 Subject: [PATCH 24/65] make Firefox dev build auto-update --- dist/firefox/updates.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/firefox/updates.json b/dist/firefox/updates.json index 1d7654c113d54..a7565c6e1589f 100644 --- a/dist/firefox/updates.json +++ b/dist/firefox/updates.json @@ -3,10 +3,10 @@ "uBlock0@raymondhill.net": { "updates": [ { - "version": "1.15.19b4", + "version": "1.15.19b5", "applications": { "gecko": { "strict_min_version": "52" } }, - "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b4", - "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b4/uBlock0.webext.signed.xpi" + "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b5", + "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b5/uBlock0.webext.signed.xpi" } ] } From f764435812121511fec7d70fc2981d2b6e32019c Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 28 Mar 2018 09:11:55 -0400 Subject: [PATCH 25/65] various changes to enhance UI for mobile devices --- src/1p-filters.html | 2 +- src/_locales/en/messages.json | 2 +- src/asset-viewer.html | 1 + src/css/dashboard-common.css | 5 +++++ src/css/dashboard.css | 30 ++++++++++++++------------- src/css/dyna-rules.css | 1 + src/dashboard.html | 2 +- src/dyna-rules.html | 4 ++-- src/js/asset-viewer.js | 1 + src/js/codemirror/search.js | 2 +- src/js/dashboard-common.js | 38 +++++++++++++++++++++++++++++++++++ src/whitelist.html | 2 +- 12 files changed, 69 insertions(+), 21 deletions(-) diff --git a/src/1p-filters.html b/src/1p-filters.html index 82db2bcbe751f..e14c06961e4b1 100644 --- a/src/1p-filters.html +++ b/src/1p-filters.html @@ -19,7 +19,7 @@
-

+

diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index c0716de42ed35..20418b2a318c5 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -1,6 +1,6 @@ { "extName":{ - "message":"uBlock₀", + "message":"uBlock Origin", "description":"extension name." }, "extShortDesc":{ diff --git a/src/asset-viewer.html b/src/asset-viewer.html index 6add32465a512..02ea2b167f81a 100644 --- a/src/asset-viewer.html +++ b/src/asset-viewer.html @@ -39,6 +39,7 @@ + diff --git a/src/css/dashboard-common.css b/src/css/dashboard-common.css index bc8f3ddd28e3a..25895f46e907d 100644 --- a/src/css/dashboard-common.css +++ b/src/css/dashboard-common.css @@ -90,3 +90,8 @@ input[type="checkbox"][disabled] + label { padding: 5px; background-color: #FEDAE0; } +@media (max-height: 640px) { + .vverbose { + display: none !important; + } + } diff --git a/src/css/dashboard.css b/src/css/dashboard.css index 142c3bd9a4b56..ba9bd678d8c7b 100644 --- a/src/css/dashboard.css +++ b/src/css/dashboard.css @@ -21,15 +21,22 @@ html, body { z-index: 10; } #dashboard-nav-widgets { - margin: 0; + align-items: stretch; + background-color: white; border-bottom: 1px solid #ccc; + display: flex; + margin: 0; padding: 4px 0 0; white-space: nowrap; - background-color: white; } -#dashboard-nav-widgets span { +#dashboard-nav-widgets > span { + align-items: center; + display: inline-flex; padding: 0 0.5em; - font-size: larger; + width: 1.25em; + } +#dashboard-nav-widgets > span > img { + width: 100%; } .tabButton { background-color: #eee; @@ -42,6 +49,7 @@ html, body { display: inline-block; font-size: 110%; margin: 0 0.2em 0 0; + overflow: hidden; padding: 4px; position: relative; text-decoration: none; @@ -65,24 +73,18 @@ iframe { width: 100%; } -@media (max-width: 600px) { +@media (max-width: 640px) { #dashboard-nav { position: relative; } #dashboard-nav-widgets { padding: 1px 0 0 0; - white-space: normal; } - [data-i18n="extName"] { - display: none; + .hverbose { + display: none !important; } .tabButton { - border-radius: 0; - display: inline-block; - font-size: 100%; - margin-bottom: 1px; - margin-right: 1px; - top: 0; + font-size: 90%; } .tabButton.selected { border-bottom: 1px solid #ccc; diff --git a/src/css/dyna-rules.css b/src/css/dyna-rules.css index 3c692000f529a..5b5fbb6dc2178 100644 --- a/src/css/dyna-rules.css +++ b/src/css/dyna-rules.css @@ -29,6 +29,7 @@ body { text-align: center; vertical-align: top; width: 50%; + white-space: normal; } #diff .ruleActions h3 { font-weight: normal; diff --git a/src/dashboard.html b/src/dashboard.html index 45e7083e5f067..2b89b4d2b45ab 100644 --- a/src/dashboard.html +++ b/src/dashboard.html @@ -12,7 +12,7 @@

- 0' + '' + diff --git a/src/js/dashboard-common.js b/src/js/dashboard-common.js index db28b6b8a2a02..efe7d6099a1d0 100644 --- a/src/js/dashboard-common.js +++ b/src/js/dashboard-common.js @@ -113,6 +113,19 @@ self.uBlockDashboard.dateNowToSensibleString = function() { /******************************************************************************/ self.uBlockDashboard.patchCodeMirrorEditor = (function() { + var grabFocusTimer; + var grabFocusTarget; + var grabFocus = function() { + grabFocusTarget.focus(); + grabFocusTimer = grabFocusTarget = undefined; + }; + var grabFocusAsync = function(cm) { + grabFocusTarget = cm; + if ( grabFocusTimer === undefined ) { + grabFocusTimer = vAPI.setTimeout(grabFocus, 1); + } + }; + // https://github.com/gorhill/uBlock/issues/3646 var patchSelectAll = function(cm, details) { var vp = cm.getViewport(); @@ -128,12 +141,37 @@ self.uBlockDashboard.patchCodeMirrorEditor = (function() { head: { line: cm.lineCount(), ch: 0 } } ]); + grabFocusAsync(cm); + }; + + var lastGutterClick = 0; + var lastGutterLine = 0; + + var onGutterClicked = function(cm, line) { + var delta = Date.now() - lastGutterClick; + if ( delta >= 500 || line !== lastGutterLine ) { + cm.setSelection( + { line: line, ch: 0 }, + { line: line + 1, ch: 0 } + ); + lastGutterClick = Date.now(); + lastGutterLine = line; + } else { + cm.setSelection( + { line: 0, ch: 0 }, + { line: cm.lineCount(), ch: 0 }, + { scroll: false } + ); + lastGutterClick = 0; + } + grabFocusAsync(cm); }; return function(cm) { if ( cm.options.inputStyle === 'contenteditable' ) { cm.on('beforeSelectionChange', patchSelectAll); } + cm.on('gutterClick', onGutterClicked); }; })(); diff --git a/src/whitelist.html b/src/whitelist.html index 3444725117161..59b0023146b61 100644 --- a/src/whitelist.html +++ b/src/whitelist.html @@ -19,7 +19,7 @@
-

+

From b785a98d5fe4a1a1ea1dbf2a68d1a4c17c50bbc3 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 28 Mar 2018 09:12:56 -0400 Subject: [PATCH 26/65] new revision for dev build --- dist/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/version b/dist/version index 3545dad966c5f..ade6ce4ea1a40 100644 --- a/dist/version +++ b/dist/version @@ -1 +1 @@ -1.15.19.5 +1.15.19.6 From 2e521e31a91df24966359281bc482b1697252d27 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 28 Mar 2018 09:17:22 -0400 Subject: [PATCH 27/65] make Firefox dev build auto-update --- dist/firefox/updates.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/firefox/updates.json b/dist/firefox/updates.json index a7565c6e1589f..c660367b1bff5 100644 --- a/dist/firefox/updates.json +++ b/dist/firefox/updates.json @@ -3,10 +3,10 @@ "uBlock0@raymondhill.net": { "updates": [ { - "version": "1.15.19b5", + "version": "1.15.19b6", "applications": { "gecko": { "strict_min_version": "52" } }, - "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b5", - "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b5/uBlock0.webext.signed.xpi" + "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b6", + "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b6/uBlock0.webext.signed.xpi" } ] } From 88f0fd6c00be7eba5efdc3dd5697c4ea5f719145 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 28 Mar 2018 09:43:48 -0400 Subject: [PATCH 28/65] avoid spurious select-all --- src/js/dashboard-common.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/js/dashboard-common.js b/src/js/dashboard-common.js index efe7d6099a1d0..d5f2768f8d95f 100644 --- a/src/js/dashboard-common.js +++ b/src/js/dashboard-common.js @@ -133,6 +133,7 @@ self.uBlockDashboard.patchCodeMirrorEditor = (function() { var range = details.ranges[0], lineFrom = range.anchor.line, lineTo = range.head.line; + if ( lineTo === lineFrom ) { return; } if ( range.head.ch !== 0 ) { lineTo += 1; } if ( lineFrom !== vp.from || lineTo !== vp.to ) { return; } details.update([ From 0a26fa1db2ed25db6ee82d849d7c55fec2b96aa3 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 28 Mar 2018 09:44:15 -0400 Subject: [PATCH 29/65] new revision for dev build --- dist/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/version b/dist/version index ade6ce4ea1a40..4b97ff06e77a7 100644 --- a/dist/version +++ b/dist/version @@ -1 +1 @@ -1.15.19.6 +1.15.19.7 From b65923a00e7620bab23e5797ddd4190ebf2fd3e3 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 28 Mar 2018 09:47:57 -0400 Subject: [PATCH 30/65] make Firefox dev build auto-update --- dist/firefox/updates.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/firefox/updates.json b/dist/firefox/updates.json index c660367b1bff5..baf73915e9444 100644 --- a/dist/firefox/updates.json +++ b/dist/firefox/updates.json @@ -3,10 +3,10 @@ "uBlock0@raymondhill.net": { "updates": [ { - "version": "1.15.19b6", + "version": "1.15.19b7", "applications": { "gecko": { "strict_min_version": "52" } }, - "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b6", - "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b6/uBlock0.webext.signed.xpi" + "update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.15.19b7", + "update_link": "https://github.com/gorhill/uBlock/releases/download/1.15.19b7/uBlock0.webext.signed.xpi" } ] } From fce2eaf3c382b4629dfe75ca4b7c8867890ca2c2 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 28 Mar 2018 16:15:50 -0400 Subject: [PATCH 31/65] further improving UI for small screens --- src/1p-filters.html | 29 +++++++------ src/3p-filters.html | 44 +++++++++---------- src/_locales/en/messages.json | 8 ++-- src/about.html | 34 ++++++++------- src/advanced-settings.html | 10 +++-- src/css/1p-filters.css | 9 ++-- src/css/advanced-settings.css | 6 --- src/css/codemirror.css | 1 - src/css/common.css | 48 +++++++++++++-------- src/css/dashboard-common.css | 16 ++++--- src/css/dyna-rules.css | 47 ++------------------- src/css/whitelist.css | 9 ++-- src/dyna-rules.html | 35 ++++++++-------- src/js/dashboard-common.js | 19 ++++++++- src/js/dyna-rules.js | 4 ++ src/settings.html | 79 ++++++++++++++++++----------------- src/whitelist.html | 29 ++++++++----- 17 files changed, 214 insertions(+), 213 deletions(-) diff --git a/src/1p-filters.html b/src/1p-filters.html index e14c06961e4b1..9c482cf4477bb 100644 --- a/src/1p-filters.html +++ b/src/1p-filters.html @@ -17,19 +17,22 @@ -

- -

-

-   - -

-

-

-   - - -

+
+
+ +

+

+ + +    + + +

+
+
+ diff --git a/src/3p-filters.html b/src/3p-filters.html index efc2a8cfde87e..1416251f080ab 100644 --- a/src/3p-filters.html +++ b/src/3p-filters.html @@ -12,29 +12,29 @@ -
- -
-
    -
  • - - -
  •   -
  • -
    -
  • -
    -
-

-
    -
    - -
    -

    - - - +

    +
    +
    +
      +
    • + + +
    •   +
    • +
      +
    • +
      +
    +

    +
      +
      +

      + + + +

      +