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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
|
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
parent.document.title="main.js Overview";
}
</script>
</head>
<body bgcolor="white" onload="asd();">
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
PREV
NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a>
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<center>
<h2>main.js</h2>
</center>
<h4>Summary</h4>
<p>
No overview generated for 'main.js'<BR/><BR/>
</p>
<hr>
<!-- ========== METHOD SUMMARY =========== -->
<a name="method_summary"><!-- --></a>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
<td colspan=2>
<font size="+2">
<b>Method Summary</b>
</font>
</td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td align="right" valign="top" width="1%">
<font size="-1">
<code>static void</code>
</font>
</td>
<td>
<code>
<b>
<a href="GLOBALS.html#!s!initialize">initialize</a></b>(callback)
</code>
<br>
</td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td align="right" valign="top" width="1%">
<font size="-1">
<code>static Object</code>
</font>
</td>
<td>
<code>
<b>
<a href="GLOBALS.html#!s!isOurPage">isOurPage</a></b>(window, matchingURLs)
</code>
<br>
</td>
</tr>
<tr bgcolor="white" class="TableRowColor">
<td align="right" valign="top" width="1%">
<font size="-1">
<code>static void</code>
</font>
</td>
<td>
<code>
<b>
<a href="GLOBALS.html#!s!skipThisPage">skipThisPage</a></b>(doc)
</code>
<br>
</td>
</tr>
</table>
<p>
<!-- ========== END METHOD SUMMARY =========== -->
<pre class="sourceview"><span class="comment">/*jslint onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: true, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */</span>
<span class="comment">// Released under the MIT/X11 license</span>
<span class="comment">// http://www.opensource.org/licenses/mit-license.php</span>
<span class="comment">//</span>
<span class="comment">// Links to read through</span>
<span class="comment">// http://ehsanakhgari.org/blog/2010-01-07/bugzilla-tweaks-enhanced</span>
<span class="comment">// http://hg.mozilla.org/users/ehsan.akhgari_gmail.com/extensions/file/tip/bugzillatweaks</span>
<span class="comment">// http://hg.mozilla.org/users/ehsan.akhgari_gmail.com/extensions/file/ecfa0f028b81/bugzillatweaks/lib/main.js</span>
<span class="comment">// http://hg.mozilla.org/users/avarma_mozilla.com/atul-packages/file/42ac1e99a107/packages\</span>
<span class="comment">// /facebook-acquaintances/lib/main.js#l11</span>
<span class="comment">// http://ehsanakhgari.org/blog/2010-05-31/my-experience-jetpack-sdk#comment-1253</span>
<span class="comment">//</span>
<span class="literal">"use strict"</span>;
var util = require(<span class="literal">"util"</span>);
var logger = require(<span class="literal">"logger"</span>);
var myStorage = require(<span class="literal">"simple-storage"</span>).storage;
var browser = require(<span class="literal">"tab-browser"</span>);
var urlMod = require(<span class="literal">"url"</span>);
var JSONURL = <span class="literal">"http://matej.ceplovi.cz/progs/data/RH_Data-packages.json"</span>;
var TriagedDistro = 13;
var NumberOfFrames = 7;
var XMLRPCurl = <span class="literal">"https://bugzilla.redhat.com/xmlrpc.cgi"</span>;
var config = {};
config.matches = [
<span class="literal">"https://bugzilla.redhat.com/show_bug.cgi"</span>,
<span class="literal">"https://bz-web2-test.devel.redhat.com/show_bug.cgi"</span>,
<span class="literal">"https://bugzilla.mozilla.org/show_bug.cgi"</span>
];
config.skipMatches = [
<span class="literal">"https://bugzilla.redhat.com/(process|post)_bug.cgi"</span>,
<span class="literal">"https://bz-web2-test.devel.redhat.com/(process|post)_bug.cgi"</span>,
<span class="literal">"https://bugzilla.mozilla.org/post_bug.cgi"</span>,
<span class="literal">"https://bugzilla.mozilla.org/process_bug.cgi"</span>,
<span class="literal">"https://bugzilla.(redhat.com|mozilla.org)/attachment.cgi$"</span>
];
<span class="comment">// ==============================================================</span>
<span class="comment">// https://wiki.mozilla.org/Labs/Jetpack/JEP/24</span>
var WillBemanifest = {
settings : [
{
name : <span class="literal">"BZpassword"</span>,
type : <span class="literal">"password"</span>,
label : <span class="literal">"Bugzilla password"</span>
},
{
name : <span class="literal">"JSONURL"</span>,
type : <span class="literal">"text"</span>,
label : <span class="literal">"Configuration file URL"</span>,
<span class="literal">"default"</span> : <span class="literal">"http://mcepl.fedorapeople.org/scripts/BugZappers_data.json"</span>
},
{
name : <span class="literal">"enabledPacks"</span>,
type : <span class="literal">"text"</span>,
label : <span class="literal">"comment packs which should be enabled"</span>,
<span class="literal">"default"</span> : <span class="literal">""</span>
}
]
};
<span class="reserved">function</span> isOurPage(window, matchingURLs) {
var url = window.location.href;
<span class="comment">// like ["regexp-url1", "regexp-url2"]</span>
<span class="reserved">return</span> matchingURLs.some(<span class="reserved">function</span> (element,i,a) {
<span class="reserved">return</span> new RegExp(element).test(url);
});
}
<span class="comment">/**
*
*/</span>
<span class="reserved">function</span> skipThisPage(doc) {
var stemURL = <span class="literal">"https://HOSTNAME/show_bug.cgi?id="</span>;
var titleStr = doc.getElementsByTagName(<span class="literal">"title"</span>)[0].textContent;
var REArr = new RegExp(<span class="literal">"[bB]ug\\s+([0-9]+)"</span>).exec(titleStr);
var hostname = urlMod.URL(doc.location.href).host;
<span class="reserved">if</span> (REArr) {
var bugNo = REArr[1];
console.log(<span class="literal">"bugNo = "</span> + bugNo + <span class="literal">", hostname = "</span> + hostname);
var emailsSent = doc.
querySelector(<span class="literal">"#bugzilla-body > dl:nth-of-type(1)"</span>).textContent;
emailsSent = emailsSent.replace(/^(\s*)$/mg,<span class="literal">""</span>);
util.notification(emailsSent);
doc.location = stemURL.replace(<span class="literal">"HOSTNAME"</span>,hostname) + bugNo;
}
}
<span class="reserved">function</span> initialize(callback) {
util.loadJSON(JSONURL, <span class="reserved">function</span>(parsedData) {
config.gJSONData = parsedData;
var keys = <span class="literal">""</span>, key = <span class="literal">""</span>;
<span class="reserved">for</span> (key in config.gJSONData) {
keys += key + <span class="literal">" "</span>;
}
console.log(<span class="literal">"loaded JSON object keys: "</span> + keys);
<span class="comment">// Get card translation table</span>
<span class="reserved">if</span> (<span class="literal">"PCIIDsURL"</span> in config.gJSONData.configData) {
util.loadJSON(config.gJSONData.configData.PCIIDsURL, <span class="reserved">function</span>(response) {
config.PCI_ID_Array = response;
});
}
<span class="reserved">if</span> (!myStorage.logs) {
console.log(<span class="literal">"myStorage.logs empty!"</span>);
myStorage.logs = {};
}
var logConstructor = logger.Logger;
config.logger = new logConstructor(myStorage.logs,
config.gJSONData.constantData.bugzillalabelAbbreviations);
callback(config);
}, <span class="reserved">this</span>);
}
exports.main = <span class="reserved">function</span> main(options, callbacks) {
initialize(<span class="reserved">function</span> (config) {
browser.whenContentLoaded(
<span class="reserved">function</span>(window) {
<span class="comment">// is this good for anything?</span>
<span class="reserved">if</span> (<span class="literal">"window"</span> in window) { window = window.window; }
var construct = {};
var bzType = config.gJSONData.configData.objectStyle;
<span class="reserved">if</span> (bzType === <span class="literal">"RH"</span>) {
construct = require(<span class="literal">"rhbzpage"</span>).RHBugzillaPage;
} <span class="reserved">else</span> <span class="reserved">if</span> (bzType === <span class="literal">"MoFo"</span>) {
construct = require(<span class="literal">"mozillabzpage"</span>).MozillaBugzilla;
}
<span class="reserved">if</span> (isOurPage(window, config.matches)) {
var curPage = new construct(window, config);
} <span class="reserved">else</span> <span class="reserved">if</span> (isOurPage(window, config.skipMatches)) {
skipThisPage(window.document);
} <span class="reserved">else</span> {
console.log(<span class="literal">"Not our page: "</span> + window.location.href);
}
}
);
});
};
</pre>
<hr>
<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
<tr align="center" valign="top">
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
</tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>
<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
PREV
NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
<a href="index.html" target="_top"><b>FRAMES</b></a>
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
<script>
<!--
if(window==top) {
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
}
//-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->
<hr>
<font size="-1">
</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Wed Jun 23 09:33:14 2010</div>
</body>
</html>
|