|
@ -495,17 +495,16 @@ function getCollapseState(domain) { |
|
|
return getUserSetting('popupCollapseDomains'); |
|
|
return getUserSetting('popupCollapseDomains'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function toggleCollapseState(element) { |
|
|
|
|
|
var el = uDom(element); |
|
|
|
|
|
if ( el.ancestors('#matHead.collapsible').length() > 0 ) { |
|
|
|
|
|
toggleMainCollapseState(el); |
|
|
|
|
|
|
|
|
function toggleCollapseState(elem) { |
|
|
|
|
|
if ( elem.ancestors('#matHead.collapsible').length > 0 ) { |
|
|
|
|
|
toggleMainCollapseState(elem); |
|
|
} else { |
|
|
} else { |
|
|
toggleSpecificCollapseState(el); |
|
|
|
|
|
|
|
|
toggleSpecificCollapseState(elem); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function toggleMainCollapseState(element) { |
|
|
|
|
|
var matHead = element.ancestors('#matHead.collapsible').toggleClass('collapsed'); |
|
|
|
|
|
|
|
|
function toggleMainCollapseState(uelem) { |
|
|
|
|
|
var matHead = uelem.ancestors('#matHead.collapsible').toggleClass('collapsed'); |
|
|
var collapsed = matHead.hasClassName('collapsed'); |
|
|
var collapsed = matHead.hasClassName('collapsed'); |
|
|
uDom('#matList .matSection.collapsible').toggleClass('collapsed', collapsed); |
|
|
uDom('#matList .matSection.collapsible').toggleClass('collapsed', collapsed); |
|
|
setUserSetting('popupCollapseDomains', collapsed); |
|
|
setUserSetting('popupCollapseDomains', collapsed); |
|
@ -523,10 +522,10 @@ function toggleMainCollapseState(element) { |
|
|
setUserSetting('popupCollapseSpecificDomains', specificCollapseStates); |
|
|
setUserSetting('popupCollapseSpecificDomains', specificCollapseStates); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function toggleSpecificCollapseState(element) { |
|
|
|
|
|
|
|
|
function toggleSpecificCollapseState(uelem) { |
|
|
// Remember collapse state forever, but only if it is different
|
|
|
// Remember collapse state forever, but only if it is different
|
|
|
// from main collapse switch.
|
|
|
// from main collapse switch.
|
|
|
var section = element.ancestors('.matSection.collapsible').toggleClass('collapsed'); |
|
|
|
|
|
|
|
|
var section = uelem.ancestors('.matSection.collapsible').toggleClass('collapsed'); |
|
|
var domain = section.prop('domain'); |
|
|
var domain = section.prop('domain'); |
|
|
var collapsed = section.hasClassName('collapsed'); |
|
|
var collapsed = section.hasClassName('collapsed'); |
|
|
var mainCollapseState = getUserSetting('popupCollapseDomains'); |
|
|
var mainCollapseState = getUserSetting('popupCollapseDomains'); |
|
@ -546,13 +545,12 @@ function toggleSpecificCollapseState(element) { |
|
|
// Color changes when rules change
|
|
|
// Color changes when rules change
|
|
|
|
|
|
|
|
|
function updateMatrixColors() { |
|
|
function updateMatrixColors() { |
|
|
var cells = $('.matrix .matRow.rw > .matCell'); |
|
|
|
|
|
|
|
|
var cells = uDom('.matrix .matRow.rw > .matCell').removeClass(); |
|
|
var i = cells.length; |
|
|
var i = cells.length; |
|
|
var cell; |
|
|
var cell; |
|
|
while ( i-- ) { |
|
|
while ( i-- ) { |
|
|
cell = $(cells[i]); |
|
|
|
|
|
cell.removeClass() |
|
|
|
|
|
.addClass('matCell ' + getCellClass(cell.prop('hostname'), cell.prop('reqType'))); |
|
|
|
|
|
|
|
|
cell = cells.node(i); |
|
|
|
|
|
cell.className = 'matCell ' + getCellClass(cell.hostname, cell.reqType); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -573,17 +571,17 @@ function updateMatrixCounts() { |
|
|
// - It is not part of group 3 (blacklisted hostnames)
|
|
|
// - It is not part of group 3 (blacklisted hostnames)
|
|
|
|
|
|
|
|
|
function updateMatrixBehavior() { |
|
|
function updateMatrixBehavior() { |
|
|
matrixList = matrixList || $('#matList'); |
|
|
|
|
|
var sections = matrixList.find('.matSection'); |
|
|
|
|
|
|
|
|
matrixList = matrixList || uDom('#matList'); |
|
|
|
|
|
var sections = matrixList.descendants('.matSection'); |
|
|
var i = sections.length; |
|
|
var i = sections.length; |
|
|
var section, subdomainRows, j, subdomainRow; |
|
|
var section, subdomainRows, j, subdomainRow; |
|
|
while ( i-- ) { |
|
|
while ( i-- ) { |
|
|
section = $(sections[i]); |
|
|
|
|
|
subdomainRows = section.children('.l2:not(.g3)'); |
|
|
|
|
|
|
|
|
section = sections.unode(i); |
|
|
|
|
|
subdomainRows = section.descendants('.l2:not(.g3)'); |
|
|
j = subdomainRows.length; |
|
|
j = subdomainRows.length; |
|
|
while ( j-- ) { |
|
|
while ( j-- ) { |
|
|
subdomainRow = $(subdomainRows[j]); |
|
|
|
|
|
subdomainRow.toggleClass('collapsible', subdomainRow.children('.gd,.rd').length === 0); |
|
|
|
|
|
|
|
|
subdomainRow = subdomainRows.unode(j); |
|
|
|
|
|
subdomainRow.toggleClass('collapsible', subdomainRow.descendants('.gd,.rd').length === 0); |
|
|
} |
|
|
} |
|
|
section.toggleClass('collapsible', subdomainRows.filter('.collapsible').length > 0); |
|
|
section.toggleClass('collapsible', subdomainRows.filter('.collapsible').length > 0); |
|
|
} |
|
|
} |
|
@ -596,7 +594,7 @@ function updateMatrixBehavior() { |
|
|
function handleFilter(button, leaning) { |
|
|
function handleFilter(button, leaning) { |
|
|
var µm = µMatrix; |
|
|
var µm = µMatrix; |
|
|
// our parent cell knows who we are
|
|
|
// our parent cell knows who we are
|
|
|
var cell = button.closest('div.matCell'); |
|
|
|
|
|
|
|
|
var cell = button.ancestors('div.matCell'); |
|
|
var type = cell.prop('reqType'); |
|
|
var type = cell.prop('reqType'); |
|
|
var hostname = cell.prop('hostname'); |
|
|
var hostname = cell.prop('hostname'); |
|
|
var nextAction = getNextAction(hostname, type, leaning); |
|
|
var nextAction = getNextAction(hostname, type, leaning); |
|
@ -676,7 +674,7 @@ function getTemporaryRuleset() { |
|
|
if ( permanentSwitches.hasOwnProperty(k) === false ) { |
|
|
if ( permanentSwitches.hasOwnProperty(k) === false ) { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
if ( temporarySwitches[rule] === undefined ) { |
|
|
|
|
|
|
|
|
if ( temporarySwitches[k] === undefined ) { |
|
|
ruleset.switchesToRemove.push(k); |
|
|
ruleset.switchesToRemove.push(k); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -696,15 +694,15 @@ var matrixRowTemplate = null; |
|
|
var matrixList = null; |
|
|
var matrixList = null; |
|
|
|
|
|
|
|
|
var startMatrixUpdate = function() { |
|
|
var startMatrixUpdate = function() { |
|
|
matrixList = matrixList || $('#matList'); |
|
|
|
|
|
|
|
|
matrixList = matrixList || uDom('#matList'); |
|
|
matrixList.detach(); |
|
|
matrixList.detach(); |
|
|
var rows = matrixList.find('.matRow'); |
|
|
|
|
|
|
|
|
var rows = matrixList.descendants('.matRow'); |
|
|
rows.detach(); |
|
|
rows.detach(); |
|
|
matrixRowPool = matrixRowPool.concat(rows.toArray()); |
|
|
matrixRowPool = matrixRowPool.concat(rows.toArray()); |
|
|
var sections = matrixList.find('.matSection'); |
|
|
|
|
|
|
|
|
var sections = matrixList.descendants('.matSection'); |
|
|
sections.detach(); |
|
|
sections.detach(); |
|
|
matrixSectionPool = matrixSectionPool.concat(sections.toArray()); |
|
|
matrixSectionPool = matrixSectionPool.concat(sections.toArray()); |
|
|
var groups = matrixList.find('.matGroup'); |
|
|
|
|
|
|
|
|
var groups = matrixList.descendants('.matGroup'); |
|
|
groups.detach(); |
|
|
groups.detach(); |
|
|
matrixGroupPool = matrixGroupPool.concat(groups.toArray()); |
|
|
matrixGroupPool = matrixGroupPool.concat(groups.toArray()); |
|
|
}; |
|
|
}; |
|
@ -720,36 +718,36 @@ var endMatrixUpdate = function() { |
|
|
} |
|
|
} |
|
|
updateMatrixBehavior(); |
|
|
updateMatrixBehavior(); |
|
|
matrixList.css('display', ''); |
|
|
matrixList.css('display', ''); |
|
|
matrixList.appendTo($('.paneContent')); |
|
|
|
|
|
|
|
|
matrixList.appendTo('.paneContent'); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var createMatrixGroup = function() { |
|
|
var createMatrixGroup = function() { |
|
|
var group = matrixGroupPool.pop(); |
|
|
var group = matrixGroupPool.pop(); |
|
|
if ( group ) { |
|
|
if ( group ) { |
|
|
return $(group).removeClass().addClass('matGroup'); |
|
|
|
|
|
|
|
|
return uDom(group).removeClass().addClass('matGroup'); |
|
|
} |
|
|
} |
|
|
return $('<div>').addClass('matGroup'); |
|
|
|
|
|
|
|
|
return uDom('<div>').addClass('matGroup'); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var createMatrixSection = function() { |
|
|
var createMatrixSection = function() { |
|
|
var section = matrixSectionPool.pop(); |
|
|
var section = matrixSectionPool.pop(); |
|
|
if ( section ) { |
|
|
if ( section ) { |
|
|
return $(section).removeClass().addClass('matSection'); |
|
|
|
|
|
|
|
|
return uDom(section).removeClass().addClass('matSection'); |
|
|
} |
|
|
} |
|
|
return $('<div>').addClass('matSection'); |
|
|
|
|
|
|
|
|
return uDom('<div>').addClass('matSection'); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var createMatrixRow = function() { |
|
|
var createMatrixRow = function() { |
|
|
var row = matrixRowPool.pop(); |
|
|
var row = matrixRowPool.pop(); |
|
|
if ( row ) { |
|
|
if ( row ) { |
|
|
row.style.visibility = ''; |
|
|
row.style.visibility = ''; |
|
|
row = $(row); |
|
|
|
|
|
row.children('.matCell').removeClass().addClass('matCell'); |
|
|
|
|
|
|
|
|
row = uDom(row); |
|
|
|
|
|
row.descendants('.matCell').removeClass().addClass('matCell'); |
|
|
row.removeClass().addClass('matRow'); |
|
|
row.removeClass().addClass('matRow'); |
|
|
return row; |
|
|
return row; |
|
|
} |
|
|
} |
|
|
if ( matrixRowTemplate === null ) { |
|
|
if ( matrixRowTemplate === null ) { |
|
|
matrixRowTemplate = $('#templates .matRow'); |
|
|
|
|
|
|
|
|
matrixRowTemplate = uDom('#templates .matRow'); |
|
|
} |
|
|
} |
|
|
return matrixRowTemplate.clone(); |
|
|
return matrixRowTemplate.clone(); |
|
|
}; |
|
|
}; |
|
@ -759,7 +757,7 @@ var createMatrixRow = function() { |
|
|
function renderMatrixHeaderRow() { |
|
|
function renderMatrixHeaderRow() { |
|
|
var matHead = uDom('#matHead.collapsible'); |
|
|
var matHead = uDom('#matHead.collapsible'); |
|
|
matHead.toggleClass('collapsed', getUserSetting('popupCollapseDomains')); |
|
|
matHead.toggleClass('collapsed', getUserSetting('popupCollapseDomains')); |
|
|
var cells = matHead.find('.matCell'); |
|
|
|
|
|
|
|
|
var cells = matHead.descendants('.matCell'); |
|
|
uDom(cells.node(0)) |
|
|
uDom(cells.node(0)) |
|
|
.prop('reqType', '*') |
|
|
.prop('reqType', '*') |
|
|
.prop('hostname', '*') |
|
|
.prop('hostname', '*') |
|
@ -845,38 +843,38 @@ function renderMatrixCellType(cell, hostname, type, stats) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function renderMatrixCellTypes(cells, hostname, stats) { |
|
|
function renderMatrixCellTypes(cells, hostname, stats) { |
|
|
renderMatrixCellType(cells[1], hostname, 'cookie', stats.cookie); |
|
|
|
|
|
renderMatrixCellType(cells[2], hostname, 'css', stats.css); |
|
|
|
|
|
renderMatrixCellType(cells[3], hostname, 'image', stats.image); |
|
|
|
|
|
renderMatrixCellType(cells[4], hostname, 'plugin', stats.plugin); |
|
|
|
|
|
renderMatrixCellType(cells[5], hostname, 'script', stats.script); |
|
|
|
|
|
renderMatrixCellType(cells[6], hostname, 'xhr', stats.xhr); |
|
|
|
|
|
renderMatrixCellType(cells[7], hostname, 'frame', stats.frame); |
|
|
|
|
|
renderMatrixCellType(cells[8], hostname, 'other', stats.other); |
|
|
|
|
|
|
|
|
renderMatrixCellType(cells.unode(1), hostname, 'cookie', stats.cookie); |
|
|
|
|
|
renderMatrixCellType(cells.unode(2), hostname, 'css', stats.css); |
|
|
|
|
|
renderMatrixCellType(cells.unode(3), hostname, 'image', stats.image); |
|
|
|
|
|
renderMatrixCellType(cells.unode(4), hostname, 'plugin', stats.plugin); |
|
|
|
|
|
renderMatrixCellType(cells.unode(5), hostname, 'script', stats.script); |
|
|
|
|
|
renderMatrixCellType(cells.unode(6), hostname, 'xhr', stats.xhr); |
|
|
|
|
|
renderMatrixCellType(cells.unode(7), hostname, 'frame', stats.frame); |
|
|
|
|
|
renderMatrixCellType(cells.unode(8), hostname, 'other', stats.other); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
/******************************************************************************/ |
|
|
|
|
|
|
|
|
function makeMatrixRowDomain(domain) { |
|
|
function makeMatrixRowDomain(domain) { |
|
|
var matrixRow = createMatrixRow().addClass('rw'); |
|
|
var matrixRow = createMatrixRow().addClass('rw'); |
|
|
var cells = matrixRow.children('.matCell'); |
|
|
|
|
|
renderMatrixCellDomain(cells[0], domain); |
|
|
|
|
|
|
|
|
var cells = matrixRow.descendants('.matCell'); |
|
|
|
|
|
renderMatrixCellDomain(cells.node(0), domain); |
|
|
renderMatrixCellTypes(cells, domain, HTTPSBPopup.matrixStats[domain].types); |
|
|
renderMatrixCellTypes(cells, domain, HTTPSBPopup.matrixStats[domain].types); |
|
|
return matrixRow; |
|
|
return matrixRow; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function makeMatrixRowSubdomain(domain, subdomain) { |
|
|
function makeMatrixRowSubdomain(domain, subdomain) { |
|
|
var matrixRow = createMatrixRow().addClass('rw'); |
|
|
var matrixRow = createMatrixRow().addClass('rw'); |
|
|
var cells = matrixRow.children('.matCell'); |
|
|
|
|
|
renderMatrixCellSubdomain(cells[0], domain, subdomain); |
|
|
|
|
|
|
|
|
var cells = matrixRow.descendants('.matCell'); |
|
|
|
|
|
renderMatrixCellSubdomain(cells.node(0), domain, subdomain); |
|
|
renderMatrixCellTypes(cells, subdomain, HTTPSBPopup.matrixStats[subdomain].types); |
|
|
renderMatrixCellTypes(cells, subdomain, HTTPSBPopup.matrixStats[subdomain].types); |
|
|
return matrixRow; |
|
|
return matrixRow; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function makeMatrixMetaRowDomain(domain, stats) { |
|
|
function makeMatrixMetaRowDomain(domain, stats) { |
|
|
var matrixRow = createMatrixRow().addClass('rw'); |
|
|
var matrixRow = createMatrixRow().addClass('rw'); |
|
|
var cells = matrixRow.children('.matCell'); |
|
|
|
|
|
renderMatrixMetaCellDomain(cells[0], domain); |
|
|
|
|
|
|
|
|
var cells = matrixRow.descendants('.matCell'); |
|
|
|
|
|
renderMatrixMetaCellDomain(cells.node(0), domain); |
|
|
renderMatrixCellTypes(cells, domain, stats); |
|
|
renderMatrixCellTypes(cells, domain, stats); |
|
|
return matrixRow; |
|
|
return matrixRow; |
|
|
} |
|
|
} |
|
@ -893,11 +891,9 @@ function renderMatrixMetaCellType(cell, count) { |
|
|
|
|
|
|
|
|
function makeMatrixMetaRow(stats) { |
|
|
function makeMatrixMetaRow(stats) { |
|
|
var typeStats = stats.types; |
|
|
var typeStats = stats.types; |
|
|
var matrixRow = uDom(createMatrixRow()[0]).addClass('ro'); |
|
|
|
|
|
var cells = matrixRow.find('.matCell'); |
|
|
|
|
|
var contents = uDom(cells.node(0)) |
|
|
|
|
|
.addClass('matCell rd') |
|
|
|
|
|
.contents(); |
|
|
|
|
|
|
|
|
var matrixRow = createMatrixRow().unode(0).addClass('ro'); |
|
|
|
|
|
var cells = matrixRow.descendants('.matCell'); |
|
|
|
|
|
var contents = cells.unode(0).addClass('rd').contents(); |
|
|
contents.node(0).textContent = ' '; |
|
|
contents.node(0).textContent = ' '; |
|
|
contents.node(1).textContent = '\u202A' + typeStats['*'].count + ' blacklisted hostname(s)'; |
|
|
contents.node(1).textContent = '\u202A' + typeStats['*'].count + ' blacklisted hostname(s)'; |
|
|
renderMatrixMetaCellType(cells.node(1), typeStats.cookie.count); |
|
|
renderMatrixMetaCellType(cells.node(1), typeStats.cookie.count); |
|
@ -908,7 +904,7 @@ function makeMatrixMetaRow(stats) { |
|
|
renderMatrixMetaCellType(cells.node(6), typeStats.xhr.count); |
|
|
renderMatrixMetaCellType(cells.node(6), typeStats.xhr.count); |
|
|
renderMatrixMetaCellType(cells.node(7), typeStats.frame.count); |
|
|
renderMatrixMetaCellType(cells.node(7), typeStats.frame.count); |
|
|
renderMatrixMetaCellType(cells.node(8), typeStats.other.count); |
|
|
renderMatrixMetaCellType(cells.node(8), typeStats.other.count); |
|
|
return $(matrixRow.node(0)); |
|
|
|
|
|
|
|
|
return matrixRow; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/******************************************************************************/ |
|
|
/******************************************************************************/ |
|
@ -1204,7 +1200,7 @@ function initMenuEnvironment() { |
|
|
var cell, key, text; |
|
|
var cell, key, text; |
|
|
while ( i-- ) { |
|
|
while ( i-- ) { |
|
|
key = keys[i]; |
|
|
key = keys[i]; |
|
|
cell = $('#matHead .matCell[data-filter-type="'+ key +'"]'); |
|
|
|
|
|
|
|
|
cell = uDom('#matHead .matCell[data-filter-type="'+ key +'"]'); |
|
|
text = chrome.i18n.getMessage(key + 'PrettyName'); |
|
|
text = chrome.i18n.getMessage(key + 'PrettyName'); |
|
|
cell.text(text); |
|
|
cell.text(text); |
|
|
prettyNames[key] = text; |
|
|
prettyNames[key] = text; |
|
@ -1242,19 +1238,14 @@ function createSiteScope() { |
|
|
dropDownMenuHide(); |
|
|
dropDownMenuHide(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function getClassSuffixFromScopeKey(scopeKey) { |
|
|
|
|
|
if ( scopeKey === '*' ) { |
|
|
|
|
|
return 'ScopeGlobal'; |
|
|
|
|
|
|
|
|
function getClassFromTargetScope() { |
|
|
|
|
|
if ( targetScope === '*' ) { |
|
|
|
|
|
return 'tScopeGlobal'; |
|
|
} |
|
|
} |
|
|
return 'ScopeLocal'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getClassFromTemporaryScopeKey(scopeKey) { |
|
|
|
|
|
return 't' + getClassSuffixFromScopeKey(scopeKey); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getClassFromPermanentScopeKey(scopeKey) { |
|
|
|
|
|
return 'p' + getClassSuffixFromScopeKey(scopeKey); |
|
|
|
|
|
|
|
|
if ( targetScope === targetPageDomain ) { |
|
|
|
|
|
return 'tScopeNarrow'; |
|
|
|
|
|
} |
|
|
|
|
|
return 'tScopeNarrow'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function initScopeCell() { |
|
|
function initScopeCell() { |
|
@ -1264,21 +1255,19 @@ function initScopeCell() { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
// Fill in the scope menu entries
|
|
|
// Fill in the scope menu entries
|
|
|
var µm = µMatrix; |
|
|
|
|
|
if ( targetPageDomain === '' || targetPageDomain === targetPageHostname ) { |
|
|
if ( targetPageDomain === '' || targetPageDomain === targetPageHostname ) { |
|
|
$('#scopeKeyDomain').css('display', 'none'); |
|
|
|
|
|
|
|
|
uDom('#scopeKeyDomain').css('display', 'none'); |
|
|
} else { |
|
|
} else { |
|
|
$('#scopeKeyDomain').text(targetPageDomain); |
|
|
|
|
|
|
|
|
uDom('#scopeKeyDomain').text(targetPageDomain); |
|
|
} |
|
|
} |
|
|
$('#scopeKeySite').text(targetPageHostname); |
|
|
|
|
|
|
|
|
uDom('#scopeKeySite').text(targetPageHostname); |
|
|
updateScopeCell(); |
|
|
updateScopeCell(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function updateScopeCell() { |
|
|
function updateScopeCell() { |
|
|
var µm = µMatrix; |
|
|
|
|
|
uDom('body') |
|
|
uDom('body') |
|
|
.removeClass('tScopeGlobal tScopeLocal tScopeSite') |
|
|
|
|
|
.addClass(getClassFromTemporaryScopeKey(targetScope)) |
|
|
|
|
|
|
|
|
.removeClass('tScopeGlobal tScopeNarrow') |
|
|
|
|
|
.addClass(getClassFromTargetScope()); |
|
|
uDom('#scopeCell').text(targetScope.replace('*', '\u2217')); |
|
|
uDom('#scopeCell').text(targetScope.replace('*', '\u2217')); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1289,11 +1278,11 @@ function updateMtxbutton() { |
|
|
var masterSwitch = µm.getTemporaryMtxFiltering(targetScope); |
|
|
var masterSwitch = µm.getTemporaryMtxFiltering(targetScope); |
|
|
var pageStats = getPageStats(); |
|
|
var pageStats = getPageStats(); |
|
|
var count = pageStats ? pageStats.requestStats.blocked.all : ''; |
|
|
var count = pageStats ? pageStats.requestStats.blocked.all : ''; |
|
|
var button = $('#buttonMtxFiltering'); |
|
|
|
|
|
|
|
|
var button = uDom('#buttonMtxFiltering'); |
|
|
button.toggleClass('disabled', !masterSwitch); |
|
|
button.toggleClass('disabled', !masterSwitch); |
|
|
button.children('span.badge').text(µm.formatCount(count)); |
|
|
|
|
|
button.attr('data-tip', button.data('tip').replace('{{count}}', count)); |
|
|
|
|
|
$('body').toggleClass('powerOff', !masterSwitch); |
|
|
|
|
|
|
|
|
button.descendants('span.badge').text(µm.formatCount(count)); |
|
|
|
|
|
button.attr('data-tip', button.attr('data-tip').replace('{{count}}', count)); |
|
|
|
|
|
uDom('body').toggleClass('powerOff', !masterSwitch); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function toggleMtxFiltering() { |
|
|
function toggleMtxFiltering() { |
|
@ -1309,12 +1298,12 @@ function toggleMtxFiltering() { |
|
|
|
|
|
|
|
|
function updatePersistButton() { |
|
|
function updatePersistButton() { |
|
|
var ruleset = getTemporaryRuleset(); |
|
|
var ruleset = getTemporaryRuleset(); |
|
|
var button = $('#buttonPersist'); |
|
|
|
|
|
|
|
|
var button = uDom('#buttonPersist'); |
|
|
button.contents() |
|
|
button.contents() |
|
|
.filter(function(){return this.nodeType===3;}) |
|
|
.filter(function(){return this.nodeType===3;}) |
|
|
.first()[0] |
|
|
|
|
|
.textContent = ruleset.count > 0 ? '\uf13e' : '\uf023'; |
|
|
|
|
|
button.children('span.badge').text(ruleset.count > 0 ? ruleset.count : ''); |
|
|
|
|
|
|
|
|
.first() |
|
|
|
|
|
.text(ruleset.count > 0 ? '\uf13e' : '\uf023'); |
|
|
|
|
|
button.descendants('span.badge').text(ruleset.count > 0 ? ruleset.count : ''); |
|
|
var disabled = ruleset.count === 0; |
|
|
var disabled = ruleset.count === 0; |
|
|
button.toggleClass('disabled', disabled); |
|
|
button.toggleClass('disabled', disabled); |
|
|
uDom('#buttonRevertScope').toggleClass('disabled', disabled); |
|
|
uDom('#buttonRevertScope').toggleClass('disabled', disabled); |
|
@ -1405,7 +1394,7 @@ function gotoExternalURL() { |
|
|
/******************************************************************************/ |
|
|
/******************************************************************************/ |
|
|
|
|
|
|
|
|
function dropDownMenuShow() { |
|
|
function dropDownMenuShow() { |
|
|
$(this).next('.dropdown-menu').addClass('show'); |
|
|
|
|
|
|
|
|
uDom(this).next('.dropdown-menu').addClass('show'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function dropDownMenuHide() { |
|
|
function dropDownMenuHide() { |
|
@ -1443,8 +1432,8 @@ var bindToTab = function(tabs) { |
|
|
|
|
|
|
|
|
// After popup menu is built, check whether there is a non-empty matrix
|
|
|
// After popup menu is built, check whether there is a non-empty matrix
|
|
|
if ( !targetPageURL ) { |
|
|
if ( !targetPageURL ) { |
|
|
$('#matHead').remove(); |
|
|
|
|
|
$('#toolbarLeft').remove(); |
|
|
|
|
|
|
|
|
uDom('#matHead').remove(); |
|
|
|
|
|
uDom('#toolbarLeft').remove(); |
|
|
|
|
|
|
|
|
// https://github.com/gorhill/httpswitchboard/issues/191
|
|
|
// https://github.com/gorhill/httpswitchboard/issues/191
|
|
|
uDom('#noNetTrafficPrompt').text(chrome.i18n.getMessage('matrixNoNetTrafficPrompt')); |
|
|
uDom('#noNetTrafficPrompt').text(chrome.i18n.getMessage('matrixNoNetTrafficPrompt')); |
|
@ -1456,55 +1445,50 @@ var bindToTab = function(tabs) { |
|
|
|
|
|
|
|
|
// Make menu only when popup html is fully loaded
|
|
|
// Make menu only when popup html is fully loaded
|
|
|
|
|
|
|
|
|
$(function() { |
|
|
|
|
|
|
|
|
uDom.onLoad(function() { |
|
|
|
|
|
|
|
|
chrome.tabs.query({ currentWindow: true, active: true }, bindToTab); |
|
|
chrome.tabs.query({ currentWindow: true, active: true }, bindToTab); |
|
|
|
|
|
|
|
|
// Below is UI stuff which is not key to make the menu, so this can
|
|
|
// Below is UI stuff which is not key to make the menu, so this can
|
|
|
// be done without having to wait for a tab to be bound to the menu.
|
|
|
// be done without having to wait for a tab to be bound to the menu.
|
|
|
|
|
|
|
|
|
var popup = HTTPSBPopup; |
|
|
|
|
|
|
|
|
|
|
|
// Matrix appearance
|
|
|
// Matrix appearance
|
|
|
$('body').css('font-size', getUserSetting('displayTextSize')); |
|
|
|
|
|
$('body').toggleClass('colorblind', getUserSetting('colorBlindFriendly') === true); |
|
|
|
|
|
|
|
|
uDom('body').css('font-size', getUserSetting('displayTextSize')); |
|
|
|
|
|
uDom('body').toggleClass('colorblind', getUserSetting('colorBlindFriendly') === true); |
|
|
|
|
|
|
|
|
// We reuse for all cells the one and only cell hotspots.
|
|
|
// We reuse for all cells the one and only cell hotspots.
|
|
|
matrixCellHotspots = $('#cellHotspots').detach(); |
|
|
|
|
|
$('#whitelist', matrixCellHotspots) |
|
|
|
|
|
.on('click', function() { |
|
|
|
|
|
handleWhitelistFilter($(this)); |
|
|
|
|
|
|
|
|
uDom('#whitelist').on('click', function() { |
|
|
|
|
|
handleWhitelistFilter(uDom(this)); |
|
|
return false; |
|
|
return false; |
|
|
}); |
|
|
}); |
|
|
$('#blacklist', matrixCellHotspots) |
|
|
|
|
|
.on('click', function() { |
|
|
|
|
|
handleBlacklistFilter($(this)); |
|
|
|
|
|
|
|
|
uDom('#blacklist').on('click', function() { |
|
|
|
|
|
handleBlacklistFilter(uDom(this)); |
|
|
return false; |
|
|
return false; |
|
|
}); |
|
|
}); |
|
|
$('#domainOnly', matrixCellHotspots) |
|
|
|
|
|
.on('click', function() { |
|
|
|
|
|
toggleCollapseState(this); |
|
|
|
|
|
|
|
|
uDom('#domainOnly').on('click', function() { |
|
|
|
|
|
toggleCollapseState(uDom(this)); |
|
|
return false; |
|
|
return false; |
|
|
}); |
|
|
}); |
|
|
$('body') |
|
|
|
|
|
|
|
|
matrixCellHotspots = uDom('#cellHotspots').detach(); |
|
|
|
|
|
uDom('body') |
|
|
.on('mouseenter', '.matCell', mouseenterMatrixCellHandler) |
|
|
.on('mouseenter', '.matCell', mouseenterMatrixCellHandler) |
|
|
.on('mouseleave', '.matCell', mouseleaveMatrixCellHandler); |
|
|
.on('mouseleave', '.matCell', mouseleaveMatrixCellHandler); |
|
|
$('#scopeKeyGlobal').on('click', createGlobalScope); |
|
|
|
|
|
$('#scopeKeyDomain').on('click', createDomainScope); |
|
|
|
|
|
$('#scopeKeySite').on('click', createSiteScope); |
|
|
|
|
|
$('#buttonMtxFiltering').on('click', toggleMtxFiltering); |
|
|
|
|
|
$('#buttonPersist').on('click', persistScope); |
|
|
|
|
|
$('#buttonRevertScope').on('click', revertScope); |
|
|
|
|
|
|
|
|
|
|
|
$('#buttonRevertAll').on('click', revertAll); |
|
|
|
|
|
$('#buttonReload').on('click', buttonReloadHandler); |
|
|
|
|
|
$('.extensionURL').on('click', gotoExtensionURL); |
|
|
|
|
|
$('.externalURL').on('click', gotoExternalURL); |
|
|
|
|
|
|
|
|
|
|
|
$('body').on('click', '.dropdown-menu-button', dropDownMenuShow); |
|
|
|
|
|
$('body').on('click', '.dropdown-menu-capture', dropDownMenuHide); |
|
|
|
|
|
|
|
|
|
|
|
$('#matList').on('click', '.g3Meta', function() { |
|
|
|
|
|
|
|
|
uDom('#scopeKeyGlobal').on('click', createGlobalScope); |
|
|
|
|
|
uDom('#scopeKeyDomain').on('click', createDomainScope); |
|
|
|
|
|
uDom('#scopeKeySite').on('click', createSiteScope); |
|
|
|
|
|
uDom('#buttonMtxFiltering').on('click', toggleMtxFiltering); |
|
|
|
|
|
uDom('#buttonPersist').on('click', persistScope); |
|
|
|
|
|
uDom('#buttonRevertScope').on('click', revertScope); |
|
|
|
|
|
|
|
|
|
|
|
uDom('#buttonRevertAll').on('click', revertAll); |
|
|
|
|
|
uDom('#buttonReload').on('click', buttonReloadHandler); |
|
|
|
|
|
uDom('.extensionURL').on('click', gotoExtensionURL); |
|
|
|
|
|
uDom('.externalURL').on('click', gotoExternalURL); |
|
|
|
|
|
|
|
|
|
|
|
uDom('body').on('click', '.dropdown-menu-button', dropDownMenuShow); |
|
|
|
|
|
uDom('body').on('click', '.dropdown-menu-capture', dropDownMenuHide); |
|
|
|
|
|
|
|
|
|
|
|
uDom('#matList').on('click', '.g3Meta', function() { |
|
|
var collapsed = uDom(this) |
|
|
var collapsed = uDom(this) |
|
|
.toggleClass('g3Collapsed') |
|
|
.toggleClass('g3Collapsed') |
|
|
.hasClass('g3Collapsed'); |
|
|
.hasClass('g3Collapsed'); |
|
|