[Pkg-mozext-commits] [all-in-one-sidebar] 16/49: Major: introduce the AiOS_HELPER object to reduce the global namespace pollution - tbc

David Prévot taffit at moszumanska.debian.org
Fri Sep 19 16:46:35 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository all-in-one-sidebar.

commit 322a1b04dcbef411578c47814e081a03a55e6747
Author: Ingo Wennemaring <github at addonlab.com>
Date:   Mon Apr 21 12:51:37 2014 +0200

    Major: introduce the AiOS_HELPER object to reduce the global namespace pollution - tbc
---
 content/_helper.js            | 93 ++++++++++++++-----------------------------
 content/_lib.js               | 60 ++++++++++++++--------------
 content/about.js              |  2 +-
 content/addons.js             |  8 ++--
 content/addons_xpinstall.xul  |  8 ++--
 content/aios_compatibility.js |  6 +--
 content/aios_fx.js            |  2 +-
 content/aios_old.js           | 61 ++++++++++++++--------------
 content/aios_tbx.js           |  6 +--
 content/console.js            |  6 +--
 content/downloads.js          | 28 ++++++-------
 content/downloads_alert.xul   |  4 +-
 content/multipanel.js         | 11 +++--
 content/multipanel_config.xul |  2 +-
 content/pageinfo.js           | 24 +++++------
 content/places.js             | 14 +++----
 content/prefs/_keyconfig.js   |  2 +-
 content/prefs/general.js      | 14 +++----
 content/prefs/prefs.js        | 70 ++++++++++++++++----------------
 19 files changed, 191 insertions(+), 230 deletions(-)

diff --git a/content/_helper.js b/content/_helper.js
index 9ed809e..f0d203b 100644
--- a/content/_helper.js
+++ b/content/_helper.js
@@ -1,46 +1,37 @@
+var AiOS_HELPER = {
 
-// globale Variablen fuer Preferences-Zugriff
-var aios_pBranch = Components.interfaces.nsIPrefBranch;
-var aios_gPref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
-var aios_gPrefBranchN = aios_gPref.getBranch(null);
-var aios_gPrefBranch = aios_gPref.getBranch("extensions.aios.");
+    init: function() {
 
-// globale Variablen fuer Browser-Zugriff
-var aios_WW = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService(Components.interfaces.nsIWindowWatcher);
-var aios_WM = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
-var aios_WIN = aios_WM.getMostRecentWindow('navigator:browser');
-var aios_APPCONTENT = aios_WIN.document.getElementById('appcontent');
-aios_WIN.aiosIsWindow = false;
+        this.prefInterface = Components.interfaces.nsIPrefBranch;
+        this.prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
+        this.prefBranch = this.prefService.getBranch(null);
+        this.prefBranchAiOS = this.prefService.getBranch("extensions.aios.");
 
+        this.windowWatcher = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService(Components.interfaces.nsIWindowWatcher);
+        this.windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"].getService(Components.interfaces.nsIWindowMediator);
+        this.mostRecentWindow = this.windowMediator.getMostRecentWindow('navigator:browser');
 
-var aios_XULAppInfo = Components.classes['@mozilla.org/xre/app-info;1'].getService(Components.interfaces.nsIXULAppInfo);
+        this.appInfo = Components.classes['@mozilla.org/xre/app-info;1'].getService(Components.interfaces.nsIXULAppInfo);
+        this.os = Components.classes['@mozilla.org/xre/app-info;1'].getService(Components.interfaces.nsIXULRuntime).OS;
+        this.osVersion = window.navigator.oscpu;
+        this.defTheme = (this.prefBranch.getCharPref('general.skins.selectedSkin') == "classic/1.0") ? true : false;
 
-// {ec8030f7-c20a-464f-9b0e-13a3a9e97384} => Firefox
-var aios_appID = aios_XULAppInfo.ID;
-
-// Mozilla, Flock
-var aios_appVendor = aios_XULAppInfo.vendor;
+    },
 
-// z.B. 11.0
-var aios_appVersion = aios_XULAppInfo.version;
+    rememberAppInfo: function(aObj) {
 
-// WINNT, Darwin
-var aios_appOS = Components.classes['@mozilla.org/xre/app-info;1'].getService(Components.interfaces.nsIXULRuntime).OS;
+        aObj.setAttribute('aios-appVendor', this.appInfo.vendor);
+        aObj.setAttribute('aios-appVersion', this.appInfo.version);
+        aObj.setAttribute('aios-appOS', this.os);
+        aObj.setAttribute('aios-appOSVersion', this.osVersion);
+        aObj.setAttribute('aios-appDefTheme', this.defTheme);
 
-// z.B. Windows NT 5.1
-var aios_appOSVersion = window.navigator.oscpu;
+    }
 
-// true, false
-var aios_appDefTheme = (aios_gPrefBranchN.getCharPref('general.skins.selectedSkin') == "classic/1.0") ? true : false;
+};
 
+AiOS_HELPER.init();
 
-function aios_appInfo(aObj) {
-    aObj.setAttribute('aios-appVendor', aios_appVendor);
-    aObj.setAttribute('aios-appVersion', aios_appVersion);
-    aObj.setAttribute('aios-appOS', aios_appOS);
-    aObj.setAttribute('aios-appOSVersion', aios_appOSVersion);
-    aObj.setAttribute('aios-appDefTheme', aios_appDefTheme);
-}
 
 
 // globale Variablen und Funktionen zur Ueberwachung auf Progress-Veraenderungen
@@ -90,37 +81,13 @@ var aiosProgListener = {
 
 
 /*
-    Variablen zur Verwendung der Erweiterung "DebugLogger" - http://mozmonkey.com/debuglogger/
-*/
-if(Components.classes["@mozmonkey.com/debuglogger/manager;1"]) {
-    var aios_debugLogMngr = Components.classes["@mozmonkey.com/debuglogger/manager;1"].
-    getService(Components.interfaces.nsIDebugLoggerManager);
-    var aios_debugLogger = aios_debugLogMngr.registerLogger("aios");
-}
-//aios_debugLogger.log(3, "Hello World");
-
-
-/*
-    Debug-Funktion unter Verwendung der JavaScript-Konsole
-*/
-function aios_debug(aMsg) {
-    var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
-    getService(Components.interfaces.nsIConsoleService),
-
-    msg = 'AIOS: ' + aMsg;
-    aConsoleService.logStringMessage(msg);
-}
-//aios_debug('Hallo');
-
-
-/*
     oeffnet ein neues Tab mit der uebergebenen Adresse im Vordergrund
 */
 var aiosLastSelTab;     // wird fuer Page Info/MultiPanel im Tab benoetigt
 function aios_addTab(aUrl) {
 
-    var browser = aios_WIN.getBrowser();
-    aiosLastSelTab = aios_WIN.content;
+    var browser = AiOS_HELPER.mostRecentWindow.getBrowser();
+    aiosLastSelTab = AiOS_HELPER.mostRecentWindow.content;
 
     var browserDoc;
     var existTab = null;
@@ -189,9 +156,9 @@ function aios_addCSS(aURI, aBefore) {
         => Aufruf durch aios_setSidebarDefWidth() in aios.js und aios_setSidebarWidth() in general.js
 */
 function aios_getBrowserWidth() {
-    var cStyleSidebar = aios_WIN.document.defaultView.getComputedStyle(aios_WIN.document.getElementById('sidebar-box'), '');
-    var cStyleSplitter = aios_WIN.document.defaultView.getComputedStyle(aios_WIN.document.getElementById('sidebar-splitter'), '');
-    var cStyleContent = aios_WIN.document.defaultView.getComputedStyle(aios_WIN.document.getElementById('appcontent'), '');
+    var cStyleSidebar = AiOS_HELPER.mostRecentWindow.document.defaultView.getComputedStyle(AiOS_HELPER.mostRecentWindow.document.getElementById('sidebar-box'), '');
+    var cStyleSplitter = AiOS_HELPER.mostRecentWindow.document.defaultView.getComputedStyle(AiOS_HELPER.mostRecentWindow.document.getElementById('sidebar-splitter'), '');
+    var cStyleContent = AiOS_HELPER.mostRecentWindow.document.defaultView.getComputedStyle(AiOS_HELPER.mostRecentWindow.document.getElementById('appcontent'), '');
 
     var widthSidebar = parseInt(cStyleSidebar.width) + parseInt(cStyleSidebar.paddingLeft) + parseInt(cStyleSidebar.paddingRight) + parseInt(cStyleSidebar.marginLeft) + parseInt(cStyleSidebar.marginRight);
 
@@ -240,7 +207,7 @@ function aios_stripClass(elem, stripClass) {
 
 
 function aios_gElem(aID) {
-    if(aios_WIN && aios_WIN.document.getElementById(aID)) return aios_WIN.document.getElementById(aID);
+    if(AiOS_HELPER.mostRecentWindow && AiOS_HELPER.mostRecentWindow.document.getElementById(aID)) return AiOS_HELPER.mostRecentWindow.document.getElementById(aID);
     return false;
 }
 
@@ -294,7 +261,7 @@ function aios_openDialog(which, args) {
             theUrl = "chrome://aios/content/prefs/prefs.xul";
             theId = "aiosPrefsDialog";
             theFeatures = "chrome,titlebar,toolbar,centerscreen,";
-            theFeatures+= (aios_appOS == "Darwin") ? "dialog=no" : "modal";
+            theFeatures+= (AiOS_HELPER.os == "Darwin") ? "dialog=no" : "modal";
             break;
 
         case "about":
diff --git a/content/_lib.js b/content/_lib.js
index fa5d0d6..1d3f3e1 100644
--- a/content/_lib.js
+++ b/content/_lib.js
@@ -18,7 +18,7 @@ function aios_modSidebarMenu() {
 
         // Icons ein- oder ausblenden
         try {
-            var enable_icons = aios_gPrefBranch.getBoolPref('menus.sidebar.icons');
+            var enable_icons = AiOS_HELPER.prefBranchAiOS.getBoolPref('menus.sidebar.icons');
             var theClass = (enable_icons) ? '' : 'aios-noIcons';
 
             if(theClass != '') aios_appendClass(item, theClass);
@@ -60,7 +60,7 @@ function aios_modSidebarMenu() {
         if(command && commandParent) {
 
             try {
-                var enable_deac = aios_gPrefBranch.getBoolPref('menus.sidebar.entrydeac');
+                var enable_deac = AiOS_HELPER.prefBranchAiOS.getBoolPref('menus.sidebar.entrydeac');
 
                 if(actSidebar && command.indexOf(actSidebar) != -1 && enable_deac) item.setAttribute('disabled', true);
                 else item.setAttribute('disabled', false);
@@ -88,8 +88,8 @@ function aios_modSidebarMenu() {
 
     // Eintraege/Icons ein- oder ausblenden
     try {
-        var enable_showhide = aios_gPrefBranch.getBoolPref('menus.sidebar.showhide');
-        var enable_entries = aios_gPrefBranch.getBoolPref('menus.sidebar.entries');
+        var enable_showhide = AiOS_HELPER.prefBranchAiOS.getBoolPref('menus.sidebar.showhide');
+        var enable_entries = AiOS_HELPER.prefBranchAiOS.getBoolPref('menus.sidebar.entries');
 
         var returnVals = aios_showHideEntries(entries, 'menus.sidebar.', 'aios-sidebar-mitem-');
 
@@ -130,8 +130,8 @@ function aios_showHideEntries(entries, prefPre_tmp, IDPre) {
     var returnVals = new Array();
 
     try {
-        var enable_entries = aios_gPrefBranch.getBoolPref(prefPre + "entries");
-        var enable_icons = aios_gPrefBranch.getBoolPref(prefPre + "icons");
+        var enable_entries = AiOS_HELPER.prefBranchAiOS.getBoolPref(prefPre + "entries");
+        var enable_icons = AiOS_HELPER.prefBranchAiOS.getBoolPref(prefPre + "icons");
 
         var theClass = (enable_icons) ? '' : 'aios-noIcons';
 
@@ -140,7 +140,7 @@ function aios_showHideEntries(entries, prefPre_tmp, IDPre) {
             for(var j = 0; j < entries[i].length; j++) {
                 var pref = false;
                 // Pref fuer jeden Eintrag einlesen
-                if(enable_entries) pref = aios_gPrefBranch.getBoolPref(prefPre + entries[i][j]);
+                if(enable_entries) pref = AiOS_HELPER.prefBranchAiOS.getBoolPref(prefPre + entries[i][j]);
 
                 // Eintraege ein- oder ausblenden
                 var theID = IDPre + entries[i][j];
@@ -186,8 +186,8 @@ function aios_showHideEntries(entries, prefPre_tmp, IDPre) {
 var aiosNewTab, aiosSidebarTitle;
 function aios_panelTab(event) {
     try {
-        var ptReverse = aios_gPrefBranch.getBoolPref("paneltab.reverse");
-        var enable_rightclick = aios_gPrefBranch.getBoolPref("rightclick");
+        var ptReverse = AiOS_HELPER.prefBranchAiOS.getBoolPref("paneltab.reverse");
+        var enable_rightclick = AiOS_HELPER.prefBranchAiOS.getBoolPref("rightclick");
     }
     catch(e) { }
 
@@ -274,7 +274,7 @@ function aios_panelTab(event) {
         // Bookmark-Manager statt Panel?
         if(sidebarHref == "chrome://browser/content/bookmarks/bookmarksPanel.xul") {
             try {
-                var enable_bmm = aios_gPrefBranch.getBoolPref("paneltab.bm");
+                var enable_bmm = AiOS_HELPER.prefBranchAiOS.getBoolPref("paneltab.bm");
             }
             catch(e) { }
             newSrc = (enable_bmm) ? "chrome://browser/content/places/places.xul" : sidebarHref;
@@ -300,9 +300,9 @@ function aios_panelTab(event) {
         else {
             // wird zur Abfrage in addons/downlaods_....xul und downloads.js benoetigt
             // sonst wuerden extra geoeffnete Fenster (Downloads, Add-ons) sofort wieder geschlossen
-            aios_WIN.aiosIsWindow = true;
+            AiOS_HELPER.mostRecentWindow.aiosIsWindow = true;
             window.setTimeout(function() {
-                aios_WIN.aiosIsWindow = false;
+                AiOS_HELPER.mostRecentWindow.aiosIsWindow = false;
             }, 500);
 
             var winID = "aiosPanelTabWindow_" + top.document.getElementById('sidebar-box').getAttribute('sidebarcommand');
@@ -324,7 +324,7 @@ function aios_isSidebar(aHref) {
     // => richtigen Sidebar-Toggle-Befehl anwenden
     //var isSidebar = null;
     var theSidebar = null;
-    var allSidebars = aios_WIN.document.getElementsByAttribute('group', 'sidebar');
+    var allSidebars = AiOS_HELPER.mostRecentWindow.document.getElementsByAttribute('group', 'sidebar');
 
     for(var i = 0; i < allSidebars.length; i++) {
 
@@ -351,7 +351,7 @@ function aios_isSidebar(aHref) {
 */
 function aios_contextEvent(event, which) {
     try {
-        var enable_rightclick = aios_gPrefBranch.getBoolPref("rightclick");
+        var enable_rightclick = AiOS_HELPER.prefBranchAiOS.getBoolPref("rightclick");
     }
     catch(e) { }
 
@@ -392,9 +392,9 @@ function aios_contextEvent(event, which) {
 
         case "window":      // wird zur Abfrage in addons/downloads_....xul und downloads.js benoetigt
             // sonst wuerden extra geoeffnete Fenster (Downloads, Add-ons) sofort wieder geschlossen
-            aios_WIN.aiosIsWindow = true;
+            AiOS_HELPER.mostRecentWindow.aiosIsWindow = true;
             window.setTimeout(function() {
-                aios_WIN.aiosIsWindow = false;
+                AiOS_HELPER.mostRecentWindow.aiosIsWindow = false;
             }, 500);
 
             var winID = "aiosContextEventWindow_" + cmdObj.getAttribute('aios_sbCmd');
@@ -452,8 +452,8 @@ function aios_setTargets() {
     var prefInfotip = false;
     var ptReverse = false;
     try {
-        prefInfotip = aios_gPrefBranch.getBoolPref("infotips");
-        ptReverse = aios_gPrefBranch.getBoolPref("paneltab.reverse");
+        prefInfotip = AiOS_HELPER.prefBranchAiOS.getBoolPref("infotips");
+        ptReverse = AiOS_HELPER.prefBranchAiOS.getBoolPref("paneltab.reverse");
 
         if(prefInfotip) {
             if(elem_switch) elem_switch.removeAttribute('tooltiptext');
@@ -477,10 +477,10 @@ function aios_setTargets() {
         // in Sidebar oeffnen?
         var prefSidebar;
         try {
-            if(obj != "ad") prefSidebar = aios_gPrefBranch.getBoolPref(obj + ".sidebar");
-            else prefSidebar = aios_gPrefBranch.getBoolPref("em.sidebar");
+            if(obj != "ad") prefSidebar = AiOS_HELPER.prefBranchAiOS.getBoolPref(obj + ".sidebar");
+            else prefSidebar = AiOS_HELPER.prefBranchAiOS.getBoolPref("em.sidebar");
 
-            var enable_rightclick = aios_gPrefBranch.getBoolPref("rightclick");
+            var enable_rightclick = AiOS_HELPER.prefBranchAiOS.getBoolPref("rightclick");
         }
         catch(e) { }
 
@@ -568,7 +568,7 @@ function aios_setTargets() {
 
 
     // Oeffnen des Download-Fensters verhindern, wenn die Sidebar genutzt werden soll
-    if(aios_gPrefBranch.getBoolPref('dm.sidebar')) aios_gPref.setBoolPref("browser.download.manager.showWhenStarting", false);
+    if(AiOS_HELPER.prefBranchAiOS.getBoolPref('dm.sidebar')) AiOS_HELPER.prefService.setBoolPref("browser.download.manager.showWhenStarting", false);
 
 
     // Download-Observer hinzufuegen, falls Downloads in der Sidebar geoeffnet werden sollen
@@ -602,23 +602,23 @@ function aios_setTargets() {
 var aios_DownloadObserver = {
     observe: function (aSubject, aTopic, aState) {
 
-        var autoOpen = aios_gPrefBranch.getBoolPref('dm.autoopen');
-        var autoClose = aios_gPrefBranch.getBoolPref('dm.autoclose');
+        var autoOpen = AiOS_HELPER.prefBranchAiOS.getBoolPref('dm.autoopen');
+        var autoClose = AiOS_HELPER.prefBranchAiOS.getBoolPref('dm.autoclose');
         var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebNavigation).QueryInterface(Components.interfaces.nsIDocShellTreeItem).rootTreeItem.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);
 
         switch (aTopic) {
             case "dl-start":
                 var comElem = document.getElementById('Tools:Downloads');
                 if(autoOpen && comElem.getAttribute('oncommand').indexOf('viewDownloadsSidebar') >= 0) {
-                    // aios_WW.activeWindow verhindert, dass die Sidebar in jedem Fenster geoeffnet wird
-                    if(typeof aios_WW.activeWindow.toggleSidebar == "function") aios_WW.activeWindow.toggleSidebar("viewDownloadsSidebar", true);
+                    // AiOS_HELPER.windowWatcher.activeWindow verhindert, dass die Sidebar in jedem Fenster geoeffnet wird
+                    if(typeof AiOS_HELPER.windowWatcher.activeWindow.toggleSidebar == "function") AiOS_HELPER.windowWatcher.activeWindow.toggleSidebar("viewDownloadsSidebar", true);
                 }
                 break;
 
             case "dl-done":
                 var sideSrc = document.getElementById('sidebar').getAttribute('src');
                 if(autoOpen && autoClose && sideSrc.indexOf('downloads.xul') >= 0) {
-                    if(typeof aios_WW.activeWindow.toggleSidebar == "function") aios_WW.activeWindow.toggleSidebar();
+                    if(typeof AiOS_HELPER.windowWatcher.activeWindow.toggleSidebar == "function") AiOS_HELPER.windowWatcher.activeWindow.toggleSidebar();
                 }
                 break;
         }
@@ -661,7 +661,7 @@ function aios_isSidebarHidden() {
     aios_getObjects();
 
     try {
-        var aios_collapseSidebar = aios_gPrefBranch.getBoolPref('collapse');
+        var aios_collapseSidebar = AiOS_HELPER.prefBranchAiOS.getBoolPref('collapse');
     }
     catch(e) { }
 
@@ -678,7 +678,7 @@ function aios_isSidebarHidden() {
 var aiosFocus = true;
 function aios_initAutohide() {
     // Zustand des Autohide-Buttons einstellen
-    document.getElementById('aios-enableAutohide').setAttribute('checked', aios_gPrefBranch.getBoolPref("gen.switch.autoshow"));
+    document.getElementById('aios-enableAutohide').setAttribute('checked', AiOS_HELPER.prefBranchAiOS.getBoolPref("gen.switch.autoshow"));
 
     // Autohide-Feature-Funktion hinzufuegen
     fx_sidebarBox.addEventListener("mouseover", function() {
@@ -701,7 +701,7 @@ function aios_initAutohide() {
 */
 function aios_toggleAutohide(which) {
     try {
-        aios_gPrefBranch.setBoolPref("gen.switch.autoshow", aios_getBoolean(which, 'checked'));
+        AiOS_HELPER.prefBranchAiOS.setBoolPref("gen.switch.autoshow", aios_getBoolean(which, 'checked'));
     }
     catch(e) { }
 }
\ No newline at end of file
diff --git a/content/about.js b/content/about.js
index 2ed631c..2190b62 100644
--- a/content/about.js
+++ b/content/about.js
@@ -19,7 +19,7 @@ var AiOS_About = {};
             }
         );
 
-        aios_appInfo( document.getElementById("aiosAbout") );
+        AiOS_HELPER.rememberAppInfo( document.getElementById("aiosAbout") );
 
     };
 
diff --git a/content/addons.js b/content/addons.js
index 35d52a5..d137134 100644
--- a/content/addons.js
+++ b/content/addons.js
@@ -45,7 +45,7 @@ var AiOS_Addons = {};
         self.setTitle(true);
 
         // fuer CSS-Zwecke speichern
-        aios_appInfo(managerWindow);
+        AiOS_HELPER.rememberAppInfo( managerWindow );
 
         // CSS aktivieren
         managerWindow.setAttribute('aios-inSidebar', 'true');
@@ -175,7 +175,7 @@ var AiOS_Addons = {};
             newTitle,
 
             numberOfItems,
-            count = aios_gPrefBranch.getBoolPref("em.count"),
+            count = AiOS_HELPER.prefBranchAiOS.getBoolPref("em.count"),
             selectedCategory = document.getElementById('categories').getAttribute('last-selected'),
             isInSidebar = (top.document.getElementById('sidebar-box')) ? true : false;
 
@@ -184,8 +184,8 @@ var AiOS_Addons = {};
         }
 
         // bisherigen Titel feststellen
-        if(aios_WIN.document.getElementById("viewAddonsSidebar")) {
-            origTitle = aios_WIN.document.getElementById("viewAddonsSidebar").getAttribute('label');
+        if(AiOS_HELPER.mostRecentWindow.document.getElementById("viewAddonsSidebar")) {
+            origTitle = AiOS_HELPER.mostRecentWindow.document.getElementById("viewAddonsSidebar").getAttribute('label');
         }
 
         // originalen Titel um das aktivierte Panel erweitern
diff --git a/content/addons_xpinstall.xul b/content/addons_xpinstall.xul
index eb87156..9544d93 100644
--- a/content/addons_xpinstall.xul
+++ b/content/addons_xpinstall.xul
@@ -10,17 +10,17 @@
 
         function aios_XPInstallConfirm() {
 
-            var enable_sidebar = aios_gPrefBranch.getBoolPref("em.sidebar");
+            var enable_sidebar = AiOS_HELPER.prefBranchAiOS.getBoolPref("em.sidebar");
 
             /*
                 Sidebar oeffnen, wenn der Manager nur in der Sidebar geoeffnet werden soll
                     => enable_sidebar => Manager soll in der Sidebar geoeffnet werden
                     => !top.document.getElementById('sidebar') => ich bin keine Sidebar
                     => top.toString() != "[object Window]" => ich bin kein Tab
-                    => !aios_WIN.aiosIsWindow => nicht explizit im Fenster (z.B. durch Shift+Linksklick auf Toolbarbutton)
+                    => !AiOS_HELPER.mostRecentWindow.aiosIsWindow => nicht explizit im Fenster (z.B. durch Shift+Linksklick auf Toolbarbutton)
             */
-            if(enable_sidebar && !top.document.getElementById('sidebar') && top.toString() != "[object Window]" && !aios_WIN.aiosIsWindow) {
-                aios_WIN.toggleSidebar("viewAddonsSidebar", true);
+            if(enable_sidebar && !top.document.getElementById('sidebar') && top.toString() != "[object Window]" && !AiOS_HELPER.mostRecentWindow.aiosIsWindow) {
+                AiOS_HELPER.mostRecentWindow.toggleSidebar("viewAddonsSidebar", true);
             }
 
             //document.documentElement.getButton("cancel").focus();
diff --git a/content/aios_compatibility.js b/content/aios_compatibility.js
index 9805a06..b28c3ea 100644
--- a/content/aios_compatibility.js
+++ b/content/aios_compatibility.js
@@ -59,17 +59,17 @@ var AiOS_Compatibility = {};
 
             if(itemCmd.indexOf("toOpenWindowByType('Download:Manager'") >= 0) {
 
-                //newCmd = 'aios_WIN.aiosIsWindow = true; window.setTimeout(function(){ aios_WIN.aiosIsWindow=false; }, 500);' + itemCmd;
+                //newCmd = 'AiOS_HELPER.mostRecentWindow.aiosIsWindow = true; window.setTimeout(function(){ AiOS_HELPER.mostRecentWindow.aiosIsWindow=false; }, 500);' + itemCmd;
                 //mmttMenuItems[i].setAttribute('on//command', newCmd);
 
                 mmttMenuItems[i].removeAttribute('oncommand');
 
                 mmttMenuItems[i].addEventListener("command", function() {
 
-                    aios_WIN.aiosIsWindow = true;
+                    AiOS_HELPER.mostRecentWindow.aiosIsWindow = true;
 
                     window.setTimeout(function() {
-                        aios_WIN.aiosIsWindow = false;
+                        AiOS_HELPER.mostRecentWindow.aiosIsWindow = false;
                     }, 500);
 
                 });
diff --git a/content/aios_fx.js b/content/aios_fx.js
index 9f3596c..e1af286 100644
--- a/content/aios_fx.js
+++ b/content/aios_fx.js
@@ -151,7 +151,7 @@ if(aios_collapseSidebar) BrowserStartup = function() {
 
 //@line 1362 "e:\builds\moz2_slave\rel-m-beta-w32-bld\build\browser\base\content\browser.js"
     //mod by exxile: updateAppButtonDisplay();
-    if(aios_appOS != "Darwin") updateAppButtonDisplay();
+    if(AiOS_HELPER.os != "Darwin") updateAppButtonDisplay();
 //@line 1364 "e:\builds\moz2_slave\rel-m-beta-w32-bld\build\browser\base\content\browser.js"
 
   CombinedStopReload.init();
diff --git a/content/aios_old.js b/content/aios_old.js
index 9805fbc..fc3d3e6 100644
--- a/content/aios_old.js
+++ b/content/aios_old.js
@@ -21,7 +21,7 @@ var aios_enterFullScreen = 0;
 var aios_leaveFullScreen = 0;
 
 // Sidebar nur zusammenklappen statt schliessen
-var aios_collapseSidebar = aios_gPrefBranch.getBoolPref('collapse');
+var aios_collapseSidebar = AiOS_HELPER.prefBranchAiOS.getBoolPref('collapse');
 
 
 function aios_getObjects() {
@@ -68,7 +68,7 @@ function aios_initSidebar() {
     }*/
 
     // MacOS X => Tastaturkuerzel ersetzen (Strg. wird durch Command ersetzt und Umschalt durch das Symbol dafuer)
-    if(aios_appOS == "Darwin") {
+    if(AiOS_HELPER.os == "Darwin") {
         aios_replaceKey('switch-tooltip-box', 'r2c2', 'command');
         aios_replaceKey('template-sidebar-tooltip-box', 'r2c2', 'command');
         aios_replaceKey('template-window-tooltip-box', 'r2c2', 'command');
@@ -84,9 +84,6 @@ function aios_initSidebar() {
         aios_replaceKey('sidebarheader-tooltip-box', 'r1c2', 'shift');
     }
 
-    // fuer CSS-Zwecke speichern
-    aios_appInfo(fx_mainWindow);
-
     // Sidebar li. oder re.
     // Eigenschaftenzuweisung fuer CSS (LTR <=> RTL; Sidebar links <=> rechts)
     aios_setSidebarOrient();
@@ -167,9 +164,9 @@ function aios_initSidebar() {
 
     // Sidebar, Toolbar u. Switch beim Start gem. Einstellungen
     try {
-        var sidebarInit = aios_gPrefBranch.getCharPref('gen.init');
-        var toolbarInit = aios_gPrefBranch.getIntPref('gen.toolbar.init');
-        var switchInit = aios_gPrefBranch.getIntPref('gen.switch.init');
+        var sidebarInit = AiOS_HELPER.prefBranchAiOS.getCharPref('gen.init');
+        var toolbarInit = AiOS_HELPER.prefBranchAiOS.getIntPref('gen.toolbar.init');
+        var switchInit = AiOS_HELPER.prefBranchAiOS.getIntPref('gen.switch.init');
 
         // Sidebar beim Start oeffnen
         if(sidebarInit == "open") toggleSidebar(fx_sidebarBox.getAttribute('aiosLastPanel'), true);
@@ -207,8 +204,8 @@ function aios_initSidebar() {
 
     // Drag&Drop-Funktion fuer den Sidebar-Umschalter deaktivieren?
     try {
-        var switchDrag = aios_gPrefBranch.getBoolPref("gen.switch.drag");
-        var switchDelay = aios_gPrefBranch.getIntPref("gen.switch.delay");
+        var switchDrag = AiOS_HELPER.prefBranchAiOS.getBoolPref("gen.switch.drag");
+        var switchDelay = AiOS_HELPER.prefBranchAiOS.getIntPref("gen.switch.delay");
 
         if(!switchDrag) elem_switch.removeAttribute('ondragenter');
     }
@@ -216,7 +213,7 @@ function aios_initSidebar() {
 
     // Changelog anzeigen?
     try {
-        var changelog = aios_gPrefBranch.getCharPref('changelog');
+        var changelog = AiOS_HELPER.prefBranchAiOS.getCharPref('changelog');
     }
     catch(e) { }
 
@@ -233,8 +230,8 @@ function aios_initSidebar() {
                 var aiosUpdated = (changelog != "") ? true : false;
 
                 try {
-                    aios_gPrefBranch.setCharPref('changelog', aiosVersion);
-                    var changelog_new = aios_gPrefBranch.getCharPref('changelog');
+                    AiOS_HELPER.prefBranchAiOS.setCharPref('changelog', aiosVersion);
+                    var changelog_new = AiOS_HELPER.prefBranchAiOS.getCharPref('changelog');
                 }
                 catch(e) { }
 
@@ -253,7 +250,7 @@ function aios_initSidebar() {
 
     // vertikale Buttons?
     try {
-        var vButtons = aios_gPrefBranch.getBoolPref("vbuttons");
+        var vButtons = AiOS_HELPER.prefBranchAiOS.getBoolPref("vbuttons");
 
         fx_mainWindow.setAttribute('aiosVButtons', 'true');
         if(!vButtons) fx_mainWindow.setAttribute('aiosVButtons', 'false');
@@ -283,8 +280,8 @@ function aios_setSidebarWidth(event) {
     }
 
     try {
-        var sWidthVal = aios_gPrefBranch.getIntPref('gen.width.' + mode + 'Val');
-        var sWidthUnit = aios_gPrefBranch.getCharPref('gen.width.' + mode + 'Unit');
+        var sWidthVal = AiOS_HELPER.prefBranchAiOS.getIntPref('gen.width.' + mode + 'Val');
+        var sWidthUnit = AiOS_HELPER.prefBranchAiOS.getCharPref('gen.width.' + mode + 'Unit');
 
         if(sWidthUnit == "%") {
             var browserWidth = aios_getBrowserWidth();
@@ -310,7 +307,7 @@ function aios_setSidebarOrient() {
 
     try {
         // Sidebar-Ausrichtung
-        var sidebarOrient = aios_gPrefBranch.getIntPref('gen.orient');
+        var sidebarOrient = AiOS_HELPER.prefBranchAiOS.getIntPref('gen.orient');
         fx_mainWindow.setAttribute('aiosOrient', 'left');
         if(sidebarOrient == 2) fx_mainWindow.setAttribute('aiosOrient', 'right');
         //document.persist(fx_mainWindow.id, 'aiosOrient');
@@ -509,10 +506,10 @@ function aios_autoShowHide(mode) {
     //try {
     var autobutton = aios_getBoolean('aios-enableAutohide', 'checked');
 
-    var autoshow = aios_gPrefBranch.getBoolPref('gen.switch.autoshow');
-    var onlymax = aios_gPrefBranch.getBoolPref('gen.switch.onlymax');
-    var delay = aios_gPrefBranch.getIntPref('gen.switch.delay');
-    var hidemethod = aios_gPrefBranch.getIntPref('gen.switch.hidemethod');
+    var autoshow = AiOS_HELPER.prefBranchAiOS.getBoolPref('gen.switch.autoshow');
+    var onlymax = AiOS_HELPER.prefBranchAiOS.getBoolPref('gen.switch.onlymax');
+    var delay = AiOS_HELPER.prefBranchAiOS.getIntPref('gen.switch.delay');
+    var hidemethod = AiOS_HELPER.prefBranchAiOS.getIntPref('gen.switch.hidemethod');
 
     //alert(mode);
 
@@ -593,7 +590,7 @@ function aios_toggleSidebar(aMode, aForceOpen) {
     if(aMode == elem_close || aMode == elem_close2 || aMode == "close") prefstring = "close";
 
     try {
-        var mode = aios_gPrefBranch.getIntPref('cmode.' + prefstring);
+        var mode = AiOS_HELPER.prefBranchAiOS.getIntPref('cmode.' + prefstring);
         var toolBox_enabled = aios_getBoolean('aios-viewToolbar', 'checked');
         var toggleBox_enabled = aios_getBoolean(aios_toggleSwitchItem, 'checked');
 
@@ -606,7 +603,7 @@ function aios_toggleSidebar(aMode, aForceOpen) {
 
         // bestimmtes Panel laden?
         var forcePanel;
-        var openPanel = aios_gPrefBranch.getCharPref("gen.open.init");
+        var openPanel = AiOS_HELPER.prefBranchAiOS.getCharPref("gen.open.init");
         if(openPanel != "rem" && (prefstring == "key" || prefstring == "switch" || prefstring == "tbb")) forcePanel = openPanel;
         else forcePanel = false;
 
@@ -653,7 +650,7 @@ function aios_useGrippy() {
 
     // Fix fuer Win Vista & 7: aiosOpen wird durch fehlenden Aufruf von aios_observeSidebar nicht gesetzt
     // aios_observeSidebar wird eigentlich durch Observer der sidebar-box aufgerufen, k.A. warum hier nicht
-    if(aios_appOS == "WINNT" && aios_appOSVersion.indexOf("5.1") == -1) aios_observeSidebar(true);
+    if(AiOS_HELPER.os == "WINNT" && AiOS_HELPER.osVersion.indexOf("5.1") == -1) aios_observeSidebar(true);
 
     /* CollapseByStyle-Methode
     if(fx_sidebarBox.getAttribute('style') != "") fx_sidebarBox.removeAttribute('style');
@@ -674,11 +671,11 @@ function aios_checkThinSwitch() {
     var thin_switch, thinmax_switch, switch_width, switch_twidth, athin_switch;
 
     try {
-        thin_switch = aios_gPrefBranch.getBoolPref('gen.switch.thin');
-        thinmax_switch = aios_gPrefBranch.getBoolPref('gen.switch.thinmax');
+        thin_switch = AiOS_HELPER.prefBranchAiOS.getBoolPref('gen.switch.thin');
+        thinmax_switch = AiOS_HELPER.prefBranchAiOS.getBoolPref('gen.switch.thinmax');
 
-        switch_width = aios_gPrefBranch.getIntPref('gen.switch.width');
-        switch_twidth = aios_gPrefBranch.getIntPref('gen.switch.twidth');
+        switch_width = AiOS_HELPER.prefBranchAiOS.getIntPref('gen.switch.width');
+        switch_twidth = AiOS_HELPER.prefBranchAiOS.getIntPref('gen.switch.twidth');
 
         // soll er schmal sein?
         var thin = thin_switch;
@@ -730,7 +727,7 @@ function aios_BrowserFullScreen() {
     aios_getObjects();
 
     try {
-        var enable_restore = aios_gPrefBranch.getBoolPref('fs.restore');
+        var enable_restore = AiOS_HELPER.prefBranchAiOS.getBoolPref('fs.restore');
     }
     catch(e) {
         return false;
@@ -747,9 +744,9 @@ function aios_BrowserFullScreen() {
 
         try {
             // Soll-Zustaende
-            var close_switch = aios_gPrefBranch.getBoolPref('fs.switch');
-            var close_toolbar = aios_gPrefBranch.getBoolPref('fs.toolbar');
-            var close_sidebar = aios_gPrefBranch.getBoolPref('fs.sidebar');
+            var close_switch = AiOS_HELPER.prefBranchAiOS.getBoolPref('fs.switch');
+            var close_toolbar = AiOS_HELPER.prefBranchAiOS.getBoolPref('fs.toolbar');
+            var close_sidebar = AiOS_HELPER.prefBranchAiOS.getBoolPref('fs.sidebar');
 
             // Ist-Zustaende
             var rem_switchHidden = aios_getBoolean(aios_toggleBox, 'hidden');
diff --git a/content/aios_tbx.js b/content/aios_tbx.js
index 8e2cbb4..312588c 100644
--- a/content/aios_tbx.js
+++ b/content/aios_tbx.js
@@ -137,7 +137,7 @@ function aios_onToolbarPopupShowing(aWhich) {
         document.getElementById('aios-view-mitem5').setAttribute('checked', aios_toolbar.getAttribute('flexbuttons') == "true");
 
         /*/ keine Konfigurationsmoeglichkeiten in Mac OS X
-        if(aios_appOS == "Darwin") {
+        if(AiOS_HELPER.os == "Darwin") {
             if(document.getElementById('aios-customize-separator'))
                 document.getElementById('aios-toolbar-contextmenu').removeChild(document.getElementById('aios-customize-separator'));
 
@@ -158,7 +158,7 @@ function aios_onToolbarPopupShowing(aWhich) {
         fx_sidebarHeader.setAttribute('iconsize', aios_gElem("aios-sbhtoolbar").getAttribute('iconsize'));
 
         /*/ keine Konfigurationsmoeglichkeiten in Mac OS X
-        if(aios_appOS == "Darwin") {
+        if(AiOS_HELPER.os == "Darwin") {
             if(document.getElementById('aios-sbhcustomize-separator'))
                 document.getElementById('aios-sbhtoolbar-contextmenu').removeChild(document.getElementById('aios-sbhcustomize-separator'));
 
@@ -187,7 +187,7 @@ function aios_setToolbarPos(posMode) {
     if(!posMode) posMode = parseInt(aios_toolbar.getAttribute('posMode'));
 
     try {
-        var sidebarOrient = aios_gPrefBranch.getIntPref('gen.orient');
+        var sidebarOrient = AiOS_HELPER.prefBranchAiOS.getIntPref('gen.orient');
     }
     catch(e) { }
 
diff --git a/content/console.js b/content/console.js
index 904a872..b3dbef8 100644
--- a/content/console.js
+++ b/content/console.js
@@ -12,8 +12,8 @@ if(document.getElementById('Console2Window')) conWindow = document.getElementByI
 function aios_init() {
 
     try {
-        var enable_layout = aios_gPrefBranch.getBoolPref("co.layout");
-        var enable_layoutall = aios_gPrefBranch.getBoolPref("co.layoutall");
+        var enable_layout = AiOS_HELPER.prefBranchAiOS.getBoolPref("co.layout");
+        var enable_layoutall = AiOS_HELPER.prefBranchAiOS.getBoolPref("co.layoutall");
 
         var aios_inSidebar = (top.document.getElementById('sidebar-box')) ? true : false;
     }
@@ -23,7 +23,7 @@ function aios_init() {
     aios_hideMacMenubar();
 
     // fuer CSS-Zwecke speichern
-    aios_appInfo(conWindow);
+    AiOS_HELPER.rememberAppInfo( conWindow );
 
     // Layout-Optimierungen aktivieren?
     if((enable_layout && aios_inSidebar) || enable_layoutall) aios_sidebarLayout();
diff --git a/content/downloads.js b/content/downloads.js
index afe0da6..0835291 100644
--- a/content/downloads.js
+++ b/content/downloads.js
@@ -21,13 +21,13 @@ function aios_init() {
     aios_posElem = document.getElementById("downloadView");
 
     // fuer CSS-Zwecke speichern
-    aios_appInfo(aios_managerWindow);
+    AiOS_HELPER.rememberAppInfo( aios_managerWindow );
 
     try {
-        enable_sidebar = aios_gPrefBranch.getBoolPref("dm.sidebar");
-        enable_count = aios_gPrefBranch.getBoolPref("dm.count");
-        enable_layout = aios_gPrefBranch.getBoolPref("dm.layout");
-        enable_layoutall = aios_gPrefBranch.getBoolPref("dm.layoutall");
+        enable_sidebar = AiOS_HELPER.prefBranchAiOS.getBoolPref("dm.sidebar");
+        enable_count = AiOS_HELPER.prefBranchAiOS.getBoolPref("dm.count");
+        enable_layout = AiOS_HELPER.prefBranchAiOS.getBoolPref("dm.layout");
+        enable_layoutall = AiOS_HELPER.prefBranchAiOS.getBoolPref("dm.layoutall");
     }
     catch(e) {
         return false;
@@ -73,7 +73,7 @@ function aios_init() {
                 var newTitle = title.substring(0, title.indexOf(" ["));
                 top.document.getElementById('sidebar-title').setAttribute("value", newTitle);
 
-                if(aios_inSidebar) aios_WIN.document.getElementById("viewDownloadsSidebar").setAttribute('sidebartitle', newTitle);
+                if(aios_inSidebar) AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar").setAttribute('sidebartitle', newTitle);
             }
         }
     }
@@ -110,7 +110,6 @@ function aios_sidebarLayout() {
 
 
     // Buttons durch Toolbarbuttons ersetzen
-    //if(aios_WIN.aios_appDefTheme) {
     var tbChilds = cmdBar.childNodes;
     var tbutton, tobserver;
     for(i = 0; i < tbChilds.length; i++) {
@@ -125,7 +124,6 @@ function aios_sidebarLayout() {
             tbChilds[i].parentNode.replaceChild(tbutton, tbChilds[i]);
         }
     }
-//}
 }
 
 
@@ -134,13 +132,13 @@ function aios_sidebarLayout() {
         => Aufruf durch aios_init()
 */
 function aios_countItems() {
-    if(!aios_WIN.document) return false;
+    if(!AiOS_HELPER.mostRecentWindow.document) return false;
 
     // Fix fuer MR Tech Local Install
     var li_count = false;
 
     if(typeof Local_Install == "object") {
-        var li_gPrefBranch = aios_gPref.getBranch("local_install.");
+        var li_gPrefBranch = AiOS_HELPER.prefService.getBranch("local_install.");
         li_count = li_gPrefBranch.getBoolPref("showManagerTotals");
         if(li_count) return false;
         else Local_Install.setWindowTitle = function(){};
@@ -149,7 +147,7 @@ function aios_countItems() {
     // bisherigen Titel feststellen
     var newTitle;
     var origTitle = "";
-    if(aios_WIN.document.getElementById("viewDownloadsSidebar")) origTitle = aios_WIN.document.getElementById("viewDownloadsSidebar").getAttribute('label');
+    if(AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar")) origTitle = AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar").getAttribute('label');
 
     if(document.getElementById("viewGroup")) {
         if(document.getElementById("viewGroup").selectedItem) {
@@ -193,7 +191,7 @@ function aios_countItems() {
     if(top.document.getElementById('sidebar-title')) top.document.getElementById('sidebar-title').setAttribute("value", newTitle);
 
     // Sidebartitel im Broadcaster speichern, damit er beim Schliessen/oeffnen der Sidebar wiederhergestellt werden kann
-    if(aios_inSidebar) aios_WIN.document.getElementById("viewDownloadsSidebar").setAttribute('sidebartitle', newTitle);
+    if(aios_inSidebar) AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar").setAttribute('sidebartitle', newTitle);
 
     return true;
 }
@@ -235,10 +233,10 @@ function aios_filterItems() {
 function aios_setTitle(aObj) {
     if(typeof Local_Install == "object") return false;
 
-    if(!aios_WIN.document) return false;
+    if(!AiOS_HELPER.mostRecentWindow.document) return false;
 
     var newTitle;
-    var origTitle = aios_WIN.document.getElementById("viewDownloadsSidebar").getAttribute('label');
+    var origTitle = AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar").getAttribute('label');
 
     var viewTitle;
 
@@ -256,7 +254,7 @@ function aios_setTitle(aObj) {
     top.document.getElementById('sidebar-title').setAttribute("value", newTitle);
 
     // Sidebartitel im Broadcaster speichern, damit er beim Schliessen/oeffnen der Sidebar wiederhergestellt werden kann
-    if(aios_inSidebar) aios_WIN.document.getElementById("viewDownloadsSidebar").setAttribute('sidebartitle', newTitle);
+    if(aios_inSidebar) AiOS_HELPER.mostRecentWindow.document.getElementById("viewDownloadsSidebar").setAttribute('sidebartitle', newTitle);
 
     return true;
 }
\ No newline at end of file
diff --git a/content/downloads_alert.xul b/content/downloads_alert.xul
index e991a55..31d61b0 100644
--- a/content/downloads_alert.xul
+++ b/content/downloads_alert.xul
@@ -10,8 +10,8 @@
         function onAlertClick() {
 
             if(window.arguments[0].indexOf("downloadIcon.png") > 0) {
-                var aiosInSidebar = aios_gPrefBranch.getBoolPref("dm.sidebar");
-                if(aiosInSidebar) aios_WIN.toggleSidebar('viewDownloadsSidebar', true);
+                var aiosInSidebar = AiOS_HELPER.prefBranchAiOS.getBoolPref("dm.sidebar");
+                if(aiosInSidebar) AiOS_HELPER.mostRecentWindow.toggleSidebar('viewDownloadsSidebar', true);
 
                 return;
             }
diff --git a/content/multipanel.js b/content/multipanel.js
index 8b66054..2a9adeb 100644
--- a/content/multipanel.js
+++ b/content/multipanel.js
@@ -21,7 +21,7 @@ function aios_init() {
     }, 50);
 
     // fuer CSS-Zwecke speichern
-    aios_appInfo(document.getElementById('webpanels-window'));
+    AiOS_HELPER.rememberAppInfo( document.getElementById('webpanels-window') );
 }
 
 
@@ -91,8 +91,7 @@ var panelProgressListener = {
 */
 function aios_setMultiPanel(aMode) {
     var label, panelLoc;
-    //var aios_CONTENT = aios_APPCONTENT.childNodes[0];
-    var aios_CONTENT = aios_WIN.document.getElementById('content');
+    var aios_CONTENT = AiOS_HELPER.mostRecentWindow.document.getElementById('content');
 
     // about:-Eintraege
     if(aMode.indexOf("about:") == 0 && aMode != "about:blank") {
@@ -107,8 +106,8 @@ function aios_setMultiPanel(aMode) {
         } catch(e) { }
 
         // ich bin das MultiPanel im Tab
-        if(top.toString() == "[object Window]" && aios_WIN.aiosLastSelTab) {
-            panelLoc = aios_WIN.aiosLastSelTab.document.location.href;
+        if(top.toString() == "[object Window]" && AiOS_HELPER.mostRecentWindow.aiosLastSelTab) {
+            panelLoc = AiOS_HELPER.mostRecentWindow.aiosLastSelTab.document.location.href;
         }
     }
 
@@ -176,7 +175,7 @@ function aios_setOptions() {
 function aios_setSBLabel() {
     var newLabel = "";
 
-    var mpLabel = aios_WIN.document.getElementById('viewWebPanelsSidebar').getAttribute('label');
+    var mpLabel = AiOS_HELPER.mostRecentWindow.document.getElementById('viewWebPanelsSidebar').getAttribute('label');
 
     if(webPanel && webPanel.contentDocument) {
         var loc = webPanel.contentDocument.location.href;
diff --git a/content/multipanel_config.xul b/content/multipanel_config.xul
index 4a5b930..49137cb 100644
--- a/content/multipanel_config.xul
+++ b/content/multipanel_config.xul
@@ -7,7 +7,7 @@
     <script><![CDATA[
 
         // fuer CSS-Zwecke speichern
-        aios_appInfo( document.getElementById("config") );
+        AiOS_HELPER.rememberAppInfo( document.getElementById("config") );
 
     ]]>
     </script>
diff --git a/content/pageinfo.js b/content/pageinfo.js
index 4d02009..b56280f 100644
--- a/content/pageinfo.js
+++ b/content/pageinfo.js
@@ -1,6 +1,6 @@
 
 var aios_inSidebar = (top.document.getElementById('sidebar-box')) ? true : false;
-var aios_inTab = (aios_WIN.aiosLastSelTab) ? true : false;
+var aios_inTab = (AiOS_HELPER.mostRecentWindow.aiosLastSelTab) ? true : false;
 
 // Listener fuer automatische Aktualisierung hinzufuegen u. entfernen
 if(aios_inSidebar) {
@@ -20,11 +20,11 @@ function aios_init() {
     aios_hideMacMenubar();
 
     // fuer CSS-Zwecke speichern
-    aios_appInfo(document.getElementById('main-window'));
+    AiOS_HELPER.rememberAppInfo( document.getElementById('main-window') );
 
     try {
-        var enable_layout = aios_gPrefBranch.getBoolPref("pi.layout");
-        var enable_layoutall = aios_gPrefBranch.getBoolPref("pi.layoutall");
+        var enable_layout = AiOS_HELPER.prefBranchAiOS.getBoolPref("pi.layout");
+        var enable_layoutall = AiOS_HELPER.prefBranchAiOS.getBoolPref("pi.layoutall");
         if((enable_layout && aios_inSidebar) || enable_layoutall) aios_sidebarLayout();
     }
     catch(e) { }
@@ -100,7 +100,7 @@ function aios_sidebarLayout() {
 }
 
 
-// automatische Aktualisierung => Aufruf durch aiosProgListener (_common.js)
+// automatische Aktualisierung => Aufruf durch aiosProgListener (_helper.js)
 function aios_onLocationChange() {
     if(aios_inSidebar) {
         aios_persistSelTab();
@@ -150,13 +150,13 @@ function onLoadPageInfo() {
         var aios_sidebar = top.document.getElementById('sidebar-box');
         var aios_window = document.getElementById('main-window');
 
-        gDocument = aios_WIN.content.document;
-        gWindow = aios_WIN.content.window;
+        gDocument = AiOS_HELPER.mostRecentWindow.content.document;
+        gWindow = AiOS_HELPER.mostRecentWindow.content.window;
     }
     else if(aios_inTab) {
 
-        gDocument = aios_WIN.aiosLastSelTab.document;
-        gWindow = aios_WIN.content.window;
+        gDocument = AiOS_HELPER.mostRecentWindow.aiosLastSelTab.document;
+        gWindow = AiOS_HELPER.mostRecentWindow.content.window;
     }
     // Original-FF-Teil
     else {
@@ -185,8 +185,8 @@ var security = {
         //viewCertHelper(window, cert);
 
         // mod by eXXile
-        if(aios_inSidebar) viewCertHelper(aios_WIN.content.window, cert);
-        else if(aios_inTab) viewCertHelper(aios_WIN.aiosLastSelTab.window, cert);
+        if(aios_inSidebar) viewCertHelper(AiOS_HELPER.mostRecentWindow.content.window, cert);
+        else if(aios_inTab) viewCertHelper(AiOS_HELPER.mostRecentWindow.aiosLastSelTab.window, cert);
         else viewCertHelper(window, cert);
     // endmod by eXXile
     },
@@ -269,7 +269,7 @@ var security = {
             return null;
         }
         else if(aios_inTab) {
-            return aios_WIN.aiosLastSelTab.securityUI;
+            return AiOS_HELPER.mostRecentWindow.aiosLastSelTab.securityUI;
         }
         // Original-FF-Teil
         else {
diff --git a/content/places.js b/content/places.js
index 8fd948d..c14fbf6 100644
--- a/content/places.js
+++ b/content/places.js
@@ -75,9 +75,9 @@ var AiOS_Places = {};
             // zuletzt geoeffneten Ordner markieren
             if(aios_getBoolean("aios-rememberFolder", "checked")) {
 
-                if(aios_gPrefBranch.prefHasUserValue(lastFolderPref)) {
+                if(AiOS_HELPER.prefBranchAiOS.prefHasUserValue(lastFolderPref)) {
 
-                    lastRowToSelect = aios_gPrefBranch.getIntPref(lastFolderPref);
+                    lastRowToSelect = AiOS_HELPER.prefBranchAiOS.getIntPref(lastFolderPref);
 
                     window.setTimeout(function() {
                         AiOS_Places.selectFolder(lastRowToSelect);
@@ -106,7 +106,7 @@ var AiOS_Places = {};
         var self = AiOS_Places;
 
         // fuer CSS-Zwecke speichern
-        aios_appInfo(self.managerWindow);
+        AiOS_HELPER.rememberAppInfo( self.managerWindow );
 
         // CSS aktivieren
         self.managerWindow.setAttribute('aios-inSidebar', 'true');
@@ -269,11 +269,11 @@ var AiOS_Places = {};
                 switch(sidebarType)
                 {
                     case "bookmarks":
-                        aios_gPrefBranch.setIntPref("lastBookmarkFolder", tree.currentIndex);
+                        AiOS_HELPER.prefBranchAiOS.setIntPref("lastBookmarkFolder", tree.currentIndex);
                         break;
 
                     case "history":
-                        aios_gPrefBranch.setIntPref("lastHistoryFolder", tree.currentIndex);
+                        AiOS_HELPER.prefBranchAiOS.setIntPref("lastHistoryFolder", tree.currentIndex);
                         break;
                 }
             }
@@ -295,8 +295,8 @@ var AiOS_Places = {};
 
         // zuletzt geoeffneten Ordner "vergessen"
         try {
-            if(document.getElementById('bookmarksPanel')) aios_gPrefBranch.clearUserPref("lastBookmarkFolder");
-            else if(document.getElementById('history-panel')) aios_gPrefBranch.clearUserPref("lastHistoryFolder");
+            if(document.getElementById('bookmarksPanel')) AiOS_HELPER.prefBranchAiOS.clearUserPref("lastBookmarkFolder");
+            else if(document.getElementById('history-panel')) AiOS_HELPER.prefBranchAiOS.clearUserPref("lastHistoryFolder");
         }
         catch(e) {  }
 
diff --git a/content/prefs/_keyconfig.js b/content/prefs/_keyconfig.js
index b9ae37b..c6272b9 100644
--- a/content/prefs/_keyconfig.js
+++ b/content/prefs/_keyconfig.js
@@ -1,5 +1,5 @@
 //mod by exxile
-var target = aios_WIN;
+var target = AiOS_HELPER.mostRecentWindow;
 if(target) {
     var gPrefService = target.aiosKeyconfig.prefService;
     var gProfile = target.aiosKeyconfig.profile;
diff --git a/content/prefs/general.js b/content/prefs/general.js
index b69ac33..608feb1 100644
--- a/content/prefs/general.js
+++ b/content/prefs/general.js
@@ -12,15 +12,15 @@ function aios_genSidebarList() {
 
     var sidebarInit = document.getElementById('sidebarInitPopup');
     var panelInit = document.getElementById('panelInitPopup');
-    var allSidebars = aios_WIN.document.getElementsByAttribute('group', 'sidebar');
+    var allSidebars = AiOS_HELPER.mostRecentWindow.document.getElementsByAttribute('group', 'sidebar');
 
     var cnt = 0;
     var initID = null;
     var sidebarPrefInit = "";
     var panelPrefInit = "";
     try {
-        sidebarPrefInit = aios_gPrefBranch.getCharPref("gen.init");
-        panelPrefInit = aios_gPrefBranch.getCharPref("gen.open.init");
+        sidebarPrefInit = AiOS_HELPER.prefBranchAiOS.getCharPref("gen.init");
+        panelPrefInit = AiOS_HELPER.prefBranchAiOS.getCharPref("gen.open.init");
     } catch(e) { }
 
     for(var i = 0; i < allSidebars.length; i++) {
@@ -147,9 +147,9 @@ function aios_setConfSidebarWidth() {
         }
         // Aufruf durch aios_initSidebar() => die abgespeicherten Werte verwenden
         else {
-            elem = aios_gPrefBranch.getIntPref("gen.width." + modes[i] + "Val");
+            elem = AiOS_HELPER.prefBranchAiOS.getIntPref("gen.width." + modes[i] + "Val");
             theValue = elem;
-            theUnit = aios_gPrefBranch.getCharPref("gen.width." + modes[i] + "Unit");
+            theUnit = AiOS_HELPER.prefBranchAiOS.getCharPref("gen.width." + modes[i] + "Unit");
         }
 
         // Prozente in Px umrechnen (Angaben in % funktionieren hier nicht??)
@@ -168,6 +168,6 @@ function aios_setConfSidebarWidth() {
         }
     }
 
-    aios_WIN.document.getElementById('sidebar').setAttribute('style', widthStyle);
-    aios_WIN.document.persist('sidebar', 'style');
+    AiOS_HELPER.mostRecentWindow.document.getElementById('sidebar').setAttribute('style', widthStyle);
+    AiOS_HELPER.mostRecentWindow.document.persist('sidebar', 'style');
 }
\ No newline at end of file
diff --git a/content/prefs/prefs.js b/content/prefs/prefs.js
index 9477478..ca50f7d 100644
--- a/content/prefs/prefs.js
+++ b/content/prefs/prefs.js
@@ -60,7 +60,7 @@ function aios_initPrefs() {
 
 
 function aios_initPane(mode) {
-    aios_appInfo(document.getElementById("aiosPreferences"));
+    AiOS_HELPER.rememberAppInfo( document.getElementById("aiosPreferences") );
 
     // zuletzt gewaehlten Tab wieder selektieren
     var tabbox = null;
@@ -96,11 +96,11 @@ function aios_defaultSettings() {
     var count = {
         value : 0
     };
-    var childList = aios_gPrefBranch.getChildList("", count);
+    var childList = AiOS_HELPER.prefBranchAiOS.getChildList("", count);
 
     for(var i = 0; i < count.value; i++) {
-        if(aios_gPrefBranch.prefHasUserValue(childList[i]) && childList[i] != "changelog") {
-            aios_gPrefBranch.clearUserPref(childList[i]);
+        if(AiOS_HELPER.prefBranchAiOS.prefHasUserValue(childList[i]) && childList[i] != "changelog") {
+            AiOS_HELPER.prefBranchAiOS.clearUserPref(childList[i]);
         }
     }
 
@@ -131,27 +131,27 @@ function aios_exportSettings(aMode) {
     aiosExport[0]+= "                     All-in-One Sidebar - Settings\n";
     aiosExport[0]+= "-----------------------------------------------------------------------\n";
     aiosExport[0]+= "          " + sDate + ", " + sTtime + " (" + sGMT + ")\n";
-    aiosExport[0]+= "          AiOS " + aios_gPrefBranch.getCharPref('changelog') + ", " + aios_appVendor + " " + aios_appVersion + ", " + aios_appOS + ", " + aios_gPrefBranchN.getCharPref('general.skins.selectedSkin') + "\n";
+    aiosExport[0]+= "          AiOS " + AiOS_HELPER.prefBranchAiOS.getCharPref('changelog') + ", " + AiOS_HELPER.appInfo.vendor + " " + AiOS_HELPER.appInfo.version + ", " + AiOS_HELPER.os + ", " + AiOS_HELPER.prefBranch.getCharPref('general.skins.selectedSkin') + "\n";
     aiosExport[0]+= "-----------------------------------------------------------------------";
 
     var count = {
         value : 0
     };
-    var childList = aios_gPrefBranch.getChildList("", count);
+    var childList = AiOS_HELPER.prefBranchAiOS.getChildList("", count);
 
     for(var i = 0; i < count.value; i++) {
         try {
-            switch(aios_gPrefBranch.getPrefType(childList[i])) {
-                case    aios_pBranch.PREF_BOOL:
-                    aiosExport[i+1] = childList[i] + '=' + aios_gPrefBranch.getBoolPref(childList[i]);
+            switch(AiOS_HELPER.prefBranchAiOS.getPrefType(childList[i])) {
+                case    AiOS_HELPER.prefInterface.PREF_BOOL:
+                    aiosExport[i+1] = childList[i] + '=' + AiOS_HELPER.prefBranchAiOS.getBoolPref(childList[i]);
                     break;
 
-                case    aios_pBranch.PREF_INT:
-                    aiosExport[i+1] = childList[i] + '=' + aios_gPrefBranch.getIntPref(childList[i]);
+                case    AiOS_HELPER.prefInterface.PREF_INT:
+                    aiosExport[i+1] = childList[i] + '=' + AiOS_HELPER.prefBranchAiOS.getIntPref(childList[i]);
                     break;
 
-                case    aios_pBranch.PREF_STRING:
-                    aiosExport[i+1] = childList[i] + '=' + aios_gPrefBranch.getCharPref(childList[i]);
+                case    AiOS_HELPER.prefInterface.PREF_STRING:
+                    aiosExport[i+1] = childList[i] + '=' + AiOS_HELPER.prefBranchAiOS.getCharPref(childList[i]);
                     break;
             }
         }
@@ -232,20 +232,20 @@ function aios_importSettings() {
     if(pattern[1].indexOf("All-in-One Sidebar - Settings") >= 0 || pattern[1].indexOf("All-In-One Sidebar - Settings") >= 0) {
         for(i = 6; i < aiosImport.length; i++) {
             try {
-                switch(aios_gPrefBranch.getPrefType(aiosImport[i][0])) {
-                    case    aios_pBranch.PREF_BOOL:
-                        aios_gPrefBranch.setBoolPref(aiosImport[i][0],/true/i.test(aiosImport[i][1]));
+                switch(AiOS_HELPER.prefBranchAiOS.getPrefType(aiosImport[i][0])) {
+                    case    AiOS_HELPER.prefInterface.PREF_BOOL:
+                        AiOS_HELPER.prefBranchAiOS.setBoolPref(aiosImport[i][0],/true/i.test(aiosImport[i][1]));
                         break;
 
-                    case    aios_pBranch.PREF_INT:
-                        aios_gPrefBranch.setIntPref(aiosImport[i][0], aiosImport[i][1]);
+                    case    AiOS_HELPER.prefInterface.PREF_INT:
+                        AiOS_HELPER.prefBranchAiOS.setIntPref(aiosImport[i][0], aiosImport[i][1]);
                         break;
 
-                    case    aios_pBranch.PREF_STRING:
+                    case    AiOS_HELPER.prefInterface.PREF_STRING:
                         var pref = aiosImport[i][1];
                         if(pref.indexOf('"') == 0) // in prev version we use " " for string
                             pref = pref.substring(1,pref.length - 1);
-                        aios_gPrefBranch.setCharPref(aiosImport[i][0], pref);
+                        AiOS_HELPER.prefBranchAiOS.setCharPref(aiosImport[i][0], pref);
                         break;
                 }
             }
@@ -475,13 +475,13 @@ function aios_synchElements() {
 
         switch(prefType) {
             case "int":
-                val = aios_gPrefBranch.getIntPref(prefName);
+                val = AiOS_HELPER.prefBranchAiOS.getIntPref(prefName);
                 break;
             case "string":
-                val = aios_gPrefBranch.getCharPref(prefName);
+                val = AiOS_HELPER.prefBranchAiOS.getCharPref(prefName);
                 break;
             case "bool":
-                val = aios_gPrefBranch.getBoolPref(prefName);
+                val = AiOS_HELPER.prefBranchAiOS.getBoolPref(prefName);
                 break;
         }
 
@@ -511,17 +511,17 @@ function aios_savePrefs() {
     aios_setConfSidebarWidth();
 
     // Tooltip fuer PanelTab-Button festlegen
-    if(aios_WIN.document.getElementById('paneltab-button')) {
-        var ptReverse = aios_gPrefBranch.getBoolPref("paneltab.reverse");
+    if(AiOS_HELPER.mostRecentWindow.document.getElementById('paneltab-button')) {
+        var ptReverse = AiOS_HELPER.prefBranchAiOS.getBoolPref("paneltab.reverse");
         var ptTooltip = (ptReverse) ? 'paneltab-tooltip-reverse' : 'paneltab-tooltip';
-        aios_WIN.document.getElementById('paneltab-button').setAttribute('tooltip', ptTooltip);
+        AiOS_HELPER.mostRecentWindow.document.getElementById('paneltab-button').setAttribute('tooltip', ptTooltip);
     }
 
-    if(aios_WIN.aios_setTargets) aios_WIN.aios_setTargets();
+    if(AiOS_HELPER.mostRecentWindow.aios_setTargets) AiOS_HELPER.mostRecentWindow.aios_setTargets();
 
-    aios_WIN.aios_checkThinSwitch();
-    if(aios_WIN.aios_setSidebarOrient) aios_WIN.aios_setSidebarOrient();
-    if(aios_WIN.aios_initAutohide) aios_WIN.aios_initAutohide();
+    AiOS_HELPER.mostRecentWindow.aios_checkThinSwitch();
+    if(AiOS_HELPER.mostRecentWindow.aios_setSidebarOrient) AiOS_HELPER.mostRecentWindow.aios_setSidebarOrient();
+    if(AiOS_HELPER.mostRecentWindow.aios_initAutohide) AiOS_HELPER.mostRecentWindow.aios_initAutohide();
 
     // Bugfix...
     // sonst wird das Kontextmenue der Erweiterung angezeigt,
@@ -548,13 +548,13 @@ function aios_applyPrefs() {
 
         switch(pType) {
             case "string":
-                aios_gPref.setCharPref(pName, pValue);
+                AiOS_HELPER.prefService.setCharPref(pName, pValue);
                 break;
             case "bool":
-                aios_gPref.setBoolPref(pName, pValue);
+                AiOS_HELPER.prefService.setBoolPref(pName, pValue);
                 break;
             case "int":
-                aios_gPref.setIntPref(pName, pValue);
+                AiOS_HELPER.prefService.setIntPref(pName, pValue);
                 break;
         }
     }
@@ -569,7 +569,7 @@ function aios_applyPrefs() {
     aios_rememberOldPrefs();
 
     // Prefs direkt in Datei speichern
-    aios_gPref.savePrefFile(null);
+    AiOS_HELPER.prefService.savePrefFile(null);
 }
 
 
@@ -682,7 +682,7 @@ function aios_deleteOldPrefs() {
 
     for(var i = 0; i < oldPrefs.length; i++) {
         try {
-            aios_gPrefBranch.clearUserPref(oldPrefs[i]);
+            AiOS_HELPER.prefBranchAiOS.clearUserPref(oldPrefs[i]);
         }
         catch(e) { }
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/all-in-one-sidebar.git



More information about the Pkg-mozext-commits mailing list