Skip to content

Instantly share code, notes, and snippets.

@lklepner
Last active March 3, 2016 17:14
Show Gist options
  • Save lklepner/f7a6fd689fc6798adce2 to your computer and use it in GitHub Desktop.
Save lklepner/f7a6fd689fc6798adce2 to your computer and use it in GitHub Desktop.
MapWarper Enlarger
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'enlarge.js'
});
});
// this is the code which will be injected into a given page...
(function() {
//window.onresize = resizeMaps();
resizeMaps();
function resizeMaps () {
console.log('resizing..');
if ( document.getElementById('unmap') ){
document.getElementById('unmap').style.height = Number(window.innerHeight - 350) + "px";
}
if (document.getElementById('from_map') ){
document.getElementById('from_map').style.height = Number(window.innerHeight - 470) + "px";
document.getElementById('to_map').style.height = Number(window.innerHeight - 470) + "px";
}
if (document.getElementById('clipmap') ){
document.getElementById('clipmap').style.height = Number(window.innerHeight - 470) + "px";
}
if (document.getElementById('warpedmap') ){
document.getElementById('warpedmap').style.height = Number(window.innerHeight - 370) + "px";
}
window.scrollTo(0, 150);
}
})();
{
"name": "MapWarper Enlarger",
"version": "0.0.1",
"manifest_version": 2,
"description": "Increase the working area of the NYPL MapWarper",
"homepage_url": "http://maps.nypl.org/warper",
"background": {
"scripts": [
"background.js"
],
"persistent": true
},
"browser_action": {
"default_title": "Enlarge Map Area"
},
"permissions": [
"https://*/*",
"http://*/*",
"tabs"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment