This commit is contained in:
Raymond Hill 2014-11-29 23:36:53 -02:00
parent be082cb666
commit 0bf088cd1e
8 changed files with 224 additions and 46 deletions

View File

@ -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 &lsquo;!&rsquo; 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}}",

View File

@ -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>

View File

@ -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;

View File

@ -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
});
};

View File

@ -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);

View File

@ -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
});
};

View File

@ -32,22 +32,53 @@
<a href="https://github.com/gorhill/uBlock/wiki/Dynamic-filtering" target="_blank">?</a>
</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 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">&lt;script&gt;</div>
<div class="label">&lt;iframe&gt;</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 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">&lt;script&gt;</div>
<div class="label">&lt;iframe&gt;</div>
</div>

View File

@ -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>