Skip to content

Commit

Permalink
Keep the bootstrap code as generic as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
nmaier committed Feb 15, 2011
1 parent c2b4148 commit 83ac8b5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 14 additions & 5 deletions bootstrap.js
Expand Up @@ -38,13 +38,17 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */


const EXPORTED_SYMBOLS = ['repagination']; const PACKAGE = "repagination";

const EXPORTED_SYMBOLS = ['main'];


const Cc = Components.classes; const Cc = Components.classes;
const Ci = Components.interfaces; const Ci = Components.interfaces;
const Cu = Components.utils; const Cu = Components.utils;
const reportError = Cu.reportError; const reportError = Cu.reportError;


const global = this;

const regxNumber = /[0-9]+/; const regxNumber = /[0-9]+/;
const regx2Numbers = /[0-9]+[^0-9][0-9]+/; const regx2Numbers = /[0-9]+[^0-9][0-9]+/;


Expand Down Expand Up @@ -157,7 +161,7 @@ if (!('setTimeout' in this)) {
/** /**
* Setup repagination for a window * Setup repagination for a window
*/ */
function repagination(window) { function main(window) {
var document = window.document; var document = window.document;


function $(id) document.getElementById(id); function $(id) document.getElementById(id);
Expand Down Expand Up @@ -792,7 +796,7 @@ const {
let sb = addon.getResourceURI( let sb = addon.getResourceURI(
'locale/' 'locale/'
+ cm[Math.max(0, idx)] + cm[Math.max(0, idx)]
+ '/repagination.properties').spec; + '/' + PACKAGE + '.properties').spec;
strings = StringBundleService.createBundle(sb); strings = StringBundleService.createBundle(sb);
}; };
cm.overrideMimeType('text/plain'); cm.overrideMimeType('text/plain');
Expand All @@ -803,7 +807,7 @@ const {
// Addon manager startup entry // Addon manager startup entry
function startup(data) AddonManager.getAddonByID(data.id, function(addon) { function startup(data) AddonManager.getAddonByID(data.id, function(addon) {
initStringBundle(addon); initStringBundle(addon);
loadXUL("repagination.xul", repagination, addon); loadXUL(PACKAGE + ".xul", main, addon);
}); });


return { return {
Expand All @@ -817,7 +821,12 @@ const {
catch (ex) { catch (ex) {
// pre-moz2 // pre-moz2
// return stubs // return stubs
strings = StringBundleService.createBundle("chrome://repagination/locale/repagination.properties") strings = StringBundleService.createBundle(
"chrome://"
+ PACKAGE
+ "/locale/"
+ PACKAGE
+ ".properties");
return { return {
install: null, install: null,
uninstall: null, uninstall: null,
Expand Down
2 changes: 1 addition & 1 deletion repagination.xul
Expand Up @@ -6,7 +6,7 @@
removeEventListener('load', arguments.callee, true); removeEventListener('load', arguments.callee, true);
let _m = {}; let _m = {};
Components.utils.import("resource://repagination/bootstrap.js", _m); Components.utils.import("resource://repagination/bootstrap.js", _m);
_m.repagination(window); _m.main(window);
}, true); }, true);
]]></script> ]]></script>
<popup id="contentAreaContextMenu"> <popup id="contentAreaContextMenu">
Expand Down

0 comments on commit 83ac8b5

Please sign in to comment.