From 262e3c61f536e9a56fea03bd442c22d9e909415a Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Mon, 5 Jul 2010 13:41:17 -0400 Subject: [PATCH] Changed to git mainline version of conkeror which required config changes. --- conkerorrc | 124 +++-------------------------------------------------- 1 file changed, 7 insertions(+), 117 deletions(-) diff --git a/conkerorrc b/conkerorrc index 91d34b6..5d47be3 100644 --- a/conkerorrc +++ b/conkerorrc @@ -1,3 +1,7 @@ +require("block-content-focus-change.js"); +require("extensions/noscript.js"); +require("session.js"); + define_key(default_global_keymap, "C-o", "cmd_scrollPageUp"); define_key(default_base_keymap, "C-o", "cmd_scrollPageUp"); define_key(default_global_keymap, "C-j", "ns-toggle-temp"); @@ -19,121 +23,7 @@ user_pref("font.minimum-size.x-western", 17); user_pref("font.size.fixed.x-western", 17); user_pref("font.size.variable.x-western", 17); +session_auto_save_file = "auto-save-session.conkeror"; -require("window.js"); -require("utils.js"); - -var noscript = Cc["@maone.net/noscript-service;1"].createInstance().wrappedJSObject; - -function unique(a) { - var r = new Array(); - o:for(var i = 0, n = a.length; i < n; i++) { - for(var x = 0, y = r.length; x < y; x++) { - if(r[x]==a[i]) continue o; - } - r[r.length] = a[i]; - } - return r; -} - -function hideObject(p, o) { - if (!p.mimeRx.test(o.type)) return; - - var r = p.document.createElement("object"); - r.style.width = o.offsetWidth + "px"; - r.style.height = o.offsetHeight + "px"; - r.style.display = "inline-block"; - o.className += " " + p.className; - o.parentNode.insertBefore(r, o); -} - -function showObject(p, o) { - var cs = o.className; - cs = cs.replace(p.classRx, ''); - if (cs != o.className) { - o.className = cs; - var r = o.previousSibling; - if (r instanceof HTMLObjectElement) { - r.parentNode.removeChild(r); - } - } -} - -function setObjectVisibility(document, callback) { - tags = ["object", "embed"]; - const ns = noscript; - var rx = ns.hideOnUnloadRegExp; - if (!rx) return; - var params = { - document: document, - mimeRx: rx, - classRx: ns.hideObjClassNameRx, - className: ns.hideObjClassName - }; - - var objects = null; - for each(var tag in tags) { - dump('tag: '+tag+'\n'); - local_objects = document.getElementsByTagName(tag); - count = local_objects.count; - if (count) { - objects = objects || [local_objects[--count]]; - while(count-- > 0) { - objects.push(local_objects[count]); - } - } - } - if(objects) { - for (counter = objects.length; counter-- > 0;) { - callback(params, objects[counter]); - } - } -} - - -function ns_allow_temp(url, buffer, P, allow) { - dump(url+"\n"); - dump(allow + "\n"); - const ns = noscript; - if (allow == "Y" || allow == "y" || allow == "yes" || allow == "Yes") { - enabled = true; - temp = ns.getPref("toggle.temp"); - ns.setTemp(url, enabled && temp); - ns.setJSEnabled(url, enabled, false, ns.mustCascadeTrust(url, temp)); - setObjectVisibility(buffer.document,showObject); - } else { - enabled = false; - temp = ns.getPref("toggle.temp"); - ns.setTemp(url, enabled && temp); - ns.setJSEnabled(url, enabled, false, ns.mustCascadeTrust(url, temp)); - setObjectVisibility(buffer.document,hideObject); - } -} - -interactive("ns-toggle-temp", "Allow a site temporary access to javascript", function(I) { - dump(I.window); - const ns = noscript; - var urls = new Array(); - var level = ns.getPref("toolbarToggle", 3); - if (!level) level = 3; - const url = ns.getQuickSite(I.buffer.document.documentURI, level); - if (url){ - urls.push(url); - var scripts = I.buffer.document.getElementsByTagName("script"); - for(i = 0;i < scripts.length;i++) { - if (scripts[i].getAttribute("src")) { - matches = scripts[i].getAttribute("src").split("/"); - if (matches[0] == "http:") { - urls.push(matches[2]); - } - } - } - urls = unique(urls); - dump(urls+"\n"); - while (url2 = urls.pop()) { - ns_allow_temp(url2, I.buffer,I.P, (yield I.minibuffer.read ($prompt = "Allow "+url2+"? [Y/[N]]"))); - } - reload(I.buffer, I.P); - } - }); - +hints_auto_exit_delay = 400; +hints_ambiguous_auto_exit_delay = 1500;