Browse Source

bring back behind-the-scene matrix

pull/2/head
gorhill 10 years ago
parent
commit
85437661bf
  1. 2
      src/js/dashboard-common.js
  2. 19
      src/js/messaging-handlers.js
  3. 7
      src/js/popup.js

2
src/js/dashboard-common.js

@ -30,7 +30,7 @@ uDom('a').attr('target', '_blank');
uDom('a[href*="dashboard.html"]').attr('target', '_parent'); uDom('a[href*="dashboard.html"]').attr('target', '_parent');
uDom('.whatisthis').on('click', function() { uDom('.whatisthis').on('click', function() {
uDom(this).parent() uDom(this).parent()
.find('.whatisthis-expandable')
.descendants('.whatisthis-expandable')
.toggleClass('whatisthis-expanded'); .toggleClass('whatisthis-expanded');
}); });

19
src/js/messaging-handlers.js

@ -86,16 +86,17 @@ var matrixSnapshot = function(details) {
popupScopeLevel: µmuser.popupScopeLevel popupScopeLevel: µmuser.popupScopeLevel
} }
}; };
/*
// Allow to scope on behind-the-scene virtual tab
if ( tab.url.indexOf('chrome-extension://' + chrome.runtime.id + '/') === 0 ) {
targetTabId = µm.behindTheSceneTabId;
targetPageURL = µm.behindTheSceneURL;
} else {
targetTabId = tab.id;
targetPageURL = µm.pageUrlFromTabId(targetTabId);
// Allow examination of behind-the-scene requests
// TODO: Not portable
if ( details.tabURL ) {
if ( details.tabURL.indexOf('chrome-extension://' + chrome.runtime.id + '/') === 0 ) {
details.tabId = µm.behindTheSceneTabId;
} else if ( details.tabURL === µm.behindTheSceneURL ) {
details.tabId = µm.behindTheSceneTabId;
} }
*/
}
var pageStore = µm.pageStatsFromTabId(details.tabId); var pageStore = µm.pageStatsFromTabId(details.tabId);
if ( !pageStore ) { if ( !pageStore ) {
return r; return r;

7
src/js/popup.js

@ -1059,13 +1059,16 @@ var onMatrixSnapshotReady = function(response) {
var queryMatrixSnapshot = function(callback) { var queryMatrixSnapshot = function(callback) {
var request = { var request = {
what: 'matrixSnapshot', what: 'matrixSnapshot',
tabId: targetTabId
tabId: targetTabId,
tabURL: matrixSnapshot.url
}; };
var onTabsReceived = function(tabs) { var onTabsReceived = function(tabs) {
if ( tabs.length === 0 ) { if ( tabs.length === 0 ) {
return; return;
} }
request.tabId = targetTabId = tabs[0].id;
var tab = tabs[0];
request.tabId = targetTabId = tab.id;
request.tabURL = tab.url;
messaging.ask(request, callback); messaging.ask(request, callback);
}; };
if ( targetTabId === undefined ) { if ( targetTabId === undefined ) {

Loading…
Cancel
Save