Permalink
Browse files

Keep the bootstrap code as generic as possible

  • Loading branch information...
1 parent c2b4148 commit 83ac8b5bf83f94f91bd32354b7e295c6f20b4fe6 @nmaier nmaier committed Feb 15, 2011
Showing with 15 additions and 6 deletions.
  1. +14 −5 bootstrap.js
  2. +1 −1 repagination.xul
View
@@ -38,13 +38,17 @@
*
* ***** END LICENSE BLOCK ***** */
-const EXPORTED_SYMBOLS = ['repagination'];
+const PACKAGE = "repagination";
+
+const EXPORTED_SYMBOLS = ['main'];
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
const reportError = Cu.reportError;
+const global = this;
+
const regxNumber = /[0-9]+/;
const regx2Numbers = /[0-9]+[^0-9][0-9]+/;
@@ -157,7 +161,7 @@ if (!('setTimeout' in this)) {
/**
* Setup repagination for a window
*/
-function repagination(window) {
+function main(window) {
var document = window.document;
function $(id) document.getElementById(id);
@@ -792,7 +796,7 @@ const {
let sb = addon.getResourceURI(
'locale/'
+ cm[Math.max(0, idx)]
- + '/repagination.properties').spec;
+ + '/' + PACKAGE + '.properties').spec;
strings = StringBundleService.createBundle(sb);
};
cm.overrideMimeType('text/plain');
@@ -803,7 +807,7 @@ const {
// Addon manager startup entry
function startup(data) AddonManager.getAddonByID(data.id, function(addon) {
initStringBundle(addon);
- loadXUL("repagination.xul", repagination, addon);
+ loadXUL(PACKAGE + ".xul", main, addon);
});
return {
@@ -817,7 +821,12 @@ const {
catch (ex) {
// pre-moz2
// return stubs
- strings = StringBundleService.createBundle("chrome://repagination/locale/repagination.properties")
+ strings = StringBundleService.createBundle(
+ "chrome://"
+ + PACKAGE
+ + "/locale/"
+ + PACKAGE
+ + ".properties");
return {
install: null,
uninstall: null,
View
@@ -6,7 +6,7 @@
removeEventListener('load', arguments.callee, true);
let _m = {};
Components.utils.import("resource://repagination/bootstrap.js", _m);
- _m.repagination(window);
+ _m.main(window);
}, true);
]]></script>
<popup id="contentAreaContextMenu">

0 comments on commit 83ac8b5

Please sign in to comment.