Browse Source

Hopefully this fixes #301

pull/2/head
gorhill 9 years ago
parent
commit
479b454307
  1. 4
      platform/chromium/vapi-common.js
  2. 19
      platform/firefox/vapi-background.js
  3. 4
      platform/firefox/vapi-common.js
  4. 5
      src/js/popup.js

4
platform/chromium/vapi-common.js

@ -81,6 +81,10 @@ vAPI.closePopup = function() {
window.open('','_self').close(); window.open('','_self').close();
}; };
vAPI.resizePopup = function() {
// Nothing to do: chromium API takes care to resize the popup
};
/******************************************************************************/ /******************************************************************************/
// A localStorage-like object which should be accessible from the // A localStorage-like object which should be accessible from the

19
platform/firefox/vapi-background.js

@ -2022,6 +2022,15 @@ vAPI.toolbarButton = {
} }
}; };
var onResizeRequested = function() {
var body = iframe.contentDocument.body;
if ( body.getAttribute('data-resize-popup') !== 'true' ) {
return;
}
body.removeAttribute('data-resize-popup');
resizePopupDelayed();
};
var onPopupReady = function() { var onPopupReady = function() {
var win = this.contentWindow; var win = this.contentWindow;
@ -2033,16 +2042,14 @@ vAPI.toolbarButton = {
tbb.onBeforePopupReady.call(this); tbb.onBeforePopupReady.call(this);
} }
new win.MutationObserver(resizePopupDelayed).observe(win.document.body, {
var mutationObserver = new win.MutationObserver(onResizeRequested);
mutationObserver.observe(win.document.body, {
attributes: true, attributes: true,
characterData: true,
subtree: true
attributeFilter: [ 'data-resize-popup' ]
}); });
resizePopupDelayed();
}; };
iframe.addEventListener('load', onPopupReady, true);
iframe.addEventListener('DOMContentLoaded', onPopupReady, true);
}; };
})(); })();

4
platform/firefox/vapi-common.js

@ -120,6 +120,10 @@ vAPI.closePopup = function() {
sendAsyncMessage(location.host + ':closePopup'); sendAsyncMessage(location.host + ':closePopup');
}; };
vAPI.resizePopup = function() {
document.body.setAttribute('data-resize-popup', 'true');
};
/******************************************************************************/ /******************************************************************************/
// A localStorage-like object which should be accessible from the // A localStorage-like object which should be accessible from the

5
src/js/popup.js

@ -288,6 +288,7 @@ function toggleCollapseState(elem) {
} else { } else {
toggleSpecificCollapseState(elem); toggleSpecificCollapseState(elem);
} }
vAPI.resizePopup();
} }
function toggleMainCollapseState(uelem) { function toggleMainCollapseState(uelem) {
@ -368,6 +369,7 @@ function updateMatrixColors() {
cell = cells.nodeAt(i); cell = cells.nodeAt(i);
cell.className = 'matCell ' + getCellClass(cell.hostname, cell.reqType); cell.className = 'matCell ' + getCellClass(cell.hostname, cell.reqType);
} }
vAPI.resizePopup();
} }
/******************************************************************************/ /******************************************************************************/
@ -393,6 +395,7 @@ function updateMatrixBehavior() {
} }
section.toggleClass('collapsible', subdomainRows.filter('.collapsible').length > 0); section.toggleClass('collapsible', subdomainRows.filter('.collapsible').length > 0);
} }
vAPI.resizePopup();
} }
/******************************************************************************/ /******************************************************************************/
@ -475,6 +478,7 @@ var endMatrixUpdate = function() {
updateMatrixBehavior(); updateMatrixBehavior();
matrixList.css('display', ''); matrixList.css('display', '');
matrixList.appendTo('.paneContent'); matrixList.appendTo('.paneContent');
vAPI.resizePopup();
}; };
var createMatrixGroup = function() { var createMatrixGroup = function() {
@ -1363,6 +1367,7 @@ uDom('#matList').on('click', '.g4Meta', function() {
.toggleClass('g4Collapsed') .toggleClass('g4Collapsed')
.hasClass('g4Collapsed'); .hasClass('g4Collapsed');
setUISetting('popupHideBlacklisted', collapsed); setUISetting('popupHideBlacklisted', collapsed);
vAPI.resizePopup();
}); });
/******************************************************************************/ /******************************************************************************/

Loading…
Cancel
Save