Various Firefox error and warning fixes #166

This commit is contained in:
Jason 2016-03-07 23:22:28 -06:00
parent 2973cac28f
commit cc95a62c7c
6 changed files with 24 additions and 13 deletions

View File

@ -83,17 +83,21 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
} }
}); });
chrome.commands.onCommand.addListener(function(command) {
switch (command) { // Not available in Firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1240350
case "openManage": if (("commands") in chrome) {
openURL({url: chrome.extension.getURL("manage.html")}); chrome.commands.onCommand.addListener(function(command) {
break; switch (command) {
case "styleDisableAll": case "openManage":
disableAllStylesToggle(); openURL({url: chrome.extension.getURL("manage.html")});
chrome.contextMenus.update("disableAll", {checked: prefs.get("disableAll")}); break;
break; case "styleDisableAll":
} disableAllStylesToggle();
}); chrome.contextMenus.update("disableAll", {checked: prefs.get("disableAll")});
break;
}
});
}
// contextMenus API is present in ancient Chrome but it throws an exception // contextMenus API is present in ancient Chrome but it throws an exception
// upon encountering the unsupported parameter value "browser_action", so we have to catch it. // upon encountering the unsupported parameter value "browser_action", so we have to catch it.

View File

@ -1,5 +1,6 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<script src="codemirror/lib/codemirror.js"></script> <script src="codemirror/lib/codemirror.js"></script>
<link rel="stylesheet" href="codemirror/lib/codemirror.css"> <link rel="stylesheet" href="codemirror/lib/codemirror.css">
<script src="codemirror/mode/css/css.js"></script> <script src="codemirror/mode/css/css.js"></script>

View File

@ -48,7 +48,7 @@ function tNodeList(nodes) {
continue; continue;
} }
name = name.substr(5); // "i18n-".length name = name.substr(5); // "i18n-".length
var value = t(attr.nodeValue); var value = t(attr.value);
switch (name) { switch (name) {
case "text": case "text":
node.insertBefore(document.createTextNode(value), node.firstChild); node.insertBefore(document.createTextNode(value), node.firstChild);
@ -59,7 +59,7 @@ function tNodeList(nodes) {
default: default:
node.setAttribute(name, value); node.setAttribute(name, value);
} }
node.removeAttributeNode(attr); node.removeAttribute(attr.nodeName);
} }
} }
} }

View File

@ -1,5 +1,6 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title i18n-text="manageTitle"></title> <title i18n-text="manageTitle"></title>
<style> <style>
body { body {

View File

@ -1,5 +1,6 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<style> <style>
body { body {
width: 200px; width: 200px;

View File

@ -1,6 +1,10 @@
var webSqlStorage = { var webSqlStorage = {
migrate: function() { migrate: function() {
if (typeof openDatabase == "undefined") {
// No WebSQL - no migration!
return;
}
webSqlStorage.getStyles(function(styles) { webSqlStorage.getStyles(function(styles) {
getDatabase(function(db) { getDatabase(function(db) {
var tx = db.transaction(["styles"], "readwrite"); var tx = db.transaction(["styles"], "readwrite");