Tip: Click lines to highlight, hold ctrl/cmd to multi-select

http://codedumper.com/uvuze (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.  
  6.  
  7. <binding id="item1" styleexplicitcontent="true">
  8. <!-- Net Usage Item GUI, licensed under the Mozilla Public License (C) 2008 Loune lpgcritter at nasquan dot com  -->
  9.     <!-- <resources>
  10.     <stylesheet src="chrome://"/>
  11.     </resources> -->
  12.     <content>
  13.  
  14.         <svg
  15.             xmlns:svg="http://www.w3.org/2000/svg"
  16.             xmlns="http://www.w3.org/2000/svg"
  17.             xmlns:xlink="http://www.w3.org/1999/xlink"
  18.             version="1.0"
  19.             x="0"
  20.             y="0"
  21.             width="0"
  22.             height="0"
  23.             id="netusagesvgdefstub" />
  24.  
  25.  
  26.         <!-- XXXXXXXXXXXXXXXXXXXXXXX CUT HERE XXXXXXXXXXXXXXXXXXXXXXXXX -->
  27.  
  28.            
  29.            
  30.         <svg
  31.              xmlns:dc="http://purl.org/dc/elements/1.1/"
  32.              xmlns:cc="http://web.resource.org/cc/"
  33.              xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  34.              xmlns:svg="http://www.w3.org/2000/svg"
  35.              xmlns="http://www.w3.org/2000/svg"
  36.              xmlns:xlink="http://www.w3.org/1999/xlink"
  37.              xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
  38.              xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
  39.              version="1.0"
  40.              x="0.00000000"
  41.              y="0.00000000"
  42.              width="126"
  43.              height="23"
  44.              id="netusagesvg"
  45.              sodipodi:version="0.32"
  46.              inkscape:version="0.44"
  47.              sodipodi:docname="netusage1.svg"
  48.              sodipodi:docbase="D:\Workspace\netusage">
  49.             <metadata
  50.                  id="metadata65">
  51.                 <rdf:RDF>
  52.                     <cc:Work
  53.                          rdf:about="">
  54.                         <dc:format>image/svg+xml</dc:format>
  55.                         <dc:type
  56.                              rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
  57.                     </cc:Work>
  58.                 </rdf:RDF>
  59.             </metadata>
  60.             <sodipodi:namedview
  61.                  inkscape:window-height="641"
  62.                  inkscape:window-width="1136"
  63.                  inkscape:pageshadow="2"
  64.                  inkscape:pageopacity="0.0"
  65.                  borderopacity="1.0"
  66.                  bordercolor="#666666"
  67.                  pagecolor="#ffffff"
  68.                  id="base"
  69.                  inkscape:zoom="11.313709"
  70.                  inkscape:cx="47.127219"
  71.                  inkscape:cy="0.49738615"
  72.                  inkscape:window-x="245"
  73.                  inkscape:window-y="259"
  74.                  inkscape:current-layer="layer2"
  75.                  showguides="true"
  76.                  inkscape:guide-bbox="true"
  77.                  height="23px"
  78.                  width="126px" />
  79.             <defs
  80.                  id="netusagedefs">
  81.                 <linearGradient
  82.                      id="linearGradient2243">
  83.                     <stop
  84.                          style="stop-color:#75ff00;stop-opacity:1"
  85.                          offset="0"
  86.                          id="stop2245" />
  87.                     <stop
  88.                          style="stop-color:#2f7f39;stop-opacity:1"
  89.                          offset="1"
  90.                          id="stop2247" />
  91.                 </linearGradient>
  92.                 <linearGradient
  93.                      id="linearGradient2258">
  94.                     <stop
  95.                          style="stop-color:#fff07a;stop-opacity:1.0000000"
  96.                          offset="0.00000000"
  97.                          id="stop2260" />
  98.                     <stop
  99.                          style="stop-color:#ff9e4e;stop-opacity:1.0000000"
  100.                          offset="0.50000000"
  101.                          id="stop2262" />
  102.                     <stop
  103.                          style="stop-color:#ff5000;stop-opacity:1.0000000"
  104.                          offset="0.50925928"
  105.                          id="stop2264" />
  106.                     <stop
  107.                          style="stop-color:#ffd600;stop-opacity:1.0000000"
  108.                          offset="1.0000000"
  109.                          id="stop2266" />
  110.                 </linearGradient>
  111.                 <linearGradient
  112.                      id="linearGradient2178">
  113.                     <stop
  114.                          style="stop-color:#9cdc62;stop-opacity:1.0000000"
  115.                          offset="0.00000000"
  116.                          id="stop2184" />
  117.                     <stop
  118.                          style="stop-color:#72e035;stop-opacity:1.0000000"
  119.                          offset="0.37201953"
  120.                          id="stop2188" />
  121.                     <stop
  122.                          style="stop-color:#5ea32a;stop-opacity:1;"
  123.                          offset="0.37201953"
  124.                          id="stop2190" />
  125.                     <stop
  126.                          style="stop-color:#b0ea7a;stop-opacity:1.0000000"
  127.                          offset="1.0000000"
  128.                          id="stop2186" />
  129.                 </linearGradient>
  130.                 <linearGradient
  131.                      id="linearGradient2083">
  132.                     <stop
  133.                          style="stop-color:#7fff00;stop-opacity:1.0000000"
  134.                          offset="0.00000000"
  135.                          id="stop2085" />
  136.                     <stop
  137.                          style="stop-color:#cfd218;stop-opacity:1.0000000"
  138.                          offset="0.29076648"
  139.                          id="stop2152" />
  140.                     <stop
  141.                          style="stop-color:#e0b21c;stop-opacity:1.0000000"
  142.                          offset="0.71105301"
  143.                          id="stop2156" />
  144.                     <stop
  145.                          style="stop-color:#ee2420;stop-opacity:1.0000000"
  146.                          offset="1.0000000"
  147.                          id="stop2087" />
  148.                 </linearGradient>
  149.                 <linearGradient
  150.                      id="linearGradient2073">
  151.                     <stop
  152.                          style="stop-color:#7c92b9;stop-opacity:1.0000000"
  153.                          offset="0.00000000"
  154.                          id="stop2075" />
  155.                     <stop
  156.                          style="stop-color:#ffffff;stop-opacity:1.0000000"
  157.                          offset="1.0000000"
  158.                          id="stop2077" />
  159.                 </linearGradient>
  160.                 <linearGradient
  161.                      id="linearGradient2051">
  162.                     <stop
  163.                          style="stop-color:#747474;stop-opacity:1.0000000"
  164.                          offset="0.00000000"
  165.                          id="stop2053" />
  166.                     <stop
  167.                          style="stop-color:#ffffff;stop-opacity:1.0000000"
  168.                          offset="1.0000000"
  169.                          id="stop2055" />
  170.                 </linearGradient>
  171.                 <linearGradient
  172.                      id="linearGradient2115">
  173.                     <stop
  174.                          style="stop-color:#1b45c4;stop-opacity:1;"
  175.                          offset="0"
  176.                          id="stop2117" />
  177.                     <stop
  178.                          style="stop-color:#0140ff;stop-opacity:0;"
  179.                          offset="1"
  180.                          id="stop2119" />
  181.                 </linearGradient>
  182.                 <linearGradient
  183.                      id="linearGradient2292">
  184.                     <stop
  185.                          id="stop2294"
  186.                          offset="0"
  187.                          style="stop-color:#ffe31c;stop-opacity:1;" />
  188.                     <stop
  189.                          id="stop2296"
  190.                          offset="1"
  191.                          style="stop-color:#ffffff;stop-opacity:0;" />
  192.                 </linearGradient>
  193.                 <linearGradient
  194.                      x1="-39.743919"
  195.                      y1="271.64819"
  196.                      x2="456.23572"
  197.                      y2="271.64819"
  198.                      id="linearGradient2081"
  199.                      xlink:href="#linearGradient2083"
  200.                      gradientUnits="userSpaceOnUse"
  201.                      gradientTransform="matrix(0.409736,0,0,0.208754,30.24163,211.051)" />
  202.                 <linearGradient
  203.                      x1="295.08344"
  204.                      y1="343.32632"
  205.                      x2="295.08344"
  206.                      y2="224.68822"
  207.                      id="linearGradient2172"
  208.                      xlink:href="#linearGradient2051"
  209.                      gradientUnits="userSpaceOnUse"
  210.                      gradientTransform="matrix(0.369234,0,0,0.410816,-15.19644,-99.69333)" />
  211.                 <linearGradient
  212.                      x1="222.15965"
  213.                      y1="237.48343"
  214.                      x2="222.15965"
  215.                      y2="301.78006"
  216.                      id="linearGradient2174"
  217.                      xlink:href="#linearGradient2073"
  218.                      gradientUnits="userSpaceOnUse"
  219.                      gradientTransform="matrix(0.341899,0,0,0.26744,-9.276913,-60.6394)" />
  220.                 <linearGradient
  221.                      x1="162.57631"
  222.                      y1="245.21945"
  223.                      x2="162.57631"
  224.                      y2="298.0766"
  225.                      id="linearGradient2176"
  226.                      xlink:href="#linearGradient2178"
  227.                      gradientUnits="userSpaceOnUse"
  228.                      gradientTransform="matrix(0.245416,0,0,0.242214,-4.287223,-52.43637)" />
  229.                 <linearGradient
  230.                      x1="162.57631"
  231.                      y1="245.21945"
  232.                      x2="162.57631"
  233.                      y2="298.07651"
  234.                      id="linearGradient2256"
  235.                      xlink:href="#linearGradient2258"
  236.                      gradientUnits="userSpaceOnUse"
  237.                      gradientTransform="matrix(0.348017,0,0,0.208754,-8.863015,-44.14369)" />
  238.                 <linearGradient
  239.                      collect="always"
  240.                      xlink:href="#linearGradient2115"
  241.                      id="linearGradient2314"
  242.                      gradientUnits="userSpaceOnUse"
  243.                      gradientTransform="matrix(3.046092,0,0,0.458,-842.6463,-147.6332)"
  244.                      x1="297.30167"
  245.                      y1="354.22491"
  246.                      x2="297.30167"
  247.                      y2="371.1955" />
  248.                 <linearGradient
  249.                      collect="always"
  250.                      xlink:href="#linearGradient2292"
  251.                      id="linearGradient2316"
  252.                      gradientUnits="userSpaceOnUse"
  253.                      gradientTransform="matrix(3.012188,0,0,0.447051,-831.282,-150.2732)"
  254.                      x1="297.31323"
  255.                      y1="354.22491"
  256.                      x2="297.31323"
  257.                      y2="371.1955" />
  258.                 <linearGradient
  259.                      inkscape:collect="always"
  260.                      xlink:href="#linearGradient2243"
  261.                      id="linearGradient2249"
  262.                      x1="136.79781"
  263.                      y1="19.51153"
  264.                      x2="136.79781"
  265.                      y2="7.1371608"
  266.                      gradientUnits="userSpaceOnUse"
  267.                      gradientTransform="matrix(0.883905,0,0,0.889813,-105.5481,-0.606724)" />
  268.                 <clipPath
  269.                      id="clipoffpeak">
  270.                     <rect
  271.                          id="clipoffpeakrect"
  272.                          width="117.875"
  273.                          height="14.520815"
  274.                          x="7"
  275.                          y="5.75"
  276.                          rx="0"
  277.                          ry="0" />
  278.                 </clipPath>
  279.                 <clipPath
  280.                      id="clipbars">
  281.                     <rect
  282.                      width="113.4"
  283.                      height="13.6"
  284.                      rx="2.258666"
  285.                      ry="2.1103067"
  286.                      x="6.7890587"
  287.                      y="4.9000001"
  288.                      id="rect2815" />
  289.                 </clipPath>
  290.                 <linearGradient
  291.                      inkscape:collect="always"
  292.                      xlink:href="#linearGradient2258"
  293.                      id="linearGradient2827"
  294.                      gradientUnits="userSpaceOnUse"
  295.                      gradientTransform="matrix(0.334468,0,0,0.219789,-8.452445,-47.85567)"
  296.                      x1="162.86516"
  297.                      y1="245.21945"
  298.                      x2="162.86516"
  299.                      y2="298.07651" />
  300.                 <linearGradient
  301.                      inkscape:collect="always"
  302.                      xlink:href="#linearGradient2073"
  303.                      id="linearGradient2817"
  304.                      gradientUnits="userSpaceOnUse"
  305.                      gradientTransform="matrix(0.353131,0,0,0.268212,-10.60411,-95.53958)"
  306.                      x1="223.25398"
  307.                      y1="237.48343"
  308.                      x2="223.25398"
  309.                      y2="301.78006" />
  310.                 <linearGradient
  311.                      inkscape:collect="always"
  312.                      xlink:href="#linearGradient2051"
  313.                      id="linearGradient2821"
  314.                      gradientUnits="userSpaceOnUse"
  315.                      gradientTransform="matrix(0.384191,0,0,0.437012,-17.52787,-141.364)"
  316.                      x1="295.08344"
  317.                      y1="343.32632"
  318.                      x2="295.08344"
  319.                      y2="224.68822" />
  320.                 <linearGradient
  321.                      inkscape:collect="always"
  322.                      xlink:href="#linearGradient2073"
  323.                      id="linearGradient2828"
  324.                      gradientUnits="userSpaceOnUse"
  325.                      gradientTransform="matrix(0.353131,0,0,0.268212,-10.85411,-95.53958)"
  326.                      x1="223.25398"
  327.                      y1="237.48343"
  328.                      x2="223.25398"
  329.                      y2="301.78006" />
  330.                 <linearGradient
  331.                      inkscape:collect="always"
  332.                      xlink:href="#linearGradient2115"
  333.                      id="linearGradient2835"
  334.                      x1="68.125"
  335.                      y1="7.25"
  336.                      x2="68.125"
  337.                      y2="25.077589"
  338.                      gradientUnits="userSpaceOnUse"
  339.                      gradientTransform="matrix(0.752725,0,0,0.50003,-4.602051,9.1255)" />
  340.                 <linearGradient
  341.                      inkscape:collect="always"
  342.                      xlink:href="#linearGradient2292"
  343.                      id="linearGradient2839"
  344.                      gradientUnits="userSpaceOnUse"
  345.                      gradientTransform="matrix(1.061878,0,0,0.460027,-9.204941,9.533024)"
  346.                      x1="68.125"
  347.                      y1="7.25"
  348.                      x2="68.125"
  349.                      y2="43.715527" />
  350.             </defs>
  351.             <g
  352.                  id="layer1">
  353.                 <rect
  354.                      width="123.5"
  355.                      height="21.5"
  356.                      rx="9.8386154"
  357.                      ry="10.379341"
  358.                      x="1.5"
  359.                      y="1"
  360.                      style="fill:url(#linearGradient2172);fill-opacity:1;stroke:black;stroke-width:0.99999976;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.63492067"
  361.                      id="rectouter" />
  362.                 <rect
  363.                      width="114.3"
  364.                      height="14.1"
  365.                      rx="2.2586658"
  366.                      ry="2.1103072"
  367.                      x="6.3"
  368.                      y="5"
  369.                      style="fill:url(#linearGradient2174);fill-opacity:1;stroke:black;stroke-width:1.00000012;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.6719577"
  370.                      id="rectinner" />
  371.                 <g
  372.                      inkscape:groupmode="layer"
  373.                      id="layer2"
  374.                      inkscape:label="bars"
  375.                      clip-path="url(#clipbars)">
  376.                     <rect
  377.                          width="113.5"
  378.                          height="13.1"
  379.                          rx="2.1912799"
  380.                          ry="1.5982112"
  381.                          x="6.8"
  382.                          y="5.5"
  383.                          style="opacity:1;fill:url(#linearGradient2827);fill-opacity:1;stroke:none;stroke-width:1.87557006;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
  384.                          id="peakover" />
  385.                     <rect
  386.                          width="113.5"
  387.                          height="13.1"
  388.                          rx="2.1912799"
  389.                          ry="1.5982111"
  390.                          x="6.8"
  391.                          y="5.5"
  392.                          style="opacity:1;fill:url(#linearGradient2176);fill-opacity:1;stroke:none;stroke-width:1.87557006;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
  393.                          id="peak" />
  394.                     <path
  395.                          d="M 3.053786,4.2362938 L 10.742332,4.2362938 L 6.8980586,9.6416242 L 3.053786,4.2362938 z "
  396.                          style="fill:black;fill-opacity:1;stroke:none;stroke-width:1.25;stroke-miterlimit:4;stroke-opacity:1"
  397.                          id="patharrow" />
  398.                     <rect
  399.                          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"
  400.                          id="offpeakover"
  401.                          width="113.5"
  402.                          height="5.5"
  403.                          x="6.8"
  404.                          y="13"
  405.                          rx="0"
  406.                          ry="0" />
  407.                     <rect
  408.                          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"
  409.                          id="offpeak"
  410.                          width="113.5"
  411.                          height="5.5"
  412.                          x="6.8"
  413.                          y="13"
  414.                          rx="0"
  415.                          ry="0" />
  416.                     <path
  417.                          d="M 9.2731107,18.772569 L 4.421751,18.698553 L 6.9057977,15.557182 L 9.2731107,18.772569 z "
  418.                          style="opacity:1;fill:white;fill-opacity:1;stroke:none;stroke-width:1.25;stroke-miterlimit:4;stroke-opacity:1"
  419.                          id="patharrow2"
  420.                          inkscape:transform-center-y="3.7231195" />
  421.  
  422.                     <g
  423.                          id="iconerror"
  424.                          transform="matrix(0.93714,0,0,0.940057,-97.13415,33.75136)">
  425.                         <path
  426.                              transform="matrix(0.427044,0,0,0.492997,65.22645,-17.42024)"
  427.                              sodipodi:open="true"
  428.                              sodipodi:end="12.497908"
  429.                              sodipodi:start="6.2292315"
  430.                              d="M 144.93554,-11.799526 A 14.672466,11.932427 0 1 1 144.92252,-11.972325"
  431.                              sodipodi:ry="11.932427"
  432.                              sodipodi:rx="14.672466"
  433.                              sodipodi:cy="-11.156038"
  434.                              sodipodi:cx="130.28442"
  435.                              id="iconerrorcircle"
  436.                              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"
  437.                              sodipodi:type="arc" />
  438.                         <path
  439.                              id="path2253"
  440.                              d="M 123.9972,-25.849435 L 118.00283,-20.400574"
  441.                              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" />
  442.                         <path
  443.                              id="path2255"
  444.                              d="M 123.82577,-19.935489 L 117.67426,-25.814523"
  445.                              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" />
  446.                     </g>
  447.                     <path
  448.                          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"
  449.                          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 "
  450.                          id="icondown"
  451.                          sodipodi:nodetypes="cccccccc" />
  452.                 </g>
  453.                 <text
  454.                          x="117.5"
  455.                          y="16.8"
  456.                          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"
  457.                          id="pclabelouter"
  458.                          xml:space="preserve"
  459.                          sodipodi:linespacing="125%"><tspan
  460.                             x="117.5"
  461.                             y="16.8"
  462.                             id="pclabel">0%</tspan></text>
  463.                 <text
  464.                      xml:space="preserve"
  465.                      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"
  466.                      x="85.661148"
  467.                      y="17.569111"
  468.                      id="pc2labelouter"
  469.                      sodipodi:linespacing="125%"><tspan
  470.                         sodipodi:role="line"
  471.                         x="85.661148"
  472.                         y="17.569111"
  473.                         id="pc2label">0%</tspan></text>
  474.             </g>
  475.         </svg>
  476.  
  477.            
  478.         <!-- XXXXXXXXXXXXXXXXXXXXXXX CUT HERE XXXXXXXXXXXXXXXXXXXXXXXXX -->
  479.  
  480.  
  481.  
  482.     </content>
  483.  
  484.     <implementation implements="nsIObserver, nsIDOMEventListener">
  485.         <constructor>
  486.             <![CDATA[
  487.  
  488.            //var svg = document.getAnonymousElementByAttribute(this, 'id', 'netusagesvg');
  489.            //var suspid = svg.suspendRedraw(1000);
  490.            
  491.            // get num from id
  492.            var sitemid = this.getAttribute('id');
  493.            this.itemid = parseInt(sitemid[sitemid.length-1], 10);
  494.  
  495.            this.defprefix = "";
  496.            this.svghack = window.navigator.userAgent.indexOf("; rv:1.8") != -1;
  497.  
  498.            if (this.svghack) {
  499.  
  500.                // hack for bug https://bugzilla.mozilla.org/show_bug.cgi?id=309020
  501.                this.defprefix = "nu"+this.itemid+"_";
  502.  
  503.                var existingStub = document.getElementById(this.defprefix+'netusagesvgdefstub');
  504.                if (existingStub) {
  505.                    // remove previous stub
  506.                    existingStub.parentNode.removeChild(existingStub);
  507.                }
  508.  
  509.                // mass append nu0_ ids to the defs
  510.                var tmplstub = document.getAnonymousElementByAttribute(this, 'id', "netusagesvgdefstub");
  511.                tmplstub.setAttribute("id", this.defprefix+'netusagesvgdefstub');
  512.  
  513.                document.getAnonymousElementByAttribute(this, 'id', "netusagedefs").setAttribute("id", this.defprefix+'netusagedefs');
  514.                this.alterNodeId(document.getAnonymousElementByAttribute(this, 'id', this.defprefix+"netusagedefs"), this.defprefix);
  515.  
  516.                var svgdefstub = document.importNode(tmplstub, true);
  517.                var svgdefs = document.importNode(document.getAnonymousElementByAttribute(this, 'id', this.defprefix+"netusagedefs"), true);
  518.  
  519.                svgdefstub.appendChild(svgdefs);
  520.                var c = svgdefstub.cloneNode(true);
  521.  
  522.                document.documentElement.appendChild(c);
  523.  
  524.                var elids = ['layer2', 'rectouter', 'rectinner', 'peak', 'peakover', 'offpeak', 'offpeakover', 'icondown'];
  525.                for(var i in elids) {
  526.                
  527.                    var r = document.getAnonymousElementByAttribute(this, 'id', elids[i]).getAttribute('clip-path');
  528.                    if (r != null) {
  529.                        r = r.replace(/url\(#([^)]+)/, "url("+document.location+"#"+this.defprefix+"$1");
  530.                        document.getAnonymousElementByAttribute(this, 'id', elids[i]).setAttribute("clip-path", r);
  531.                    }
  532.                    r = document.getAnonymousElementByAttribute(this, 'id', elids[i]).getAttribute('style');
  533.                    if (r != null) {
  534.                        r = r.replace(/fill: url\(#([^)]+)/, "fill: url("+document.location+"#"+this.defprefix+"$1");
  535.                        
  536.                        document.getAnonymousElementByAttribute(this, 'id', elids[i]).setAttribute("style", r);
  537.                    }
  538.                }
  539.            }
  540.  
  541.            var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
  542.            prefs = prefs.getBranch("extensions.netusage.");            
  543.  
  544.            if(prefs.getBoolPref('widen')){
  545.  
  546.                var elids2 = ['netusagesvg', 'rectouter', 'rectinner', 'peakover', 'peak', 'offpeakover', 'offpeak', 'pclabel', 'pclabelouter', 'pc2labelouter', 'pc2label'];
  547.                for(var i in elids2) {
  548.  
  549.                    var e = document.getAnonymousElementByAttribute(this, 'id', elids2[i]), huh = 'x';
  550.  
  551.                    if(e.hasAttribute('width')){
  552.                    
  553.                        huh = 'width';
  554.                    
  555.                    }
  556.                
  557.                    var getW = Number(e.getAttribute(huh))+prefs.getIntPref("widenNumber");
  558.  
  559.                    e.setAttribute(huh, getW);
  560.  
  561.                }
  562.        
  563.            }        
  564.  
  565.            // GUI
  566.            this.maxWidth = parseInt(document.getAnonymousElementByAttribute(this, 'id', 'peakover').getAttribute("width"), 10);
  567.            this.maxWidth2 = parseInt(document.getAnonymousElementByAttribute(this, 'id', 'offpeakover').getAttribute("width"), 10);
  568.            // for New Modern offpeak which progresses backwards
  569.            this.baseX = parseInt(document.getAnonymousElementByAttribute(this, 'id', this.defprefix+'clipoffpeakrect').getAttribute("x"), 10);
  570.            
  571.            // The following two function fails when running outside chrome
  572.            // flashing timer
  573.            try {
  574.            this.timer = Components.classes['@mozilla.org/timer;1'].createInstance(Components.interfaces.nsITimer);
  575.            } catch (e) { dump("EXCEPTION flashing timer create failed" + e); }
  576.            
  577.            try {
  578.            this.addEventListener('DOMAttrModified', this, false);
  579.            } catch (e) { dump("EXCEPTION addEventListener DOMAttrModified failed" + e); }
  580.  
  581.            //svg.unsuspendRedraw(suspid);
  582.            
  583.            // set state to initial values
  584.            this.refreshItem("text", this.getAttribute("text"));
  585.            this.refreshItem("text2", this.getAttribute("text2"));
  586.            this.refreshItem("pc", parseInt(this.getAttribute("pc"), 10));
  587.            this.refreshItem("pc2", parseInt(this.getAttribute("pc2"), 10));
  588.            this.refreshItem("arrow", parseInt(this.getAttribute("arrow"), 10));
  589.            this.refreshItem("arrow2", parseInt(this.getAttribute("arrow2"), 10));
  590.            this.refreshItem("status", this.getAttribute("status"));
  591.            this.refreshItem("flashing", this.getAttribute("flashing"));
  592.            
  593.            ]]>
  594.         </constructor>
  595.  
  596.         <destructor>
  597.             <![CDATA[
  598.            if (this.timer)
  599.                this.timer.cancel();
  600.            this.timer = null;
  601.            ]]>
  602.         </destructor>
  603.  
  604.         <property name="arrow">
  605.             <getter>
  606.                 return parseInt(this.getAttribute('arrow'));
  607.             </getter>
  608.             <setter>
  609.                 <![CDATA[
  610.            this.setAttribute("arrow", val);
  611.            ]]>
  612.             </setter>
  613.         </property>
  614.  
  615.         <property name="arrow2">
  616.             <getter>
  617.                 return parseInt(this.getAttribute('arrow2'));
  618.             </getter>
  619.             <setter>
  620.                 <![CDATA[
  621.            this.setAttribute("arrow2", val);
  622.            ]]>
  623.             </setter>
  624.         </property>
  625.  
  626.  
  627.  
  628.         <property name="pc">
  629.             <getter>
  630.                 return parseInt(this.getAttribute('pc'));
  631.             </getter>
  632.  
  633.             <setter>
  634.                 <![CDATA[
  635.            this.setAttribute("pc", val);
  636.            ]]>
  637.             </setter>
  638.         </property>
  639.  
  640.  
  641.         <property name="pc2">
  642.             <getter>
  643.                 return parseInt(this.getAttribute('pc2'));
  644.             </getter>
  645.  
  646.             <setter>
  647.                 <![CDATA[
  648.            this.setAttribute("pc2", val);
  649.            ]]>
  650.             </setter>
  651.         </property>
  652.  
  653.         <property name="status">
  654.             <getter>
  655.                 return this.getAttribute('status');
  656.             </getter>
  657.  
  658.             <setter>
  659.                 <![CDATA[
  660.            this.setAttribute("status", val);
  661.            ]]>
  662.             </setter>
  663.         </property>
  664.  
  665.  
  666.         <property name="text">
  667.             <getter>
  668.                 return this.getAttribute('text');
  669.             </getter>
  670.  
  671.             <setter>
  672.                 <![CDATA[
  673.            this.setAttribute("text", val);
  674.            ]]>
  675.             </setter>
  676.         </property>
  677.         <property name="text2">
  678.             <getter>
  679.                 return this.getAttribute('text2');
  680.             </getter>