Update to manifest version 2

It mostly works but there are still some bugs in RedditAPI.getReddits()
This commit is contained in:
wassname
2018-08-02 10:31:34 +08:00
parent 224c0e9821
commit e03e05d203
6 changed files with 38 additions and 37 deletions
+2 -17
View File
@@ -6,22 +6,7 @@
<script type="text/javascript" src="/fancy-settings/lib/store.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script type="text/javascript">
var background;
background = new Background();
function initBackground() {
cache.removeAll();
button.setBadgeDefaults();
chrome.tabs.onUpdated.addListener(background.prepareBrowserAction);
background.watchMail();
window.setInterval(background.clearCache, (settings.get('cacheTime') * 60 * 1000));
reddit.getReddits();
}
window.onload = initBackground;
</script>
<script type="text/javascript" src="/js/background.js"></script>
</head>
<body id="body"></body>
</html>
</html>
+2 -19
View File
@@ -6,26 +6,9 @@
<link type="text/css" rel="stylesheet" href="/css/popup.css">
<script type="text/javascript" src="/fancy-settings/lib/store.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script type="text/javascript">
var popup;
popup = new Popup();
function initPopup() {
chrome.tabs.getSelected(null, function(currTab) {
if (cache.get(currTab.url) !== undefined && cache.get(currTab.url).count >= 1) {
document.getElementById('body').innerHTML = popup.createListHTML(currTab.url);
document.getElementById('body').style.width = settings.get('popupWidth') + 'px';
} else {
document.getElementById('body').innerHTML = popup.createSubmitForm(currTab);
}
});
}
window.addEventListener('load', initPopup);
</script>
<script type="text/javascript" src="/js/popup.js"></script>
</head>
<body id="body">
<img id="loading" src="/pix/ajaxload.info.gif" width="32" height="32" alt="Loading..." />
</body>
</html>
</html>
+14
View File
@@ -0,0 +1,14 @@
var background;
background = new Background();
function initBackground() {
cache.removeAll();
button.setBadgeDefaults();
chrome.tabs.onUpdated.addListener(background.prepareBrowserAction);
background.watchMail();
window.setInterval(background.clearCache, (settings.get('cacheTime') * 60 * 1000));
reddit.getReddits();
}
window.onload = initBackground;
+2
View File
@@ -1308,3 +1308,5 @@ Popup.prototype.cacheComment = function (e) {
cache.set(url, oldCache);
return true;
};
+16
View File
@@ -0,0 +1,16 @@
var popup;
popup = new Popup();
function initPopup() {
chrome.tabs.getSelected(null, function(currTab) {
if (cache.get(currTab.url) !== undefined && cache.get(currTab.url).count >= 1) {
document.getElementById('body').innerHTML = popup.createListHTML(currTab.url);
document.getElementById('body').style.width = settings.get('popupWidth') + 'px';
} else {
document.getElementById('body').innerHTML = popup.createSubmitForm(currTab);
}
});
}
window.addEventListener('load', initPopup);
+2 -1
View File
@@ -1,6 +1,7 @@
{
"name": "Mostly Harmless",
"version": "1.5.1",
"manifest_version": 2,
"description": "Find, vote on, save, hide, and report links on reddit; submit new links; These and more! http://kerrick.github.com/Mostly-Harmless",
"browser_action": {
"default_icon": "pix/alien.png",
@@ -16,7 +17,7 @@
"48": "pix/icon48.png",
"128": "pix/icon128.png"
},
"background_page": "html/background.html",
"background": {"page":"html/background.html","persistent": true},
"options_page": "fancy-settings/index.html",
"default_locale": "en_US"
}