Merge pull request #148 from tophf/fixes

Fixes
This commit is contained in:
Jason Barnabe 2015-08-30 11:36:03 -05:00
commit 9dc7d289b8
4 changed files with 22 additions and 22 deletions

View File

@ -243,6 +243,14 @@
padding: 0.5rem; padding: 0.5rem;
z-index: 99; z-index: 99;
} }
#help-popup.big {
max-width: 100%;
left: 3rem;
}
#help-popup.big .CodeMirror {
min-height: 2rem;
height: 70vh;
}
#help-popup .title { #help-popup .title {
font-weight: bold; font-weight: bold;
background-color: rgba(0,0,0,0.05); background-color: rgba(0,0,0,0.05);

View File

@ -1529,7 +1529,7 @@ function showLintHelp() {
function showHelp(title, text) { function showHelp(title, text) {
var div = document.getElementById("help-popup"); var div = document.getElementById("help-popup");
div.style.cssText = ""; div.classList.remove("big");
div.querySelector(".contents").innerHTML = text; div.querySelector(".contents").innerHTML = text;
div.querySelector(".title").innerHTML = title; div.querySelector(".title").innerHTML = title;
@ -1552,7 +1552,7 @@ function showHelp(title, text) {
function showCodeMirrorPopup(title, html, options) { function showCodeMirrorPopup(title, html, options) {
var popup = showHelp(title, html); var popup = showHelp(title, html);
popup.style.width = popup.style.maxWidth = "calc(100vw - 7rem)"; popup.classList.add("big");
popup.codebox = CodeMirror(popup.querySelector(".contents"), shallowMerge(options, { popup.codebox = CodeMirror(popup.querySelector(".contents"), shallowMerge(options, {
mode: "css", mode: "css",
@ -1567,7 +1567,6 @@ function showCodeMirrorPopup(title, html, options) {
keyMap: prefs.getPref("editor.keyMap") keyMap: prefs.getPref("editor.keyMap")
})); }));
popup.codebox.focus(); popup.codebox.focus();
popup.codebox.setSize(null, "70vh");
popup.codebox.on("focus", function() { hotkeyRerouter.setState(false) }); popup.codebox.on("focus", function() { hotkeyRerouter.setState(false) });
popup.codebox.on("blur", function() { hotkeyRerouter.setState(true) }); popup.codebox.on("blur", function() { hotkeyRerouter.setState(true) });
return popup; return popup;

View File

@ -389,38 +389,31 @@ function codeIsEqual(a, b) {
} }
function jsonEquals(a, b, property) { function jsonEquals(a, b, property) {
var type = getType(a[property]); var aProp = a[property], typeA = getType(aProp);
var typeB = getType(b[property]); var bProp = b[property], typeB = getType(bProp);
if (type != typeB) { if (typeA != typeB) {
// consider empty arrays equivalent to lack of property // consider empty arrays equivalent to lack of property
if ((type == "undefined" || (type == "array" && a[property].length == 0)) && (typeB == "undefined" || (typeB == "array" && b[property].length == 0))) { if ((typeA == "undefined" || (typeA == "array" && aProp.length == 0)) && (typeB == "undefined" || (typeB == "array" && bProp.length == 0))) {
return true; return true;
} }
return false; return false;
} }
if (type == "undefined") { if (typeA == "undefined") {
return true; return true;
} }
if (type == "array") { if (typeA == "array") {
if (a[property].length != b[property].length) { if (aProp.length != bProp.length) {
return false; return false;
} }
for (var i = 0; i < a.length; i++) { for (var i = 0; i < aProp.length; i++) {
var found = false; if (bProp.indexOf(aProp[i]) == -1) {
for (var j = 0; j < b.length; j++) {
if (a[i] == b[j]) {
found = true;
break;
}
}
if (!found) {
return false; return false;
} }
} }
return true; return true;
} }
if (type == "string") { if (typeA == "string") {
return a[property] == b[property]; return aProp == bProp;
} }
} }

View File

@ -69,7 +69,7 @@ function dbV14(d, error, done) {
function dbV15(d, error, done) { function dbV15(d, error, done) {
d.changeVersion(d.version, '1.5', function (t) { d.changeVersion(d.version, '1.5', function (t) {
t.executeSql('ALTER TABLE styles ADD COLUMN originalMd5 TEXT NULL;'); t.executeSql('ALTER TABLE styles ADD COLUMN originalMd5 TEXT NULL;');
}, error, function() { dbV15(d, error, done)}); }, error, function() { done(d); });
} }
function enableStyle(id, enabled) { function enableStyle(id, enabled) {