1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-14 23:12:28 +02:00
This commit is contained in:
gorhill 2015-05-28 16:02:00 -04:00
parent 4abd2d7dc7
commit 446059a66d

View File

@ -99,7 +99,9 @@ var renderFilterLists = function() {
} }
elem = li.descendants('a:nth-of-type(1)'); elem = li.descendants('a:nth-of-type(1)');
elem.attr('href', encodeURI(listKey)); elem.attr('href', 'asset-viewer.html?url=' + encodeURI(listKey));
elem.attr('type', 'text/html');
elem.attr('data-listkey', listKey);
elem.text(listNameFromListKey(listKey) + '\u200E'); elem.text(listNameFromListKey(listKey) + '\u200E');
elem = li.descendants('a:nth-of-type(2)'); elem = li.descendants('a:nth-of-type(2)');
@ -344,7 +346,7 @@ var listsContentChanged = function() {
/******************************************************************************/ /******************************************************************************/
var onListCheckboxChanged = function() { var onListCheckboxChanged = function() {
var href = uDom(this).parent().descendants('a').first().attr('href'); var href = uDom(this).parent().descendants('a').first().attr('data-listkey');
if ( typeof href !== 'string' ) { if ( typeof href !== 'string' ) {
return; return;
} }
@ -357,24 +359,10 @@ var onListCheckboxChanged = function() {
/******************************************************************************/ /******************************************************************************/
var onListLinkClicked = function(ev) {
messager.send({
what: 'gotoURL',
details: {
url: 'asset-viewer.html?url=' + uDom(this).attr('href'),
select: true,
index: -1
}
});
ev.preventDefault();
};
/******************************************************************************/
var onPurgeClicked = function() { var onPurgeClicked = function() {
var button = uDom(this); var button = uDom(this);
var li = button.parent(); var li = button.parent();
var href = li.descendants('a').first().attr('href'); var href = li.descendants('a').first().attr('data-listkey');
if ( !href ) { if ( !href ) {
return; return;
} }
@ -403,7 +391,7 @@ var selectFilterLists = function(callback) {
while ( i-- ) { while ( i-- ) {
li = lis.at(i); li = lis.at(i);
switches.push({ switches.push({
location: li.descendants('a').attr('href'), location: li.descendants('a').attr('data-listkey'),
off: li.descendants('input').prop('checked') === false off: li.descendants('input').prop('checked') === false
}); });
} }
@ -534,7 +522,6 @@ uDom.onLoad(function() {
uDom('#buttonUpdate').on('click', buttonUpdateHandler); uDom('#buttonUpdate').on('click', buttonUpdateHandler);
uDom('#buttonPurgeAll').on('click', buttonPurgeAllHandler); uDom('#buttonPurgeAll').on('click', buttonPurgeAllHandler);
uDom('#lists').on('change', '.listEntry > input', onListCheckboxChanged); uDom('#lists').on('change', '.listEntry > input', onListCheckboxChanged);
uDom('#lists').on('click', '.listEntry > a:nth-of-type(1)', onListLinkClicked);
uDom('#lists').on('click', 'span.purge', onPurgeClicked); uDom('#lists').on('click', 'span.purge', onPurgeClicked);
uDom('#externalLists').on('input', externalListsChangeHandler); uDom('#externalLists').on('input', externalListsChangeHandler);
uDom('#externalListsApply').on('click', externalListsApplyHandler); uDom('#externalListsApply').on('click', externalListsApplyHandler);