...continued
The code in case you wish to create the extension from scratch or just see what's going on
manifest.json
[code]{
"manifest_version": 2,
"name": "Zoomify",
"version": "1.0.0.0",
"browser_action": {
"default_icon": {
"19": "images/icon19.png",
"38": "images/icon38.png"
},
"default_title": "Zoomify"
},
"background": {
"scripts": ["background.js"],
"persistent": false
},
"permissions": ["tabs", "http://www.bbc.co.uk/iplayer*"],
"icons": {
"16": "images/icon16.png",
"48": "images/icon48.png",
"128": "images/icon128.png"
}
}
[/code]
background.js
[code]chrome.tabs.onUpdated.addListener(function (tabId, changeinfo, tab) {
"use strict";
var url = tab.url,
zoomVal = 1.75; /* zoom value for player */
if (url.indexOf('http://www.bbc.co.uk/iplayer') === 0) {
if (url === 'http://www.bbc.co.uk/iplayer') {
zoomVal = 1.5; /* zoom value for thumbs page */
}
chrome.tabs.getZoom(tabId, function (zoomFactor) {
if (zoomFactor !== zoomVal) {
chrome.tabs.setZoom(tab.id, zoomVal);
}
});
}
});
[/code]
23-Jun-2016 14:13:58
- Last edited on
23-Jun-2016 14:24:12
by
Indecent Act