Language: XML

Untitled XML (30-Jun @ 15:00)

Syntax Highlighted Code

  1.  
  2. <c:choose>
  3.     <c:when test="${!empty param.JSSpec}">
  4. <script type="text/javascript" src="/jsspec/JSSpec.js?autorun=false&autototals=false&runlinks=1">
  5. [5 more lines...]

Plain Code


<c:choose>
    <c:when test="${!empty param.JSSpec}">
<script type="text/javascript" src="/jsspec/JSSpec.js?autorun=false&autototals=false&runlinks=1">
</script>
<link rel="spec" rev="sample" href="test/spec/SampleWorkflowSpec.html" type="text/html" charset="utf-8">
<link rel="spec" rev="basic" href="test/spec/BasicWorkflowSpec.html" type="text/html" charset="utf-8">
    </c:when>
</c:choose>    

Untitled XML (29-Jun @ 16:01)

yansky

Syntax Highlighted Code

  1. <?xml version="1.0"?>
  2. <bindings xmlns="http://www.mozilla.org/xbl"
  3.  xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  4.  xmlns:html="http://www.w3.org/1999/xhtml">
  5. [903 more lines...]

Plain Code

<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl"
 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
 xmlns:html="http://www.w3.org/1999/xhtml">


<binding id="item1" styleexplicitcontent="true">
<!-- Net Usage Item GUI, licensed under the Mozilla Public License (C) 2008 Loune lpgcritter at nasquan dot com  -->
    <!-- <resources>
    <stylesheet src="chrome://"/>
    </resources> -->
    <content>

        <svg
            xmlns:svg="http://www.w3.org/2000/svg"
            xmlns="http://www.w3.org/2000/svg"
            xmlns:xlink="http://www.w3.org/1999/xlink"
            version="1.0"
            x="0"
            y="0"
            width="0"
            height="0"
            id="netusagesvgdefstub" />


        <!-- XXXXXXXXXXXXXXXXXXXXXXX CUT HERE XXXXXXXXXXXXXXXXXXXXXXXXX -->

            
            
        <svg
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:cc="http://web.resource.org/cc/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:svg="http://www.w3.org/2000/svg"
             xmlns="http://www.w3.org/2000/svg"
             xmlns:xlink="http://www.w3.org/1999/xlink"
             xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
             xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
             version="1.0"
             x="0.00000000"
             y="0.00000000"
             width="126"
             height="23"
             id="netusagesvg"
             sodipodi:version="0.32"
             inkscape:version="0.44"
             sodipodi:docname="netusage1.svg"
             sodipodi:docbase="D:\Workspace\netusage">
            <metadata
                 id="metadata65">
                <rdf:RDF>
                    <cc:Work
                         rdf:about="">
                        <dc:format>image/svg+xml</dc:format>
                        <dc:type
                             rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
                    </cc:Work>
                </rdf:RDF>
            </metadata>
            <sodipodi:namedview
                 inkscape:window-height="641"
                 inkscape:window-width="1136"
                 inkscape:pageshadow="2"
                 inkscape:pageopacity="0.0"
                 borderopacity="1.0"
                 bordercolor="#666666"
                 pagecolor="#ffffff"
                 id="base"
                 inkscape:zoom="11.313709"
                 inkscape:cx="47.127219"
                 inkscape:cy="0.49738615"
                 inkscape:window-x="245"
                 inkscape:window-y="259"
                 inkscape:current-layer="layer2"
                 showguides="true"
                 inkscape:guide-bbox="true"
                 height="23px"
                 width="126px" />
            <defs
                 id="netusagedefs">
                <linearGradient
                     id="linearGradient2243">
                    <stop
                         style="stop-color:#75ff00;stop-opacity:1"
                         offset="0"
                         id="stop2245" />
                    <stop
                         style="stop-color:#2f7f39;stop-opacity:1"
                         offset="1"
                         id="stop2247" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2258">
                    <stop
                         style="stop-color:#fff07a;stop-opacity:1.0000000"
                         offset="0.00000000"
                         id="stop2260" />
                    <stop
                         style="stop-color:#ff9e4e;stop-opacity:1.0000000"
                         offset="0.50000000"
                         id="stop2262" />
                    <stop
                         style="stop-color:#ff5000;stop-opacity:1.0000000"
                         offset="0.50925928"
                         id="stop2264" />
                    <stop
                         style="stop-color:#ffd600;stop-opacity:1.0000000"
                         offset="1.0000000"
                         id="stop2266" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2178">
                    <stop
                         style="stop-color:#9cdc62;stop-opacity:1.0000000"
                         offset="0.00000000"
                         id="stop2184" />
                    <stop
                         style="stop-color:#72e035;stop-opacity:1.0000000"
                         offset="0.37201953"
                         id="stop2188" />
                    <stop
                         style="stop-color:#5ea32a;stop-opacity:1;"
                         offset="0.37201953"
                         id="stop2190" />
                    <stop
                         style="stop-color:#b0ea7a;stop-opacity:1.0000000"
                         offset="1.0000000"
                         id="stop2186" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2083">
                    <stop
                         style="stop-color:#7fff00;stop-opacity:1.0000000"
                         offset="0.00000000"
                         id="stop2085" />
                    <stop
                         style="stop-color:#cfd218;stop-opacity:1.0000000"
                         offset="0.29076648"
                         id="stop2152" />
                    <stop
                         style="stop-color:#e0b21c;stop-opacity:1.0000000"
                         offset="0.71105301"
                         id="stop2156" />
                    <stop
                         style="stop-color:#ee2420;stop-opacity:1.0000000"
                         offset="1.0000000"
                         id="stop2087" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2073">
                    <stop
                         style="stop-color:#7c92b9;stop-opacity:1.0000000"
                         offset="0.00000000"
                         id="stop2075" />
                    <stop
                         style="stop-color:#ffffff;stop-opacity:1.0000000"
                         offset="1.0000000"
                         id="stop2077" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2051">
                    <stop
                         style="stop-color:#747474;stop-opacity:1.0000000"
                         offset="0.00000000"
                         id="stop2053" />
                    <stop
                         style="stop-color:#ffffff;stop-opacity:1.0000000"
                         offset="1.0000000"
                         id="stop2055" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2115">
                    <stop
                         style="stop-color:#1b45c4;stop-opacity:1;"
                         offset="0"
                         id="stop2117" />
                    <stop
                         style="stop-color:#0140ff;stop-opacity:0;"
                         offset="1"
                         id="stop2119" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2292">
                    <stop
                         id="stop2294"
                         offset="0"
                         style="stop-color:#ffe31c;stop-opacity:1;" />
                    <stop
                         id="stop2296"
                         offset="1"
                         style="stop-color:#ffffff;stop-opacity:0;" />
                </linearGradient>
                <linearGradient
                     x1="-39.743919"
                     y1="271.64819"
                     x2="456.23572"
                     y2="271.64819"
                     id="linearGradient2081"
                     xlink:href="#linearGradient2083"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.409736,0,0,0.208754,30.24163,211.051)" />
                <linearGradient
                     x1="295.08344"
                     y1="343.32632"
                     x2="295.08344"
                     y2="224.68822"
                     id="linearGradient2172"
                     xlink:href="#linearGradient2051"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.369234,0,0,0.410816,-15.19644,-99.69333)" />
                <linearGradient
                     x1="222.15965"
                     y1="237.48343"
                     x2="222.15965"
                     y2="301.78006"
                     id="linearGradient2174"
                     xlink:href="#linearGradient2073"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.341899,0,0,0.26744,-9.276913,-60.6394)" />
                <linearGradient
                     x1="162.57631"
                     y1="245.21945"
                     x2="162.57631"
                     y2="298.0766"
                     id="linearGradient2176"
                     xlink:href="#linearGradient2178"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.245416,0,0,0.242214,-4.287223,-52.43637)" />
                <linearGradient
                     x1="162.57631"
                     y1="245.21945"
                     x2="162.57631"
                     y2="298.07651"
                     id="linearGradient2256"
                     xlink:href="#linearGradient2258"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.348017,0,0,0.208754,-8.863015,-44.14369)" />
                <linearGradient
                     collect="always"
                     xlink:href="#linearGradient2115"
                     id="linearGradient2314"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(3.046092,0,0,0.458,-842.6463,-147.6332)"
                     x1="297.30167"
                     y1="354.22491"
                     x2="297.30167"
                     y2="371.1955" />
                <linearGradient
                     collect="always"
                     xlink:href="#linearGradient2292"
                     id="linearGradient2316"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(3.012188,0,0,0.447051,-831.282,-150.2732)"
                     x1="297.31323"
                     y1="354.22491"
                     x2="297.31323"
                     y2="371.1955" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2243"
                     id="linearGradient2249"
                     x1="136.79781"
                     y1="19.51153"
                     x2="136.79781"
                     y2="7.1371608"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.883905,0,0,0.889813,-105.5481,-0.606724)" />
                <clipPath
                     id="clipoffpeak">
                    <rect
                         id="clipoffpeakrect"
                         width="117.875"
                         height="14.520815"
                         x="7"
                         y="5.75"
                         rx="0"
                         ry="0" />
                </clipPath>
                <clipPath
                     id="clipbars">
                    <rect
                     width="113.4"
                     height="13.6"
                     rx="2.258666"
                     ry="2.1103067"
                     x="6.7890587"
                     y="4.9000001"
                     id="rect2815" />
                </clipPath>
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2258"
                     id="linearGradient2827"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.334468,0,0,0.219789,-8.452445,-47.85567)"
                     x1="162.86516"
                     y1="245.21945"
                     x2="162.86516"
                     y2="298.07651" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2073"
                     id="linearGradient2817"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.353131,0,0,0.268212,-10.60411,-95.53958)"
                     x1="223.25398"
                     y1="237.48343"
                     x2="223.25398"
                     y2="301.78006" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2051"
                     id="linearGradient2821"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.384191,0,0,0.437012,-17.52787,-141.364)"
                     x1="295.08344"
                     y1="343.32632"
                     x2="295.08344"
                     y2="224.68822" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2073"
                     id="linearGradient2828"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.353131,0,0,0.268212,-10.85411,-95.53958)"
                     x1="223.25398"
                     y1="237.48343"
                     x2="223.25398"
                     y2="301.78006" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2115"
                     id="linearGradient2835"
                     x1="68.125"
                     y1="7.25"
                     x2="68.125"
                     y2="25.077589"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.752725,0,0,0.50003,-4.602051,9.1255)" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2292"
                     id="linearGradient2839"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(1.061878,0,0,0.460027,-9.204941,9.533024)"
                     x1="68.125"
                     y1="7.25"
                     x2="68.125"
                     y2="43.715527" />
            </defs>
            <g
                 id="layer1">
                <rect
                     width="123.5"
                     height="21.5"
                     rx="9.8386154"
                     ry="10.379341"
                     x="1.5"
                     y="1"
                     style="fill:url(#linearGradient2172);fill-opacity:1;stroke:black;stroke-width:0.99999976;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.63492067"
                     id="rectouter" />
                <rect
                     width="114.3"
                     height="14.1"
                     rx="2.2586658"
                     ry="2.1103072"
                     x="6.3"
                     y="5"
                     style="fill:url(#linearGradient2174);fill-opacity:1;stroke:black;stroke-width:1.00000012;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.6719577"
                     id="rectinner" />
                <g
                     inkscape:groupmode="layer"
                     id="layer2"
                     inkscape:label="bars"
                     clip-path="url(#clipbars)">
                    <rect
                         width="113.5"
                         height="13.1"
                         rx="2.1912799"
                         ry="1.5982112"
                         x="6.8"
                         y="5.5"
                         style="opacity:1;fill:url(#linearGradient2827);fill-opacity:1;stroke:none;stroke-width:1.87557006;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
                         id="peakover" />
                    <rect
                         width="113.5"
                         height="13.1"
                         rx="2.1912799"
                         ry="1.5982111"
                         x="6.8"
                         y="5.5"
                         style="opacity:1;fill:url(#linearGradient2176);fill-opacity:1;stroke:none;stroke-width:1.87557006;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
                         id="peak" />
                    <path
                         d="M 3.053786,4.2362938 L 10.742332,4.2362938 L 6.8980586,9.6416242 L 3.053786,4.2362938 z "
                         style="fill:black;fill-opacity:1;stroke:none;stroke-width:1.25;stroke-miterlimit:4;stroke-opacity:1"
                         id="patharrow" />
                    <rect
                         style="opacity:1;fill:url(#linearGradient2839);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
                         id="offpeakover"
                         width="113.5"
                         height="5.5"
                         x="6.8"
                         y="13"
                         rx="0"
                         ry="0" />
                    <rect
                         style="opacity:1;fill:url(#linearGradient2835);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
                         id="offpeak"
                         width="113.5"
                         height="5.5"
                         x="6.8"
                         y="13"
                         rx="0"
                         ry="0" />
                    <path
                         d="M 9.2731107,18.772569 L 4.421751,18.698553 L 6.9057977,15.557182 L 9.2731107,18.772569 z "
                         style="opacity:1;fill:white;fill-opacity:1;stroke:none;stroke-width:1.25;stroke-miterlimit:4;stroke-opacity:1"
                         id="patharrow2"
                         inkscape:transform-center-y="3.7231195" />

                    <g
                         id="iconerror"
                         transform="matrix(0.93714,0,0,0.940057,-97.13415,33.75136)">
                        <path
                             transform="matrix(0.427044,0,0,0.492997,65.22645,-17.42024)"
                             sodipodi:open="true"
                             sodipodi:end="12.497908"
                             sodipodi:start="6.2292315"
                             d="M 144.93554,-11.799526 A 14.672466,11.932427 0 1 1 144.92252,-11.972325"
                             sodipodi:ry="11.932427"
                             sodipodi:rx="14.672466"
                             sodipodi:cy="-11.156038"
                             sodipodi:cx="130.28442"
                             id="iconerrorcircle"
                             style="opacity:1;fill:red;fill-opacity:0.78835976;stroke:black;stroke-width:2.32200027;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
                             sodipodi:type="arc" />
                        <path
                             id="path2253"
                             d="M 123.9972,-25.849435 L 118.00283,-20.400574"
                             style="fill:none;fill-opacity:0.78835976;fill-rule:evenodd;stroke:white;stroke-width:1.59812951;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
                        <path
                             id="path2255"
                             d="M 123.82577,-19.935489 L 117.67426,-25.814523"
                             style="fill:none;fill-opacity:0.78835976;fill-rule:evenodd;stroke:white;stroke-width:1.59812939;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
                    </g>
                    <path
                         style="opacity:0.88144334;fill:url(#linearGradient2249);fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.47692309"
                         d="M 13.195219,6.1889253 L 13.195219,11.292777 L 8.4873981,11.292777 L 15.549124,18.675132 L 22.24872,11.292777 L 17.450357,11.292776 L 17.540899,6.1889253 L 13.195219,6.1889253 z "
                         id="icondown"
                         sodipodi:nodetypes="cccccccc" />
                </g>
                <text
                         x="117.5"
                         y="16.8"
                         style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:end;line-height:125%;writing-mode:lr;text-anchor:end;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial"
                         id="pclabelouter"
                         xml:space="preserve"
                         sodipodi:linespacing="125%"><tspan
                            x="117.5"
                            y="16.8"
                            id="pclabel">0%</tspan></text>
                <text
                     xml:space="preserve"
                     style="font-size:13px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:end;line-height:125%;writing-mode:lr-tb;text-anchor:end;fill:#fff5f5;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:none;font-family:Arial"
                     x="85.661148"
                     y="17.569111"
                     id="pc2labelouter"
                     sodipodi:linespacing="125%"><tspan
                        sodipodi:role="line"
                        x="85.661148"
                        y="17.569111"
                        id="pc2label">0%</tspan></text>
            </g>
        </svg>

            
        <!-- XXXXXXXXXXXXXXXXXXXXXXX CUT HERE XXXXXXXXXXXXXXXXXXXXXXXXX -->



    </content>

    <implementation implements="nsIObserver, nsIDOMEventListener">
        <constructor>
            <![CDATA[

            //var svg = document.getAnonymousElementByAttribute(this, 'id', 'netusagesvg');
            //var suspid = svg.suspendRedraw(1000);
            
            // get num from id
            var sitemid = this.getAttribute('id');
            this.itemid = parseInt(sitemid[sitemid.length-1], 10);

            this.defprefix = "";
            this.svghack = window.navigator.userAgent.indexOf("; rv:1.8") != -1;

            if (this.svghack) {

                // hack for bug https://bugzilla.mozilla.org/show_bug.cgi?id=309020
                this.defprefix = "nu"+this.itemid+"_";

                var existingStub = document.getElementById(this.defprefix+'netusagesvgdefstub');
                if (existingStub) {
                    // remove previous stub
                    existingStub.parentNode.removeChild(existingStub);
                }

                // mass append nu0_ ids to the defs
                var tmplstub = document.getAnonymousElementByAttribute(this, 'id', "netusagesvgdefstub");
                tmplstub.setAttribute("id", this.defprefix+'netusagesvgdefstub');

                document.getAnonymousElementByAttribute(this, 'id', "netusagedefs").setAttribute("id", this.defprefix+'netusagedefs');
                this.alterNodeId(document.getAnonymousElementByAttribute(this, 'id', this.defprefix+"netusagedefs"), this.defprefix);

                var svgdefstub = document.importNode(tmplstub, true);
                var svgdefs = document.importNode(document.getAnonymousElementByAttribute(this, 'id', this.defprefix+"netusagedefs"), true);

                svgdefstub.appendChild(svgdefs);
                var c = svgdefstub.cloneNode(true);

                document.documentElement.appendChild(c);

                var elids = ['layer2', 'rectouter', 'rectinner', 'peak', 'peakover', 'offpeak', 'offpeakover', 'icondown'];
                for(var i in elids) {
                
                    var r = document.getAnonymousElementByAttribute(this, 'id', elids[i]).getAttribute('clip-path');
                    if (r != null) {
                        r = r.replace(/url\(#([^)]+)/, "url("+document.location+"#"+this.defprefix+"$1");
                        document.getAnonymousElementByAttribute(this, 'id', elids[i]).setAttribute("clip-path", r);
                    }
                    r = document.getAnonymousElementByAttribute(this, 'id', elids[i]).getAttribute('style');
                    if (r != null) {
                        r = r.replace(/fill: url\(#([^)]+)/, "fill: url("+document.location+"#"+this.defprefix+"$1");
                        
                        document.getAnonymousElementByAttribute(this, 'id', elids[i]).setAttribute("style", r);
                    }
                }
            }

            var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
            prefs = prefs.getBranch("extensions.netusage.");            

            if(prefs.getBoolPref('widen')){

                var elids2 = ['netusagesvg', 'rectouter', 'rectinner', 'peakover', 'peak', 'offpeakover', 'offpeak', 'pclabel', 'pclabelouter', 'pc2labelouter', 'pc2label'];
                for(var i in elids2) {

                    var e = document.getAnonymousElementByAttribute(this, 'id', elids2[i]), huh = 'x';

                    if(e.hasAttribute('width')){
                    
                        huh = 'width';
                    
                    }
                
                    var getW = Number(e.getAttribute(huh))+prefs.getIntPref("widenNumber");

                    e.setAttribute(huh, getW);

                }
        
            }        

            // GUI
            this.maxWidth = parseInt(document.getAnonymousElementByAttribute(this, 'id', 'peakover').getAttribute("width"), 10);
            this.maxWidth2 = parseInt(document.getAnonymousElementByAttribute(this, 'id', 'offpeakover').getAttribute("width"), 10);
            // for New Modern offpeak which progresses backwards
            this.baseX = parseInt(document.getAnonymousElementByAttribute(this, 'id', this.defprefix+'clipoffpeakrect').getAttribute("x"), 10);
            
            // The following two function fails when running outside chrome
            // flashing timer
            try {
            this.timer = Components.classes['@mozilla.org/timer;1'].createInstance(Components.interfaces.nsITimer);
            } catch (e) { dump("EXCEPTION flashing timer create failed" + e); }
            
            try {
            this.addEventListener('DOMAttrModified', this, false);
            } catch (e) { dump("EXCEPTION addEventListener DOMAttrModified failed" + e); }

            //svg.unsuspendRedraw(suspid);
            
            // set state to initial values
            this.refreshItem("text", this.getAttribute("text"));
            this.refreshItem("text2", this.getAttribute("text2"));
            this.refreshItem("pc", parseInt(this.getAttribute("pc"), 10));
            this.refreshItem("pc2", parseInt(this.getAttribute("pc2"), 10));
            this.refreshItem("arrow", parseInt(this.getAttribute("arrow"), 10));
            this.refreshItem("arrow2", parseInt(this.getAttribute("arrow2"), 10));
            this.refreshItem("status", this.getAttribute("status"));
            this.refreshItem("flashing", this.getAttribute("flashing"));
            
            ]]>
        </constructor>

        <destructor>
            <![CDATA[
            if (this.timer)
                this.timer.cancel();
            this.timer = null;
            ]]>
        </destructor>

        <property name="arrow">
            <getter>
                return parseInt(this.getAttribute('arrow'));
            </getter>
            <setter>
                <![CDATA[
            this.setAttribute("arrow", val);
            ]]>
            </setter>
        </property>

        <property name="arrow2">
            <getter>
                return parseInt(this.getAttribute('arrow2'));
            </getter>
            <setter>
                <![CDATA[
            this.setAttribute("arrow2", val);
            ]]>
            </setter>
        </property>



        <property name="pc">
            <getter>
                return parseInt(this.getAttribute('pc'));
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("pc", val);
            ]]>
            </setter>
        </property>


        <property name="pc2">
            <getter>
                return parseInt(this.getAttribute('pc2'));
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("pc2", val);
            ]]>
            </setter>
        </property>

        <property name="status">
            <getter>
                return this.getAttribute('status');
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("status", val);
            ]]>
            </setter>
        </property>


        <property name="text">
            <getter>
                return this.getAttribute('text');
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("text", val);
            ]]>
            </setter>
        </property>
        <property name="text2">
            <getter>
                return this.getAttribute('text2');
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("text2", val);
            ]]>
            </setter>
        </property>
        <property name="flashing">
            <getter>
                return this.getAttribute('flashing');
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("flashing", val); // val needs to be turned into string or else DOMAttrModified won't trip
            ]]>
            </setter>
        </property>

        <method name="alterNodeId">
            <parameter name="root" />
            <parameter name="prepend_id" />
            <body>
                <![CDATA[
            for (var i = 0; i < root.childNodes.length; i++) {
                this.alterNodeId(root.childNodes[i], prepend_id);
                if (!root.childNodes[i].setAttribute)
                    continue;
                //root.childNodes[i].setAttribute("id", prepend_id+root.childNodes[i].id);
                root.childNodes[i].id = prepend_id+root.childNodes[i].id;
                //if (root.childNodes[i].getAttributeNS("http://www.w3.org/1999/xlink", "href") != null) {
                var xlinkhref = root.childNodes[i].getAttribute("xlink:href");
                if (xlinkhref != null) {
                    root.childNodes[i].setAttribute("xlink:href", "#"+prepend_id+xlinkhref.substring(1, xlinkhref.length));
                    //alert(root.childNodes[i].getAttribute("xlink:href"));
                }
            }
            ]]>
            </body>
        </method>

        <method name="observe">
            <parameter name="subject" />
            <parameter name="topic" />
            <parameter name="data" />
            <body>
                <![CDATA[
            if (topic == 'timer-callback') {
                try {
                // flash
                var svg = document.getAnonymousElementByAttribute(this, 'id', 'netusagesvg');
                if (this.anipos >= 9 || this.anipos <= 5) {
                    this.anistep = -this.anistep;
                }
                if (this.flashEnabled || (!this.flashEnabled && this.anipos < 9)) {
                    //svg.style.MozOpacity = '0.'+this.anipos;
                    svg.setAttribute('style', 'opacity: 0.'+this.anipos);
                    this.anipos += this.anistep;
                } else {
                    // flashing disabled and cycle is complete
                    this.timer.cancel();
                    //svg.style.opacity = '1';
                    svg.setAttribute('style', 'opacity: 1');
                    this.anipos = 9;
                    this.anistep = 1;
                }
                } catch (e) { this.timer.cancel(); alert('netusage flash timer-callback error: '+e); }
            }

            ]]>
            </body>
        </method>


        <method name="handleEvent">
            <parameter name="e" />
            <body>
                <![CDATA[
            //dump('DOMAttrModified '+e.attrName+' '+e.originalTarget+'\n');
            if (e.type == 'DOMAttrModified' && e.originalTarget == this) {
                if (e.attrName == 'status' || e.attrName == 'text' || e.attrName == 'text2' || e.attrName == 'flashing')
                    this.refreshItem(e.attrName, e.newValue);
                else
                    this.refreshItem(e.attrName, parseInt(e.newValue, 10));
                //e.prevValue = 
                
                /* dump('event {\n');
                for(i in e) {
                    dump(i + ": " + e[i] +"\n")
                }
                dump('}\n'); */
                
            }
            ]]>
            </body>
        </method>


        <method name="refreshItem">
            <parameter name="attr" />
            <parameter name="v" />
            <body>
                <![CDATA[
            var maxWidth = parseInt(this.maxWidth); // TODO do we really need to parseInt? was it a bug?
            var maxWidth2 = parseInt(this.maxWidth2);
            var baseX = parseInt(this.baseX);
            var svg = document.getAnonymousElementByAttribute(this, 'id', 'netusagesvg');
            var suspid = svg.suspendRedraw(1000);
            //e.prevValue = 
            
            if (attr == 'pc') {
                if (v < 100) {
                    document.getAnonymousElementByAttribute(this, 'id', 'peakover').style.display = 'none';
                    document.getAnonymousElementByAttribute(this, 'id', 'peak').setAttribute('width', maxWidth * v / 100);
                }
                else {
                    document.getAnonymousElementByAttribute(this, 'id', 'peakover').style.display = '';
                    document.getAnonymousElementByAttribute(this, 'id', 'peak').setAttribute('width', maxWidth * 100 / v);
                }
            }
            else if (attr == 'pc2') {
                if ((document.getAnonymousElementByAttribute(this, 'id', 'offpeak').getAttribute('clip-path')+"").indexOf('clipoffpeak') == -1) {
                    if (v < 100) {
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeakover').style.display = 'none';
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeak').setAttribute('width', maxWidth2 * v / 100);
                    }
                    else {
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeakover').style.display = '';
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeak').setAttribute('width', maxWidth2 * 100 / v);
                    }
                }
                else {
                    // for New Modern theme, where off peak bar comes the opposite direction
                    var clipoffpeakrect = this.svghack ? document.getElementById(this.defprefix+'clipoffpeakrect') : document.getAnonymousElementByAttribute(this, 'id', 'clipoffpeakrect');

                    if (v < 100) {
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeakover').style.display = 'none';
                        clipoffpeakrect.setAttribute('x', baseX + maxWidth - maxWidth * v / 100);
                        clipoffpeakrect.setAttribute('width', maxWidth * v / 100);
                    }
                    else {
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeakover').style.display = '';
                        clipoffpeakrect.setAttribute('x', baseX + maxWidth - maxWidth * 100 / v);
                        clipoffpeakrect.setAttribute('width', maxWidth * 100 / v);
                    }
                    
                    // hack for bug that doesn't redraw clipping
                    var cp = document.getAnonymousElementByAttribute(this, 'id', 'offpeak').getAttribute('clip-path');
                    document.getAnonymousElementByAttribute(this, 'id', 'offpeak').setAttribute('clip-path', '');
                    document.getAnonymousElementByAttribute(this, 'id', 'offpeak').setAttribute('clip-path', cp);
                }
            }
            else if (attr == 'arrow') {
                if (v <= 100) {
                    document.getAnonymousElementByAttribute(this, 'id', 'patharrow').setAttribute('transform', 'translate('+(maxWidth * v / 100)+',0)');
                }
            }
            else if (attr == 'arrow2') {
                if (v > 0 && v <= 100) {
                    document.getAnonymousElementByAttribute(this, 'id', 'patharrow2').style.display = '';
                    if ((document.getAnonymousElementByAttribute(this, 'id', 'offpeak').getAttribute('clip-path')+"").indexOf('clipoffpeak') == -1)
                        document.getAnonymousElementByAttribute(this, 'id', 'patharrow2').setAttribute('transform', 'translate('+(maxWidth2 * v / 100)+',0)');
                    else // for New Modern Theme
                        document.getAnonymousElementByAttribute(this, 'id', 'patharrow2').setAttribute('transform', 'translate(-'+(maxWidth * v / 100)+',0)');
                } else {
                    document.getAnonymousElementByAttribute(this, 'id', 'patharrow2').style.display = 'none';
                }
            }
            else if (attr == 'status') {
                switch(v) {
                    case 'fetching':
                        document.getAnonymousElementByAttribute(this, 'id', "iconerror").setAttribute("display", "none");
                        document.getAnonymousElementByAttribute(this, 'id', "icondown").setAttribute("display", "");
                        break;
                    case 'error':
                        document.getAnonymousElementByAttribute(this, 'id', "iconerror").setAttribute("display", "");
                        document.getAnonymousElementByAttribute(this, 'id', "icondown").setAttribute("display", "none");
                        break;
                    default:
                        document.getAnonymousElementByAttribute(this, 'id', "iconerror").setAttribute("display", "none");
                        document.getAnonymousElementByAttribute(this, 'id', "icondown").setAttribute("display", "none");
                }
            }
            else if (attr == 'text') {
                var el = document.createTextNode(v);
                var pclabel = document.getAnonymousElementByAttribute(this, 'id', 'pclabel');
                if (pclabel.hasChildNodes()) {
                    pclabel.removeChild(pclabel.firstChild);
                }
                pclabel.appendChild(el);
            }
            else if (attr == 'text2') {
                var el = document.createTextNode(v);
                var pclabel = document.getAnonymousElementByAttribute(this, 'id', 'pc2label');
                if (pclabel.hasChildNodes()) {
                    pclabel.removeChild(pclabel.firstChild);
                }
                pclabel.appendChild(el);
            }
            else if (attr == 'flashing') {
                if (!v || v == "false") {
                    this.flashEnabled = false;

                } else {
                    this.anipos = 9;
                    this.anistep = 1;
                    this.flashEnabled = true;

                    if (!this.timer)
                            return; // TODO This happens because on first run, netusage update has returned when usagebar constructor has not been run yet
                    this.timer.cancel();
                    this.timer.init(this, 150, this.timer.TYPE_REPEATING_SLACK);
                }
            }
            svg.unsuspendRedraw(suspid);

            ]]>
            </body>
        </method>


    </implementation>
</binding>



</bindings>

Untitled XML (29-Jun @ 16:00)

yansky

Syntax Highlighted Code

  1. <?xml version="1.0"?>
  2. <!--
  3.  
  4. The NetUsage Project
  5. [257 more lines...]

Plain Code

<?xml version="1.0"?>
<!--

The NetUsage Project
http://netusage.mozdev.org/

Copyright (C) 2006, NetUsage Project
This extension can be freely distributed under
the terms of the Mozilla Public Licence 1.1
See the licence at http://www.mozilla.org/MPL/


Net Usage Item

XULPref

-->

<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>


<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    xmlns:html="http://www.w3.org/1999/xhtml"
    title="Net Usage Preferences"
    style="margin: 0px; padding: 0px;"
    onload="startup();"
    ondialogaccept="return fbAccept();"
    id="netusageprefsdlg">

<script type="application/x-javascript" src="usagelib.js" />
<script type="application/x-javascript" src="usagePrefs.js" />
<stack width="100%" style="background-color: #FFFFFF;">
    <hbox pack="end" style="background: url(chrome://netusageitem/skin/banner.png) top left no-repeat; height: 64px"></hbox>
    <description width="100%" id="nuiversion" style="color: #000000; font-size: 8pt; font-weight: bold;" />
</stack>
<vbox style="padding: 5px" flex="1">
<groupbox orient="horizontal" width="100%">
    <caption label="General Settings" />

    <vbox flex="1">
        <grid flex="1">
            <columns>
                <column flex="1" />
                <column flex="3" />
            </columns>
            <rows id="generalgrid">
                <row>
                    <label control="selisp" value="ISP" />
                    <hbox>
                        <menulist id="selcountry" disabled="false" oncommand="refreshISPList(null);">
                            <menupopup id="selcts">
                                <menuitem id="ct_more" value="more" label="More..." />
                            </menupopup>
                        </menulist>
                        <menulist id="selisp" disabled="false" flex="1"  oncommand="settingsChanged=true; refreshISPPrefs(false);"
                            preftype="string"
                            prefstring="extensions.netusage.0.userisp"
                            prefattribute="value">
                            <menupopup id="selisps">
                                <menuitem id="ispsna" value="na" label="Disable Usage Extension" />
                            </menupopup>
                        </menulist>
                    </hbox>
                </row>
                <row>
                    <label control="selinterval" value="Auto Refresh" />
                    <menulist id="selinterval" disabled="false" oncommand="settingsChanged=true;"
                        preftype="int"
                        prefstring="extensions.netusage.0.checkinterval"
                        prefattribute="value">
                        <menupopup>
                            <menuitem value="-1" label="Disabled" />
                            <menuitem value="900" label="Every 15 minutes" />
                            <menuitem value="1800" label="Every 30 minutes" />
                            <menuitem value="3600" label="Every hour" />
                            <menuitem value="7200" label="Every 2 hours" />
                            <menuitem value="14400" label="Every 4 hours" />
                            <menuitem value="21600" label="Every 6 hours" />
                            <menuitem value="43200" label="Every 12 hours" />
                            <menuitem value="86400" label="Every 24 hours" />
                        </menupopup>
                    </menulist>
                </row>
                <row id="rowuuname">
                    <label id="lbluuname" control="uuname" value="Username" />
                    <textbox id="uuname" flex="1" />
                </row>
                <row id="rowupass">
                    <label id="lblupass" control="upass" value="Password" />
                    <textbox id="upass" flex="1" type="password" />
                </row>
            </rows>
        </grid>
    </vbox>

</groupbox>



<groupbox orient="horizontal" width="100%">
    <caption label="ISP Settings" />

    <vbox flex="1">
        <description id="lbldescisp"></description>
        <grid>
            <columns>
                <column />
                <column flex="1" />
            </columns>
            <rows id="ispprefgrid">

            </rows>
        </grid>
    </vbox>

</groupbox>

<groupbox orient="horizontal" width="100%">
    <caption label="Time Settings" />

    <vbox flex="1">
        <label value="Configuration of the following time related settings are optional." />
        <grid>
            <columns>
                <column />
                <column flex="1" />
            </columns>
            <rows id="">
                <row>
                <label value="Offpeak (In Local time)" />
                <hbox>
                    <label value="From" />
                    <menulist id="seloffpeakstarttime" disabled="false" oncommand="settingsChanged=true;"
                        preftype="int"
                        prefstring="extensions.netusage.0.vars.offpeakstarttime"
                        prefattribute="value">
                        <menupopup>
                            <menuitem value="0" label="12:00 AM Midnight" />
                            <menuitem value="3600" label="1:00 AM" />
                            <menuitem value="7200" label="2:00 AM" />
                            <menuitem value="10800" label="3:00 AM" />
                            <menuitem value="14400" label="4:00 AM" />
                            <menuitem value="18000" label="5:00 AM" />
                            <menuitem value="21600" label="6:00 AM" />
                            <menuitem value="25200" label="7:00 AM" />
                            <menuitem value="28800" label="8:00 AM" />
                            <menuitem value="32400" label="9:00 AM" />
                            <menuitem value="36000" label="10:00 AM" />
                            <menuitem value="39600" label="11:00 AM" />
                            <menuitem value="43200" label="12:00 PM Noon" />
                            <menuitem value="46800" label="1:00 PM" />
                            <menuitem value="50400" label="2:00 PM" />
                            <menuitem value="54000" label="3:00 PM" />
                            <menuitem value="57600" label="4:00 PM" />
                            <menuitem value="61200" label="5:00 PM" />
                            <menuitem value="64800" label="6:00 PM" />
                            <menuitem value="68400" label="7:00 PM" />
                            <menuitem value="72000" label="8:00 PM" />
                            <menuitem value="75600" label="9:00 PM" />
                            <menuitem value="79200" label="10:00 PM" />
                            <menuitem value="82800" label="11:00 PM" />
                        </menupopup>
                    </menulist>
                    <label value="to" />
                    <menulist id="seloffpeakendtime" disabled="false" oncommand="settingsChanged=true;"
                        preftype="int"
                        prefstring="extensions.netusage.0.vars.offpeakendtime"
                        prefattribute="value">
                        <menupopup>
                            <menuitem value="0" label="12:00 AM Midnight" />
                            <menuitem value="3600" label="1:00 AM" />
                            <menuitem value="7200" label="2:00 AM" />
                            <menuitem value="10800" label="3:00 AM" />
                            <menuitem value="14400" label="4:00 AM" />
                            <menuitem value="18000" label="5:00 AM" />
                            <menuitem value="21600" label="6:00 AM" />
                            <menuitem value="25200" label="7:00 AM" />
                            <menuitem value="28800" label="8:00 AM" />
                            <menuitem value="32400" label="9:00 AM" />
                            <menuitem value="36000" label="10:00 AM" />
                            <menuitem value="39600" label="11:00 AM" />
                            <menuitem value="43200" label="12:00 PM Noon" />
                            <menuitem value="46800" label="1:00 PM" />
                            <menuitem value="50400" label="2:00 PM" />
                            <menuitem value="54000" label="3:00 PM" />
                            <menuitem value="57600" label="4:00 PM" />
                            <menuitem value="61200" label="5:00 PM" />
                            <menuitem value="64800" label="6:00 PM" />
                            <menuitem value="68400" label="7:00 PM" />
                            <menuitem value="72000" label="8:00 PM" />
                            <menuitem value="75600" label="9:00 PM" />
                            <menuitem value="79200" label="10:00 PM" />
                            <menuitem value="82800" label="11:00 PM" />
                        </menupopup>
                    </menulist>
                </hbox>
                </row>
                <row>
                    <label value="ISP Accounting Timezone" />

                    <menulist id="selisptime" disabled="false" oncommand="settingsChanged=true;"
                        preftype="int"
                        prefstring="extensions.netusage.0.vars.isptz"
                        prefattribute="value">
                        <menupopup>
                            <menuitem id="selisptimedefault" value="86400" label="Default/Local Time" />

                            <menuitem value="46800" label="(GMT+13:00)" />
                            <menuitem value="43200" label="(GMT+12:00) New Zealand" />
                            <menuitem value="39600" label="(GMT+11:00) NSW VIC TAS Summer Time" />
                            <menuitem value="37800" label="(GMT+10:30) SA Summer Time" />
                            <menuitem value="36000" label="(GMT+10:00) QLD; NSW VIC TAS Winter Time" />
                            <menuitem value="34200" label="(GMT+09:30) NT; SA Winter Time" />
                            <menuitem value="32400" label="(GMT+09:00) WA Summer Time" />
                            <menuitem value="28800" label="(GMT+08:00) WA Winter Time" />
                            <menuitem value="25200" label="(GMT+07:00)" />
                            <menuitem value="21600" label="(GMT+06:00)" />
                            <menuitem value="18000" label="(GMT+05:00)" />
                            <menuitem value="14400" label="(GMT+04:00)" />
                            <menuitem value="10800" label="(GMT+03:00)" />
                            <menuitem value="7200" label="(GMT+02:00)" />
                            <menuitem value="3600" label="(GMT+01:00)" />
                            <menuitem value="0" label="(GMT+00:00)" />
                            <menuitem value="-3600" label="(GMT-01:00)" />
                            <menuitem value="-7200" label="(GMT-02:00)" />
                            <menuitem value="-10800" label="(GMT-03:00)" />
                            <menuitem value="-14400" label="(GMT-04:00)" />
                            <menuitem value="-18000" label="(GMT-05:00)" />
                            <menuitem value="-21600" label="(GMT-06:00)" />
                            <menuitem value="-25200" label="(GMT-07:00)" />
                            <menuitem value="-28800" label="(GMT-08:00)" />
                            <menuitem value="-32400" label="(GMT-09:00)" />
                            <menuitem value="-36000" label="(GMT-10:00)" />
                            <menuitem value="-39600" label="(GMT-11:00)" />
                            <menuitem value="-43200" label="(GMT-12:00)" />
                        </menupopup>
                    </menulist>
                </row>
            </rows>
        </grid>
    </vbox>

</groupbox>
<spacer style="margin-top:10px;" />
<groupbox orient="horizontal" width="100%">
<checkbox label="Widen NetUsage Bar By" checked="false" prefstring="extensions.netusage.widen" prefattribute="checked" preftype="bool" />
<textbox id="widepix" preftype="int" prefstring="extensions.netusage.widenNumber" />Pixels  (requires a restart)
</groupbox>
<spacer style="margin-bottom:10px;" />
<hbox>
    <hbox>
        <button label="Clear all settings" id="btnclear"  onclick="clearAllSettings();" />
    </hbox>
    <hbox flex="1" pack="end">
        <button label="OK" id="btnok" onclick="if (onOK()) window.close();" />
        <button label="Cancel" onclick="window.close();" />
    </hbox>
</hbox>

</vbox>

</window>

Untitled XML (29-Jun @ 15:56)

Syntax Highlighted Code

  1. <?xml version="1.0"?>
  2. <bindings xmlns="http://www.mozilla.org/xbl"
  3.  xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  4.  xmlns:html="http://www.w3.org/1999/xhtml">
  5. [903 more lines...]

Plain Code

<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl"
 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
 xmlns:html="http://www.w3.org/1999/xhtml">


<binding id="item1" styleexplicitcontent="true">
<!-- Net Usage Item GUI, licensed under the Mozilla Public License (C) 2008 Loune lpgcritter at nasquan dot com  -->
    <!-- <resources>
    <stylesheet src="chrome://"/>
    </resources> -->
    <content>

        <svg
            xmlns:svg="http://www.w3.org/2000/svg"
            xmlns="http://www.w3.org/2000/svg"
            xmlns:xlink="http://www.w3.org/1999/xlink"
            version="1.0"
            x="0"
            y="0"
            width="0"
            height="0"
            id="netusagesvgdefstub" />


        <!-- XXXXXXXXXXXXXXXXXXXXXXX CUT HERE XXXXXXXXXXXXXXXXXXXXXXXXX -->

            
            
        <svg
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:cc="http://web.resource.org/cc/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:svg="http://www.w3.org/2000/svg"
             xmlns="http://www.w3.org/2000/svg"
             xmlns:xlink="http://www.w3.org/1999/xlink"
             xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
             xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
             version="1.0"
             x="0.00000000"
             y="0.00000000"
             width="126"
             height="23"
             id="netusagesvg"
             sodipodi:version="0.32"
             inkscape:version="0.44"
             sodipodi:docname="netusage1.svg"
             sodipodi:docbase="D:\Workspace\netusage">
            <metadata
                 id="metadata65">
                <rdf:RDF>
                    <cc:Work
                         rdf:about="">
                        <dc:format>image/svg+xml</dc:format>
                        <dc:type
                             rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
                    </cc:Work>
                </rdf:RDF>
            </metadata>
            <sodipodi:namedview
                 inkscape:window-height="641"
                 inkscape:window-width="1136"
                 inkscape:pageshadow="2"
                 inkscape:pageopacity="0.0"
                 borderopacity="1.0"
                 bordercolor="#666666"
                 pagecolor="#ffffff"
                 id="base"
                 inkscape:zoom="11.313709"
                 inkscape:cx="47.127219"
                 inkscape:cy="0.49738615"
                 inkscape:window-x="245"
                 inkscape:window-y="259"
                 inkscape:current-layer="layer2"
                 showguides="true"
                 inkscape:guide-bbox="true"
                 height="23px"
                 width="126px" />
            <defs
                 id="netusagedefs">
                <linearGradient
                     id="linearGradient2243">
                    <stop
                         style="stop-color:#75ff00;stop-opacity:1"
                         offset="0"
                         id="stop2245" />
                    <stop
                         style="stop-color:#2f7f39;stop-opacity:1"
                         offset="1"
                         id="stop2247" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2258">
                    <stop
                         style="stop-color:#fff07a;stop-opacity:1.0000000"
                         offset="0.00000000"
                         id="stop2260" />
                    <stop
                         style="stop-color:#ff9e4e;stop-opacity:1.0000000"
                         offset="0.50000000"
                         id="stop2262" />
                    <stop
                         style="stop-color:#ff5000;stop-opacity:1.0000000"
                         offset="0.50925928"
                         id="stop2264" />
                    <stop
                         style="stop-color:#ffd600;stop-opacity:1.0000000"
                         offset="1.0000000"
                         id="stop2266" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2178">
                    <stop
                         style="stop-color:#9cdc62;stop-opacity:1.0000000"
                         offset="0.00000000"
                         id="stop2184" />
                    <stop
                         style="stop-color:#72e035;stop-opacity:1.0000000"
                         offset="0.37201953"
                         id="stop2188" />
                    <stop
                         style="stop-color:#5ea32a;stop-opacity:1;"
                         offset="0.37201953"
                         id="stop2190" />
                    <stop
                         style="stop-color:#b0ea7a;stop-opacity:1.0000000"
                         offset="1.0000000"
                         id="stop2186" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2083">
                    <stop
                         style="stop-color:#7fff00;stop-opacity:1.0000000"
                         offset="0.00000000"
                         id="stop2085" />
                    <stop
                         style="stop-color:#cfd218;stop-opacity:1.0000000"
                         offset="0.29076648"
                         id="stop2152" />
                    <stop
                         style="stop-color:#e0b21c;stop-opacity:1.0000000"
                         offset="0.71105301"
                         id="stop2156" />
                    <stop
                         style="stop-color:#ee2420;stop-opacity:1.0000000"
                         offset="1.0000000"
                         id="stop2087" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2073">
                    <stop
                         style="stop-color:#7c92b9;stop-opacity:1.0000000"
                         offset="0.00000000"
                         id="stop2075" />
                    <stop
                         style="stop-color:#ffffff;stop-opacity:1.0000000"
                         offset="1.0000000"
                         id="stop2077" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2051">
                    <stop
                         style="stop-color:#747474;stop-opacity:1.0000000"
                         offset="0.00000000"
                         id="stop2053" />
                    <stop
                         style="stop-color:#ffffff;stop-opacity:1.0000000"
                         offset="1.0000000"
                         id="stop2055" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2115">
                    <stop
                         style="stop-color:#1b45c4;stop-opacity:1;"
                         offset="0"
                         id="stop2117" />
                    <stop
                         style="stop-color:#0140ff;stop-opacity:0;"
                         offset="1"
                         id="stop2119" />
                </linearGradient>
                <linearGradient
                     id="linearGradient2292">
                    <stop
                         id="stop2294"
                         offset="0"
                         style="stop-color:#ffe31c;stop-opacity:1;" />
                    <stop
                         id="stop2296"
                         offset="1"
                         style="stop-color:#ffffff;stop-opacity:0;" />
                </linearGradient>
                <linearGradient
                     x1="-39.743919"
                     y1="271.64819"
                     x2="456.23572"
                     y2="271.64819"
                     id="linearGradient2081"
                     xlink:href="#linearGradient2083"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.409736,0,0,0.208754,30.24163,211.051)" />
                <linearGradient
                     x1="295.08344"
                     y1="343.32632"
                     x2="295.08344"
                     y2="224.68822"
                     id="linearGradient2172"
                     xlink:href="#linearGradient2051"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.369234,0,0,0.410816,-15.19644,-99.69333)" />
                <linearGradient
                     x1="222.15965"
                     y1="237.48343"
                     x2="222.15965"
                     y2="301.78006"
                     id="linearGradient2174"
                     xlink:href="#linearGradient2073"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.341899,0,0,0.26744,-9.276913,-60.6394)" />
                <linearGradient
                     x1="162.57631"
                     y1="245.21945"
                     x2="162.57631"
                     y2="298.0766"
                     id="linearGradient2176"
                     xlink:href="#linearGradient2178"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.245416,0,0,0.242214,-4.287223,-52.43637)" />
                <linearGradient
                     x1="162.57631"
                     y1="245.21945"
                     x2="162.57631"
                     y2="298.07651"
                     id="linearGradient2256"
                     xlink:href="#linearGradient2258"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.348017,0,0,0.208754,-8.863015,-44.14369)" />
                <linearGradient
                     collect="always"
                     xlink:href="#linearGradient2115"
                     id="linearGradient2314"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(3.046092,0,0,0.458,-842.6463,-147.6332)"
                     x1="297.30167"
                     y1="354.22491"
                     x2="297.30167"
                     y2="371.1955" />
                <linearGradient
                     collect="always"
                     xlink:href="#linearGradient2292"
                     id="linearGradient2316"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(3.012188,0,0,0.447051,-831.282,-150.2732)"
                     x1="297.31323"
                     y1="354.22491"
                     x2="297.31323"
                     y2="371.1955" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2243"
                     id="linearGradient2249"
                     x1="136.79781"
                     y1="19.51153"
                     x2="136.79781"
                     y2="7.1371608"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.883905,0,0,0.889813,-105.5481,-0.606724)" />
                <clipPath
                     id="clipoffpeak">
                    <rect
                         id="clipoffpeakrect"
                         width="117.875"
                         height="14.520815"
                         x="7"
                         y="5.75"
                         rx="0"
                         ry="0" />
                </clipPath>
                <clipPath
                     id="clipbars">
                    <rect
                     width="113.4"
                     height="13.6"
                     rx="2.258666"
                     ry="2.1103067"
                     x="6.7890587"
                     y="4.9000001"
                     id="rect2815" />
                </clipPath>
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2258"
                     id="linearGradient2827"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.334468,0,0,0.219789,-8.452445,-47.85567)"
                     x1="162.86516"
                     y1="245.21945"
                     x2="162.86516"
                     y2="298.07651" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2073"
                     id="linearGradient2817"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.353131,0,0,0.268212,-10.60411,-95.53958)"
                     x1="223.25398"
                     y1="237.48343"
                     x2="223.25398"
                     y2="301.78006" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2051"
                     id="linearGradient2821"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.384191,0,0,0.437012,-17.52787,-141.364)"
                     x1="295.08344"
                     y1="343.32632"
                     x2="295.08344"
                     y2="224.68822" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2073"
                     id="linearGradient2828"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.353131,0,0,0.268212,-10.85411,-95.53958)"
                     x1="223.25398"
                     y1="237.48343"
                     x2="223.25398"
                     y2="301.78006" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2115"
                     id="linearGradient2835"
                     x1="68.125"
                     y1="7.25"
                     x2="68.125"
                     y2="25.077589"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(0.752725,0,0,0.50003,-4.602051,9.1255)" />
                <linearGradient
                     inkscape:collect="always"
                     xlink:href="#linearGradient2292"
                     id="linearGradient2839"
                     gradientUnits="userSpaceOnUse"
                     gradientTransform="matrix(1.061878,0,0,0.460027,-9.204941,9.533024)"
                     x1="68.125"
                     y1="7.25"
                     x2="68.125"
                     y2="43.715527" />
            </defs>
            <g
                 id="layer1">
                <rect
                     width="123.5"
                     height="21.5"
                     rx="9.8386154"
                     ry="10.379341"
                     x="1.5"
                     y="1"
                     style="fill:url(#linearGradient2172);fill-opacity:1;stroke:black;stroke-width:0.99999976;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.63492067"
                     id="rectouter" />
                <rect
                     width="114.3"
                     height="14.1"
                     rx="2.2586658"
                     ry="2.1103072"
                     x="6.3"
                     y="5"
                     style="fill:url(#linearGradient2174);fill-opacity:1;stroke:black;stroke-width:1.00000012;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.6719577"
                     id="rectinner" />
                <g
                     inkscape:groupmode="layer"
                     id="layer2"
                     inkscape:label="bars"
                     clip-path="url(#clipbars)">
                    <rect
                         width="113.5"
                         height="13.1"
                         rx="2.1912799"
                         ry="1.5982112"
                         x="6.8"
                         y="5.5"
                         style="opacity:1;fill:url(#linearGradient2827);fill-opacity:1;stroke:none;stroke-width:1.87557006;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
                         id="peakover" />
                    <rect
                         width="113.5"
                         height="13.1"
                         rx="2.1912799"
                         ry="1.5982111"
                         x="6.8"
                         y="5.5"
                         style="opacity:1;fill:url(#linearGradient2176);fill-opacity:1;stroke:none;stroke-width:1.87557006;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
                         id="peak" />
                    <path
                         d="M 3.053786,4.2362938 L 10.742332,4.2362938 L 6.8980586,9.6416242 L 3.053786,4.2362938 z "
                         style="fill:black;fill-opacity:1;stroke:none;stroke-width:1.25;stroke-miterlimit:4;stroke-opacity:1"
                         id="patharrow" />
                    <rect
                         style="opacity:1;fill:url(#linearGradient2839);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
                         id="offpeakover"
                         width="113.5"
                         height="5.5"
                         x="6.8"
                         y="13"
                         rx="0"
                         ry="0" />
                    <rect
                         style="opacity:1;fill:url(#linearGradient2835);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
                         id="offpeak"
                         width="113.5"
                         height="5.5"
                         x="6.8"
                         y="13"
                         rx="0"
                         ry="0" />
                    <path
                         d="M 9.2731107,18.772569 L 4.421751,18.698553 L 6.9057977,15.557182 L 9.2731107,18.772569 z "
                         style="opacity:1;fill:white;fill-opacity:1;stroke:none;stroke-width:1.25;stroke-miterlimit:4;stroke-opacity:1"
                         id="patharrow2"
                         inkscape:transform-center-y="3.7231195" />

                    <g
                         id="iconerror"
                         transform="matrix(0.93714,0,0,0.940057,-97.13415,33.75136)">
                        <path
                             transform="matrix(0.427044,0,0,0.492997,65.22645,-17.42024)"
                             sodipodi:open="true"
                             sodipodi:end="12.497908"
                             sodipodi:start="6.2292315"
                             d="M 144.93554,-11.799526 A 14.672466,11.932427 0 1 1 144.92252,-11.972325"
                             sodipodi:ry="11.932427"
                             sodipodi:rx="14.672466"
                             sodipodi:cy="-11.156038"
                             sodipodi:cx="130.28442"
                             id="iconerrorcircle"
                             style="opacity:1;fill:red;fill-opacity:0.78835976;stroke:black;stroke-width:2.32200027;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
                             sodipodi:type="arc" />
                        <path
                             id="path2253"
                             d="M 123.9972,-25.849435 L 118.00283,-20.400574"
                             style="fill:none;fill-opacity:0.78835976;fill-rule:evenodd;stroke:white;stroke-width:1.59812951;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
                        <path
                             id="path2255"
                             d="M 123.82577,-19.935489 L 117.67426,-25.814523"
                             style="fill:none;fill-opacity:0.78835976;fill-rule:evenodd;stroke:white;stroke-width:1.59812939;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
                    </g>
                    <path
                         style="opacity:0.88144334;fill:url(#linearGradient2249);fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.47692309"
                         d="M 13.195219,6.1889253 L 13.195219,11.292777 L 8.4873981,11.292777 L 15.549124,18.675132 L 22.24872,11.292777 L 17.450357,11.292776 L 17.540899,6.1889253 L 13.195219,6.1889253 z "
                         id="icondown"
                         sodipodi:nodetypes="cccccccc" />
                </g>
                <text
                         x="117.5"
                         y="16.8"
                         style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:end;line-height:125%;writing-mode:lr;text-anchor:end;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial"
                         id="pclabelouter"
                         xml:space="preserve"
                         sodipodi:linespacing="125%"><tspan
                            x="117.5"
                            y="16.8"
                            id="pclabel">0%</tspan></text>
                <text
                     xml:space="preserve"
                     style="font-size:13px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:end;line-height:125%;writing-mode:lr-tb;text-anchor:end;fill:#fff5f5;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:none;font-family:Arial"
                     x="85.661148"
                     y="17.569111"
                     id="pc2labelouter"
                     sodipodi:linespacing="125%"><tspan
                        sodipodi:role="line"
                        x="85.661148"
                        y="17.569111"
                        id="pc2label">0%</tspan></text>
            </g>
        </svg>

            
        <!-- XXXXXXXXXXXXXXXXXXXXXXX CUT HERE XXXXXXXXXXXXXXXXXXXXXXXXX -->



    </content>

    <implementation implements="nsIObserver, nsIDOMEventListener">
        <constructor>
            <![CDATA[

            //var svg = document.getAnonymousElementByAttribute(this, 'id', 'netusagesvg');
            //var suspid = svg.suspendRedraw(1000);
            
            // get num from id
            var sitemid = this.getAttribute('id');
            this.itemid = parseInt(sitemid[sitemid.length-1], 10);

            this.defprefix = "";
            this.svghack = window.navigator.userAgent.indexOf("; rv:1.8") != -1;

            if (this.svghack) {

                // hack for bug https://bugzilla.mozilla.org/show_bug.cgi?id=309020
                this.defprefix = "nu"+this.itemid+"_";

                var existingStub = document.getElementById(this.defprefix+'netusagesvgdefstub');
                if (existingStub) {
                    // remove previous stub
                    existingStub.parentNode.removeChild(existingStub);
                }

                // mass append nu0_ ids to the defs
                var tmplstub = document.getAnonymousElementByAttribute(this, 'id', "netusagesvgdefstub");
                tmplstub.setAttribute("id", this.defprefix+'netusagesvgdefstub');

                document.getAnonymousElementByAttribute(this, 'id', "netusagedefs").setAttribute("id", this.defprefix+'netusagedefs');
                this.alterNodeId(document.getAnonymousElementByAttribute(this, 'id', this.defprefix+"netusagedefs"), this.defprefix);

                var svgdefstub = document.importNode(tmplstub, true);
                var svgdefs = document.importNode(document.getAnonymousElementByAttribute(this, 'id', this.defprefix+"netusagedefs"), true);

                svgdefstub.appendChild(svgdefs);
                var c = svgdefstub.cloneNode(true);

                document.documentElement.appendChild(c);

                var elids = ['layer2', 'rectouter', 'rectinner', 'peak', 'peakover', 'offpeak', 'offpeakover', 'icondown'];
                for(var i in elids) {
                
                    var r = document.getAnonymousElementByAttribute(this, 'id', elids[i]).getAttribute('clip-path');
                    if (r != null) {
                        r = r.replace(/url\(#([^)]+)/, "url("+document.location+"#"+this.defprefix+"$1");
                        document.getAnonymousElementByAttribute(this, 'id', elids[i]).setAttribute("clip-path", r);
                    }
                    r = document.getAnonymousElementByAttribute(this, 'id', elids[i]).getAttribute('style');
                    if (r != null) {
                        r = r.replace(/fill: url\(#([^)]+)/, "fill: url("+document.location+"#"+this.defprefix+"$1");
                        
                        document.getAnonymousElementByAttribute(this, 'id', elids[i]).setAttribute("style", r);
                    }
                }
            }

            var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
            prefs = prefs.getBranch("extensions.netusage.");            

            if(prefs.getBoolPref('widen')){

                var elids2 = ['netusagesvg', 'rectouter', 'rectinner', 'peakover', 'peak', 'offpeakover', 'offpeak', 'pclabel', 'pclabelouter', 'pc2labelouter', 'pc2label'];
                for(var i in elids2) {

                    var e = document.getAnonymousElementByAttribute(this, 'id', elids2[i]), huh = 'x';

                    if(e.hasAttribute('width')){
                    
                        huh = 'width';
                    
                    }
                
                    var getW = Number(e.getAttribute(huh))+prefs.getIntPref("widenNumber");

                    e.setAttribute(huh, getW);

                }
        
            }        

            // GUI
            this.maxWidth = parseInt(document.getAnonymousElementByAttribute(this, 'id', 'peakover').getAttribute("width"), 10);
            this.maxWidth2 = parseInt(document.getAnonymousElementByAttribute(this, 'id', 'offpeakover').getAttribute("width"), 10);
            // for New Modern offpeak which progresses backwards
            this.baseX = parseInt(document.getAnonymousElementByAttribute(this, 'id', this.defprefix+'clipoffpeakrect').getAttribute("x"), 10);
            
            // The following two function fails when running outside chrome
            // flashing timer
            try {
            this.timer = Components.classes['@mozilla.org/timer;1'].createInstance(Components.interfaces.nsITimer);
            } catch (e) { dump("EXCEPTION flashing timer create failed" + e); }
            
            try {
            this.addEventListener('DOMAttrModified', this, false);
            } catch (e) { dump("EXCEPTION addEventListener DOMAttrModified failed" + e); }

            //svg.unsuspendRedraw(suspid);
            
            // set state to initial values
            this.refreshItem("text", this.getAttribute("text"));
            this.refreshItem("text2", this.getAttribute("text2"));
            this.refreshItem("pc", parseInt(this.getAttribute("pc"), 10));
            this.refreshItem("pc2", parseInt(this.getAttribute("pc2"), 10));
            this.refreshItem("arrow", parseInt(this.getAttribute("arrow"), 10));
            this.refreshItem("arrow2", parseInt(this.getAttribute("arrow2"), 10));
            this.refreshItem("status", this.getAttribute("status"));
            this.refreshItem("flashing", this.getAttribute("flashing"));
            
            ]]>
        </constructor>

        <destructor>
            <![CDATA[
            if (this.timer)
                this.timer.cancel();
            this.timer = null;
            ]]>
        </destructor>

        <property name="arrow">
            <getter>
                return parseInt(this.getAttribute('arrow'));
            </getter>
            <setter>
                <![CDATA[
            this.setAttribute("arrow", val);
            ]]>
            </setter>
        </property>

        <property name="arrow2">
            <getter>
                return parseInt(this.getAttribute('arrow2'));
            </getter>
            <setter>
                <![CDATA[
            this.setAttribute("arrow2", val);
            ]]>
            </setter>
        </property>



        <property name="pc">
            <getter>
                return parseInt(this.getAttribute('pc'));
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("pc", val);
            ]]>
            </setter>
        </property>


        <property name="pc2">
            <getter>
                return parseInt(this.getAttribute('pc2'));
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("pc2", val);
            ]]>
            </setter>
        </property>

        <property name="status">
            <getter>
                return this.getAttribute('status');
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("status", val);
            ]]>
            </setter>
        </property>


        <property name="text">
            <getter>
                return this.getAttribute('text');
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("text", val);
            ]]>
            </setter>
        </property>
        <property name="text2">
            <getter>
                return this.getAttribute('text2');
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("text2", val);
            ]]>
            </setter>
        </property>
        <property name="flashing">
            <getter>
                return this.getAttribute('flashing');
            </getter>

            <setter>
                <![CDATA[
            this.setAttribute("flashing", val); // val needs to be turned into string or else DOMAttrModified won't trip
            ]]>
            </setter>
        </property>

        <method name="alterNodeId">
            <parameter name="root" />
            <parameter name="prepend_id" />
            <body>
                <![CDATA[
            for (var i = 0; i < root.childNodes.length; i++) {
                this.alterNodeId(root.childNodes[i], prepend_id);
                if (!root.childNodes[i].setAttribute)
                    continue;
                //root.childNodes[i].setAttribute("id", prepend_id+root.childNodes[i].id);
                root.childNodes[i].id = prepend_id+root.childNodes[i].id;
                //if (root.childNodes[i].getAttributeNS("http://www.w3.org/1999/xlink", "href") != null) {
                var xlinkhref = root.childNodes[i].getAttribute("xlink:href");
                if (xlinkhref != null) {
                    root.childNodes[i].setAttribute("xlink:href", "#"+prepend_id+xlinkhref.substring(1, xlinkhref.length));
                    //alert(root.childNodes[i].getAttribute("xlink:href"));
                }
            }
            ]]>
            </body>
        </method>

        <method name="observe">
            <parameter name="subject" />
            <parameter name="topic" />
            <parameter name="data" />
            <body>
                <![CDATA[
            if (topic == 'timer-callback') {
                try {
                // flash
                var svg = document.getAnonymousElementByAttribute(this, 'id', 'netusagesvg');
                if (this.anipos >= 9 || this.anipos <= 5) {
                    this.anistep = -this.anistep;
                }
                if (this.flashEnabled || (!this.flashEnabled && this.anipos < 9)) {
                    //svg.style.MozOpacity = '0.'+this.anipos;
                    svg.setAttribute('style', 'opacity: 0.'+this.anipos);
                    this.anipos += this.anistep;
                } else {
                    // flashing disabled and cycle is complete
                    this.timer.cancel();
                    //svg.style.opacity = '1';
                    svg.setAttribute('style', 'opacity: 1');
                    this.anipos = 9;
                    this.anistep = 1;
                }
                } catch (e) { this.timer.cancel(); alert('netusage flash timer-callback error: '+e); }
            }

            ]]>
            </body>
        </method>


        <method name="handleEvent">
            <parameter name="e" />
            <body>
                <![CDATA[
            //dump('DOMAttrModified '+e.attrName+' '+e.originalTarget+'\n');
            if (e.type == 'DOMAttrModified' && e.originalTarget == this) {
                if (e.attrName == 'status' || e.attrName == 'text' || e.attrName == 'text2' || e.attrName == 'flashing')
                    this.refreshItem(e.attrName, e.newValue);
                else
                    this.refreshItem(e.attrName, parseInt(e.newValue, 10));
                //e.prevValue = 
                
                /* dump('event {\n');
                for(i in e) {
                    dump(i + ": " + e[i] +"\n")
                }
                dump('}\n'); */
                
            }
            ]]>
            </body>
        </method>


        <method name="refreshItem">
            <parameter name="attr" />
            <parameter name="v" />
            <body>
                <![CDATA[
            var maxWidth = parseInt(this.maxWidth); // TODO do we really need to parseInt? was it a bug?
            var maxWidth2 = parseInt(this.maxWidth2);
            var baseX = parseInt(this.baseX);
            var svg = document.getAnonymousElementByAttribute(this, 'id', 'netusagesvg');
            var suspid = svg.suspendRedraw(1000);
            //e.prevValue = 
            
            if (attr == 'pc') {
                if (v < 100) {
                    document.getAnonymousElementByAttribute(this, 'id', 'peakover').style.display = 'none';
                    document.getAnonymousElementByAttribute(this, 'id', 'peak').setAttribute('width', maxWidth * v / 100);
                }
                else {
                    document.getAnonymousElementByAttribute(this, 'id', 'peakover').style.display = '';
                    document.getAnonymousElementByAttribute(this, 'id', 'peak').setAttribute('width', maxWidth * 100 / v);
                }
            }
            else if (attr == 'pc2') {
                if ((document.getAnonymousElementByAttribute(this, 'id', 'offpeak').getAttribute('clip-path')+"").indexOf('clipoffpeak') == -1) {
                    if (v < 100) {
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeakover').style.display = 'none';
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeak').setAttribute('width', maxWidth2 * v / 100);
                    }
                    else {
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeakover').style.display = '';
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeak').setAttribute('width', maxWidth2 * 100 / v);
                    }
                }
                else {
                    // for New Modern theme, where off peak bar comes the opposite direction
                    var clipoffpeakrect = this.svghack ? document.getElementById(this.defprefix+'clipoffpeakrect') : document.getAnonymousElementByAttribute(this, 'id', 'clipoffpeakrect');

                    if (v < 100) {
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeakover').style.display = 'none';
                        clipoffpeakrect.setAttribute('x', baseX + maxWidth - maxWidth * v / 100);
                        clipoffpeakrect.setAttribute('width', maxWidth * v / 100);
                    }
                    else {
                        document.getAnonymousElementByAttribute(this, 'id', 'offpeakover').style.display = '';
                        clipoffpeakrect.setAttribute('x', baseX + maxWidth - maxWidth * 100 / v);
                        clipoffpeakrect.setAttribute('width', maxWidth * 100 / v);
                    }
                    
                    // hack for bug that doesn't redraw clipping
                    var cp = document.getAnonymousElementByAttribute(this, 'id', 'offpeak').getAttribute('clip-path');
                    document.getAnonymousElementByAttribute(this, 'id', 'offpeak').setAttribute('clip-path', '');
                    document.getAnonymousElementByAttribute(this, 'id', 'offpeak').setAttribute('clip-path', cp);
                }
            }
            else if (attr == 'arrow') {
                if (v <= 100) {
                    document.getAnonymousElementByAttribute(this, 'id', 'patharrow').setAttribute('transform', 'translate('+(maxWidth * v / 100)+',0)');
                }
            }
            else if (attr == 'arrow2') {
                if (v > 0 && v <= 100) {
                    document.getAnonymousElementByAttribute(this, 'id', 'patharrow2').style.display = '';
                    if ((document.getAnonymousElementByAttribute(this, 'id', 'offpeak').getAttribute('clip-path')+"").indexOf('clipoffpeak') == -1)
                        document.getAnonymousElementByAttribute(this, 'id', 'patharrow2').setAttribute('transform', 'translate('+(maxWidth2 * v / 100)+',0)');
                    else // for New Modern Theme
                        document.getAnonymousElementByAttribute(this, 'id', 'patharrow2').setAttribute('transform', 'translate(-'+(maxWidth * v / 100)+',0)');
                } else {
                    document.getAnonymousElementByAttribute(this, 'id', 'patharrow2').style.display = 'none';
                }
            }
            else if (attr == 'status') {
                switch(v) {
                    case 'fetching':
                        document.getAnonymousElementByAttribute(this, 'id', "iconerror").setAttribute("display", "none");
                        document.getAnonymousElementByAttribute(this, 'id', "icondown").setAttribute("display", "");
                        break;
                    case 'error':
                        document.getAnonymousElementByAttribute(this, 'id', "iconerror").setAttribute("display", "");
                        document.getAnonymousElementByAttribute(this, 'id', "icondown").setAttribute("display", "none");
                        break;
                    default:
                        document.getAnonymousElementByAttribute(this, 'id', "iconerror").setAttribute("display", "none");
                        document.getAnonymousElementByAttribute(this, 'id', "icondown").setAttribute("display", "none");
                }
            }
            else if (attr == 'text') {
                var el = document.createTextNode(v);
                var pclabel = document.getAnonymousElementByAttribute(this, 'id', 'pclabel');
                if (pclabel.hasChildNodes()) {
                    pclabel.removeChild(pclabel.firstChild);
                }
                pclabel.appendChild(el);
            }
            else if (attr == 'text2') {
                var el = document.createTextNode(v);
                var pclabel = document.getAnonymousElementByAttribute(this, 'id', 'pc2label');
                if (pclabel.hasChildNodes()) {
                    pclabel.removeChild(pclabel.firstChild);
                }
                pclabel.appendChild(el);
            }
            else if (attr == 'flashing') {
                if (!v || v == "false") {
                    this.flashEnabled = false;

                } else {
                    this.anipos = 9;
                    this.anistep = 1;
                    this.flashEnabled = true;

                    if (!this.timer)
                            return; // TODO This happens because on first run, netusage update has returned when usagebar constructor has not been run yet
                    this.timer.cancel();
                    this.timer.init(this, 150, this.timer.TYPE_REPEATING_SLACK);
                }
            }
            svg.unsuspendRedraw(suspid);

            ]]>
            </body>
        </method>


    </implementation>
</binding>



</bindings>

Untitled XML (24-Jun @ 10:09)

Syntax Highlighted Code

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <root>
  3.   <hello>foo <baz/> bar</hello>
  4.   <moar/>
  5. </root>

Plain Code

<?xml version="1.0" encoding="utf-8"?>
<root>
  <hello>foo <baz/> bar</hello>
  <moar/>
</root>

Untitled XML (15-Jun @ 08:51)

yansky

Syntax Highlighted Code

  1. <?xml version="1.0"?>
  2. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
  3. <?xml-stylesheet href="style/style.css" type="text/css"?>
  4. <window id="main" persist="screenX screenY width height" title="ScrapeBot3000" width="600" orient="horizontal" height="600" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  5. [93 more lines...]

Plain Code

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="style/style.css" type="text/css"?>
<window id="main" persist="screenX screenY width height" title="ScrapeBot3000" width="600" orient="horizontal" height="600" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="text/javascript" src="scrapeB.js"/>    

    <vbox id="holder" flex="1">
        <toolbox>
            <toolbar id="findfilesToolbar">
                <menubar id="scrapeMenubar">
                    <menu id="scrapeFileMenu" label="File">
                        <menupopup id="filePopup">
                            <menuitem id="scrapeInstall" label="Install Script"/>
                            <menuseparator/>
                            <menuitem id="programExit" label="Exit"/>
                        </menupopup>
                    </menu>
                    <menu id="scrapeSettingsMenu" label="Settings">
                        <menupopup id="edit-popup">
                            <menuitem id="scrapePreferences" label="Set Download Folder"/>
                        </menupopup>
                    </menu>
                    <menu id="scrapeHelpMenu" label="Help">
                        <menupopup id="help-popup">
                            <menuitem label="Help Contents"/>
                            <menuitem label="About"/>
                            <menuitem label="Donate"/>
                        </menupopup>
                    </menu>                    
                </menubar>
            </toolbar>
        </toolbox>
        <menuseparator/>
        <spacer style="height: 20px"/>
       
        <description id="descr">
            I can haz intarwebs?
        </description>

        <spacer style="height: 20px"/>

        
        <vbox id="selectContainer">
            
                <menulist id="selectScript">
                    <menupopup id="selectScriptMP">
                        <menuitem value="Select A Script To Run" label="Select A Script To Run"/>
                    </menupopup>
                </menulist>
            
           
                <groupbox id="sInfo">
                    <caption label="Script Info:"/>
                    <label class="sInfoLabels" value="Filename:"/>
                    <description value=""/>
                    <label class="sInfoLabels" value="Script Name:"/>
                    <description value=""/>
                    <label class="sInfoLabels" value="Version:"/>
                    <description value=""/>
                    <label