diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.032/source/chrome/content/common.js releases/unplug-2.03/source/chrome/content/common.js 1,149d0 < /* < * _ ___ < * /\ / /___ / _ \ /\ /\ _ ___ < * / // // _ \ / // // // // // _ \ < * / // // // / / ___// // // // // / < * \___//_//_/ /_/ /_/ \___/ \_ / < * \___/ < * < * Compunach UnPlug < * Copyright (C) 2010 David Batley < * < * This program is free software: you can redistribute it and/or modify < * it under the terms of the GNU Affero General Public License as < * published by the Free Software Foundation, either version 3 of the < * License, or (at your option) any later version. < * < * This program is distributed in the hope that it will be useful, < * but WITHOUT ANY WARRANTY; without even the implied warranty of < * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the < * GNU General Public License for more details. < * < * You should have received a copy of the GNU Affero General Public License < * along with this program. If not, see . < * < */ < < /** < * Common things which need to be loaded everywhere, < * such as getting settings. < */ < UnPlug2 = { < UnPlug2 : function () { < var prefs_service = Components.classes["@mozilla.org/preferences-service;1"] < .getService(Components.interfaces.nsIPrefService) < this._prefs = prefs_service.getBranch("extensions.unplug2."); < this._root_prefs = prefs_service.getBranch(""); < this._locale = Components.classes["@mozilla.org/intl/stringbundle;1"] < .getService(Components.interfaces.nsIStringBundleService) < .createBundle("chrome://unplug/locale/strings.txt"); < this._js_console = Components.classes["@mozilla.org/consoleservice;1"] < .getService(Components.interfaces.nsIConsoleService); < this._re_trim = /^\s*(.*?)\s*$/m; < }, < < /** < * get_pref < * return value of an unplug setting (or def if it doesn't exist) < */ < get_pref : function (name, def) { < return UnPlug2._get_pref(name, def, UnPlug2._prefs); < }, < < /** < * return value of a pref (or def if it doesn't exist < */ < get_root_pref : function (name, def) { < return UnPlug2._get_pref(name, def, UnPlug2._root_prefs); < }, < < _get_pref : function (name, def, prefs) { < switch (prefs.getPrefType(name)) { < case prefs.PREF_STRING: < return prefs.getCharPref(name); < case prefs.PREF_INT: < return prefs.getIntPref(name); < case prefs.PREF_BOOL: < return prefs.getBoolPref(name); < default: < return def; < } < }, < < /** < * set_pref < * set value of an unplug setting < */ < set_pref : function (name, value) { < switch (typeof(value)) { < case "number": < this._prefs.setIntPref(name, value); < break < case "boolean": < this._prefs.setBoolPref(name, value); < break < case "string": < this._prefs.setCharPref(name, value); < break < default: < throw "Cannot set pref of type" + typeof(value); < } < }, < < /** < * return a translated version of the string < */ < str : function (name) { < try { < return this._locale.GetStringFromName(name) < } catch(e) { < return "#{" + name + "}"; < } < }, < < /** < * Print to js console log < */ < log : function (msg) { < this._js_console.logStringMessage("UnPlug2: " + msg); < }, < < /** < * document.getElelementById for xml files < */ < get_element : function (node, tagname, idname) { < var ellist = node.getElementsByTagName(tagname); < for (var i=0; i < ellist.length; i++) { < if (ellist[i].getAttribute("id") == idname) { < return ellist[i] < } < } < return null; < }, < < trim : function (x) { < if (!x) < return ""; < return UnPlug2._re_trim.exec(x)[1]; < }, < < toString : function () { < return ""; < }, < < // these should be updated by hand: < version : 2.032, < codename : "sprawl", < < // the following line is auto-generated by upload.sh: < revision : 201008291635, < < // do one-time setup stuff: < setup_number : 1, < < end_of_object : 1 } < < // init < UnPlug2.UnPlug2(); < < diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.032/source/chrome/content/config/config.js releases/unplug-2.03/source/chrome/content/config/config.js 1,159d0 < /* < * _ ___ < * /\ / /___ / _ \ /\ /\ _ ___ < * / // // _ \ / // // // // // _ \ < * / // // // / / ___// // // // // / < * \___//_//_/ /_/ /_/ \___/ \_ / < * \___/ < * < * Compunach UnPlug < * Copyright (C) 2010 David Batley < * < * This program is free software: you can redistribute it and/or modify < * it under the terms of the GNU Affero General Public License as < * published by the Free Software Foundation, either version 3 of the < * License, or (at your option) any later version. < * < * This program is distributed in the hope that it will be useful, < * but WITHOUT ANY WARRANTY; without even the implied warranty of < * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the < * GNU General Public License for more details. < * < * You should have received a copy of the GNU Affero General Public License < * along with this program. If not, see . < * < */ < < function do_load() { < if (window.arguments && window.arguments.length >= 1) { < if (window.arguments[0] == "setup") { < setup_unplug(); < } < } < populate_configs(); < detect_toolbarbutton(); < goto_tab_requested() < } < < function populate_configs() { < var elemlist = document.getElementsByTagName("configwrapper"); < for (var i = 0; i < elemlist.length; i++) { < var el = elemlist[i]; < var value = UnPlug2.get_pref(el.getAttribute("name"), el.getAttribute("default")); < el.setValue(value); < } < document.getElementById("version").setAttribute("value", "Version: " + UnPlug2.version.toFixed(3) + " (" + UnPlug2.codename + ") " + UnPlug2.revision); < } < < function browser_window() { < var w = window; < while (!w.getBrowser) { < w = w.opener; < if (!w) < return null; < } < return w; < } < < function detect_toolbarbutton() { < var w = browser_window() < if (!w) < return; < var toolbarbutton = w.document.getElementById("unplug2_toolbarbutton"); < var checkbox = document.getElementById("add_toolbar_button"); < checkbox.checked = (toolbarbutton != null) ? true : false; < checkbox.disabled = false; < } < < function toggle_toolbarbutton() { < var w = browser_window() < if (!w) < return; < var toolbarbutton = w.document.getElementById("unplug2_toolbarbutton"); < if (toolbarbutton) { < var navtoolbar = w.document.getElementById("nav-bar"); < // do persist thing (applies next restart) < var curSet = navtoolbar.currentSet; < if (curSet) { < if (curSet.indexOf("urlbar-container") < 0 && curSet.indexOf("search-container") < 0) { < alert("There's a problem removing the toolbar button\n\n" + curSet); < } else { < navtoolbar.setAttribute("currentset", curSet.replace(",unplug2_toolbarbutton", "")); < w.document.persist("nav-bar","currentset"); < } < } else { < alert("Persist failed - cannot remove toolbar button"); < } < // remove button (applies this session) < navtoolbar.removeChild(toolbarbutton); < } else { < var navtoolbar = w.document.getElementById("nav-bar"); < // do persist thing (applies next restart) < var curSet = navtoolbar.currentSet; < if (curSet) { < if (curSet.indexOf("urlbar-container") < 0 && curSet.indexOf("search-container") < 0) { < alert("There's a problem adding the toolbar button\n\n" + curSet); < } else { < navtoolbar.setAttribute("currentset", curSet + ",unplug2_toolbarbutton"); < w.document.persist("nav-bar","currentset"); < } < } else { < alert("Persist failed - cannot add toolbar button"); < } < // add button (applies this session) < navtoolbar.insertItem("unplug2_toolbarbutton", null, null, false); < } < } < < < function save_configs() { < var elemlist = document.getElementsByTagName("configwrapper"); < for (var i = 0; i < elemlist.length; i++) { < var el = elemlist[i]; < var value = UnPlug2.set_pref(el.getAttribute("name"), el.getValue()); < } < } < < function goto_tab_requested() { < if (window.arguments && window.arguments.length >= 1) < goto_tab(window.arguments[0]); < } < < function goto_tab(tabname) { < var tb = document.getElementById("tabbox"); < switch (tabname) { < case "welcome": < case "setup": < tb.selectedIndex = 3; < break; < case "main": < tb.selectedIndex = 0; < break; < case "downloader": < tb.selectedIndex = 1; < break; < } < } < < /* < * This function is called once, to set up unplug < */ < function setup_unplug() { < // check if we've set up everthing we need to (eg: installed toolbar button, etc) < switch (UnPlug2.get_pref("setup_number", 0)) { < case 0: < if (!detect_toolbarbutton()) < toggle_toolbarbutton(); < UnPlug2.set_pref("setup_number", 1); < break; < default: < UnPlug2.log("Unknown setup_number " + UnPlug2.get_pref("setup_number", 0)); < break; < } < < // show setup complete message < document.getElementById("setup_complete").style.display = "block"; < } < < < diff --new-file --recursive --suppress-common-lines --exclude changes.txt --exclude diff.txt releases/unplug-2.032/source/chrome/content/config/config.xul releases/unplug-2.03/source/chrome/content/config/config.xul 1,138d0 < < < < < %dtdcommon; < < %dtdlocal; < < %dtdunplugresult; < ]> < < <