mirror of https://github.com/gorhill/uBlock.git
code review + fine tuning UI
This commit is contained in:
parent
a61975b798
commit
9ed6d9bac0
|
@ -86,10 +86,20 @@ p {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
#dynamicFilteringToggler::after {
|
#dynamicFilteringToggler a {
|
||||||
|
padding: 0 2px;
|
||||||
|
position: absolute;
|
||||||
|
__MSG_@@bidi_end_edge__: 0;
|
||||||
|
color: #aaa;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
#dynamicFilteringToggler.on a {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
#dynamicFilteringToggler::before {
|
||||||
content: '\f107';
|
content: '\f107';
|
||||||
}
|
}
|
||||||
#dynamicFilteringToggler.on::after {
|
#dynamicFilteringToggler.on::before {
|
||||||
content: '\f106';
|
content: '\f106';
|
||||||
}
|
}
|
||||||
#dynamicFilteringContainer {
|
#dynamicFilteringContainer {
|
||||||
|
@ -116,10 +126,10 @@ p {
|
||||||
}
|
}
|
||||||
.dynamicFiltering > div {
|
.dynamicFiltering > div {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: 1px solid #eee;
|
border: 1px solid #e6e6e6;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background-color: #eee;
|
background-color: #e6e6e6;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
@ -173,14 +183,14 @@ p {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
.dynamicFiltering > div.blocked {
|
.dynamicFiltering > div.blocked {
|
||||||
border-color: #fdd;
|
border-color: #fbb;
|
||||||
background-color: #fdd;
|
background-color: #fbb;
|
||||||
}
|
}
|
||||||
.dynamicFiltering > div.ownFilter {
|
.dynamicFiltering > div.ownFilter {
|
||||||
border-color: #bbb;
|
border-color: #bbb;
|
||||||
background-color: #bbb;
|
background-color: #bbb;
|
||||||
}
|
}
|
||||||
.dynamicFiltering > div.blocked.ownFilter {
|
.dynamicFiltering > div.blocked.ownFilter {
|
||||||
border-color: #eaa;
|
border-color: #f66;
|
||||||
background-color: #eaa;
|
background-color: #f66;
|
||||||
}
|
}
|
||||||
|
|
|
@ -650,27 +650,24 @@ var getUserData = function(callback) {
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var restoreUserData = function(userData) {
|
var restoreUserData = function(userData) {
|
||||||
var onUserFiltersSaved = function() {
|
// If we are going to restore all, might as well wipe out clean local
|
||||||
µb.XAL.restart();
|
// storage
|
||||||
};
|
µb.XAL.keyvalRemoveAll();
|
||||||
µb.destroySelfie();
|
µBlock.saveLocalSettings();
|
||||||
µb.XAL.keyvalSetMany(userData.userSettings);
|
µb.XAL.keyvalSetMany(userData.userSettings);
|
||||||
µb.XAL.keyvalSetOne('remoteBlacklists', userData.filterLists);
|
µb.XAL.keyvalSetOne('remoteBlacklists', userData.filterLists);
|
||||||
µb.XAL.keyvalSetOne('netWhitelist', userData.netWhitelist);
|
µb.XAL.keyvalSetOne('netWhitelist', userData.netWhitelist);
|
||||||
µb.assets.put('assets/user/filters.txt', userData.userFilters, onUserFiltersSaved);
|
µb.assets.put('assets/user/filters.txt', userData.userFilters);
|
||||||
|
µb.XAL.restart();
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var resetUserData = function() {
|
var resetUserData = function() {
|
||||||
var onAllDone = function() {
|
µb.XAL.keyvalRemoveAll();
|
||||||
µb.XAL.restart();
|
|
||||||
};
|
|
||||||
// Keep global counts, people can become quite attached to numbers
|
// Keep global counts, people can become quite attached to numbers
|
||||||
var onAllRemoved = function() {
|
µBlock.saveLocalSettings();
|
||||||
µBlock.saveLocalSettings(onAllDone);
|
µb.XAL.restart();
|
||||||
};
|
|
||||||
µb.XAL.keyvalRemoveAll(onAllRemoved);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
|
@ -235,7 +235,11 @@ var onDynamicFilterClicked = function(ev) {
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var toggleDynamicFiltering = function() {
|
var toggleDynamicFiltering = function(ev) {
|
||||||
|
// Discard events destined to child elements.
|
||||||
|
if ( ev !== undefined && ev.target !== this ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var el = uDom('#dynamicFilteringToggler');
|
var el = uDom('#dynamicFilteringToggler');
|
||||||
el.toggleClass('on');
|
el.toggleClass('on');
|
||||||
messaging.tell({
|
messaging.tell({
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
var exports = {};
|
var exports = {};
|
||||||
|
var noopFunc = function(){};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ exports.keyvalSetMany = function(dict) {
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
exports.keyvalRemoveAll = function(callback) {
|
exports.keyvalRemoveAll = function(callback) {
|
||||||
chrome.storage.local.clear(callback);
|
chrome.storage.local.clear(callback || noopFunc);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
|
@ -24,7 +24,9 @@
|
||||||
<p id="total-blocked">?</p>
|
<p id="total-blocked">?</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="dynamicFilteringToggler" class="fa on"></div>
|
<div id="dynamicFilteringToggler" class="fa on">
|
||||||
|
<a href="https://github.com/gorhill/uBlock/wiki/Dynamic-filtering" target="_blank">?</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="dynamicFilteringContainer">
|
<div id="dynamicFilteringContainer">
|
||||||
<div class="dynamicFiltering local" data-scope=".">
|
<div class="dynamicFiltering local" data-scope=".">
|
||||||
|
|
Loading…
Reference in New Issue