aboutsummaryrefslogblamecommitdiffstats
path: root/docs/html/overview-summary-main.js.html
blob: 4e3d98b5c7c08364949d3620a968fb9bc5f5880d (plain) (tree)













































































































































































































































































































































































                                                                                                                                                                                                                                                                                
<!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>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</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">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<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&nbsp;void</code>
			 </font>
		      </td>
		      <td>
			 <code>
			    <b>
			       <a href="GLOBALS.html#!s!initialize">initialize</a></b>(callback)
			 </code>
			 <br>
			 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			 
		      </td>
		   </tr>
		
		   <tr bgcolor="white" class="TableRowColor">
		      <td align="right" valign="top" width="1%">
			 <font size="-1">
			    <code>static&nbsp;Object</code>
			 </font>
		      </td>
		      <td>
			 <code>
			    <b>
			       <a href="GLOBALS.html#!s!isOurPage">isOurPage</a></b>(window, matchingURLs)
			 </code>
			 <br>
			 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			 
		      </td>
		   </tr>
		
		   <tr bgcolor="white" class="TableRowColor">
		      <td align="right" valign="top" width="1%">
			 <font size="-1">
			    <code>static&nbsp;void</code>
			 </font>
		      </td>
		      <td>
			 <code>
			    <b>
			       <a href="GLOBALS.html#!s!skipThisPage">skipThisPage</a></b>(doc)
			 </code>
			 <br>
			 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			 
		      </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 &gt; 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>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</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">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<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>