From 28ffb254a36473590f68ff19e8b318229bfcfc4a Mon Sep 17 00:00:00 2001
From: Bommels05 <69975756+Bommels05@users.noreply.github.com>
Date: Mon, 10 Nov 2025 20:10:53 +0100
Subject: [PATCH] Initial Extension Commit
---
extension/chrome.manifest | 3 +
extension/content/browserOverlay.xul | 5 +
extension/content/icon.png | Bin 0 -> 7952 bytes
extension/content/icon16.png | Bin 0 -> 925 bytes
extension/content/init.js | 14 ++
extension/content/old.js | 140 +++++++++++++++++
extension/install.rdf | 20 +++
extension/modules/common.jsm | 226 ++++++++++++++++++++++++++
extension/modules/main.jsm | 227 +++++++++++++++++++++++++++
9 files changed, 635 insertions(+)
create mode 100644 extension/chrome.manifest
create mode 100644 extension/content/browserOverlay.xul
create mode 100644 extension/content/icon.png
create mode 100644 extension/content/icon16.png
create mode 100644 extension/content/init.js
create mode 100644 extension/content/old.js
create mode 100644 extension/install.rdf
create mode 100644 extension/modules/common.jsm
create mode 100644 extension/modules/main.jsm
diff --git a/extension/chrome.manifest b/extension/chrome.manifest
new file mode 100644
index 0000000..4d2c5f1
--- /dev/null
+++ b/extension/chrome.manifest
@@ -0,0 +1,3 @@
+content befatoraddon content/
+overlay chrome://browser/content/browser.xul chrome://befatoraddon/content/browserOverlay.xul
+resource befatoraddon modules/
\ No newline at end of file
diff --git a/extension/content/browserOverlay.xul b/extension/content/browserOverlay.xul
new file mode 100644
index 0000000..7d13e1f
--- /dev/null
+++ b/extension/content/browserOverlay.xul
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/extension/content/icon.png b/extension/content/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..4daeb55ad4067bfca026a8733a381ca2bc1c480f
GIT binary patch
literal 7952
zcmV+rAMfCaP)NklAoDYg(Ea9itP8u}4TqLSu0Wv)G1RFn&H3uf6uO*J~bL
z_8Ha&{_tYFJhZm4z1Ya>w`;>%*fJmk5)u+Z(nurCNHfErIW=dW)kk$5S(OVTrfDkDt34q2I{=#Cih7^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a_3H!Bs6
zh_Dz*r2Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!~g&e!~vBn4jTXf12RcOK~y+TC6i5P
z9CaARe>4C2p8d#nNwQmuF>NX-=1_x55x+5~qCq7Wi@69Q^w2}Wo(jDRf}jXqRD@C$
zwHMKY^@|ExY#R?I;zwdpl9Fzd>}IpOGdrKYyB(O}KlA@T&-1>|`;0dA*kbNE9=2b`
zuzf6LlPL?+)In2n19=XqMwCXRaX{1$$--U2po{L>?htHSWn8;}@_ank!xS>dc5tl0
z?P7W+j^p4uvhR5~eo4N2=!RRuaLZWoQ6B(I2j#dZStCH%01;8T!U{GpgwV7_z$u{n
zf-&8Klq-j1!!iUQhmjU0olUAvf|K-^*DvyL=K`bK-?6y=Dvlmw7b&i
zEuqLo=@LC#nB^GZa13DPSts7Zib(K{hi{Ck9g~Nk4!hw9$kDhAM`vZd!XF?
z`;u@dx@$iS%RX2uvDET;@5GdtnM(f!HiMi?m#^}Z^8&hVh}&YeSWmCLP5kFC)LCU}
zqAKO({Il7n8N%d&I$vH}=fkhA33!<;`##)Z3tEoK728+d#S8!A$nj@!HxhO>I!xSM
z;pCwiTAMd`hSc;xwSu*BwZcK<8^lTw%JN_o`0&w^ev4KtO~miEl@jj
zj81Ed{O|&ONn_j(D3`|3W}i8oOD 3.6
+ console = {
+ log: function(message) {
+ dump(message);
+ }
+ }
+ }
+
+ console.log("Befator Init!");
+ Components.utils.import("resource://befatoraddon/common.jsm");
+ befatorUpdate(window);
+}
\ No newline at end of file
diff --git a/extension/content/old.js b/extension/content/old.js
new file mode 100644
index 0000000..77d3731
--- /dev/null
+++ b/extension/content/old.js
@@ -0,0 +1,140 @@
+console.log(window.document.location.href)
+
+if (window.document.location.href == "chrome://browser/content/browser.xul") {
+ console.log(window.document);
+
+ Components.utils.import("chrome://befatoraddon/content/common.jsm");
+ befatorWindow = window;
+ befatorUpdate();
+
+ window.document.title = "Befator Inc Secure-Web Browser";
+ let windowElement = window.document.getElementById("main-window");
+ windowElement.setAttribute("titlemodifier", windowElement.getAttribute("titlemodifier") + " (Befator Inc. Secure-Web)")
+ //window.document.children[0].append("Befator Inc grüßt Sie
");
+ window.document.getElementById("search-container").setAttribute("style", "display: none;");
+ window.document.getElementById("urlbar").setAttribute("placeholder", "Aus Sicherheitsgründen sind nur geprüfte Seiten erlaubt");
+ window.document.getElementById("urlbar").setAttribute("disabled", "true");
+ if (window.toggleAddonBar != null) {//!null -> 24
+ window.document.getAnonymousElementByAttribute(window.document.getElementById("urlbar"), "anonid", "historydropmarker").setAttribute("enablehistory", "false");
+ }
+
+ //window.document.getElementById("history-menu").setAttribute("disabled", "true");
+ if (window.document.getElementById("pocket-button") != null) {//Null -> 38
+ window.document.getElementById("pocket-button").setAttribute("disabled", "true");
+ window.document.getElementById("menu_pocket").setAttribute("disabled", "true");
+ }
+
+
+ if (window.document.getElementById("identity-icon") != null) {//null -> 31
+ window.document.getElementById("identity-icon").setAttribute("style", "list-style-image: url(chrome://befatoraddon/content/icon.png);");
+ window.document.getElementById("connection-icon").setAttribute("style", "display: none;");
+ } else {
+ window.document.getElementById("page-proxy-favicon").setAttribute("style", "list-style-image: url(chrome://befatoraddon/content/icon.png);-moz-image-region: initial;");
+ window.gIdentityHandler.checkIdentity = function() {};
+ }
+ window.document.getElementById("identity-icon-labels").setAttribute("collapsed", "false");
+ window.document.getElementById("identity-icon-labels").setAttribute("style", "visibility: visible;");
+ window.document.getElementById("identity-icon-label").setAttribute("value", "Secure-Web");
+ window.document.getElementById("identity-box").setAttribute("onclick", "");
+
+ if (window.SidebarUI != undefined) {
+ window.SidebarUI.hide = function() {
+ window.SidebarUI.show("viewBookmarksSidebar");
+ }
+ window.SidebarUI.toggle = window.SidebarUI.hide;
+ window.SidebarUI.hide();
+ } else {
+ window.originalSidebar = window.toggleSidebar;
+ window.toggleSidebar = function() {
+ window.originalSidebar("viewBookmarksSidebar", true);
+ }
+ window.toggleSidebar();
+ }
+ if (window.toggleAddonBar != null) {
+ window.originalAddonBar = window.setToolbarVisibility;
+ window.setToolbarVisibility = function(toolbar, visible) {
+ if (window.document.getElementById("addon-bar") == toolbar) {
+ window.originalAddonBar(toolbar, true);
+ } else {
+ window.originalAddonBar(toolbar, visible);
+ }
+ }
+ window.setToolbarVisibility(window.document.getElementById("addon-bar"), true);
+ }
+
+ window.gIdentityHandler.refreshIdentityBlock = function() {};
+
+ window.gBrowser.addProgressListener({
+ onLocationChange: function (browser, webProgress, request, location, flags) {
+ /*window.setTimeout(function() {
+ if (!window.document.title.endsWith("(Befator Inc. Secure-Web)")) {
+ console.log(window.document.title);
+ window.document.title = window.document.title + " (Befator Inc. Secure-Web)";
+ }
+ }, 333);*/
+
+ let currentUrl = window.gURLBar.value;
+ console.log(currentUrl);
+ if (currentUrl.startsWith("http://proxy.befatorinc.de:3636/proxy/")) {
+ window.gURLBar.value = currentUrl.replace("http://proxy.befatorinc.de:3636/proxy/", "");
+ } else if (currentUrl.startsWith("proxy.befatorinc.de:3636/proxy/")) {
+ window.gURLBar.value = currentUrl.replace("proxy.befatorinc.de:3636/proxy/", "");
+ }
+ }
+ });
+}
+if (window.document.location.href == "chrome://browser/content/browser.xul" || window.document.location.href == "chrome://browser/content/places/places.xul") {
+ window.originalGoDoPlaces = window.goDoPlacesCommand;
+ let befatorBookmark = function(cmd) {
+ if (cmd != "placesCmd_new:bookmark") {
+ window.originalGoDoPlaces(cmd);
+ } else {
+ Services.prompt.alert(window, "Befator Inc Secure-Web", "Aus Sicherheitsgründen können nur auf geprüften Seiten Bookmarks erstellt werden");
+ }
+ }
+ window.goDoPlacesCommand = befatorBookmark;
+
+ if (window.document.location.href == "chrome://browser/content/browser.xul") {
+ let sidebar = window.document.getElementById("sidebar").contentWindow;
+ let bookmarksFixer = function() {
+ if (sidebar.goDoPlacesCommand == undefined) {
+ window.setTimeout(bookmarksFixer, 2000);
+ return;
+ }
+ console.log(sidebar.document.location.href);
+ sidebar.goDoPlacesCommand = befatorBookmark;
+ }
+ bookmarksFixer();
+
+ /*let panelFixer = function() {
+ if (window.document.getElementById("history-panelmenu") == null) {
+ window.setTimeout(panelFixer, 2000);
+ return;
+ }
+ window.document.getElementById("history-panelmenu").setAttribute("disabled", "true");
+ window.document.getElementById("privatebrowsing-button").setAttribute("disabled", "true");
+ }
+ panelFixer();*/
+
+ let panelFixer2 = function() {
+ if (window.document.getElementById("privatebrowsing-button") == null) {
+ window.setTimeout(panelFixer2, 2000);
+ return;
+ }
+ window.document.getElementById("privatebrowsing-button").setAttribute("disabled", "true");
+ }
+ panelFixer2();
+
+ let menuFixer = function() {//Wierdness
+ window.document.getElementById("menu_openFile").setAttribute("disabled", "true");
+ window.document.getElementById("menu_newPrivateWindow").setAttribute("disabled", "true");
+ window.setTimeout(menuFixer, 2000);
+ }
+ menuFixer();
+ }
+}
+if (window.document.location.href == "chrome://browser/content/places/places.xul" || window.document.location.href == "chrome://browser/content/places/bookmarkProperties.xul") {
+ window.document.getElementById("editBMPanel_locationField").setAttribute("disabled", "true");
+}
+
+console.log("Befator Done!");
\ No newline at end of file
diff --git a/extension/install.rdf b/extension/install.rdf
new file mode 100644
index 0000000..2a00ea1
--- /dev/null
+++ b/extension/install.rdf
@@ -0,0 +1,20 @@
+
+
+
+
+ 2
+ befatoraddon@jetpack
+ Befator Inc. Secure-Web
+ Bommels05
+ Erlaubt das browsen durch das Befator Inc. Secure-Web ("BefatorWeb")
+ 0.2.0
+
+
+ {ec8030f7-c20a-464f-9b0e-13a3a9e97384}
+ 3.6
+ 52.*
+
+
+
+
\ No newline at end of file
diff --git a/extension/modules/common.jsm b/extension/modules/common.jsm
new file mode 100644
index 0000000..be3b72c
--- /dev/null
+++ b/extension/modules/common.jsm
@@ -0,0 +1,226 @@
+/*var self = require("sdk/self");
+
+var buttons;
+try {
+ buttons = require('sdk/ui/button/action');
+} catch (ex) {
+ buttons = null;
+}
+var tabs = require("sdk/tabs");
+
+const {Cc, Ci, Cu, Cr} = require("chrome");*/
+
+/*if (buttons != null) {//null -> 24
+ var button = buttons.ActionButton({
+ id: "mozilla-link",
+ label: "Befator Inc. Secure-Web!",
+ icon: {
+ "16": "./icon-64.png",
+ "32": "./icon-64.png",
+ "64": "./icon-64.png"
+ },
+ onClick: handleClick
+ });
+} else {
+ var widgets = require("sdk/widget")
+ var widget = widgets.Widget({
+ id: "mozilla-link",
+ label: "Befator Inc. Secure-Web!",
+ contentURL: "resource://befatoraddon-at-jetpack/befatoraddon/data/icon-64.png",
+ onClick: handleClick
+ });
+}*/
+var EXPORTED_SYMBOLS = ["befatorUpdate", "handleBefatorClick"];
+
+//console.log("Befator Inc grüßt Sie!");
+
+var befatorWindow;
+
+function handleBefatorClick(window) {
+ try {
+ window.Cu.import('resource://gre/modules/Services.jsm');
+ } catch (e) {//e -> 3.6
+ var Services = {
+ prompt: window.Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService)
+ }
+ }
+
+ let request = new window.XMLHttpRequest();
+ request.onreadystatechange = function() {
+ if (request.readyState == 4) {
+ Services.prompt.alert(window, "Befator Inc Secure-Web", request.responseText);
+ }
+ }
+ request.open("GET", "http://proxy.befatorinc.de:3636/api/progressMessage?currentPage=" + window.document.getElementById("content").selectedBrowser.contentDocument.location.href.replace("http://proxy.befatorinc.de:3636/proxy/", ""), true);
+ request.send(null);
+ //tabs.open("https://wiki.befatorinc.de/index.php/Hauptseite");
+}
+
+function handleWindow(window) {
+ if (window.document.readyState == "complete") {
+ befatorWindow.console.log("Window!");
+ Components.utils.import("resource://befatoraddon/main.jsm");
+ onBefatorWindow(window);
+ } else {
+ window.addEventListener('load', function(e) {
+ handleWindow(window);
+ }, false);
+ }
+}
+
+//https://udn.realityripple.com/docs/Archive/Add-ons/Tabbed_browser#Getting_the_tab_that_fires_the_http-on-modify-request_notification
+function loadContextGoodies(httpChannel) {
+ //httpChannel must be the subject of http-on-modify-request QI'ed to nsiHTTPChannel as is done on line 8 "httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);"
+ //start loadContext stuff
+ var loadContext;
+ try {
+ var interfaceRequestor = httpChannel.notificationCallbacks.QueryInterface(befatorWindow.Ci.nsIInterfaceRequestor);
+ //var DOMWindow = interfaceRequestor.getInterface(Components.interfaces.nsIDOMWindow); //not to be done anymore because: https://developer.mozilla.org/docs/Updating_extensions_for_Firefox_3.5#Getting_a_load_context_from_a_request //instead do the loadContext stuff below
+ try {
+ loadContext = interfaceRequestor.getInterface(befatorWindow.Ci.nsILoadContext);
+ } catch (ex) {
+ try {
+ loadContext = subject.loadGroup.notificationCallbacks.getInterface(befatorWindow.Ci.nsILoadContext);
+ } catch (ex2) {}
+ }
+ } catch (ex0) {}
+
+ if (!loadContext) {
+ //no load context so dont do anything although you can run this, which is your old code
+ //this probably means that its loading an ajax call or like a google ad thing
+ return null;
+ } else {
+ var contentWindow = loadContext.associatedWindow;
+ if (!contentWindow) {
+ //this channel does not have a window, its probably loading a resource
+ //this probably means that its loading an ajax call or like a google ad thing
+ return null;
+ } else {
+ try {
+ var aDOMWindow = contentWindow.top.QueryInterface(befatorWindow.Ci.nsIInterfaceRequestor)
+ .getInterface(befatorWindow.Ci.nsIWebNavigation)
+ .QueryInterface(befatorWindow.Ci.nsIDocShellTreeItem)
+ .rootTreeItem
+ .QueryInterface(befatorWindow.Ci.nsIInterfaceRequestor)
+ .getInterface(befatorWindow.Ci.nsIDOMWindow);
+ var gBrowser = aDOMWindow.gBrowser;
+ var aTab = gBrowser._getTabForContentWindow(contentWindow.top); //this is the clickable tab xul element, the one found in the tab strip of the firefox window, aTab.linkedBrowser is same as browser var above //can stylize tab like aTab.style.backgroundColor = 'blue'; //can stylize the tab like aTab.style.fontColor = 'red';
+ var browser = aTab.linkedBrowser; //this is the browser within the tab //this is where the example in the previous section ends
+ return {
+ aDOMWindow: aDOMWindow,
+ gBrowser: gBrowser,
+ aTab: aTab,
+ browser: browser,
+ contentWindow: contentWindow
+ };
+ } catch(e) {
+ return null;
+ }
+ }
+ }
+}
+
+var init = false;
+function befatorUpdate(newWindow) {
+ if (!init) {
+ befatorWindow = newWindow;
+ init = true;
+ try {
+ Components.utils.import('resource://gre/modules/Services.jsm');
+ } catch(e) {//e -> 3.6
+ var Services = {
+ obs: Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService),
+ prefs: Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(""),
+ io: Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService)
+ }
+ }
+
+ var observers = {
+ 'http-on-modify-request': {
+ observe: function (aSubject, aTopic, aData) {
+ //console.log('http-on-modify-request: aSubject = ' + aSubject + ' | aTopic = ' + aTopic + ' | aData = ' + aData);
+ var httpChannel = aSubject.QueryInterface(befatorWindow.Ci.nsIHttpChannel);
+ var requestUrl = httpChannel.URI.spec.toLowerCase();
+ //befatorWindow.console.log("Requesting: " + requestUrl);
+ //for (var i=0; i -1) {
+ //httpChannel.cancel(Cr.NS_BINDING_ABORTED); //this aborts the load
+ var contains = false;
+ if (requestUrl.includes != undefined) {
+ contains = requestUrl.includes("befatorinc.de:3636/");
+ } else if (requestUrl.contains != undefined) {
+ contains = requestUrl.contains("befatorinc.de:3636/");
+ } else {
+ contains = requestUrl.indexOf("befatorinc.de:3636/") != -1;
+ }
+
+ if (!contains) {
+ if (httpChannel.redirectTo != undefined) {//undefined -> 17
+ httpChannel.redirectTo(Services.io.newURI("http://proxy.befatorinc.de:3636/proxy/" + requestUrl, null, null/*redir_obj[urls_block[i]], null, null)*/)); //can redirect with this line, if dont want to redirect and just block, then uncomment this line and comment out line above (line 17)
+ } else {
+ httpChannel.cancel(befatorWindow.Cr.NS_BINDING_ABORTED);
+ var goodies = loadContextGoodies(httpChannel);
+ if (goodies && requestUrl.indexOf("web-static.archive.org") == -1) {
+ goodies.contentWindow.location.href = "http://proxy.befatorinc.de:3636/proxy/" + requestUrl;
+ } else {
+ //error?
+ }
+ //Components.utils.import("chrome://befatoraddon/content/ChannelReplacement.jsm");
+ //ChannelReplacement.runWhenPending(httpChannel, function() {
+ //var cr = new ChannelReplacement(httpChannel, Services.io.newURI("http://proxy.befatorinc.de:3636/proxy/" + requestUrl, null, null));
+ //cr.replace(true, null);
+ //cr.open();
+ //});
+ }
+ }
+ //break;
+ //}
+ //}
+ },
+ reg: function () {
+ Services.obs.addObserver(observers['http-on-modify-request'], 'http-on-modify-request', false);
+ },
+ unreg: function () {
+ Services.obs.removeObserver(observers['http-on-modify-request'], 'http-on-modify-request');
+ }
+ },
+ 'homepage-pref': {
+ observe: function (aSubject, aTopic, aData) {
+ //befatorWindow.console.log("HomePage!");
+ if (Services.prefs.getCharPref("browser.startup.homepage") != "about:home") {
+ Services.prefs.setCharPref("browser.startup.homepage", "about:home");
+ }
+ },
+ reg: function () {
+ var pref = Services.prefs;
+ if (pref.addObserver == undefined) {//undefined -> 3.6
+ pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch2)
+ }
+ pref.addObserver("browser.startup.homepage", observers['homepage-pref'], false);
+ },
+ unreg: function () {
+ //Services.obs.removeObserver(observers['http-on-modify-request'], 'http-on-modify-request');
+ }
+ },
+ 'toplevel-window-ready': {
+ observe: function (aSubject, aTopic, aData) {
+ handleWindow(aSubject);
+ },
+ reg: function () {
+ Services.obs.addObserver(observers['toplevel-window-ready'], 'toplevel-window-ready', false);
+ },
+ unreg: function () {
+ Services.obs.removeObserver(observers['toplevel-window-ready'], 'toplevel-window-ready');
+ }
+ }
+ };
+
+ //console.log("Startup");
+
+ for (var o in observers) {
+ observers[o].reg();
+ }
+
+ handleWindow(befatorWindow);
+ }
+}
diff --git a/extension/modules/main.jsm b/extension/modules/main.jsm
new file mode 100644
index 0000000..d33c1c6
--- /dev/null
+++ b/extension/modules/main.jsm
@@ -0,0 +1,227 @@
+var EXPORTED_SYMBOLS = ["onBefatorWindow"];
+
+function onBefatorWindow(window) {
+ let console = window.console;
+ if (console == undefined) {//undefined -> 3.6
+ console = {
+ log: function(message) {
+ dump(message);
+ }
+ }
+ }
+ console.log(window.document.location.href)
+
+ if (window.document.location.href == "chrome://browser/content/browser.xul") {
+ console.log(window.document);
+
+ Components.utils.import("resource://befatoraddon/common.jsm");
+ befatorUpdate();
+
+ window.document.title = "Befator Inc Secure-Web Browser";
+ let windowElement = window.document.getElementById("main-window");
+ windowElement.setAttribute("titlemodifier", windowElement.getAttribute("titlemodifier") + " (Befator Inc. Secure-Web)")
+ //window.document.children[0].append("Befator Inc grüßt Sie
");
+ window.document.getElementById("search-container").setAttribute("style", "display: none;");
+ window.document.getElementById("urlbar").setAttribute("placeholder", "Aus Sicherheitsgründen sind nur geprüfte Seiten erlaubt");
+ window.document.getElementById("urlbar").setAttribute("disabled", "true");
+ if (window.toggleAddonBar != null) {//!null -> 24
+ window.document.getAnonymousElementByAttribute(window.document.getElementById("urlbar"), "anonid", "historydropmarker").setAttribute("enablehistory", "false");
+ } else if (window.console == undefined) {//undefined -> 3.6
+ window.document.getElementById("urlbar").setAttribute("enablehistory", "false");
+ }
+
+ //window.document.getElementById("history-menu").setAttribute("disabled", "true");
+ if (window.document.getElementById("pocket-button") != null) {//Null -> 38
+ window.document.getElementById("pocket-button").setAttribute("disabled", "true");
+ window.document.getElementById("menu_pocket").setAttribute("disabled", "true");
+ }
+
+ if ("".startsWith != undefined) {//undefined -> 10
+ if (window.document.getElementById("identity-icon") != null) {//null -> 31
+ window.document.getElementById("identity-icon").setAttribute("style", "list-style-image: url(chrome://befatoraddon/content/icon.png);");
+ window.document.getElementById("connection-icon").setAttribute("style", "display: none;");
+ } else {
+ if (window.document.getElementById("page-proxy-favicon").insertAdjacentHTML != undefined) {//undefined -> 17
+ window.document.getElementById("page-proxy-favicon").setAttribute("style", "list-style-image: url(chrome://befatoraddon/content/icon.png);-moz-image-region: initial;");
+ } else {
+ window.document.getElementById("page-proxy-favicon").setAttribute("style", "list-style-image: url(chrome://befatoraddon/content/icon16.png);");
+ }
+ window.gIdentityHandler.checkIdentity = function() {};
+ }
+ window.document.getElementById("identity-icon-labels").setAttribute("collapsed", "false");
+ window.document.getElementById("identity-icon-labels").setAttribute("style", "visibility: visible;");
+ window.document.getElementById("identity-icon-label").setAttribute("value", "Secure-Web");
+ }
+ window.document.getElementById("identity-box").setAttribute("onclick", "");
+
+ let navbar = window.document.getElementById("nav-bar-customization-target");
+ if (window.document.getElementById("identity-icon") != null) {
+ navbar.insertAdjacentHTML("beforeend", '');
+ } else if (navbar != null) {//null -> 24
+ navbar.insertAdjacentHTML("beforeend", '');
+ } else {
+ navbar = window.document.getElementById("addon-bar");
+ if (navbar != null) {//null -> 3.6
+ if (navbar.insertAdjacentHTML != undefined) {//undefined -> 17
+ navbar.insertAdjacentHTML("beforeend", '');
+ } else {
+ let button = window.document.createElement("toolbarbutton");
+ button.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional badged-button");
+ button.setAttribute("label", "Befator Inc. Secure-Web!");
+ button.setAttribute("tooltiptext", "Befator Inc. Secure-Web!");
+ button.setAttribute("style", "list-style-image: url(chrome://befatoraddon/content/icon16.png);");
+ button.setAttribute("onclick", "handleBefatorClick(window);");
+ navbar.appendChild(button);
+ }
+ } else {
+ navbar = window.document.getElementById("status-bar");
+ let button = window.document.createElement("statusbarpanel");
+ //button.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional badged-button");
+ button.setAttribute("tooltiptext", "Befator Inc. Secure-Web!");
+ button.setAttribute("style", "list-style-image: url(chrome://befatoraddon/content/icon16.png);");
+ button.setAttribute("onclick", "handleBefatorClick(window);");
+ navbar.appendChild(button);
+ }
+ }
+
+ if (window.SidebarUI != undefined) {
+ window.SidebarUI.hide = function() {
+ window.SidebarUI.show("viewBookmarksSidebar");
+ }
+ window.SidebarUI.toggle = window.SidebarUI.hide;
+ window.SidebarUI.hide();
+ } else {
+ window.originalSidebar = window.toggleSidebar;
+ window.toggleSidebar = function() {
+ window.originalSidebar("viewBookmarksSidebar", true);
+ }
+ window.toggleSidebar();
+ }
+ if (window.toggleAddonBar != null) {
+ window.originalAddonBar = window.setToolbarVisibility;
+ window.setToolbarVisibility = function(toolbar, visible) {
+ if (window.document.getElementById("addon-bar") == toolbar) {
+ window.originalAddonBar(toolbar, true);
+ } else {
+ window.originalAddonBar(toolbar, visible);
+ }
+ }
+ window.setToolbarVisibility(window.document.getElementById("addon-bar"), true);
+ } else if (window.goToggleToolbar != undefined) {
+ window.originalStatusBar = window.goToggleToolbar;
+ window.goToggleToolbar = function(toolbar, type) {
+ if (toolbar == "status-bar") {
+ }
+ window.originalStatusBar(toolbar, type);
+ }
+ }
+
+ window.gIdentityHandler.refreshIdentityBlock = function() {};
+
+ window.gBrowser.addProgressListener({
+ onLocationChange: function (browser, webProgress, request, location, flags) {
+ /*window.setTimeout(function() {
+ if (!window.document.title.endsWith("(Befator Inc. Secure-Web)")) {
+ console.log(window.document.title);
+ window.document.title = window.document.title + " (Befator Inc. Secure-Web)";
+ }
+ }, 333);*/
+
+ let currentUrl = window.gURLBar.value;
+ console.log(currentUrl);
+ if (currentUrl.startsWith != undefined) {//undefined -> 10
+ if (currentUrl.startsWith("http://proxy.befatorinc.de:3636/proxy/")) {
+ window.gURLBar.value = currentUrl.replace("http://proxy.befatorinc.de:3636/proxy/", "");
+ } else if (currentUrl.startsWith("proxy.befatorinc.de:3636/proxy/")) {
+ window.gURLBar.value = currentUrl.replace("proxy.befatorinc.de:3636/proxy/", "");
+ }
+ } else {
+ if (currentUrl.indexOf("http://proxy.befatorinc.de:3636/proxy/") == 0) {
+ window.gURLBar.value = currentUrl.replace("http://proxy.befatorinc.de:3636/proxy/", "");
+ } else if (currentUrl.indexOf("proxy.befatorinc.de:3636/proxy/") == 0) {
+ window.gURLBar.value = currentUrl.replace("proxy.befatorinc.de:3636/proxy/", "");
+ }
+ }
+ }
+ });
+ }
+ if (window.document.location.href == "chrome://browser/content/browser.xul" || window.document.location.href == "chrome://browser/content/places/places.xul") {
+ try {
+ Components.utils.import('resource://gre/modules/Services.jsm');
+ } catch (e) {//e -> 3.6
+ var Services = {
+ prompt: Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService)
+ }
+ }
+
+ window.originalGoDoPlaces = window.goDoPlacesCommand;
+ let befatorBookmark = function(cmd) {
+ if (cmd != "placesCmd_new:bookmark") {
+ window.originalGoDoPlaces(cmd);
+ } else {
+ Services.prompt.alert(window, "Befator Inc Secure-Web", "Aus Sicherheitsgründen können nur auf geprüften Seiten Bookmarks erstellt werden");
+ }
+ }
+ window.goDoPlacesCommand = befatorBookmark;
+
+ if (window.document.location.href == "chrome://browser/content/browser.xul") {
+ let sidebar = window.document.getElementById("sidebar").contentWindow;
+ let bookmarksFixer = function() {
+ if (sidebar.goDoPlacesCommand == undefined) {
+ window.setTimeout(bookmarksFixer, 2000);
+ return;
+ }
+ console.log(sidebar.document.location.href);
+ sidebar.goDoPlacesCommand = befatorBookmark;
+ }
+ bookmarksFixer();
+
+ /*let panelFixer = function() {
+ if (window.document.getElementById("history-panelmenu") == null) {
+ window.setTimeout(panelFixer, 2000);
+ return;
+ }
+ window.document.getElementById("history-panelmenu").setAttribute("disabled", "true");
+ window.document.getElementById("privatebrowsing-button").setAttribute("disabled", "true");
+ }
+ panelFixer();*/
+
+ let panelFixer2 = function() {
+ if (window.document.getElementById("privatebrowsing-button") == null) {
+ window.setTimeout(panelFixer2, 2000);
+ return;
+ }
+ window.document.getElementById("privatebrowsing-button").setAttribute("disabled", "true");
+ }
+ panelFixer2();
+
+ let menuFixer = function() {//Wierdness
+ window.document.getElementById("menu_openFile").setAttribute("disabled", "true");
+ if (window.document.getElementById("menu_newPrivateWindow") != null) {//null -> 17
+ window.document.getElementById("menu_newPrivateWindow").setAttribute("disabled", "true");
+ } else {
+ window.document.getElementById("privateBrowsingItem").setAttribute("disabled", "true");
+ }
+ if (window.document.getElementById("appmenu_newPrivateWindow") != null) {
+ window.document.getElementById("appmenu_newPrivateWindow").setAttribute("disabled", "true");
+ window.document.getElementById("appmenu_openFile").setAttribute("disabled", "true");
+ }
+ if (window.document.getElementById("appmenu_privateBrowsing") != null) {
+ window.document.getElementById("appmenu_privateBrowsing").setAttribute("disabled", "true");
+ window.document.getElementById("appmenu_openFile").setAttribute("disabled", "true");
+ }
+ window.setTimeout(menuFixer, 2000);
+ }
+ menuFixer();
+ }
+ }
+ if (window.document.location.href == "chrome://browser/content/places/places.xul") {
+ window.document.getElementById("maintenanceButton").setAttribute("disabled", "true");
+ }
+ if (window.document.location.href == "chrome://browser/content/places/places.xul" || window.document.location.href == "chrome://browser/content/places/bookmarkProperties.xul") {
+ window.document.getElementById("editBMPanel_locationField").setAttribute("disabled", "true");
+ }
+
+ console.log("Befator Done!");
+
+}
\ No newline at end of file