From 27328ca29515c21192067b1053314639e73592ef Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Sat, 4 Oct 2008 06:15:39 +0000 Subject: [PATCH] Back out part of my last commit. --- content/buffer.js | 31 +++++++------------------------ content/ui.js | 5 +++-- content/util.js | 19 +++++++++++++++---- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/content/buffer.js b/content/buffer.js index 2a6d6676..f220035e 100644 --- a/content/buffer.js +++ b/content/buffer.js @@ -61,8 +61,7 @@ liberator.Buffer = function () //{{{ if (sheets.some(function (s) s[0] == filter && s[1] == css)) return null; sheets.push([filter, css]); - let uri = cssUri(wrapCSS(filter, css)); - this.registerSheet(uri, sss.USER_SHEET); + this.registerSheet(cssUri(wrapCSS(filter, css))); return null; } @@ -71,8 +70,8 @@ liberator.Buffer = function () //{{{ if (number >= sheets.length) return false; let sheet = sheets.splice(number)[0]; - let uri = cssUri(wrapCSS(sheet[0], sheet[1])); - this.unregisterSheet(uri, sss.USER_SHEET); + let uri = + this.unregisterSheet(cssUri(wrapCSS(sheet[0], sheet[1]))); return true; } @@ -152,18 +151,6 @@ liberator.Buffer = function () //{{{ let styles = liberator.storage.newObject(styles, Styles, false); - for (let sheet in arrayIter(liberator.config.userSheets || [])) - styles.registerSheet(sheet); - - /* FIXME: This doesn't belong here. */ - let mainWindowID = liberator.config.mainWindowID || "main-window"; - let fontSize = document.defaultView.getComputedStyle(document.getElementById(mainWindowID), null) - .getPropertyValue("font-size"); - - let name = liberator.config.name.toLowerCase(); - let error = styles.addSheet("chrome://" + name + "/skin/blank-" + name + ".xhtml", - "body { font-size: " + fontSize + "}"); - function setZoom(value, fullZoom) { if (value < 1 || value > 2000) @@ -1398,14 +1385,10 @@ liberator.Buffer = function () //{{{ // add the frame indicator var doc = frames[next].document; - - /* Doesn't unapply... - var class = doc.body.class || ""; - doc.body.setAttribute("class", class + " liberator-frame-indicator"); - setTimeout(function () doc.body.setAttribute("class", class), 500); - */ - - var indicator =
; + var indicator = +
; doc.body.appendChild(liberator.util.xmlToDom(indicator)); // remove the frame indicator diff --git a/content/ui.js b/content/ui.js index d68f860c..86139130 100644 --- a/content/ui.js +++ b/content/ui.js @@ -121,7 +121,8 @@ liberator.CommandLine = function () //{{{ // the widget used for multiline output var multilineOutputWidget = document.getElementById("liberator-multiline-output"); - liberator.util.blankDocument(multilineOutputWidget, "liberator-multiline-output-content"); + multilineOutputWidget.setAttribute("src", + liberator.util.blankDocument("liberator-multiline-output-content")); var outputContainer = multilineOutputWidget.parentNode; @@ -1196,7 +1197,7 @@ liberator.ItemList = function (id) //{{{ var doc; var container = iframe.parentNode; - liberator.util.blankDocument(iframe, id + "-content"); + iframe.setAttribute("src", liberator.util.blankDocument(id + "-content")); var completions = []; // a reference to the Array of completions var listOffset = -1; // how many items is the displayed list shifted from the internal tab index diff --git a/content/util.js b/content/util.js index 65314492..f59a9080 100644 --- a/content/util.js +++ b/content/util.js @@ -77,11 +77,22 @@ liberator.util = { //{{{ yield ary[i]; }, - blankDocument: function (iframe, bodyId) + blankDocument: function (bodyId) { - let name = liberator.config.name.toLowerCase(); - iframe.addEventListener("load", function () iframe.contentDocument.body.setAttribute("id", bodyId), true); - iframe.setAttribute("src", "chrome://" + name + "/skin/blank-" + name + ".xhtml"); + let mainWindowID = liberator.config.mainWindowID || "main-window"; + let fontSize = document.defaultView.getComputedStyle(document.getElementById(mainWindowID), null) + .getPropertyValue("font-size"); + + return 'data:application/xhtml+xml,' + encodeURI('' + + '' + + + + + <link rel="stylesheet" type="text/css" + href={"chrome://" + liberator.config.name.toLowerCase() + "/skin/vimperator.css"}/> + </head> + <body id={bodyId} style={"font-size: " + fontSize}/> + </html>) }, clip: function (str, length)