aboutsummaryrefslogtreecommitdiffstats
path: root/src/chrome/content/about.js
blob: f8370b4a41897b6708247874722e3a9059a0d069 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
function open_tab(UrlToGoTo) {
    if( MPS_isThunderBird() ) {
        var messenger = Components.classes["@mozilla.org/messenger;1"].createInstance()
                                  .QueryInterface(Components.interfaces.nsIMessenger);
                                  
        messenger.launchExternalURL(UrlToGoTo);
    } else {        
        var navWindow;
        
        // Try to get the most recently used browser window
        try {
            var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
                               .getService(Components.interfaces.nsIWindowMediator);
            navWindow = wm.getMostRecentWindow("navigator:browser");
        } catch(ex) {}
        
        if (navWindow) {  // Open the URL in most recently used browser window
            if ("delayedOpenTab" in navWindow) {
                navWindow.delayedOpenTab(UrlToGoTo);
            } else if ("loadURI" in navWindow) {
                navWindow.loadURI(UrlToGoTo);
            } else {
                navWindow._content.location.href = UrlToGoTo;
            }
        } else {  // If there is no recently used browser window open new browser window with the URL
            var ass = Components.classes["@mozilla.org/appshell/appShellService;1"]
                                .getService(Components.interfaces.nsIAppShellService);
            var win = ass.hiddenDOMWindow;
            
            win.openDialog("chrome://navigator/content/navigator.xul", "",
                           "chrome,all, dialog=no", UrlToGoTo );
        }
    }	
 /*
    var uri = Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIURI);
    uri.spec = aURL;
    var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"].getService(Components.interfaces.nsIExternalProtocolService);
    protocolSvc.loadUrl(uri);
    */
}


const SEAMONKEY_ID = "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}";
const THUNDERBIRD_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}";
function MPS_isThunderBird() {
	var id;
	  if("@mozilla.org/xre/app-info;1" in Components.classes) {
	    // running under Mozilla 1.8 or later
	    id = Components.classes["@mozilla.org/xre/app-info;1"]
	                   .getService(Components.interfaces.nsIXULAppInfo).ID;
	  } else {
	    try {
	      id = Components.classes["@mozilla.org/preferences-service;1"]
	                     .getService(Components.interfaces.nsIPrefBranch)
	                     .getCharPref("app.id");
	    } catch(e) {
	    }
	  }
 	if ( id != null && id == THUNDERBIRD_ID ) {
		return true;
	}
	else { 
		return false;
	}
}

function MPS_isSunbirdOrLightning() {
	var id;
	  if("@mozilla.org/xre/app-info;1" in Components.classes) {
	    // running under Mozilla 1.8 or later
	    id = Components.classes["@mozilla.org/xre/app-info;1"]
	                   .getService(Components.interfaces.nsIXULAppInfo).ID;
	  } else {
	    try {
	      id = Components.classes["@mozilla.org/preferences-service;1"]
	                     .getService(Components.interfaces.nsIPrefBranch)
	                     .getCharPref("app.id");
	    } catch(e) {
	    }
	  }
	  
	// check if this is Sunbird
 	if ( id != null && id == "{718e30fb-e89b-41dd-9da7-e25a45638b28}" ) {
		return true;
	}
	else 	if ( id != null && id == THUNDERBIRD_ID ) {
		var em = Components.classes["@mozilla.org/extensions/manager;1"]
                   .getService(Components.interfaces.nsIExtensionManager);
		var addon = em.getItemForID("{e2fda1a4-762b-4020-b5ad-a41df1933103}");
		// check to see if the version attribute exists (if not, then the addon doesn't exist)
		if ( addon != null && (addon.version != null && addon.version != "" )) {
			return true;
		}		
	}
	return false;
}