diff options
author | Raymond Hill <rhill@raymondhill.net> | 2014-11-29 23:36:53 -0200 |
---|---|---|
committer | Raymond Hill <rhill@raymondhill.net> | 2014-11-29 23:36:53 -0200 |
commit | 0bf088cd1e8df00f9bd56cc0055b18759903b3fc (patch) | |
tree | 4f911277b3ab4b3f8c278f2e89ffa1fb0fa998ac | |
parent | be082cb666c98b9cf2019870cfa28691e2656a7f (diff) | |
download | uBlock-0bf088cd1e8df00f9bd56cc0055b18759903b3fc.zip uBlock-0bf088cd1e8df00f9bd56cc0055b18759903b3fc.tar.gz uBlock-0bf088cd1e8df00f9bd56cc0055b18759903b3fc.tar.bz2 |
this fixes #386, #346, #299, #288, #285, #284, #279
-rw-r--r-- | src/_locales/en/messages.json | 118 | ||||
-rw-r--r-- | src/about.html | 1 | ||||
-rw-r--r-- | src/css/popup.css | 24 | ||||
-rw-r--r-- | src/js/1p-filters.js | 5 | ||||
-rw-r--r-- | src/js/about.js | 21 | ||||
-rw-r--r-- | src/js/whitelist.js | 5 | ||||
-rw-r--r-- | src/popup.html | 95 | ||||
-rw-r--r-- | src/settings.html | 1 |
8 files changed, 224 insertions, 46 deletions
diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 06c1fe6..ae5dfa6 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -67,6 +67,86 @@ "message":"Go to request log", "description":"English: Go to request log" }, + "popupSiteInlineScriptEnabled":{ + "message":"Inline <code>script</code> tags are <b>enabled</b> for this site", + "description":"" + }, + "popupSiteInlineScriptDisabled":{ + "message":"Inline <code>script</code> tags are <b>disabled</b> for this site", + "description":"" + }, + "popupSite1pScriptEnabled":{ + "message":"1st-party scripts are <b>enabled</b> for this site", + "description":"" + }, + "popupSite1pScriptDisabled":{ + "message":"1st-party scripts are <b>disabled</b> for this site", + "description":"" + }, + "popupSite3pScriptEnabled":{ + "message":"3rd-party scripts are <b>enabled</b> for this site", + "description":"" + }, + "popupSite3pScriptDisabled":{ + "message":"3rd-party scripts are <b>disabled</b> for this site", + "description":"" + }, + "popupSite1pFrameEnabled":{ + "message":"1st-party frames are <b>enabled</b> for this site", + "description":"" + }, + "popupSite1pFrameDisabled":{ + "message":"1st-party frames are <b>disabled</b> for this site", + "description":"" + }, + "popupSite3pFrameEnabled":{ + "message":"3rd-party frames are <b>enabled</b> for this site", + "description":"" + }, + "popupSite3pFrameDisabled":{ + "message":"3rd-party frames are <b>disabled</b> for this site", + "description":"" + }, + "popupDefaultInlineScriptEnabled":{ + "message":"Inline <code>script</code> tags are <b>enabled</b> everywhere by default", + "description":"" + }, + "popupDefaultInlineScriptDisabled":{ + "message":"Inline <code>script</code> tags are <b>disabled</b> everywhere by default", + "description":"" + }, + "popupDefault1pScriptEnabled":{ + "message":"1st-party scripts are <b>enabled</b> everywhere by default", + "description":"" + }, + "popupDefault1pScriptDisabled":{ + "message":"1st-party scripts are <b>disabled</b> everywhere by default", + "description":"" + }, + "popupDefault3pScriptEnabled":{ + "message":"3rd-party scripts are <b>enabled</b> everywhere by default", + "description":"" + }, + "popupDefault3pScriptDisabled":{ + "message":"3rd-party scripts are <b>disabled</b> everywhere by default", + "description":"" + }, + "popupDefault1pFrameEnabled":{ + "message":"1st-party frames are <b>enabled</b> everywhere by default", + "description":"" + }, + "popupDefault1pFrameDisabled":{ + "message":"1st-party frames are <b>disabled</b> everywhere by default", + "description":"" + }, + "popupDefault3pFrameEnabled":{ + "message":"3rd-party frames are <b>enabled</b> everywhere by default", + "description":"" + }, + "popupDefault3pFrameDisabled":{ + "message":"3rd-party frames are <b>disabled</b> everywhere by default", + "description":"" + }, "pickerCreate":{ "message":"Create", "description":"English: Create" @@ -108,7 +188,7 @@ "description":"English: Make use of context menu where appropriate" }, "settingsExperimentalPrompt":{ - "message":"Enable experimental features", + "message":"Enable experimental features (<a href='https://github.com/gorhill/uBlock/wiki/Experimental-features'>About</a>)", "description":"English: Enable experimental features" }, "3pListsOfBlockedHostsPrompt":{ @@ -180,8 +260,8 @@ "description":"English: One URL per line. Lines prefixed with ‘!’ will be ignored. Invalid URLs will be silently ignored." }, "3pExternalListsApply":{ - "message":"Apply", - "description":"English: Apply" + "message":"Parse", + "description":"English: Parse" }, "3pExternalListPurge":{ "message":"purge cache", @@ -207,6 +287,10 @@ "message":"Export", "description":"English: Export" }, + "1pExportFilename" : { + "message": "ublock-custom-filters_{{datetime}}.txt", + "description": "English: ublock-custom-filters_{{datetime}}.txt" + }, "1pApplyChanges":{ "message":"Apply changes", "description":"English: Apply changes" @@ -223,6 +307,10 @@ "message":"Export", "description":"English: Export" }, + "whitelistExportFilename" : { + "message": "ublock-whitelist_{{datetime}}.txt", + "description": "English: ublock-whitelist_{{datetime}}.txt" + }, "whitelistApply":{ "message":"Apply changes", "description":"English: Apply changes" @@ -271,6 +359,10 @@ "message":"Change log", "description":"English: Change log" }, + "aboutWiki":{ + "message":"Wiki", + "description":"English: project' wiki on Github" + }, "aboutCode":{ "message":"Source code (GPLv3)", "description":"English: Source code (GPLv3)" @@ -280,24 +372,32 @@ "description":"English: Contributors" }, "aboutBackupDataButton" : { - "message": "Backup to file...", - "description": "English: Backup to file..." + "message": "Backup to file", + "description": "English: Backup to file" + }, + "aboutBackupFilename" : { + "message": "ublock-backup_{{datetime}}.txt", + "description": "English: ublock-backup_{{datetime}}.txt" }, "aboutRestoreDataButton" : { "message": "Restore from file...", "description": "English: Restore from file..." }, "aboutResetDataButton" : { - "message": "Start from scratch...", - "description": "English: Start from scratch..." + "message": "Reset to default settings...", + "description": "English: Reset to default settings..." }, "aboutRestoreDataConfirm" : { "message": "All your settings will be overwritten using data backed up on {{time}}, and µBlock will restart.\n\nOverwrite all existing settings using backed up data?", "description": "Message asking user to confirm restore" }, + "aboutRestoreDataError" : { + "message": "The data could not be read or is invalid", + "description": "Message to display when an error occurred during restore" + }, "aboutResetDataConfirm" : { - "message": "All your settings will be erased, and µBlock will restart.\n\nReset µBlock to factory settings?", - "description": "Message asking user to confirm restore" + "message": "All your settings will be removed, and µBlock will restart.\n\nReset µBlock to factory settings?", + "description": "Message asking user to confirm reset" }, "errorCantConnectTo":{ "message":"Unable to connect to {{url}}", diff --git a/src/about.html b/src/about.html index 101ffd6..10eb280 100644 --- a/src/about.html +++ b/src/about.html @@ -13,6 +13,7 @@ <h2 id="aboutNameVer"></h2> <ul> <li><a href="https://github.com/gorhill/uBlock/releases" data-i18n="aboutChangelog"></a> + <li><a href="https://github.com/gorhill/uBlock/wiki" data-i18n="aboutWiki"></a> <li><a href="https://github.com/gorhill/uBlock" data-i18n="aboutCode"></a> <li><span data-i18n="aboutContributors"></span> <ul> diff --git a/src/css/popup.css b/src/css/popup.css index bc2e523..c2a6103 100644 --- a/src/css/popup.css +++ b/src/css/popup.css @@ -79,6 +79,30 @@ p { color: #444; } +.dynamicFiltering div > .tip { + background-color: #fffff4; + border: 1px solid #888; + border-radius: 7px; + bottom: 20vh; + box-shadow: 1px 1px 2px 0 rgba(0,0,0,0.8); + display: none; + font-size: small; + left: 8vw; + padding: 0.25em; + position: fixed; + right: 8vw; + } +.dynamicFiltering div:not(.blocked):hover > .tip:nth-of-type(1) { + display: block; + } +.dynamicFiltering div.blocked:hover > .tip:nth-of-type(2) { + display: block; + } +.dynamicFiltering div > .tip code { + background-color: #eee; + font: normal monospace; + padding: 1px 0; + } #dynamicFilteringToggler { margin: 0; border: 0; diff --git a/src/js/1p-filters.js b/src/js/1p-filters.js index b0536ba..57fbad8 100644 --- a/src/js/1p-filters.js +++ b/src/js/1p-filters.js @@ -105,9 +105,12 @@ var exportUserFiltersToFile = function() { return; } var now = new Date(); + var filename = vAPI.i18n('1pExportFilename') + .replace('{{datetime}}', now.toLocaleString()) + .replace(/ +/g, '_'); vAPI.download({ 'url': 'data:text/plain;charset=utf-8,' + encodeURIComponent(val), - 'filename': 'ublock-filters_' + now.toLocaleString().replace(/ +/g, '_') + '.txt' + 'filename': filename }); }; diff --git a/src/js/about.js b/src/js/about.js index 747bd4a..8f23292 100644 --- a/src/js/about.js +++ b/src/js/about.js @@ -39,9 +39,12 @@ var exportToFile = function() { return; } var now = new Date(); + var filename = vAPI.i18n('aboutBackupFilename') + .replace('{{datetime}}', now.toLocaleString()) + .replace(/ +/g, '_'); vAPI.download({ - 'url': 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(userData)), - 'filename': 'ublock-backup_' + now.toLocaleString().replace(/ +/g, '_') + '.txt' + 'url': 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(userData, null, ' ')), + 'filename': filename }); }; @@ -55,10 +58,24 @@ var handleImportFilePicker = function() { var userData; try { userData = JSON.parse(this.result); + if ( typeof userData !== 'object' ) { + throw 'Invalid'; + } + if ( typeof userData.userSettings !== 'object' ) { + throw 'Invalid'; + } + if ( typeof userData.netWhitelist !== 'string' ) { + throw 'Invalid'; + } + if ( typeof userData.filterLists !== 'object' ) { + throw 'Invalid'; + } } catch (e) { + userData = undefined; } if ( userData === undefined ) { + window.alert(vAPI.i18n('aboutRestoreDataError')); return; } var time = new Date(userData.timeStamp); diff --git a/src/js/whitelist.js b/src/js/whitelist.js index fe731c6..31f6672 100644 --- a/src/js/whitelist.js +++ b/src/js/whitelist.js @@ -99,9 +99,12 @@ var exportWhitelistToFile = function() { return; } var now = new Date(); + var filename = vAPI.i18n('whitelistExportFilename') + .replace('{{datetime}}', now.toLocaleString()) + .replace(/ +/g, '_'); vAPI.download({ 'url': 'data:text/plain;charset=utf-8,' + encodeURIComponent(val), - 'filename': 'ublock-whitelist_' + now.toLocaleString().replace(/ +/g, '_') + '.txt' + 'filename': filename }); }; diff --git a/src/popup.html b/src/popup.html index 8857d86..3325320 100644 --- a/src/popup.html +++ b/src/popup.html @@ -11,18 +11,18 @@ <body> <h4 title="popupTipDashboard">v<span id="version"></span></h4> <div> -<p id="switch" data-i18n-tip="popupPowerSwitchInfo"><span class="fa"></span></p> -<p id="switch-hint"></p> -<p style="font-size: 16px;" data-i18n="popupBlockedRequestPrompt"></p> -<p id="stats"> - <span data-i18n="popupBlockedOnThisPagePrompt"></span>  - <span id="gotoPick" class="fa tool" data-i18n-tip="popupTipPicker" data-tip-anchor="top"></span>  - <span id="gotoLog" class="fa tool" data-i18n-tip="popupTipLog" data-tip-anchor="top"></span> - </p> -<p id="page-blocked">?</p> -<p id="stats" data-i18n="popupBlockedSinceInstallPrompt"></p> -<p id="total-blocked">?</p> -</div> + <p id="switch" data-i18n-tip="popupPowerSwitchInfo"><span class="fa"></span></p> + <p id="switch-hint"></p> + <p style="font-size: 16px;" data-i18n="popupBlockedRequestPrompt"></p> + <p id="stats"> + <span data-i18n="popupBlockedOnThisPagePrompt"></span>  + <span id="gotoPick" class="fa tool" data-i18n-tip="popupTipPicker" data-tip-anchor="top"></span>  + <span id="gotoLog" class="fa tool" data-i18n-tip="popupTipLog" data-tip-anchor="top"></span> + </p> + <p id="page-blocked">?</p> + <p id="stats" data-i18n="popupBlockedSinceInstallPrompt"></p> + <p id="total-blocked">?</p> + </div> <div id="dynamicFilteringToggler" class="fa on"> <div></div> @@ -30,28 +30,59 @@ <div></div> <div></div> <a href="https://github.com/gorhill/uBlock/wiki/Dynamic-filtering" target="_blank">?</a> -</div> + </div> + <div id="dynamicFilteringContainer"> -<div class="dynamicFiltering local" data-scope="."> - <div data-first-party data-type="inline-script"></div> - <div data-first-party data-type="script"></div> - <div data-type="script"></div> - <div data-first-party data-type="sub_frame"></div> - <div data-type="sub_frame"></div> - <div class="label"><script></div> - <div class="label"><iframe></div> -</div> -<div class="dynamicFiltering global" data-scope="/"> - <div data-first-party data-type="inline-script"></div> - <div data-first-party data-type="script"></div> - <div data-type="script"></div> - <div data-first-party data-type="sub_frame"></div> - <div data-type="sub_frame"></div> - <div class="label"><script></div> - <div class="label"><iframe></div> -</div> -</div> + <div class="dynamicFiltering local" data-scope="."> + <div data-first-party data-type="inline-script"> + <div class="tip" data-i18n="popupSiteInlineScriptEnabled"></div> + <div class="tip" data-i18n="popupSiteInlineScriptDisabled"></div> + </div> + <div data-first-party data-type="script"> + <div class="tip" data-i18n="popupSite1pScriptEnabled"></div> + <div class="tip" data-i18n="popupSite1pScriptDisabled"></div> + </div> + <div data-type="script"> + <div class="tip" data-i18n="popupSite3pScriptEnabled"></div> + <div class="tip" data-i18n="popupSite3pScriptDisabled"></div> + </div> + <div data-first-party data-type="sub_frame"> + <div class="tip" data-i18n="popupSite1pFrameEnabled"></div> + <div class="tip" data-i18n="popupSite1pFrameDisabled"></div> + </div> + <div data-type="sub_frame"> + <div class="tip" data-i18n="popupSite3pFrameEnabled"></div> + <div class="tip" data-i18n="popupSite3pFrameDisabled"></div> + </div> + <div class="label"><script></div> + <div class="label"><iframe></div> + </div> + <div class="dynamicFiltering global" data-scope="/"> + <div data-first-party data-type="inline-script"> + <div class="tip" data-i18n="popupDefaultInlineScriptEnabled"></div> + <div class="tip" data-i18n="popupDefaultInlineScriptDisabled"></div> + </div> + <div data-first-party data-type="script"> + <div class="tip" data-i18n="popupDefault1pScriptEnabled"></div> + <div class="tip" data-i18n="popupDefault1pScriptDisabled"></div> + </div> + <div data-type="script"> + <div class="tip" data-i18n="popupDefault3pScriptEnabled"></div> + <div class="tip" data-i18n="popupDefault3pScriptDisabled"></div> + </div> + <div data-first-party data-type="sub_frame"> + <div class="tip" data-i18n="popupDefault1pFrameEnabled"></div> + <div class="tip" data-i18n="popupDefault1pFrameDisabled"></div> + </div> + <div data-type="sub_frame"> + <div class="tip" data-i18n="popupDefault3pFrameEnabled"></div> + <div class="tip" data-i18n="popupDefault3pFrameDisabled"></div> + </div> + <div class="label"><script></div> + <div class="label"><iframe></div> + </div> + </div> <script src="js/vapi-common.js"></script> <script src="js/vapi-client.js"></script> <script src="js/vapi-appinfo.js"></script> diff --git a/src/settings.html b/src/settings.html index 34c57ee..242370e 100644 --- a/src/settings.html +++ b/src/settings.html @@ -22,7 +22,6 @@ ul { <li><input id="icon-badge" type="checkbox"><label data-i18n="settingsIconBadgePrompt" for="icon-badge"></label> <li><input id="context-menu-enabled" type="checkbox"><label data-i18n="settingsContextMenuPrompt" for="context-menu-enabled"></label> <li><input id="experimental-enabled" type="checkbox"><label data-i18n="settingsExperimentalPrompt" for="experimental-enabled"></label> - (<a href="https://github.com/gorhill/uBlock/wiki/Experimental-features" style="font-style:italic">Experimental features</a>) </ul> <script src="js/vapi-common.js"></script> |