Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -rU3 original/chrome/content/useragentswitcher/options/dialogs/useragent.js profexer/chrome/content/useragentswitcher/options/dialogs/useragent.js
- --- original/chrome/content/useragentswitcher/options/dialogs/useragent.js 2011-01-04 18:53:34.000000000 +0200
- +++ profexer/chrome/content/useragentswitcher/options/dialogs/useragent.js 2012-06-16 00:25:20.000000000 +0300
- @@ -9,20 +9,21 @@
- window.opener.UserAgentSwitcherOptions.appVersion = null;
- window.opener.UserAgentSwitcherOptions.description = null;
- window.opener.UserAgentSwitcherOptions.platform = null;
- + window.opener.UserAgentSwitcherOptions.oscpu = null;
- window.opener.UserAgentSwitcherOptions.userAgent = null;
- },
- -
- +
- // Initializes the user agent dialog box
- initialize: function()
- {
- var type = window.arguments[0];
- -
- +
- // If the type is new
- if(type == "new")
- {
- document.documentElement.getButton("accept").disabled = true;
- document.title = UserAgentSwitcherStringBundle.getString("newUserAgent");
- -
- +
- this.retrieveDefault();
- }
- else if(type == "edit")
- @@ -34,13 +35,14 @@
- document.getElementById("useragentswitcher-app-version").value = window.arguments[3];
- document.getElementById("useragentswitcher-description").value = window.arguments[4];
- document.getElementById("useragentswitcher-platform").value = window.arguments[5];
- - document.getElementById("useragentswitcher-user-agent").value = window.arguments[6];
- - document.getElementById("useragentswitcher-vendor").value = window.arguments[7];
- - document.getElementById("useragentswitcher-vendor-sub").value = window.arguments[8];
- + document.getElementById("useragentswitcher-oscpu").value = window.arguments[6];
- + document.getElementById("useragentswitcher-user-agent").value = window.arguments[7]; //6
- + document.getElementById("useragentswitcher-vendor").value = window.arguments[8]; //7
- + document.getElementById("useragentswitcher-vendor-sub").value = window.arguments[9]; //8
- document.title = UserAgentSwitcherStringBundle.getString("editUserAgent");
- }
- },
- -
- +
- // Retrieves the default user agent
- retrieveDefault: function()
- {
- @@ -49,117 +51,135 @@
- var appVersion = null;
- var description = null;
- var platform = null;
- + var oscpu = null;
- var userAgent = null;
- var vendor = null;
- var vendorSub = null;
- -
- +
- // If the app code name is being overridden
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.useragent.appName"))
- {
- appCodeName = UserAgentSwitcherPreferences.getStringPreference("general.useragent.appName", true);
- -
- +
- UserAgentSwitcherPreferences.deletePreference("general.useragent.appName");
- }
- -
- +
- // If the app name is being overridden
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.appname.override"))
- {
- appName = UserAgentSwitcherPreferences.getStringPreference("general.appname.override", true);
- -
- +
- UserAgentSwitcherPreferences.deletePreference("general.appname.override");
- }
- -
- +
- // If the app version is being overridden
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.appversion.override"))
- {
- appVersion = UserAgentSwitcherPreferences.getStringPreference("general.appversion.override", true);
- -
- +
- UserAgentSwitcherPreferences.deletePreference("general.appversion.override");
- }
- -
- +
- // If the platform is being overridden
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.platform.override"))
- {
- platform = UserAgentSwitcherPreferences.getStringPreference("general.platform.override", true);
- -
- +
- UserAgentSwitcherPreferences.deletePreference("general.platform.override");
- }
- -
- +
- + // PROFEDIT: If the oscpu is being overridden
- + if(UserAgentSwitcherPreferences.isPreferenceSet("general.oscpu.override"))
- + {
- + oscpu = UserAgentSwitcherPreferences.getStringPreference("general.oscpu.override", true);
- +
- + UserAgentSwitcherPreferences.deletePreference("general.oscpu.override");
- + }
- + // ENDPROFEDIT
- +
- // If the user agent is being overridden
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.useragent.override"))
- {
- userAgent = UserAgentSwitcherPreferences.getStringPreference("general.useragent.override", true);
- -
- +
- UserAgentSwitcherPreferences.deletePreference("general.useragent.override");
- }
- -
- +
- // If the vendor is being overridden
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.useragent.vendor"))
- {
- vendor = UserAgentSwitcherPreferences.getStringPreference("general.useragent.vendor", true);
- -
- +
- UserAgentSwitcherPreferences.deletePreference("general.useragent.vendor");
- }
- -
- +
- // If the vendor sub is being overridden
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.useragent.vendorSub"))
- {
- vendorSub = UserAgentSwitcherPreferences.getStringPreference("general.useragent.vendorSub", true);
- -
- +
- UserAgentSwitcherPreferences.deletePreference("general.useragent.vendorSub");
- }
- -
- +
- document.getElementById("useragentswitcher-app-code-name").value = navigator.appCodeName;
- document.getElementById("useragentswitcher-app-name").value = navigator.appName;
- document.getElementById("useragentswitcher-app-version").value = navigator.appVersion;
- document.getElementById("useragentswitcher-platform").value = navigator.platform;
- + document.getElementById("useragentswitcher-oscpu").value = navigator.oscpu;
- document.getElementById("useragentswitcher-user-agent").value = navigator.userAgent;
- document.getElementById("useragentswitcher-vendor").value = navigator.vendor;
- document.getElementById("useragentswitcher-vendor-sub").value = navigator.vendorSub;
- -
- +
- // If the app code name was being overridden
- if(appCodeName)
- {
- UserAgentSwitcherPreferences.setStringPreference("general.useragent.appName", appCodeName);
- }
- -
- +
- // If the app name was being overridden
- if(appName)
- {
- UserAgentSwitcherPreferences.setStringPreference("general.appname.override", appName);
- }
- -
- +
- // If the app version was being overridden
- if(appVersion)
- {
- UserAgentSwitcherPreferences.setStringPreference("general.appversion.override", appVersion);
- }
- -
- +
- // If the platform was being overridden
- if(platform)
- {
- UserAgentSwitcherPreferences.setStringPreference("general.platform.override", platform);
- }
- -
- +
- + // PROFEDIT: If the oscpu was being overridden
- + if(oscpu)
- + {
- + UserAgentSwitcherPreferences.setStringPreference("general.oscpu.override", oscpu);
- + }
- + // ENDPROFEDIT
- +
- // If the user agent was being overridden
- if(userAgent)
- {
- UserAgentSwitcherPreferences.setStringPreference("general.useragent.override", userAgent);
- }
- -
- +
- // If the vendor was being overridden
- if(vendor)
- {
- UserAgentSwitcherPreferences.setStringPreference("general.useragent.vendor", vendor);
- }
- -
- +
- // If the vendor sub was being overridden
- if(vendorSub)
- {
- UserAgentSwitcherPreferences.setStringPreference("general.useragent.vendorSub", vendorSub);
- }
- },
- -
- +
- // Saves a user agent
- saveUserAgent: function()
- {
- @@ -168,14 +188,15 @@
- window.opener.UserAgentSwitcherOptions.appVersion = UserAgentSwitcherString.trim(document.getElementById("useragentswitcher-app-version").value);
- window.opener.UserAgentSwitcherOptions.description = UserAgentSwitcherString.trim(document.getElementById("useragentswitcher-description").value);
- window.opener.UserAgentSwitcherOptions.platform = UserAgentSwitcherString.trim(document.getElementById("useragentswitcher-platform").value);
- + window.opener.UserAgentSwitcherOptions.oscpu = UserAgentSwitcherString.trim(document.getElementById("useragentswitcher-oscpu").value);
- window.opener.UserAgentSwitcherOptions.userAgent = UserAgentSwitcherString.trim(document.getElementById("useragentswitcher-user-agent").value);
- window.opener.UserAgentSwitcherOptions.vendor = UserAgentSwitcherString.trim(document.getElementById("useragentswitcher-vendor").value);
- window.opener.UserAgentSwitcherOptions.vendorSub = UserAgentSwitcherString.trim(document.getElementById("useragentswitcher-vendor-sub").value);
- },
- -
- +
- // Disable the OK button if the description is not set
- updateDescription: function()
- {
- document.documentElement.getButton("accept").disabled = (UserAgentSwitcherString.trim(document.getElementById("useragentswitcher-description").value).length == 0);
- }
- -};
- \ No newline at end of file
- +};
- diff -rU3 original/chrome/content/useragentswitcher/options/dialogs/useragent.xul profexer/chrome/content/useragentswitcher/options/dialogs/useragent.xul
- --- original/chrome/content/useragentswitcher/options/dialogs/useragent.xul 2011-01-04 18:53:34.000000000 +0200
- +++ profexer/chrome/content/useragentswitcher/options/dialogs/useragent.xul 2012-06-16 00:08:52.000000000 +0300
- @@ -22,7 +22,7 @@
- <vbox>
- <description id="useragentswitcher-new-user-agent">&useragentswitcher.new.user.agent.description;</description>
- <separator id="useragentswitcher-user-agent-separator"/>
- -
- +
- <grid flex="1">
- <columns>
- <column/>
- @@ -54,6 +54,10 @@
- <textbox id="useragentswitcher-platform"/>
- </row>
- <row align="center">
- + <label control="useragentswitcher-oscpu" value="&useragentswitcher.oscpu;"/>
- + <textbox id="useragentswitcher-oscpu"/>
- + </row>
- + <row align="center">
- <label control="useragentswitcher-vendor" value="&useragentswitcher.vendor;"/>
- <textbox id="useragentswitcher-vendor"/>
- </row>
- diff -rU3 original/chrome/content/useragentswitcher/options/options.js profexer/chrome/content/useragentswitcher/options/options.js
- --- original/chrome/content/useragentswitcher/options/options.js 2011-01-04 18:53:34.000000000 +0200
- +++ profexer/chrome/content/useragentswitcher/options/options.js 2012-06-16 00:05:39.000000000 +0300
- @@ -8,10 +8,11 @@
- description: null,
- folder: null,
- platform: null,
- + oscpu: null,
- userAgent: null,
- vendor: null,
- vendorSub: null,
- -
- +
- // Adds a tree item to the selection
- addTreeItemToSelection: function(treeItem)
- {
- @@ -20,7 +21,7 @@
- var treeView = document.getElementById("useragentswitcher-options-tree").view;
- var selections = treeView.selection.getRangeCount();
- var selectedItem = null;
- -
- +
- // If there are no selections
- if(selections == 0)
- {
- @@ -37,7 +38,7 @@
- {
- treeView.selection.getRangeAt(selections - 1, startIndex, endIndex);
- }
- -
- +
- selectedItem = treeView.getItemAtIndex(endIndex.value);
- // If the selected item is set
- @@ -55,7 +56,7 @@
- }
- }
- },
- -
- +
- // Copies user agents
- copy: function()
- {
- @@ -63,14 +64,14 @@
- var startIndex = {};
- var treeView = document.getElementById("useragentswitcher-options-tree").view;
- var selections = treeView.selection.getRangeCount();
- -
- +
- this.clipboard = [];
- // If there is 1 selection
- if(selections == 1)
- - {
- + {
- treeView.selection.getRangeAt(0, startIndex, endIndex);
- -
- +
- // If more than one item is selected
- if(endIndex.value - startIndex.value > 0)
- {
- @@ -79,13 +80,13 @@
- else
- {
- var selectedItem = treeView.getItemAtIndex(startIndex.value);
- -
- +
- // If an item is selected
- if(selectedItem)
- {
- this.clipboard.push(selectedItem.cloneNode(true));
- }
- - }
- + }
- }
- else
- {
- @@ -98,20 +99,20 @@
- }
- }
- },
- -
- +
- // Copies selections
- copySelections: function(treeView, startIndex, endIndex)
- {
- var endValue = endIndex.value;
- var startValue = startIndex.value;
- -
- +
- // Loop through the items in reverse order to delete without changing the index
- for(var index = startValue; index <= endValue; index++)
- {
- this.clipboard.push(treeView.getItemAtIndex(index).cloneNode(true));
- }
- },
- -
- +
- // Cuts user agents
- cut: function()
- {
- @@ -119,14 +120,14 @@
- var startIndex = {};
- var treeView = document.getElementById("useragentswitcher-options-tree").view;
- var selections = treeView.selection.getRangeCount();
- -
- +
- this.copy();
- // If there is 1 selection
- if(selections == 1)
- - {
- + {
- treeView.selection.getRangeAt(0, startIndex, endIndex);
- -
- +
- // If more than one item is selected
- if(endIndex.value - startIndex.value > 0)
- {
- @@ -135,13 +136,13 @@
- else
- {
- var selectedItem = treeView.getItemAtIndex(startIndex.value);
- -
- +
- // If an item is selected
- if(selectedItem)
- {
- UserAgentSwitcherDOM.removeElement(selectedItem);
- }
- - }
- + }
- }
- else
- {
- @@ -154,7 +155,7 @@
- }
- }
- },
- -
- +
- // Deletes user agents
- deleteUserAgents: function()
- {
- @@ -162,12 +163,12 @@
- var startIndex = {};
- var treeView = document.getElementById("useragentswitcher-options-tree").view;
- var selections = treeView.selection.getRangeCount();
- -
- +
- // If there is 1 selection
- if(selections == 1)
- - {
- + {
- treeView.selection.getRangeAt(0, startIndex, endIndex);
- -
- +
- // If more than one item is selected
- if(endIndex.value - startIndex.value > 0)
- {
- @@ -180,13 +181,13 @@
- else
- {
- var selectedItem = treeView.getItemAtIndex(startIndex.value);
- -
- +
- // If an item is selected and is either a separator, or a folder or user agent and the deletion is confirmed
- if(selectedItem && (this.isSeparatorSelected(selectedItem) || (selectedItem.hasAttribute("container") && confirm(UserAgentSwitcherStringBundle.getString("deleteFolderConfirmation"))) || (!selectedItem.hasAttribute("container") && confirm(UserAgentSwitcherStringBundle.getString("deleteUserAgentConfirmation")))))
- {
- UserAgentSwitcherDOM.removeElement(selectedItem);
- - }
- - }
- + }
- + }
- }
- else
- {
- @@ -197,26 +198,26 @@
- for(var i = selections - 1; i >= 0; i--)
- {
- treeView.selection.getRangeAt(i, startIndex, endIndex);
- -
- +
- this.deleteSelections(treeView, startIndex, endIndex);
- }
- }
- }
- },
- -
- +
- // Deletes selections
- deleteSelections: function(treeView, startIndex, endIndex)
- {
- var endValue = endIndex.value;
- var startValue = startIndex.value;
- -
- +
- // Loop through the items in reverse order to delete without changing the index
- for(var index = endValue; index >= startValue; index--)
- {
- UserAgentSwitcherDOM.removeElement(treeView.getItemAtIndex(index));
- }
- },
- -
- +
- // Edit user agents
- edit: function()
- {
- @@ -224,11 +225,11 @@
- var selectedItem = null;
- var startIndex = {};
- var treeView = document.getElementById("useragentswitcher-options-tree").view;
- -
- +
- treeView.selection.getRangeAt(0, startIndex, endIndex);
- selectedItem = treeView.getItemAtIndex(startIndex.value);
- -
- +
- // If the selected item is set
- if(selectedItem)
- {
- @@ -243,7 +244,7 @@
- }
- }
- },
- -
- +
- // Edits a folder
- editFolder: function(selectedItem)
- {
- @@ -251,7 +252,7 @@
- if(selectedItem)
- {
- window.openDialog("chrome://useragentswitcher/content/options/dialogs/folder.xul", "useragentswitcher-folder-dialog", "centerscreen,chrome,modal,resizable", "edit", selectedItem.getAttribute("label"));
- -
- +
- // If the folder is set
- if(this.folder)
- {
- @@ -259,15 +260,15 @@
- }
- }
- },
- -
- +
- // Edits a user agent
- editUserAgent: function(selectedItem)
- {
- // If an item is selected
- if(selectedItem)
- {
- - window.openDialog("chrome://useragentswitcher/content/options/dialogs/useragent.xul", "useragentswitcher-user-agent-dialog", "centerscreen,chrome,modal,resizable", "edit", selectedItem.getAttribute("useragentswitcherappcodename"), selectedItem.getAttribute("useragentswitcherappname"), selectedItem.getAttribute("useragentswitcherappversion"), selectedItem.getAttribute("label"), selectedItem.getAttribute("useragentswitcherplatform"), selectedItem.getAttribute("useragentswitcheruseragent"), selectedItem.getAttribute("useragentswitchervendor"), selectedItem.getAttribute("useragentswitchervendorsub"));
- -
- + window.openDialog("chrome://useragentswitcher/content/options/dialogs/useragent.xul", "useragentswitcher-user-agent-dialog", "centerscreen,chrome,modal,resizable", "edit", selectedItem.getAttribute("useragentswitcherappcodename"), selectedItem.getAttribute("useragentswitcherappname"), selectedItem.getAttribute("useragentswitcherappversion"), selectedItem.getAttribute("label"), selectedItem.getAttribute("useragentswitcherplatform"), selectedItem.getAttribute("useragentswitcheroscpu"), selectedItem.getAttribute("useragentswitcheruseragent"), selectedItem.getAttribute("useragentswitchervendor"), selectedItem.getAttribute("useragentswitchervendorsub"));
- +
- // If the description is set
- if(this.description)
- {
- @@ -276,32 +277,33 @@
- selectedItem.setAttribute("useragentswitcherappname", this.appName);
- selectedItem.setAttribute("useragentswitcherappversion", this.appVersion);
- selectedItem.setAttribute("useragentswitcherplatform", this.platform);
- + selectedItem.setAttribute("useragentswitcheroscpu", this.oscpu);
- selectedItem.setAttribute("useragentswitcheruseragent", this.userAgent);
- selectedItem.setAttribute("useragentswitchervendor", this.vendor);
- selectedItem.setAttribute("useragentswitchervendorsub", this.vendorSub);
- }
- }
- },
- -
- +
- // Exports user agents to a file
- exportUserAgents: function()
- {
- var filePicker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
- var result = null;
- -
- +
- filePicker.defaultExtension = "xml";
- filePicker.defaultString = "useragentswitcher.xml";
- -
- +
- filePicker.appendFilter(UserAgentSwitcherStringBundle.getString("xmlFileDescription"), "*.xml");
- filePicker.init(window, UserAgentSwitcherStringBundle.getString("exportUserAgents"), filePicker.modeSave);
- -
- +
- result = filePicker.show();
- -
- +
- // If the user selected a file
- if(result == filePicker.returnOK || result == filePicker.returnReplace)
- {
- var errorMessage = UserAgentSwitcherExporter.export(filePicker.file);
- -
- +
- // If there is an error message
- if(errorMessage)
- {
- @@ -309,20 +311,20 @@
- }
- }
- },
- -
- +
- // Imports user agents from a file
- importUserAgents: function()
- {
- var filePicker = Components.classes["@mozilla.org/filepicker;1"].createInstance(Components.interfaces.nsIFilePicker);
- -
- +
- filePicker.appendFilter(UserAgentSwitcherStringBundle.getString("xmlFileDescription"), "*.xml");
- filePicker.init(window, UserAgentSwitcherStringBundle.getString("importUserAgents"), filePicker.modeOpen);
- -
- +
- // If the user selected an XML file
- if(filePicker.show() == filePicker.returnOK)
- {
- var errorMessage = UserAgentSwitcherImporter.import(UserAgentSwitcherImporter.importTypeOptions, filePicker.file, false);
- -
- +
- // If there is an error message
- if(errorMessage)
- {
- @@ -330,12 +332,12 @@
- }
- }
- },
- -
- +
- // Initializes the options
- initialize: function()
- {
- UserAgentSwitcherImporter.import(UserAgentSwitcherImporter.importTypeOptions, UserAgentSwitcherImporter.getUserAgentFileLocation(), false);
- -
- +
- // If the hide menu preference is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("useragentswitcher.menu.hide"))
- {
- @@ -355,10 +357,10 @@
- {
- document.getElementById("useragentswitcher-import-overwrite").checked = false;
- }
- -
- +
- document.getElementById("useragentswitcher-options-user-agents").addEventListener("dblclick", UserAgentSwitcherOptions.treeDoubleClick, false);
- },
- -
- +
- // Returns true if a separator is selected
- isSeparatorSelected: function(selectedItem)
- {
- @@ -366,11 +368,11 @@
- if(selectedItem && selectedItem.nodeName == "treeseparator")
- {
- return true;
- - }
- -
- + }
- +
- return false;
- },
- -
- +
- // Moves the selected item down
- moveDown: function()
- {
- @@ -379,11 +381,11 @@
- var startIndex = {};
- var treeView = document.getElementById("useragentswitcher-options-tree").view;
- var treeSelection = treeView.selection;
- -
- +
- treeSelection.getRangeAt(0, startIndex, endIndex);
- selectedItem = treeView.getItemAtIndex(startIndex.value);
- -
- +
- // If the selected item is set
- if(selectedItem)
- {
- @@ -391,7 +393,7 @@
- treeSelection.select(startIndex.value + 1);
- }
- },
- -
- +
- // Moves the selected item up
- moveUp: function()
- {
- @@ -400,11 +402,11 @@
- var startIndex = {};
- var treeView = document.getElementById("useragentswitcher-options-tree").view;
- var treeSelection = treeView.selection;
- -
- +
- treeSelection.getRangeAt(0, startIndex, endIndex);
- selectedItem = treeView.getItemAtIndex(startIndex.value);
- -
- +
- // If the selected item is set
- if(selectedItem)
- {
- @@ -412,12 +414,12 @@
- treeSelection.select(startIndex.value - 1);
- }
- },
- -
- +
- // Adds a new folder
- newFolder: function()
- {
- window.openDialog("chrome://useragentswitcher/content/options/dialogs/folder.xul", "useragentswitcher-folder-dialog", "centerscreen,chrome,modal,resizable", "new");
- -
- +
- // If the folder is set
- if(this.folder)
- {
- @@ -434,29 +436,29 @@
- treeRow.appendChild(treeCell);
- treeItem.appendChild(treeRow);
- treeItem.appendChild(treeChildren);
- -
- - this.addTreeItemToSelection(treeItem);
- +
- + this.addTreeItemToSelection(treeItem);
- }
- },
- -
- +
- // Adds a new separator
- newSeparator: function()
- {
- - this.addTreeItemToSelection(document.createElement("treeseparator"));
- + this.addTreeItemToSelection(document.createElement("treeseparator"));
- },
- -
- +
- // Adds a new user agent
- newUserAgent: function()
- {
- window.openDialog("chrome://useragentswitcher/content/options/dialogs/useragent.xul", "useragentswitcher-user-agent-dialog", "centerscreen,chrome,modal,resizable", "new");
- -
- +
- // If the description is set
- if(this.description)
- {
- var treeCell = document.createElement("treecell");
- var treeItem = document.createElement("treeitem");
- var treeRow = document.createElement("treerow");
- -
- +
- treeCell.setAttribute("label", this.description);
- treeRow.appendChild(treeCell);
- treeItem.appendChild(treeRow);
- @@ -465,19 +467,20 @@
- treeCell.setAttribute("useragentswitcherappname", this.appName);
- treeCell.setAttribute("useragentswitcherappversion", this.appVersion);
- treeCell.setAttribute("useragentswitcherplatform", this.platform);
- + treeCell.setAttribute("useragentswitcheroscpu", this.oscpu);
- treeCell.setAttribute("useragentswitcheruseragent", this.userAgent);
- treeCell.setAttribute("useragentswitchervendor", this.vendor);
- treeCell.setAttribute("useragentswitchervendorsub", this.vendorSub);
- -
- - this.addTreeItemToSelection(treeItem);
- +
- + this.addTreeItemToSelection(treeItem);
- }
- },
- -
- +
- // Opens the user agents page
- openUserAgentsPage: function()
- {
- var parentWindow = null;
- -
- +
- // If there is a parent window
- if(window.opener)
- {
- @@ -491,16 +494,16 @@
- parentWindow = window.opener;
- }
- }
- -
- +
- // If a parent window was found
- if(parentWindow)
- {
- parentWindow.getBrowser().selectedTab = parentWindow.getBrowser().addTab("http://chrispederick.com/work/user-agent-switcher/user-agents/");
- -
- +
- window.close();
- }
- },
- -
- +
- // Pastes user agents
- paste: function()
- {
- @@ -510,12 +513,12 @@
- var startIndex = {};
- var treeView = document.getElementById("useragentswitcher-options-tree").view;
- var selections = treeView.selection.getRangeCount();
- -
- +
- // If there are no selections
- if(selections == 0)
- {
- var userAgents = document.getElementById("useragentswitcher-options-user-agents");
- -
- +
- // Loop through the clipboard
- for(var i = 0; i < clipboardLength; i++)
- {
- @@ -525,9 +528,9 @@
- else
- {
- treeView.selection.getRangeAt(0, startIndex, endIndex);
- -
- +
- selectedItem = treeView.getItemAtIndex(startIndex.value);
- -
- +
- // If the selected item is set
- if(selectedItem)
- {
- @@ -551,24 +554,24 @@
- }
- }
- },
- -
- +
- // Resets the user's options
- resetOptions: function()
- {
- var promptServiceInterface = Components.interfaces.nsIPromptService;
- -
- +
- // If the reset is confirmed
- if(Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(promptServiceInterface).confirmEx(null, UserAgentSwitcherStringBundle.getString("resetConfirmationMessage"), UserAgentSwitcherStringBundle.getString("resetConfirmation"), promptServiceInterface.BUTTON_TITLE_IS_STRING * promptServiceInterface.BUTTON_POS_0 + promptServiceInterface.BUTTON_TITLE_CANCEL * promptServiceInterface.BUTTON_POS_1, UserAgentSwitcherStringBundle.getString("reset"), null, null, null, {}) == 0)
- {
- UserAgentSwitcherPreferences.deletePreferenceBranch("useragentswitcher.");
- UserAgentSwitcherUpgrade.setVersion();
- - UserAgentSwitcherDOM.removeAllChildElements(document.getElementById("useragentswitcher-options-user-agents"));
- + UserAgentSwitcherDOM.removeAllChildElements(document.getElementById("useragentswitcher-options-user-agents"));
- UserAgentSwitcherImporter.reset();
- -
- +
- this.initialize();
- }
- },
- -
- +
- // Saves the user's options
- saveOptions: function()
- {
- @@ -578,13 +581,13 @@
- UserAgentSwitcherExporter.export(UserAgentSwitcherExporter.getUserAgentFileLocation());
- UserAgentSwitcherImporter.import(UserAgentSwitcherImporter.importTypeMenu, UserAgentSwitcherImporter.getUserAgentFileLocation(), false);
- },
- -
- +
- // Handles a user agent being selected
- selectUserAgent: function(tree)
- {
- var treeView = tree.view;
- var selections = treeView.selection.getRangeCount();
- -
- +
- // If there are no selections
- if(selections == 0)
- {
- @@ -597,9 +600,9 @@
- {
- var endIndex = {};
- var startIndex = {};
- -
- +
- treeView.selection.getRangeAt(0, startIndex, endIndex);
- -
- +
- // If more than one item is selected
- if(endIndex.value - startIndex.value > 0)
- {
- @@ -607,8 +610,8 @@
- if(document.getElementById("useragentswitcher-delete-button").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-delete-button").removeAttribute("disabled");
- - }
- -
- + }
- +
- document.getElementById("useragentswitcher-edit-button").setAttribute("disabled", true);
- document.getElementById("useragentswitcher-move-down-button").setAttribute("disabled", true);
- document.getElementById("useragentswitcher-move-up-button").setAttribute("disabled", true);
- @@ -616,23 +619,23 @@
- else
- {
- var selectedItem = treeView.getItemAtIndex(startIndex.value);
- -
- +
- // If the delete button is disabled
- if(document.getElementById("useragentswitcher-delete-button").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-delete-button").removeAttribute("disabled");
- - }
- -
- + }
- +
- // If a separator is selected
- if(this.isSeparatorSelected(treeView.getItemAtIndex(startIndex.value)))
- {
- document.getElementById("useragentswitcher-edit-button").setAttribute("disabled", true);
- - }
- + }
- else if(document.getElementById("useragentswitcher-edit-button").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-edit-button").removeAttribute("disabled");
- - }
- -
- + }
- +
- // If the selected item is set and has a previous sibling
- if(selectedItem && selectedItem.previousSibling)
- {
- @@ -640,13 +643,13 @@
- if(document.getElementById("useragentswitcher-move-up-button").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-move-up-button").removeAttribute("disabled");
- - }
- + }
- }
- else
- {
- document.getElementById("useragentswitcher-move-up-button").setAttribute("disabled", true);
- }
- -
- +
- // If the selected item is set and has a next sibling
- if(selectedItem && selectedItem.nextSibling)
- {
- @@ -654,13 +657,13 @@
- if(document.getElementById("useragentswitcher-move-down-button").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-move-down-button").removeAttribute("disabled");
- - }
- + }
- }
- else
- {
- document.getElementById("useragentswitcher-move-down-button").setAttribute("disabled", true);
- }
- - }
- + }
- }
- else
- {
- @@ -668,21 +671,21 @@
- if(document.getElementById("useragentswitcher-delete-button").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-delete-button").removeAttribute("disabled");
- - }
- -
- + }
- +
- document.getElementById("useragentswitcher-edit-button").setAttribute("disabled", true);
- document.getElementById("useragentswitcher-move-down-button").setAttribute("disabled", true);
- document.getElementById("useragentswitcher-move-up-button").setAttribute("disabled", true);
- }
- },
- -
- +
- // Handles double clicking on the tree
- treeDoubleClick: function(event)
- {
- var tree = document.getElementById("useragentswitcher-options-tree");
- var rowPosition = tree.treeBoxObject.getRowAt(event.clientX, event.clientY);
- var treeItem = tree.view.getItemAtIndex(rowPosition);
- -
- +
- // If the tree item is set
- if(treeItem)
- {
- @@ -693,13 +696,13 @@
- }
- }
- },
- -
- +
- // Uninitializes the options
- uninitialize: function()
- {
- document.getElementById("useragentswitcher-options-user-agents").removeEventListener("dblclick", UserAgentSwitcherOptions.treeDoubleClick, false);
- },
- -
- +
- // Updates the context menu
- updateContextMenu: function()
- {
- @@ -709,7 +712,7 @@
- // If the clipboard is empty
- if(this.clipboard.length == 0)
- {
- - document.getElementById("useragentswitcher-paste").setAttribute("disabled", true);
- + document.getElementById("useragentswitcher-paste").setAttribute("disabled", true);
- }
- // If there are no selections
- @@ -721,20 +724,20 @@
- document.getElementById("useragentswitcher-edit-menu").setAttribute("disabled", true);
- document.getElementById("useragentswitcher-move-up").setAttribute("disabled", true);
- document.getElementById("useragentswitcher-move-down").setAttribute("disabled", true);
- -
- +
- // If the clipboard is not empty and the paste menu is disabled
- if(this.clipboard.length > 0 && document.getElementById("useragentswitcher-paste").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-paste").removeAttribute("disabled");
- - }
- + }
- }
- else if(selections == 1)
- {
- var endIndex = {};
- var startIndex = {};
- -
- +
- treeView.selection.getRangeAt(0, startIndex, endIndex);
- -
- +
- // If more than one item is selected
- if(endIndex.value - startIndex.value > 0)
- {
- @@ -742,20 +745,20 @@
- if(document.getElementById("useragentswitcher-copy").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-copy").removeAttribute("disabled");
- - }
- -
- + }
- +
- // If the cut menu is disabled
- if(document.getElementById("useragentswitcher-cut").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-cut").removeAttribute("disabled");
- - }
- -
- + }
- +
- // If the delete menu is disabled
- if(document.getElementById("useragentswitcher-delete-menu").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-delete-menu").removeAttribute("disabled");
- - }
- -
- + }
- +
- document.getElementById("useragentswitcher-edit-menu").setAttribute("disabled", true);
- document.getElementById("useragentswitcher-move-up").setAttribute("disabled", true);
- document.getElementById("useragentswitcher-move-down").setAttribute("disabled", true);
- @@ -764,41 +767,41 @@
- else
- {
- var selectedItem = treeView.getItemAtIndex(startIndex.value);
- -
- +
- // If the copy menu is disabled
- if(document.getElementById("useragentswitcher-copy").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-copy").removeAttribute("disabled");
- - }
- -
- + }
- +
- // If the cut menu is disabled
- if(document.getElementById("useragentswitcher-cut").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-cut").removeAttribute("disabled");
- - }
- -
- + }
- +
- // If the delete menu is disabled
- if(document.getElementById("useragentswitcher-delete-menu").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-delete-menu").removeAttribute("disabled");
- - }
- -
- + }
- +
- // If a separator is selected
- if(this.isSeparatorSelected(selectedItem))
- {
- document.getElementById("useragentswitcher-edit-menu").setAttribute("disabled", true);
- - }
- + }
- else if(document.getElementById("useragentswitcher-edit-menu").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-edit-menu").removeAttribute("disabled");
- - }
- -
- + }
- +
- // If the clipboard is not empty and the paste menu is disabled
- if(this.clipboard.length > 0 && document.getElementById("useragentswitcher-paste").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-paste").removeAttribute("disabled");
- - }
- -
- + }
- +
- // If the selected item is set and has a previous sibling
- if(selectedItem && selectedItem.previousSibling)
- {
- @@ -806,13 +809,13 @@
- if(document.getElementById("useragentswitcher-move-up").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-move-up").removeAttribute("disabled");
- - }
- + }
- }
- else
- {
- document.getElementById("useragentswitcher-move-up").setAttribute("disabled", true);
- }
- -
- +
- // If the selected item is set and has a next sibling
- if(selectedItem && selectedItem.nextSibling)
- {
- @@ -820,13 +823,13 @@
- if(document.getElementById("useragentswitcher-move-down").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-move-down").removeAttribute("disabled");
- - }
- + }
- }
- else
- {
- document.getElementById("useragentswitcher-move-down").setAttribute("disabled", true);
- }
- - }
- + }
- }
- else
- {
- @@ -834,20 +837,20 @@
- if(document.getElementById("useragentswitcher-copy").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-copy").removeAttribute("disabled");
- - }
- -
- + }
- +
- // If the cut menu is disabled
- if(document.getElementById("useragentswitcher-cut").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-cut").removeAttribute("disabled");
- - }
- -
- + }
- +
- // If the delete menu is disabled
- if(document.getElementById("useragentswitcher-delete-menu").hasAttribute("disabled"))
- {
- document.getElementById("useragentswitcher-delete-menu").removeAttribute("disabled");
- - }
- -
- + }
- +
- document.getElementById("useragentswitcher-edit-menu").setAttribute("disabled", true);
- document.getElementById("useragentswitcher-move-up").setAttribute("disabled", true);
- document.getElementById("useragentswitcher-move-down").setAttribute("disabled", true);
- diff -rU3 original/chrome/content/useragentswitcher/upgrade.js profexer/chrome/content/useragentswitcher/upgrade.js
- --- original/chrome/content/useragentswitcher/upgrade.js 2011-01-04 18:53:34.000000000 +0200
- +++ profexer/chrome/content/useragentswitcher/upgrade.js 2012-06-15 23:49:05.000000000 +0300
- @@ -33,13 +33,13 @@
- var userAgentFile = null;
- var xmlDocument = document.implementation.createDocument("", "", null);
- var rootElement = xmlDocument.createElement("useragentswitcher");
- -
- +
- // If the user agent directory does not exist
- if(!UserAgentSwitcherImporter.getUserAgentDirectoryLocation().exists())
- {
- UserAgentSwitcherImporter.createUserAgentDirectory();
- }
- -
- +
- // If the user agent file exists
- if(UserAgentSwitcherImporter.getUserAgentFileLocation().exists())
- {
- @@ -51,12 +51,12 @@
- {
- userAgentFile = UserAgentSwitcherImporter.createUserAgentFile();
- }
- -
- +
- // Loop through the user agents
- for(var i = 1; i <= userAgentCount; i++)
- {
- description = UserAgentSwitcherPreferences.getStringPreference("useragentswitcher." + i + ".description");
- -
- +
- // If the description is set
- if(description)
- {
- @@ -73,7 +73,7 @@
- {
- userAgent.setAttribute("useragent", "");
- }
- -
- +
- // If the app code name is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("useragentswitcher." + i + ".appcodename"))
- {
- @@ -83,7 +83,7 @@
- {
- userAgent.setAttribute("appcodename", "");
- }
- -
- +
- // If the app name is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("useragentswitcher." + i + ".appname"))
- {
- @@ -93,7 +93,7 @@
- {
- userAgent.setAttribute("appname", "");
- }
- -
- +
- // If the app version is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("useragentswitcher." + i + ".appversion"))
- {
- @@ -103,7 +103,7 @@
- {
- userAgent.setAttribute("appversion", "");
- }
- -
- +
- // If the platform is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("useragentswitcher." + i + ".platform"))
- {
- @@ -113,7 +113,18 @@
- {
- userAgent.setAttribute("platform", "");
- }
- -
- +
- + // PROFEDIT: If the oscpu is set
- + if(UserAgentSwitcherPreferences.isPreferenceSet("useragentswitcher." + i + ".oscpu"))
- + {
- + userAgent.setAttribute("oscpu", UserAgentSwitcherPreferences.getStringPreference("useragentswitcher." + i + ".oscpu"));
- + }
- + else
- + {
- + userAgent.setAttribute("oscpu", "");
- + }
- + // ENDPROFEDIT
- +
- // If the vendor is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("useragentswitcher." + i + ".vendor"))
- {
- @@ -123,7 +134,7 @@
- {
- userAgent.setAttribute("vendor", "");
- }
- -
- +
- // If the vendor sub is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("useragentswitcher." + i + ".vendorsub"))
- {
- @@ -133,12 +144,12 @@
- {
- userAgent.setAttribute("vendorsub", "");
- }
- - }
- + }
- rootElement.appendChild(userAgent);
- UserAgentSwitcherPreferences.deletePreferenceBranch("useragentswitcher." + i + ".");
- }
- -
- +
- UserAgentSwitcherPreferences.deletePreference("useragentswitcher.user.agents.count");
- // If old user agents could be migrated
- @@ -148,11 +159,11 @@
- var xmlSerializer = new XMLSerializer();
- xmlDocument.appendChild(rootElement);
- -
- +
- outputStream.init(userAgentFile, 0x04 | 0x08 | 0x20, 00644, null);
- xmlSerializer.serializeToStream(xmlDocument, outputStream, "utf-8");
- outputStream.close();
- - }
- + }
- else
- {
- UserAgentSwitcherImporter.reset();
- @@ -163,10 +174,10 @@
- openUpgradePage: function()
- {
- var windowContent = window.getBrowser();
- -
- +
- windowContent.removeEventListener("load", UserAgentSwitcherUpgrade.openUpgradePage, false);
- - window.setTimeout(function() { windowContent.selectedTab = windowContent.addTab("http://chrispederick.com/work/user-agent-switcher/installed/" + UserAgentSwitcherUpgrade.getVersion().replace(/\./g, "") + "/"); }, 0);
- + window.setTimeout(function() { windowContent.selectedTab = windowContent.addTab("http://chrispederick.com/work/user-agent-switcher/installed/" + UserAgentSwitcherUpgrade.getVersion().replace(/\./g, "") + "/"); }, 0);
- },
- // Parses the version number
- @@ -178,13 +189,13 @@
- var splitVersion = version.split(".");
- var parsedVersion = splitVersion[0] + ".";
- var splitVersionLength = splitVersion.length;
- -
- +
- // Loop through the remaining parts of the version
- for(var i = 1; i < splitVersionLength; i++)
- {
- parsedVersion += splitVersion[i];
- }
- -
- +
- return parseFloat(parsedVersion);
- }
- else
- @@ -192,13 +203,13 @@
- return 0;
- }
- },
- -
- +
- // Sets the version
- setVersion: function()
- {
- UserAgentSwitcherPreferences.setStringPreference("useragentswitcher.version", UserAgentSwitcherUpgrade.getVersion());
- },
- -
- +
- // Upgrades the extension
- upgrade: function()
- {
- @@ -217,7 +228,7 @@
- this.installUserAgents();
- window.getBrowser().addEventListener("load", UserAgentSwitcherUpgrade.openUpgradePage, false);
- -
- +
- UserAgentSwitcherPreferences.setStringPreference("useragentswitcher.version", version);
- }
- }
- diff -rU3 original/chrome/content/useragentswitcher/useragentswitcher.js profexer/chrome/content/useragentswitcher/useragentswitcher.js
- --- original/chrome/content/useragentswitcher/useragentswitcher.js 2011-01-04 18:53:34.000000000 +0200
- +++ profexer/chrome/content/useragentswitcher/useragentswitcher.js 2012-06-16 00:09:41.000000000 +0300
- @@ -1,5 +1,5 @@
- // User Agent Switcher
- -var UserAgentSwitcher =
- +var UserAgentSwitcher =
- {
- // Displays the about dialog
- about: function()
- @@ -12,26 +12,26 @@
- {
- nsDragAndDrop.drop(event, UserAgentSwitcher);
- },
- -
- +
- // Changes the options
- changeOptions: function()
- {
- var hideMenuPreference = false;
- var menu = document.getElementById("useragentswitcher-menu");
- -
- +
- // If the hide menu preference is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("useragentswitcher.menu.hide"))
- {
- hideMenuPreference = UserAgentSwitcherPreferences.getBooleanPreference("useragentswitcher.menu.hide", true);
- }
- -
- +
- // If the menu exists
- if(menu)
- {
- menu.setAttribute("hidden", hideMenuPreference);
- }
- },
- -
- +
- // Finds the selected user agent and returns it's position and description
- findSelectedUserAgent: function()
- {
- @@ -39,28 +39,28 @@
- var userAgent = null;
- var userAgents = document.getElementById("useragentswitcher-popup-menu").getElementsByAttribute("type", "radio");
- var userAgentsLength = userAgents.length;
- -
- +
- selectedUserAgent.description = "";
- selectedUserAgent.position = "";
- -
- +
- // Loop through the user agents
- for(var i = 0; i < userAgentsLength; i++)
- {
- userAgent = userAgents.item(i);
- -
- +
- // If this is the selected user agent
- if(UserAgentSwitcher.isSelectedUserAgent(userAgent))
- {
- selectedUserAgent.description = userAgent.getAttribute("label");
- selectedUserAgent.position = i;
- -
- +
- break;
- }
- }
- -
- +
- return selectedUserAgent;
- },
- -
- +
- // Returns the selected user agents for a particular menu
- getIndividualSelectedUserAgents: function(menu)
- {
- @@ -71,7 +71,7 @@
- {
- var subMenus = menu.getElementsByTagName("menu");
- var subMenusLength = subMenus.length;
- -
- +
- userAgents = userAgents.concat(UserAgentSwitcherArray.convertCollectionToArray(menu.getElementsByAttribute("checked", "true")));
- // Loop through the sub menus
- @@ -83,15 +83,15 @@
- return userAgents;
- },
- -
- +
- // Returns the selected user agents
- getSelectedUserAgents: function(windowDocument)
- {
- return UserAgentSwitcher.getIndividualSelectedUserAgents(windowDocument.getElementById("useragentswitcher-popup-menu")).concat(UserAgentSwitcher.getIndividualSelectedUserAgents(windowDocument.getElementById("useragentswitcher-popup-toolbar")));
- },
- -
- +
- // Return the supported flavours
- - getSupportedFlavours: function()
- + getSupportedFlavours: function()
- {
- var flavourSet = new FlavourSet();
- @@ -99,13 +99,13 @@
- return flavourSet;
- },
- -
- +
- // Opens the help
- help: function()
- {
- window.getBrowser().selectedTab = window.getBrowser().addTab("http://chrispederick.com/work/user-agent-switcher/help/");
- },
- -
- +
- // Initializes the extension
- initialize: function(event)
- {
- @@ -117,13 +117,13 @@
- UserAgentSwitcherUpgrade.upgrade();
- UserAgentSwitcherImporter.import(UserAgentSwitcherImporter.importTypeMenu, UserAgentSwitcherImporter.getUserAgentFileLocation(), true);
- UserAgentSwitcher.initializeDisplay();
- -
- +
- // If the observer service is set
- if(observerService)
- {
- observerService.addObserver(UserAgentSwitcher, "quit-application-requested", false);
- }
- -
- +
- document.getElementById("navigator-toolbox").addEventListener("dragdrop", UserAgentSwitcher.buttonDrop, false);
- window.removeEventListener("load", UserAgentSwitcher.initialize, false);
- }
- @@ -169,24 +169,25 @@
- {
- UserAgentSwitcher.resetUserAgent(allWindows[i].document, defaultUserAgent);
- }
- - }
- + }
- },
- // Returns true if this is the selected user agent
- isSelectedUserAgent: function(userAgent)
- {
- // If all the attributes match
- - if((UserAgentSwitcherPreferences.getStringPreference("general.useragent.appName", true) == userAgent.getAttribute("useragentswitcherappcodename") || (UserAgentSwitcherPreferences.getStringPreference("general.useragent.appName", true) == " " && userAgent.getAttribute("useragentswitcherappcodename") == "")) &&
- + if((UserAgentSwitcherPreferences.getStringPreference("general.useragent.appName", true) == userAgent.getAttribute("useragentswitcherappcodename") || (UserAgentSwitcherPreferences.getStringPreference("general.useragent.appName", true) == " " && userAgent.getAttribute("useragentswitcherappcodename") == "")) &&
- UserAgentSwitcherPreferences.getStringPreference("general.appname.override", true) == userAgent.getAttribute("useragentswitcherappname") &&
- UserAgentSwitcherPreferences.getStringPreference("general.appversion.override", true) == userAgent.getAttribute("useragentswitcherappversion") &&
- UserAgentSwitcherPreferences.getStringPreference("general.platform.override", true) == userAgent.getAttribute("useragentswitcherplatform") &&
- + UserAgentSwitcherPreferences.getStringPreference("general.oscpu.override", true) == userAgent.getAttribute("useragentswitcheroscpu") &&
- UserAgentSwitcherPreferences.getStringPreference("general.useragent.override", true) == userAgent.getAttribute("useragentswitcheruseragent") &&
- UserAgentSwitcherPreferences.getStringPreference("general.useragent.vendor", true) == userAgent.getAttribute("useragentswitchervendor") &&
- UserAgentSwitcherPreferences.getStringPreference("general.useragent.vendorSub", true) == userAgent.getAttribute("useragentswitchervendorsub"))
- {
- return true;
- }
- -
- +
- return false;
- },
- @@ -201,18 +202,18 @@
- return false;
- },
- -
- +
- // Called when a button has been dropped
- - onDrop: function (event, transferData, session)
- + onDrop: function (event, transferData, session)
- {
- // If the User Agent Switcher button was dropped
- if(transferData.data == "useragentswitcher-button")
- {
- UserAgentSwitcherImporter.import(UserAgentSwitcherImporter.importTypeMenu, UserAgentSwitcherImporter.getUserAgentFileLocation(), true);
- - UserAgentSwitcher.initializeDisplay();
- + UserAgentSwitcher.initializeDisplay();
- }
- },
- -
- +
- // Opens a toolbar button automatically if another toolbar button is open on the toolbar
- openToolbarButton: function(currentToolbarButton)
- {
- @@ -222,32 +223,32 @@
- var toolbarButton = null;
- var toolbarButtons = currentToolbarButton.parentNode.getElementsByTagName("toolbarbutton");
- var toolbarButtonsLength = toolbarButtons.length;
- -
- +
- // Loop through the toolbar buttons
- for(var i = 0; i < toolbarButtonsLength; i++)
- {
- toolbarButton = toolbarButtons.item(i);
- -
- +
- // If the toolbar button is set, is not the same toolbar button and is open
- if(toolbarButton && toolbarButton != currentToolbarButton && toolbarButton.open)
- {
- toolbarButton.open = false;
- currentToolbarButton.open = true;
- -
- +
- break;
- }
- }
- }
- },
- -
- +
- // Displays the options dialog
- options: function()
- {
- window.openDialog("chrome://useragentswitcher/content/options/options.xul", "useragentswitcher-options-dialog", "centerscreen,chrome,modal,resizable");
- -
- +
- UserAgentSwitcher.changeOptions();
- },
- -
- +
- // Resets the user agent
- reset: function()
- {
- @@ -260,37 +261,44 @@
- {
- UserAgentSwitcherPreferences.deletePreference("general.useragent.appName");
- }
- -
- +
- // If an override app name is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.appname.override"))
- {
- UserAgentSwitcherPreferences.deletePreference("general.appname.override");
- }
- -
- +
- // If an override app version is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.appversion.override"))
- {
- UserAgentSwitcherPreferences.deletePreference("general.appversion.override");
- }
- -
- +
- // If an override platform is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.platform.override"))
- {
- UserAgentSwitcherPreferences.deletePreference("general.platform.override");
- }
- -
- +
- + // PROFEDIT: If an override oscpu is set
- + if(UserAgentSwitcherPreferences.isPreferenceSet("general.oscpu.override"))
- + {
- + UserAgentSwitcherPreferences.deletePreference("general.oscpu.override");
- + }
- + // ENDPROFEDIT
- +
- // If an override user agent is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.useragent.override"))
- {
- UserAgentSwitcherPreferences.deletePreference("general.useragent.override");
- }
- -
- +
- // If an override vendor is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.useragent.vendor"))
- {
- UserAgentSwitcherPreferences.deletePreference("general.useragent.vendor");
- }
- -
- +
- // If an override vendor sub is set
- if(UserAgentSwitcherPreferences.isPreferenceSet("general.useragent.vendorSub"))
- {
- @@ -324,22 +332,22 @@
- // If the user agent button is set
- if(userAgentButton)
- - {
- + {
- // If the user agent button has a default attribute
- if(userAgentButton.hasAttribute("default"))
- {
- userAgentButton.removeAttribute("default");
- - }
- + }
- userAgentButton.setAttribute("label", defaultUserAgent);
- userAgentButton.setAttribute("tooltiptext", defaultUserAgent);
- }
- -
- +
- // Loop through the selected user agents
- for(var i = 0; i < selectedUserAgentsLength; i++)
- {
- selectedUserAgent = selectedUserAgents[i];
- -
- +
- // If the selected user agent does not have an id or the id is not the default
- if(!selectedUserAgent.hasAttribute("id") || selectedUserAgent.getAttribute("id").indexOf("useragentswitcher-default-") != 0)
- {
- @@ -376,7 +384,7 @@
- {
- userAgentMenu.setAttribute("image", "chrome://useragentswitcher/skin/non-default.png");
- - // If the selected user agent description is set
- + // If the selected user agent description is set
- if(selectedUserAgentDescription)
- {
- userAgentMenu.setAttribute("label", selectedUserAgentDescription);
- @@ -385,22 +393,22 @@
- // If the user agent button is set
- if(userAgentButton)
- - {
- + {
- userAgentButton.setAttribute("default", "false");
- - // If the selected user agent description is set
- + // If the selected user agent description is set
- if(selectedUserAgentDescription)
- {
- userAgentButton.setAttribute("label", selectedUserAgentDescription);
- userAgentButton.setAttribute("tooltiptext", selectedUserAgentDescription);
- }
- }
- -
- +
- // Loop through the selected user agents
- for(var i = 0; i < selectedUserAgentsLength; i++)
- {
- selectedUserAgent = selectedUserAgents[i];
- -
- +
- // If the selected user agent does not have an id or the id does not match the position
- if(!selectedUserAgent.hasAttribute("id") || selectedUserAgent.getAttribute("id").indexOf("useragentswitcher-user-agent-" + position + "-") != 0)
- {
- @@ -420,7 +428,7 @@
- positionToolbar.setAttribute("checked", true);
- }
- },
- -
- +
- // Switches the user agent
- switchUserAgent: function(userAgent)
- {
- @@ -429,17 +437,18 @@
- var appCodeName = userAgent.getAttribute("useragentswitcherappcodename");
- var position = userAgent.getAttribute("useragentswitcherposition");
- var userAgentDescription = userAgent.getAttribute("label");
- -
- +
- // If the app code name is not set add a space since an empty app code name is ignored
- if(!appCodeName)
- {
- appCodeName = " ";
- }
- -
- +
- UserAgentSwitcherPreferences.setStringPreference("general.useragent.appName", appCodeName);
- UserAgentSwitcherPreferences.setStringPreference("general.appname.override", userAgent.getAttribute("useragentswitcherappname"));
- UserAgentSwitcherPreferences.setStringPreference("general.appversion.override", userAgent.getAttribute("useragentswitcherappversion"));
- UserAgentSwitcherPreferences.setStringPreference("general.platform.override", userAgent.getAttribute("useragentswitcherplatform"));
- + UserAgentSwitcherPreferences.setStringPreference("general.oscpu.override", userAgent.getAttribute("useragentswitcheroscpu"));
- UserAgentSwitcherPreferences.setStringPreference("general.useragent.override", userAgent.getAttribute("useragentswitcheruseragent"));
- UserAgentSwitcherPreferences.setStringPreference("general.useragent.vendor", userAgent.getAttribute("useragentswitchervendor"));
- UserAgentSwitcherPreferences.setStringPreference("general.useragent.vendorSub", userAgent.getAttribute("useragentswitchervendorsub"));
- @@ -450,13 +459,13 @@
- UserAgentSwitcher.selectUserAgent(allWindows[i].document, position, userAgentDescription);
- }
- },
- -
- +
- // Opens the test page
- test: function()
- {
- window.getBrowser().selectedTab = window.getBrowser().addTab("http://chrispederick.com/work/user-agent-switcher/features/test/");
- },
- -
- +
- // Uninitializes the extension
- uninitialize: function(event)
- {
- @@ -464,27 +473,27 @@
- try
- {
- var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
- -
- +
- // If the observer service is set
- if(observerService)
- {
- observerService.removeObserver(UserAgentSwitcher, "quit-application-requested", false);
- }
- -
- +
- // If the reset on close preference is not set or is set to true
- if(!UserAgentSwitcherPreferences.isPreferenceSet("useragentswitcher.reset.onclose") || UserAgentSwitcherPreferences.getBooleanPreference("useragentswitcher.reset.onclose", true))
- {
- var allWindows = UserAgentSwitcherDOM.getAllWindows();
- var windowCount = allWindows.length;
- -
- +
- // If this is the last window closing
- if(windowCount == 0)
- {
- UserAgentSwitcher.reset();
- }
- }
- -
- - document.getElementById("navigator-toolbox").removeEventListener("dragdrop", UserAgentSwitcher.buttonDrop, false);
- +
- + document.getElementById("navigator-toolbox").removeEventListener("dragdrop", UserAgentSwitcher.buttonDrop, false);
- window.removeEventListener("close", UserAgentSwitcher.uninitialize, false);
- }
- catch(exception)
- diff -rU3 original/chrome/content/useragentswitcher/xml/export.js profexer/chrome/content/useragentswitcher/xml/export.js
- --- original/chrome/content/useragentswitcher/xml/export.js 2011-01-04 18:53:34.000000000 +0200
- +++ profexer/chrome/content/useragentswitcher/xml/export.js 2012-06-16 00:05:00.000000000 +0300
- @@ -12,7 +12,7 @@
- {
- file.create(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 00644);
- }
- -
- +
- // If the file exists, is a file and is writable
- if(file.exists() && file.isFile() && file.isWritable())
- {
- @@ -21,9 +21,9 @@
- var xmlDocument = document.implementation.createDocument("", "", null);
- var rootElement = xmlDocument.createElement("useragentswitcher");
- var xmlSerializer = new XMLSerializer();
- -
- +
- this.exportFile(document.getElementById("useragentswitcher-options-user-agents").childNodes, rootElement, xmlDocument);
- -
- +
- xmlDocument.appendChild(rootElement);
- outputStream.init(file, 0x04 | 0x08 | 0x20, 00644, null);
- @@ -39,7 +39,7 @@
- {
- UserAgentSwitcherLog.log("UserAgentSwitcherExporter.export", exception);
- }
- -
- +
- return null;
- },
- @@ -52,7 +52,7 @@
- for(var i = 0; i < elementsLength; i++)
- {
- var element = elements[i];
- -
- +
- // If the element is a separator
- if(element.nodeName == "treeseparator")
- {
- @@ -68,7 +68,7 @@
- }
- }
- },
- -
- +
- // Exports a folder
- exportFolder: function(element, parentElement, xmlDocument)
- {
- @@ -82,7 +82,7 @@
- }
- this.exportFile(element.getElementsByTagName("treechildren")[0].childNodes, folder, xmlDocument);
- -
- +
- parentElement.appendChild(folder);
- },
- @@ -91,12 +91,12 @@
- {
- parentElement.appendChild(xmlDocument.createElement("separator"));
- },
- -
- +
- // Exports a user agent
- exportUserAgent: function(element, parentElement, xmlDocument)
- {
- var userAgentElement = element.getElementsByTagName("treerow")[0].getElementsByTagName("treecell")[0];
- -
- +
- // If the user agent has a label
- if(userAgentElement.hasAttribute("label"))
- {
- @@ -113,7 +113,7 @@
- {
- userAgent.setAttribute("useragent", "");
- }
- -
- +
- // If the app code name is set
- if(userAgentElement.hasAttribute("useragentswitcherappcodename"))
- {
- @@ -123,7 +123,7 @@
- {
- userAgent.setAttribute("appcodename", "");
- }
- -
- +
- // If the app name is set
- if(userAgentElement.hasAttribute("useragentswitcherappname"))
- {
- @@ -133,7 +133,7 @@
- {
- userAgent.setAttribute("appname", "");
- }
- -
- +
- // If the app version is set
- if(userAgentElement.hasAttribute("useragentswitcherappversion"))
- {
- @@ -143,7 +143,7 @@
- {
- userAgent.setAttribute("appversion", "");
- }
- -
- +
- // If the platform is set
- if(userAgentElement.hasAttribute("useragentswitcherplatform"))
- {
- @@ -153,7 +153,18 @@
- {
- userAgent.setAttribute("platform", "");
- }
- -
- +
- + // PROFEDIT: If the oscpu is set
- + if(userAgentElement.hasAttribute("useragentswitcheroscpu"))
- + {
- + userAgent.setAttribute("oscpu", userAgentElement.getAttribute("useragentswitcheroscpu"));
- + }
- + else
- + {
- + userAgent.setAttribute("oscpu", "");
- + }
- + // ENDPROFEDIT
- +
- // If the vendor is set
- if(userAgentElement.hasAttribute("useragentswitchervendor"))
- {
- @@ -163,7 +174,7 @@
- {
- userAgent.setAttribute("vendor", "");
- }
- -
- +
- // If the vendor sub is set
- if(userAgentElement.hasAttribute("useragentswitchervendorsub"))
- {
- @@ -173,7 +184,7 @@
- {
- userAgent.setAttribute("vendorsub", "");
- }
- -
- +
- parentElement.appendChild(userAgent);
- }
- },
- diff -rU3 original/chrome/content/useragentswitcher/xml/import.js profexer/chrome/content/useragentswitcher/xml/import.js
- --- original/chrome/content/useragentswitcher/xml/import.js 2011-01-04 18:53:34.000000000 +0200
- +++ profexer/chrome/content/useragentswitcher/xml/import.js 2012-06-16 00:05:42.000000000 +0300
- @@ -4,11 +4,11 @@
- importType: 0,
- importTypeMenu: 1,
- importTypeOptions: 2,
- -
- +
- folderCount: 0,
- separatorCount: 0,
- userAgentCount: 0,
- -
- +
- menuParentFolder: null,
- optionsParentFolder: null,
- toolbarParentFolder: null,
- @@ -31,14 +31,14 @@
- {
- var menu = this.importDocument.getElementById("useragentswitcher-popup-" + suffix);
- var optionsSeparator = this.importDocument.getElementById("useragentswitcher-separator-2-" + suffix);
- -
- +
- // If the menu and options separator exist
- if(menu && optionsSeparator)
- - {
- + {
- menu.insertBefore(newMenu, optionsSeparator);
- - }
- + }
- }
- -
- +
- return newMenu;
- },
- @@ -58,12 +58,12 @@
- {
- var menu = this.importDocument.getElementById("useragentswitcher-popup-" + suffix);
- var optionsSeparator = this.importDocument.getElementById("useragentswitcher-separator-2-" + suffix);
- -
- +
- // If the menu and options separator exist
- if(menu && optionsSeparator)
- - {
- + {
- menu.insertBefore(newMenuSeparator, optionsSeparator);
- - }
- + }
- }
- },
- @@ -73,7 +73,7 @@
- var newMenuItem = menuItem.cloneNode(false);
- newMenuItem.setAttribute("id", "useragentswitcher-user-agent-" + this.userAgentCount + "-" + suffix);
- - newMenuItem.setAttribute("name", "useragentswitcher-group-" + suffix);
- + newMenuItem.setAttribute("name", "useragentswitcher-group-" + suffix);
- // If the parent folder is set
- if(parentFolder)
- @@ -84,12 +84,12 @@
- {
- var menu = this.importDocument.getElementById("useragentswitcher-popup-" + suffix);
- var optionsSeparator = this.importDocument.getElementById("useragentswitcher-separator-2-" + suffix);
- -
- +
- // If the menu and options separator exist
- if(menu && optionsSeparator)
- - {
- + {
- menu.insertBefore(newMenuItem, optionsSeparator);
- - }
- + }
- }
- },
- @@ -139,7 +139,7 @@
- createUserAgentDirectory: function()
- {
- var userAgentDirectory = this.getUserAgentDirectoryLocation();
- -
- +
- userAgentDirectory.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755);
- },
- @@ -150,7 +150,7 @@
- userAgentFile.initWithPath(this.getUserAgentFileLocation().path);
- userAgentFile.create(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 00644);
- -
- +
- return userAgentFile;
- },
- @@ -163,15 +163,15 @@
- var ownerDocument = element.ownerDocument;
- var xPathEvaluator = new XPathEvaluator();
- var resolver = xPathEvaluator.createNSResolver(element.ownerDocument == null ? element.documentElement : element.ownerDocument.documentElement);
- -
- +
- evaluationResults = xPathEvaluator.evaluate(expression, element, resolver, 0, null);
- -
- +
- // While there are more matching elements
- while((matchingElement = evaluationResults.iterateNext()) != null)
- {
- matchingElements.push(matchingElement);
- }
- -
- +
- return matchingElements;
- },
- @@ -180,11 +180,11 @@
- {
- var existingCounts = {};
- var userAgentTree = this.importDocument.getElementById("useragentswitcher-options-user-agents");
- -
- +
- existingCounts.folderCount = UserAgentSwitcherDOM.findElementsByXPath(userAgentTree, "//treeitem[@container='true']").length;
- existingCounts.separatorCount = UserAgentSwitcherDOM.findElementsByXPath(userAgentTree, "//treeseparator").length;
- existingCounts.userAgentCount = UserAgentSwitcherDOM.findElementsByXPath(userAgentTree, "//treeitem[not(@container)]").length;
- -
- +
- return existingCounts;
- },
- @@ -194,7 +194,7 @@
- var directory = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsILocalFile);
- directory.append("useragentswitcher");
- -
- +
- return directory;
- },
- @@ -202,9 +202,9 @@
- getUserAgentFileLocation: function()
- {
- var file = this.getUserAgentDirectoryLocation();
- -
- +
- file.append("useragents.xml");
- -
- +
- return file;
- },
- @@ -219,12 +219,12 @@
- {
- var request = new XMLHttpRequest();
- var xmlDocument = null;
- -
- +
- request.open("get", "file://" + file.path, false);
- request.send(null);
- -
- +
- xmlDocument = request.responseXML;
- -
- +
- // If the file could not be parsed correctly
- if(xmlDocument.documentElement.nodeName == "parsererror")
- {
- @@ -242,16 +242,16 @@
- if(type == this.importTypeOptions)
- {
- this.importDocument = document;
- -
- +
- // If the overwrite preference is set
- if(this.importDocument.getElementById("useragentswitcher-import-overwrite").checked)
- {
- - UserAgentSwitcherDOM.removeAllChildElements(this.importDocument.getElementById("useragentswitcher-options-user-agents"));
- + UserAgentSwitcherDOM.removeAllChildElements(this.importDocument.getElementById("useragentswitcher-options-user-agents"));
- }
- else
- {
- var existingCounts = this.getExistingCounts();
- -
- +
- this.folderCount = existingCounts.folderCount;
- this.separatorCount = existingCounts.separatorCount;
- this.userAgentCount = existingCounts.userAgentCount;
- @@ -260,11 +260,11 @@
- else
- {
- this.setImportDocument(ignoreParentWindow);
- - this.removeUserAgents();
- + this.removeUserAgents();
- }
- -
- +
- this.importFile(xmlDocument.documentElement);
- -
- +
- // If nothing was imported
- if(this.separatorCount == 0 && this.folderCount == 0 && this.userAgentCount == 0)
- {
- @@ -284,7 +284,7 @@
- return null;
- },
- -
- +
- // Imports the user agents
- importFile: function(rootNode)
- {
- @@ -302,23 +302,23 @@
- {
- this.userAgentCount++;
- - this.importUserAgent(element);
- + this.importUserAgent(element);
- }
- else if(element.nodeName == "folder")
- {
- - this.folderCount++;
- + this.folderCount++;
- - this.importFolder(element);
- + this.importFolder(element);
- }
- else if(element.nodeName == "separator")
- {
- this.separatorCount++;
- - this.importSeparator();
- + this.importSeparator();
- }
- }
- },
- -
- +
- // Imports a folder
- importFolder: function(folderElement)
- {
- @@ -328,22 +328,22 @@
- var menu = this.importDocument.createElement("menu");
- var previousMenuParentFolder = this.menuParentFolder;
- var previousToolbarParentFolder = this.toolbarParentFolder;
- -
- +
- // If the folder element has a description attribute
- if(folderElement.hasAttribute("description"))
- {
- menu.setAttribute("label", folderElement.getAttribute("description"));
- }
- -
- +
- menu.appendChild(this.importDocument.createElement("menupopup"));
- -
- - this.menuParentFolder = this.addMenuFolder(menu, "menu", this.menuParentFolder);
- - this.toolbarParentFolder = this.addMenuFolder(menu, "toolbar", this.toolbarParentFolder);
- -
- +
- + this.menuParentFolder = this.addMenuFolder(menu, "menu", this.menuParentFolder);
- + this.toolbarParentFolder = this.addMenuFolder(menu, "toolbar", this.toolbarParentFolder);
- +
- this.importFile(folderElement);
- -
- - this.menuParentFolder = previousMenuParentFolder;
- - this.toolbarParentFolder = previousToolbarParentFolder;
- +
- + this.menuParentFolder = previousMenuParentFolder;
- + this.toolbarParentFolder = previousToolbarParentFolder;
- }
- else if(this.importType == this.importTypeOptions)
- {
- @@ -352,7 +352,7 @@
- var treeChildren = this.importDocument.createElement("treechildren");
- var treeItem = this.importDocument.createElement("treeitem");
- var treeRow = this.importDocument.createElement("treerow");
- -
- +
- // If the folder element has a description attribute
- if(folderElement.hasAttribute("description"))
- {
- @@ -364,17 +364,17 @@
- treeRow.appendChild(treeCell);
- treeItem.appendChild(treeRow);
- treeItem.appendChild(treeChildren);
- -
- - this.addOptionsFolder(treeItem);
- -
- +
- + this.addOptionsFolder(treeItem);
- +
- this.optionsParentFolder = treeChildren;
- -
- +
- this.importFile(folderElement);
- -
- +
- this.optionsParentFolder = previousParentFolder
- }
- },
- -
- +
- // Imports a separator
- importSeparator: function()
- {
- @@ -382,16 +382,16 @@
- if(this.importType == this.importTypeMenu)
- {
- var menuSeparator = this.importDocument.createElement("menuseparator");
- -
- - this.addMenuSeparator(menuSeparator, "menu", this.menuParentFolder);
- - this.addMenuSeparator(menuSeparator, "toolbar", this.toolbarParentFolder);
- +
- + this.addMenuSeparator(menuSeparator, "menu", this.menuParentFolder);
- + this.addMenuSeparator(menuSeparator, "toolbar", this.toolbarParentFolder);
- }
- else if(this.importType == this.importTypeOptions)
- {
- - this.addOptionsSeparator(this.importDocument.createElement("treeseparator"));
- + this.addOptionsSeparator(this.importDocument.createElement("treeseparator"));
- }
- },
- -
- +
- // Imports a user agent
- importUserAgent: function(userAgentElement)
- {
- @@ -402,32 +402,32 @@
- if(this.importType == this.importTypeMenu)
- {
- var menuItem = this.importDocument.createElement("menuitem");
- -
- +
- this.populateUserAgent(menuItem, userAgentElement);
- -
- +
- menuItem.setAttribute("oncommand", "UserAgentSwitcher.switchUserAgent(this)");
- menuItem.setAttribute("type", "radio");
- menuItem.setAttribute("useragentswitcherposition", this.userAgentCount);
- -
- - this.addMenuUserAgent(menuItem, "menu", this.menuParentFolder);
- - this.addMenuUserAgent(menuItem, "toolbar", this.toolbarParentFolder);
- +
- + this.addMenuUserAgent(menuItem, "menu", this.menuParentFolder);
- + this.addMenuUserAgent(menuItem, "toolbar", this.toolbarParentFolder);
- }
- else if(this.importType == this.importTypeOptions)
- {
- var treeCell = this.importDocument.createElement("treecell");
- var treeItem = this.importDocument.createElement("treeitem");
- var treeRow = this.importDocument.createElement("treerow");
- -
- +
- this.populateUserAgent(treeCell, userAgentElement);
- -
- +
- treeRow.appendChild(treeCell);
- treeItem.appendChild(treeRow);
- - this.addOptionsUserAgent(treeItem);
- + this.addOptionsUserAgent(treeItem);
- }
- }
- },
- -
- +
- // Populates a user agent
- populateUserAgent: function(userAgent, userAgentElement)
- {
- @@ -473,6 +473,17 @@
- userAgent.setAttribute("useragentswitcherplatform", "");
- }
- + // PROFEDIT: If the user agent element has a oscpu attribute
- + if(userAgentElement.hasAttribute("oscpu"))
- + {
- + userAgent.setAttribute("useragentswitcheroscpu", userAgentElement.getAttribute("oscpu"));
- + }
- + else
- + {
- + userAgent.setAttribute("useragentswitcheroscpu", "");
- + }
- + // ENDPROFEDIT
- +
- // If the user agent element has a useragent attribute
- if(userAgentElement.hasAttribute("useragent"))
- {
- @@ -503,7 +514,7 @@
- userAgent.setAttribute("useragentswitchervendorsub", "");
- }
- },
- -
- +
- // Removes the user agents from the menu
- removeMenuUserAgents: function(suffix)
- {
- @@ -511,7 +522,7 @@
- // If the options separator exists
- if(optionsSeparator)
- - {
- + {
- // Remove the next sibling to the top separator if it exists and is not the bottom separator
- while(optionsSeparator.nextSibling && optionsSeparator.nextSibling.getAttribute("id") != "useragentswitcher-separator-2-" + suffix)
- {
- @@ -519,14 +530,14 @@
- }
- }
- },
- -
- +
- // Removes the user agents
- removeUserAgents: function()
- {
- this.removeMenuUserAgents("menu");
- this.removeMenuUserAgents("toolbar");
- },
- -
- +
- // Resets the user agent file
- reset: function()
- {
- @@ -541,14 +552,14 @@
- outputStream.init(userAgentFile, 0x04 | 0x08 | 0x20, 00644, null);
- outputStream.write(request.responseText, request.responseText.length);
- - outputStream.close();
- + outputStream.close();
- },
- // Sets the import document
- setImportDocument: function(ignoreParentWindow)
- {
- this.importDocument = document;
- -
- +
- // If not ignoring the parent window and there is a parent window
- if(!ignoreParentWindow && window.opener)
- {
- diff -rU3 original/chrome/content/useragentswitcher/xml/useragents.xml profexer/chrome/content/useragentswitcher/xml/useragents.xml
- --- original/chrome/content/useragentswitcher/xml/useragents.xml 2011-01-04 18:53:34.000000000 +0200
- +++ profexer/chrome/content/useragentswitcher/xml/useragents.xml 2012-06-16 00:28:37.000000000 +0300
- @@ -1,13 +1,13 @@
- <useragentswitcher>
- <folder description="Internet Explorer">
- - <useragent description="Internet Explorer 6" useragent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" appcodename="Mozilla" appname="Microsoft Internet Explorer" appversion="4.0 (compatible; MSIE 6.0; Windows NT 5.1)" platform="Win32" vendor="" vendorsub=""/>
- - <useragent description="Internet Explorer 7" useragent="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)" appcodename="Mozilla" appname="Microsoft Internet Explorer" appversion="4.0 (compatible; MSIE 7.0; Windows NT 6.0)" platform="Win32" vendor="" vendorsub=""/>
- - <useragent description="Internet Explorer 8" useragent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)" appcodename="Mozilla" appname="Microsoft Internet Explorer" appversion="4.0 (compatible; MSIE 8.0; Windows NT 6.1)" platform="Win32" vendor="" vendorsub=""/>
- + <useragent description="Internet Explorer 6" useragent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" appcodename="Mozilla" appname="Microsoft Internet Explorer" appversion="4.0 (compatible; MSIE 6.0; Windows NT 5.1)" platform="Win32" oscpu="Windows NT 5.1" vendor="" vendorsub=""/>
- + <useragent description="Internet Explorer 7" useragent="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)" appcodename="Mozilla" appname="Microsoft Internet Explorer" appversion="4.0 (compatible; MSIE 7.0; Windows NT 6.0)" platform="Win32" oscpu="Windows NT 6.0" vendor="" vendorsub=""/>
- + <useragent description="Internet Explorer 8" useragent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)" appcodename="Mozilla" appname="Microsoft Internet Explorer" appversion="4.0 (compatible; MSIE 8.0; Windows NT 6.1)" platform="Win32" oscpu="Windows NT 6.1" vendor="" vendorsub=""/>
- </folder>
- <folder description="Search Robots">
- - <useragent description="Googlebot 2.1" useragent="Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" appcodename="" appname="" appversion="" platform="" vendor="" vendorsub=""/>
- - <useragent description="Msnbot 1.1" useragent="msnbot/1.1 (+http://search.msn.com/msnbot.htm)" appcodename="" appname="" appversion="" platform="" vendor="" vendorsub=""/>
- - <useragent description="Yahoo Slurp" useragent="Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" appcodename="" appname="" appversion="" platform="" vendor="" vendorsub=""/>
- + <useragent description="Googlebot 2.1" useragent="Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" appcodename="" appname="" appversion="" platform="" oscpu="" vendor="" vendorsub=""/>
- + <useragent description="Msnbot 1.1" useragent="msnbot/1.1 (+http://search.msn.com/msnbot.htm)" appcodename="" appname="" appversion="" platform="" oscpu="" vendor="" vendorsub=""/>
- + <useragent description="Yahoo Slurp" useragent="Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" appcodename="" appname="" appversion="" platform="" oscpu="" vendor="" vendorsub=""/>
- </folder>
- - <useragent description="iPhone 3.0" useragent="Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16" appcodename="Mozilla" appname="Netscape" appversion="5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16" platform="iPhone" vendor="Apple Computer, Inc." vendorsub=""/>
- -</useragentswitcher>
- \ No newline at end of file
- + <useragent description="iPhone 3.0" useragent="Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16" appcodename="Mozilla" appname="Netscape" appversion="5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16" platform="iPhone" oscpu="iPhone" vendor="Apple Computer, Inc." vendorsub=""/>
- +</useragentswitcher>
- diff -rU3 original/chrome/locale/en-US/useragentswitcher/useragentswitcher.dtd profexer/chrome/locale/en-US/useragentswitcher/useragentswitcher.dtd
- --- original/chrome/locale/en-US/useragentswitcher/useragentswitcher.dtd 2011-01-04 18:53:36.000000000 +0200
- +++ profexer/chrome/locale/en-US/useragentswitcher/useragentswitcher.dtd 2012-06-15 23:48:15.000000000 +0300
- @@ -40,6 +40,7 @@
- <!ENTITY useragentswitcher.options.title "User Agent Switcher Options">
- <!ENTITY useragentswitcher.paste "Paste">
- <!ENTITY useragentswitcher.platform "Platform:">
- +<!ENTITY useragentswitcher.oscpu "OSCPU:">
- <!ENTITY useragentswitcher.reset.options "Reset Options...">
- <!ENTITY useragentswitcher.test "Test...">
- <!ENTITY useragentswitcher.test.key "T">
- Binary files original/chrome/useragentswitcher.jar and profexer/chrome/useragentswitcher.jar differ
- diff -rU3 original/install.js profexer/install.js
- --- original/install.js 2011-01-04 18:53:36.000000000 +0200
- +++ profexer/install.js 2012-06-16 00:23:16.000000000 +0300
- @@ -1,6 +1,6 @@
- -var author = "Chris Pederick";
- +var author = "Created by: Chris Pederick, Edited by: Profexer";
- var contentFlag = CONTENT | PROFILE_CHROME;
- -var displayName = "User Agent Switcher";
- +var displayName = "User Agent Switcher (Profexer edition)";
- var error = null;
- var folder = getFolder("Current User", "chrome");
- var localeFlag = LOCALE | PROFILE_CHROME;
- @@ -68,4 +68,4 @@
- {
- alert("The installation of the " + displayName + " extension failed.\nThe error code is: " + error);
- }
- -}
- \ No newline at end of file
- +}
- diff -rU3 original/install.rdf profexer/install.rdf
- --- original/install.rdf 2011-01-04 18:53:36.000000000 +0200
- +++ profexer/install.rdf 2012-06-16 00:21:48.000000000 +0300
- @@ -4,16 +4,16 @@
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
- <Description about="urn:mozilla:install-manifest">
- - <em:aboutURL>chrome://useragentswitcher/content/about/about.xul</em:aboutURL>
- - <em:creator>Chris Pederick</em:creator>
- + <!--<em:aboutURL>chrome://useragentswitcher/content/about/about.xul</em:aboutURL>-->
- + <em:creator>Created by: Chris Pederick, Edited by: Profexer</em:creator>
- <em:description>Adds a menu and a toolbar button to switch the user agent of a browser.</em:description>
- - <em:homepageURL>http://chrispederick.com/work/user-agent-switcher/</em:homepageURL>
- + <!--<em:homepageURL>http://chrispederick.com/work/user-agent-switcher/</em:homepageURL>-->
- <em:iconURL>chrome://useragentswitcher/content/logo.png</em:iconURL>
- <em:id>{e968fc70-8f95-4ab9-9e79-304de2a71ee1}</em:id>
- - <em:name>User Agent Switcher</em:name>
- + <em:name>User Agent Switcher (Profexer edition)</em:name>
- <em:optionsURL>chrome://useragentswitcher/content/options/options.xul</em:optionsURL>
- - <em:updateInfoURL>http://chrispederick.com/work/user-agent-switcher/history/</em:updateInfoURL>
- - <em:version>0.7.3</em:version>
- + <!--<em:updateInfoURL>http://chrispederick.com/work/user-agent-switcher/history/</em:updateInfoURL>-->
- + <em:version>0.7.3 (PE)</em:version>
- <em:file>
- <Description about="urn:mozilla:extension:file:useragentswitcher.jar">
- <em:locale>locale/en-US/useragentswitcher/</em:locale>
- @@ -44,10 +44,10 @@
- </em:targetApplication>
- <em:targetApplication>
- <Description>
- - <em:id>songbird@songbirdnest.com</em:id>
- + <!--<em:id>songbird@songbirdnest.com</em:id>-->
- <em:maxVersion>1.8.*</em:maxVersion>
- <em:minVersion>1.0</em:minVersion>
- </Description>
- </em:targetApplication>
- </Description>
- -</RDF>
- \ No newline at end of file
- +</RDF>
- Only in original/: original.xpi
- Only in profexer/: profexer.xpi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement