1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-22 22:05:48 +01:00

Fix stupid styling bug

This commit is contained in:
Kris Maglione
2008-11-01 03:20:24 +00:00
parent 47f753d72c
commit db5543dcb5

View File

@@ -215,7 +215,7 @@ function Styles(name, store, serial)
matches = matches.filter(function (i) sheets[i].css == css); matches = matches.filter(function (i) sheets[i].css == css);
if (filter) if (filter)
matches = matches.filter(function (i) sheets[i].sites.indexOf(filter) >= 0); matches = matches.filter(function (i) sheets[i].sites.indexOf(filter) >= 0);
return matches.map(function (i) [i, sheets[i]]); return matches.map(function (i) sheets[i]);
}; };
this.removeSheet = function (name, filter, css, index, system) this.removeSheet = function (name, filter, css, index, system)
@@ -235,20 +235,20 @@ function Styles(name, store, serial)
if (matches.length == 0) if (matches.length == 0)
return; return;
for (let [,[i, sheet]] in Iterator(matches.reverse())) for (let [,sheet] in Iterator(matches.reverse()))
{ {
if (name) if (name)
{ {
sheet.ref.splice(sheet.ref.indexOf(name)); if (sheet.ref.indexOf(name) > -1)
sheet.ref.splice(sheet.ref.indexOf(name), 1);
delete names[name]; delete names[name];
} }
if (!sheet.ref.length) if (!sheet.ref.length)
{ {
sheets.splice(i);
this.unregisterSheet(cssUri(wrapCSS(sheet))); this.unregisterSheet(cssUri(wrapCSS(sheet)));
if (sheets.indexOf(sheet) > -1)
sheets.splice(sheets.indexOf(sheet), 1);
} }
// Filter out the given site, and re-add if there are any left
// This could have unintended consequences
if (filter) if (filter)
{ {
let sites = sheet.sites.filter(function (f) f != filter); let sites = sheet.sites.filter(function (f) f != filter);
@@ -388,8 +388,8 @@ liberator.registerObserver("load_commands", function ()
let sheet = styles.findSheets(name, null, null, null, false)[0]; let sheet = styles.findSheets(name, null, null, null, false)[0];
if (sheet) if (sheet)
{ {
filter = sheet[1].sites.concat(filter).join(","); filter = sheet.sites.concat(filter).join(",");
css = sheet[1].css.replace(/;?\s*$/, "; " + css); css = sheet.css.replace(/;?\s*$/, "; " + css);
} }
} }
let err = styles.addSheet(name, filter, css, false, special); let err = styles.addSheet(name, filter, css, false, special);