1 /* coded by Ketmar // Invisible Vector (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
4 * This program is free software. It comes without any warranty, to
5 * the extent permitted by applicable law. You can redistribute it
6 * and/or modify it under the terms of the Do What The Fuck You Want
7 * To Public License, Version 2, as published by Sam Hocevar. See
8 * http://www.wtfpl.net/txt/copying/ for more details.
10 // main extension loader -- user-defined code
11 require("utils/utils");
14 let {PackageDB
} = require("pkg/packagedb");
15 let pkgDB
= new PackageDB();
17 registerStartupHook("packagedb creation", function () {
18 (function () { let db
= pkgDB
.db
; })();
21 registerShutdownHook("packagedb closing", function () {
26 let {PkgDownloader
} = require("pkg/downpkg");
27 let scacheAPI
= require("scriptcache");
28 let pkgman
= require("pkg/pkgman");
34 const {openTab
} = require("sbapi/opentab");
35 registerWindowLoadHook("readme hook", function (win
) {
36 // open documentation on first run
37 if (!addonOptions
.fsoReadmeViewed
) {
38 //addonOptions.fsoReadmeViewed = true;
39 //conlog("win=", win, "; url=", gsdoxUrl+"README.txt");
40 //openTab(win, gsdoxUrl+"README.txt", false);
41 let dwn
= win
.QueryInterface(Ci
.nsIInterfaceRequestor
).getInterface(Ci
.nsIDOMWindow
);
42 if (!dwn
) { conlog("000"); return; }
44 dwn
.QueryInterface(Ci
.nsIInterfaceRequestor
).
45 getInterface(Ci
.nsIWebNavigation
).
46 QueryInterface(Ci
.nsIDocShellTreeItem
).
48 QueryInterface(Ci
.nsIInterfaceRequestor
).
49 getInterface(Ci
.nsIDOMWindow
);
50 if (!chromeWindow
) { conlog("001"); return; }
51 let bro
= chromeWindow
.gBrowser
;
52 if (!bro
) { conlog("002"); return; }
55 let oss
= Cc
["@mozilla.org/observer-service;1"].getService(Ci
.nsIObserverService
);
57 observe: function (aSubject
, aTopic
, aData
) {
58 //conlog("OBS: ", aTopic);
59 if (aTopic
=== "sessionstore-windows-restored") {
60 if (!addonOptions
.fsoReadmeViewed
) {
61 bro
.selectedTab
= bro
.addTab(gsdoxUrl
+"README.txt");
62 addonOptions
.fsoReadmeViewed
= true;
64 //oss.removeObserver(observer, "sessionstore-windows-restored");
68 oss
.addObserver(observer
, "sessionstore-windows-restored", false);