1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 15:22:26 +01:00

Back out part of my last commit.

This commit is contained in:
Kris Maglione
2008-10-04 06:15:39 +00:00
parent ce06d55415
commit 27328ca295
3 changed files with 25 additions and 30 deletions

View File

@@ -61,8 +61,7 @@ liberator.Buffer = function () //{{{
if (sheets.some(function (s) s[0] == filter && s[1] == css)) if (sheets.some(function (s) s[0] == filter && s[1] == css))
return null; return null;
sheets.push([filter, css]); sheets.push([filter, css]);
let uri = cssUri(wrapCSS(filter, css)); this.registerSheet(cssUri(wrapCSS(filter, css)));
this.registerSheet(uri, sss.USER_SHEET);
return null; return null;
} }
@@ -71,8 +70,8 @@ liberator.Buffer = function () //{{{
if (number >= sheets.length) if (number >= sheets.length)
return false; return false;
let sheet = sheets.splice(number)[0]; let sheet = sheets.splice(number)[0];
let uri = cssUri(wrapCSS(sheet[0], sheet[1])); let uri =
this.unregisterSheet(uri, sss.USER_SHEET); this.unregisterSheet(cssUri(wrapCSS(sheet[0], sheet[1])));
return true; return true;
} }
@@ -152,18 +151,6 @@ liberator.Buffer = function () //{{{
let styles = liberator.storage.newObject(styles, Styles, false); 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) function setZoom(value, fullZoom)
{ {
if (value < 1 || value > 2000) if (value < 1 || value > 2000)
@@ -1398,14 +1385,10 @@ liberator.Buffer = function () //{{{
// add the frame indicator // add the frame indicator
var doc = frames[next].document; var doc = frames[next].document;
var indicator =
/* Doesn't unapply... <div id="liberator-frame-indicator"
var class = doc.body.class || ""; style="background-color: red; opacity: 0.5; z-index: 999
doc.body.setAttribute("class", class + " liberator-frame-indicator"); position: fixed; top: 0; bottom: 0; left: 0; right: 0"/>;
setTimeout(function () doc.body.setAttribute("class", class), 500);
*/
var indicator = <div id="liberator-frame-indicator"/>;
doc.body.appendChild(liberator.util.xmlToDom(indicator)); doc.body.appendChild(liberator.util.xmlToDom(indicator));
// remove the frame indicator // remove the frame indicator

View File

@@ -121,7 +121,8 @@ liberator.CommandLine = function () //{{{
// the widget used for multiline output // the widget used for multiline output
var multilineOutputWidget = document.getElementById("liberator-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; var outputContainer = multilineOutputWidget.parentNode;
@@ -1196,7 +1197,7 @@ liberator.ItemList = function (id) //{{{
var doc; var doc;
var container = iframe.parentNode; 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 completions = []; // a reference to the Array of completions
var listOffset = -1; // how many items is the displayed list shifted from the internal tab index var listOffset = -1; // how many items is the displayed list shifted from the internal tab index

View File

@@ -77,11 +77,22 @@ liberator.util = { //{{{
yield ary[i]; yield ary[i];
}, },
blankDocument: function (iframe, bodyId) blankDocument: function (bodyId)
{ {
let name = liberator.config.name.toLowerCase(); let mainWindowID = liberator.config.mainWindowID || "main-window";
iframe.addEventListener("load", function () iframe.contentDocument.body.setAttribute("id", bodyId), true); let fontSize = document.defaultView.getComputedStyle(document.getElementById(mainWindowID), null)
iframe.setAttribute("src", "chrome://" + name + "/skin/blank-" + name + ".xhtml"); .getPropertyValue("font-size");
return 'data:application/xhtml+xml,' + encodeURI('<?xml version="1.0" encoding="UTF-8"?>' +
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' +
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title/>
<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) clip: function (str, length)