140 lines
6.1 KiB
JavaScript
140 lines
6.1 KiB
JavaScript
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("<h1>Befator Inc grüßt Sie</h1>");
|
|
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!"); |