1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-06-02 10:24:59 +12:00

remember last selected scope

This commit is contained in:
gorhill 2014-10-18 21:42:06 -04:00
parent 7e17e2ea84
commit e3dcf085a8
2 changed files with 13 additions and 1 deletions

View file

@ -61,6 +61,7 @@ return {
processBehindTheSceneRequests: false, processBehindTheSceneRequests: false,
processHyperlinkAuditing: true, processHyperlinkAuditing: true,
processReferer: false, processReferer: false,
scopeLevel: '*',
smartAutoReload: 'all', smartAutoReload: 'all',
spoofUserAgent: false, spoofUserAgent: false,
spoofUserAgentEvery: 5, spoofUserAgentEvery: 5,

View file

@ -1208,6 +1208,7 @@ function initMenuEnvironment() {
function createGlobalScope() { function createGlobalScope() {
targetScope = '*'; targetScope = '*';
setUserSetting('scopeLevel', '*');
updateMatrixStats(); updateMatrixStats();
updateMatrixColors(); updateMatrixColors();
updateMatrixBehavior(); updateMatrixBehavior();
@ -1217,6 +1218,7 @@ function createGlobalScope() {
function createDomainScope() { function createDomainScope() {
targetScope = targetPageDomain; targetScope = targetPageDomain;
setUserSetting('scopeLevel', 'domain');
updateMatrixStats(); updateMatrixStats();
updateMatrixColors(); updateMatrixColors();
updateMatrixBehavior(); updateMatrixBehavior();
@ -1226,6 +1228,7 @@ function createDomainScope() {
function createSiteScope() { function createSiteScope() {
targetScope = targetPageHostname; targetScope = targetPageHostname;
setUserSetting('scopeLevel', 'site');
updateMatrixStats(); updateMatrixStats();
updateMatrixColors(); updateMatrixColors();
updateMatrixBehavior(); updateMatrixBehavior();
@ -1256,6 +1259,14 @@ function initScopeCell() {
uDom('#scopeKeyDomain').text(targetPageDomain); uDom('#scopeKeyDomain').text(targetPageDomain);
} }
uDom('#scopeKeySite').text(targetPageHostname); uDom('#scopeKeySite').text(targetPageHostname);
var scopeLevel = getUserSetting('scopeLevel');
if ( scopeLevel === 'site' ) {
targetScope = targetPageHostname;
} else if ( scopeLevel === 'domain' ) {
targetScope = targetPageDomain;
} else {
targetScope = '*';
}
updateScopeCell(); updateScopeCell();
} }
@ -1419,7 +1430,7 @@ var bindToTab = function(tabs) {
targetPageURL = µm.pageUrlFromTabId(targetTabId); targetPageURL = µm.pageUrlFromTabId(targetTabId);
} }
targetPageHostname = µm.URI.hostnameFromURI(targetPageURL); targetPageHostname = µm.URI.hostnameFromURI(targetPageURL);
targetPageDomain = µm.URI.domainFromHostname(targetPageHostname); targetPageDomain = µm.URI.domainFromHostname(targetPageHostname) || targetPageHostname;
// Now that tabId and pageURL are set, we can build our menu // Now that tabId and pageURL are set, we can build our menu
initMenuEnvironment(); initMenuEnvironment();