2
|
1 var nightlyApp = {
|
|
2
|
|
3 savedSetTitleFromFolder: window.setTitleFromFolder,
|
|
4 customTitle: '',
|
|
5
|
|
6 init: function()
|
|
7 {
|
|
8 var brandbundle = document.getElementById("bundle_brand");
|
|
9 if (nightly.variables.name==null)
|
|
10 {
|
|
11 nightly.variables.name=brandbundle.getString("brandShortName");
|
|
12 }
|
|
13 nightly.variables.defaulttitle=brandbundle.getString("brandShortName");
|
|
14 nightly.variables.brandname=brandbundle.getString("brandFullName");
|
|
15 },
|
|
16
|
|
17 openURL: function(url, event)
|
|
18 {
|
|
19 var uri = Components.classes["@mozilla.org/network/io-service;1"]
|
|
20 .getService(Components.interfaces.nsIIOService)
|
|
21 .newURI(url, null, null);
|
|
22
|
|
23 var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
|
|
24 .getService(Components.interfaces.nsIExternalProtocolService);
|
|
25 protocolSvc.loadUrl(uri);
|
|
26 },
|
|
27
|
|
28 detectLeaks: function(event)
|
|
29 {
|
|
30 var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
|
31 .getService(Components.interfaces.nsIWindowMediator);
|
|
32 var win = wm.getMostRecentWindow("Nightly:LeakReporter");
|
|
33 if (win)
|
|
34 win.focus();
|
|
35 else
|
|
36 window.openDialog("chrome://nightly/content/leaks/leaks.xul", "_blank", "chrome,all,dialog=no");
|
|
37 },
|
|
38
|
|
39 customSetTitleFromFolder: function(msgfolder, subject)
|
|
40 {
|
|
41 var brandbundle = document.getElementById("bundle_brand");
|
|
42 var end = " - "+brandbundle.getString("brandShortName");
|
|
43 nightlyApp.savedSetTitleFromFolder(msgfolder,subject);
|
|
44
|
|
45 var title;
|
|
46 if ((document.title)&&(document.title.length>0))
|
|
47 {
|
|
48 title = document.title;
|
|
49 }
|
|
50 else
|
|
51 {
|
|
52 title = window.title;
|
|
53 }
|
|
54
|
|
55 if (title.substring(title.length-end.length)==end)
|
|
56 {
|
|
57 title=title.substring(0,title.length-end.length);
|
|
58 if (nightlyApp.customTitle && nightlyApp.customTitle.length>0)
|
|
59 title=title+' - '+nightlyApp.customTitle;
|
|
60 }
|
|
61
|
|
62 if ((document.title)&&(document.title.length>0))
|
|
63 {
|
|
64 document.title=title;
|
|
65 }
|
|
66 else
|
|
67 {
|
|
68 window.title=title;
|
|
69 }
|
|
70 },
|
|
71
|
|
72 updateTitle: function()
|
|
73 {
|
|
74 if (gDBView)
|
|
75 window.setTitleFromFolder(gDBView.msgFolder,null);
|
|
76 },
|
|
77
|
|
78 setCustomTitle: function(title)
|
|
79 {
|
|
80 nightlyApp.customTitle=title;
|
|
81 window.setTitleFromFolder=nightlyApp.customSetTitleFromFolder;
|
|
82 nightlyApp.updateTitle();
|
|
83 },
|
|
84
|
|
85 setBlankTitle: function()
|
|
86 {
|
|
87 nightlyApp.customTitle='';
|
|
88 window.setTitleFromFolder=nightlyApp.customSetTitleFromFolder;
|
|
89 nightlyApp.updateTitle();
|
|
90 },
|
|
91
|
|
92 setStandardTitle: function()
|
|
93 {
|
|
94 window.setTitleFromFolder=nightlyApp.savedSetTitleFromFolder;
|
|
95 nightlyApp.updateTitle();
|
|
96 }
|
|
97
|
|
98 }
|