update to a new version of video downloader
authorDon Armstrong <don@donarmstrong.com>
Fri, 13 Apr 2007 21:23:57 +0000 (21:23 +0000)
committerDon Armstrong <don@donarmstrong.com>
Fri, 13 Apr 2007 21:23:57 +0000 (21:23 +0000)
.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/chrome.manifest
.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/chrome/dwhelper.jar
.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/components/.cvsignore [new file with mode: 0644]
.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/components/dhIUtilService.xpt [new file with mode: 0644]
.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/components/dhUtilService.js [new file with mode: 0644]
.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/defaults/preferences/prefs-dwhelper.js
.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/install.rdf

index 3fe40df..3693db1 100755 (executable)
@@ -3,4 +3,9 @@ content dwhelper    jar:chrome/dwhelper.jar!/content/
 skin    dwhelper classic/1.0 jar:chrome/dwhelper.jar!/skin/classic/\r
 locale  dwhelper en-US jar:chrome/dwhelper.jar!/locale/en-US/\r
 locale  dwhelper fr-FR jar:chrome/dwhelper.jar!/locale/fr-FR/\r
+locale  dwhelper nl-NL jar:chrome/dwhelper.jar!/locale/nl-NL/\r
+locale  dwhelper de-DE jar:chrome/dwhelper.jar!/locale/de-DE/\r
+locale  dwhelper es-ES jar:chrome/dwhelper.jar!/locale/es-ES/\r
+locale  dwhelper it-IT jar:chrome/dwhelper.jar!/locale/it-IT/\r
+locale  dwhelper pt-BR jar:chrome/dwhelper.jar!/locale/pt-BR/\r
 style   chrome://global/content/customizeToolbar.xul    chrome://dwhelper/skin/classic/dwhelper.css
\ No newline at end of file
index 84b4759..f1da5a8 100644 (file)
Binary files a/.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/chrome/dwhelper.jar and b/.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/chrome/dwhelper.jar differ
diff --git a/.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/components/.cvsignore b/.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/components/.cvsignore
new file mode 100644 (file)
index 0000000..19903b8
--- /dev/null
@@ -0,0 +1 @@
+*.xpt
diff --git a/.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/components/dhIUtilService.xpt b/.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/components/dhIUtilService.xpt
new file mode 100644 (file)
index 0000000..16165ba
Binary files /dev/null and b/.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/components/dhIUtilService.xpt differ
diff --git a/.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/components/dhUtilService.js b/.mozilla/firefox/default/extensions/{b9db16a4-6edc-47ec-a1f4-b86292ed211d}/components/dhUtilService.js
new file mode 100644 (file)
index 0000000..31fccc7
--- /dev/null
@@ -0,0 +1,925 @@
+/******************************************************************************
+ *
+ * This code belongs to its author. All rights reserved.
+ *
+ * Author    : michel.gutierrez@gmail.com
+ *
+ ******************************************************************************/
+
+/**
+* @fileoverview Accessing global utilities
+* @author mig
+* @version 1.0
+*/
+
+/**
+ * Constants.
+ */
+const NS_UTIL_SERVICE_CID = Components.ID("{dbd8dc72-2cdf-44ad-bf9a-5dc7a3fc3036}");
+const NS_UTIL_SERVICE_PROG_ID = "@downloadhelper.net/util-service;1";
+
+Node=null;
+XPathResult=null;
+
+/**
+* Service constructor
+* @class Service accessing global utilities
+*/
+function UtilService() {
+       this.stringBundle=Components.classes["@mozilla.org/intl/stringbundle;1"].getService().
+               QueryInterface(Components.interfaces.nsIStringBundleService).
+                       createBundle("chrome://dwhelper/locale/strings.properties");
+       this.RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService().
+               QueryInterface(Components.interfaces.nsIRDFService);
+       this.RDFCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].getService().
+               QueryInterface(Components.interfaces.nsIRDFContainerUtils);
+}
+
+UtilService.prototype = {
+}
+
+UtilService.prototype.getRDF = function() {
+       return this.RDF;
+}
+
+UtilService.prototype.getRDFCUtils = function() {
+       return this.RDFCUtils;
+}
+
+UtilService.prototype.getText = function(name) {
+       try {
+               return this.stringBundle.GetStringFromName(name);
+       } catch(e) {
+               return name;
+       }
+}
+
+UtilService.prototype.getFText=function(name,params,length) {
+       if(params==null)
+               params=[];
+       try {
+               return this.stringBundle.formatStringFromName(name,params,params.length);
+       } catch(e) {
+               return name;
+       }
+}
+
+UtilService.prototype.getVersion=function(uuid) {
+       var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService().
+               QueryInterface(Components.interfaces.nsIRDFService);
+       var RDFCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].getService().
+               QueryInterface(Components.interfaces.nsIRDFContainerUtils);
+       var extMgr=Components.classes["@mozilla.org/extensions/manager;1"].
+               getService(Components.interfaces.nsIExtensionManager);          
+       var target=extMgr.datasource.GetTarget(
+               RDF.GetResource("urn:mozilla:item:"+uuid),
+               RDF.GetResource("http://www.mozilla.org/2004/em-rdf#version"),
+               true);
+       if(target==null)
+               return null;
+       return target.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
+}
+
+UtilService.prototype.getPropertyValue = function(ds,res,prop) {
+       var target=ds.GetTarget(res,prop,true);
+       if(target==null)
+               return null;
+       return target.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
+}
+
+UtilService.prototype.getPropertyValueRS = function(ds,res,prop) {
+       return this.getPropertyValue(ds,res,this.RDF.GetResource(prop));
+}
+
+UtilService.prototype.getPropertyValueSR = function(ds,res,prop) {
+       return this.getPropertyValue(ds,this.RDF.GetResource(res),prop);
+}
+
+UtilService.prototype.getPropertyValueSS = function(ds,res,prop) {
+       return this.getPropertyValue(ds,this.RDF.GetResource(res),this.RDF.GetResource(prop));
+}
+
+UtilService.prototype.setPropertyValue = function(ds,res,prop,value) {
+       value=this.RDF.GetLiteral(value);
+       this.removeProperties(ds,res,prop);
+       if(value!=null) {
+               ds.Assert(res,prop,value,true);
+       }
+}
+
+UtilService.prototype.setPropertyValueSR = function(ds,res,prop,value) {
+       this.setPropertyValue(ds,this.RDF.GetResource(res),prop,value);
+}
+
+UtilService.prototype.setPropertyValueRS = function(ds,res,prop,value) {
+       this.setPropertyValue(ds,res,this.RDF.GetResource(prop),value);
+}
+
+UtilService.prototype.setPropertyValueSS = function(ds,res,prop,value) {
+       this.setPropertyValue(ds,this.RDF.GetResource(res),this.RDF.GetResource(prop),value);
+}
+
+UtilService.prototype.removeProperties = function(ds,res,prop) {
+       var i=ds.GetTargets(res,prop,true);
+       var targets=[];
+       while(i.hasMoreElements()) {
+               targets.push(i.getNext());
+       }
+       for(var i=0;i<targets.length;i++) {
+               ds.Unassert(res,prop,targets[i]);
+       }
+}
+
+UtilService.prototype.removePropertiesSR = function(ds,res,prop) {
+       this.removeProperties(ds,this.RDF.GetResource(res),prop);
+}
+
+UtilService.prototype.removePropertiesRS = function(ds,res,prop) {
+       this.removeProperties(ds,res,this.RDF.GetResource(prop));
+}
+
+UtilService.prototype.removePropertiesSS = function(ds,res,prop) {
+       this.removeProperties(ds,this.RDF.GetResource(res),this.RDF.GetResource(prop));
+}
+
+UtilService.prototype.getChildResources = function(ds,res,count) {
+       var children=[];
+       var seq=this.RDFCUtils.MakeSeq(ds,res);
+       var j=seq.GetElements();
+       while(j.hasMoreElements()) {
+               var li=j.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+               children.push(li);
+       }
+       count.value=children.length;
+       return children;
+}
+
+UtilService.prototype.getChildResourcesS = function(ds,res,count) {
+       return this.getChildResources(ds,this.RDF.GetResource(res),count);
+}
+
+UtilService.prototype.getPropertyResource = function(ds,res,prop) {
+       var target=ds.GetTarget(res,prop,true);
+       if(target==null)
+               return null;
+       return target.QueryInterface(Components.interfaces.nsIRDFResource);
+}
+
+UtilService.prototype.getPropertyResourceRS = function(ds,res,prop) {
+       return this.getPropertyResource(ds,res,this.RDF.GetResource(prop));
+}
+
+UtilService.prototype.getPropertyResourceSR = function(ds,res,prop) {
+       return this.getPropertyResource(ds,this.RDF.GetResource(res),prop);
+}
+
+UtilService.prototype.getPropertyResourceSS = function(ds,res,prop) {
+       return this.getPropertyResource(ds,this.RDF.GetResource(res),this.RDF.GetResource(prop));
+}
+
+UtilService.prototype.setPropertyResource = function(ds,res,prop,value) {
+       this.removeProperties(ds,res,prop);
+       if(value!=null) {
+               ds.Assert(res,prop,value,true);
+       }
+}
+
+UtilService.prototype.setPropertyResourceRRS = function(ds,res,prop,value) {
+       this.setPropertyResource(ds,res,prop,this.RDF.GetResource(value));
+}
+
+UtilService.prototype.setPropertyResourceRSR = function(ds,res,prop,value) {
+       this.setPropertyResource(ds,res,this.RDF.GetResource(prop),value);
+}
+
+UtilService.prototype.setPropertyResourceRSS = function(ds,res,prop,value) {
+       this.setPropertyResource(ds,res,this.RDF.GetResource(prop),this.RDF.GetResource(value));
+}
+
+UtilService.prototype.setPropertyResourceSRR = function(ds,res,prop,value) {
+       this.setPropertyResource(ds,this.RDF.GetResource(res),prop,value);
+}
+
+UtilService.prototype.setPropertyResourceSRS = function(ds,res,prop,value) {
+       this.setPropertyResource(ds,this.RDF.GetResource(res),prop,this.RDF.GetResource(value));
+}
+
+UtilService.prototype.setPropertyResourceSSR = function(ds,res,prop,value) {
+       this.setPropertyResource(ds,this.RDF.GetResource(res),this.RDF.GetResource(prop),value);
+}
+
+UtilService.prototype.setPropertyResourceSSS = function(ds,res,prop,value) {
+       this.setPropertyResource(ds,this.RDF.GetResource(res),this.RDF.GetResource(prop),this.RDF.GetResource(value));
+}
+
+UtilService.prototype.createNode=function(ds,parentNode,res) {
+       var node=res;
+       if(node==null) {
+               node=this.RDF.GetAnonymousResource();
+       } 
+       this.setPropertyResourceRSS(ds,node,
+               "http://www.w3.org/1999/02/22-rdf-syntax-ns#instanceOf",
+               "http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq");
+       this.setPropertyValueRS(ds,node,
+               "http://www.w3.org/1999/02/22-rdf-syntax-ns#nextVal","1");
+       
+       if(parentNode!=null) {
+               parentNode=this.RDFCUtils.MakeSeq(ds,parentNode);
+               parentNode.AppendElement(node);
+       } 
+       return node;
+}
+
+UtilService.prototype.createNodeRS=function(ds,parentNode,resValue) {
+       if(resValue!=null)
+               resValue=this.RDF.GetResource(resValue);
+       return this.createNode(ds,parentNode,resValue);
+}
+
+UtilService.prototype.createNodeSR=function(ds,parentNode,resValue) {
+       if(parentNode!=null)
+               parentNode=this.RDF.GetResource(parentNode);
+       return this.createNode(ds,parentNode,resValue);
+}
+
+UtilService.prototype.createNodeSS=function(ds,parentNode,resValue) {
+       if(parentNode!=null)
+               parentNode=this.RDF.GetResource(parentNode);
+       if(resValue!=null)
+               resValue=this.RDF.GetResource(resValue);
+       return this.createNode(ds,parentNode,resValue);
+}
+
+UtilService.prototype.createAnonymousNode=function(ds,parentNode) {
+       return this.createNode(ds,parentNode,null);
+}
+
+UtilService.prototype.createAnonymousNodeS=function(ds,parentNode) {
+       return this.createAnonymousNode(ds,this.RDF.GetResource(parentNode));
+}
+
+UtilService.prototype.createRootNode=function(ds,res) {
+       return this.createNode(ds,null,res);
+}
+
+UtilService.prototype.createRootNodeS=function(ds,resValue) {
+       return this.createRootNode(ds,this.RDF.GetResource(resValue));
+}
+
+UtilService.prototype.createAnonymousRootNode=function(ds) {
+       return this.createNode(ds,null,null);
+}
+
+UtilService.prototype.getDatasourceFromRDFFile=function(file) {
+       var stream = Components.classes['@mozilla.org/network/file-input-stream;1'].
+           createInstance(Components.interfaces.nsIFileInputStream);
+       stream.init(file,1,0,false);
+       var scriptableStream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
+       scriptableStream.init(stream);
+       
+       var fileSize = scriptableStream.available();
+       var fileContents = scriptableStream.read(fileSize);
+
+       scriptableStream.close();
+       stream.close();
+       
+       var parser=Components.classes
+               ['@mozilla.org/rdf/xml-parser;1'].
+                       createInstance(Components.interfaces.nsIRDFXMLParser);
+       var uri = Components.classes["@mozilla.org/network/standard-url;1"].
+                   createInstance(Components.interfaces.nsIURI);
+       uri.spec = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+       var memDS=Components.classes
+               ['@mozilla.org/rdf/datasource;1?name=in-memory-datasource'].
+                       createInstance(Components.interfaces.nsIRDFDataSource);
+       parser.parseString(memDS,uri,fileContents);
+       return memDS;
+}
+
+UtilService.prototype.dumpDatasource=function(ds) {
+       if(ds==null)
+               return;
+       var i = ds.GetAllResources();
+       while(i.hasMoreElements()) {
+               var source = i.getNext();
+               var j = ds.ArcLabelsOut(source);
+               while(j.hasMoreElements()) {
+                       var predicate = j.getNext();
+                       var k = ds.GetTargets(source,predicate,true);
+                       while(k.hasMoreElements()) {
+                               var target = k.getNext();
+                               source=source.QueryInterface(Components.interfaces.nsIRDFResource);
+                               predicate=predicate.QueryInterface(Components.interfaces.nsIRDFResource);
+                               try {
+                                       target=target.QueryInterface(Components.interfaces.nsIRDFResource);
+                               } catch(e) {
+                                       target=target.QueryInterface(Components.interfaces.nsIRDFLiteral);
+                               }
+                               dump(source.Value+" - "+predicate.Value+" - "+target.Value+"\n");
+                       }
+               }
+       }
+}
+
+UtilService.prototype.getDatasource=function(tree) {
+       if(tree.database==null)
+               return null;
+       var i=tree.database.GetDataSources();
+       if(i.hasMoreElements()) {
+               return i.getNext().QueryInterface(Components.interfaces.nsIRDFDataSource);
+       } else {
+               return null;
+       }
+}
+
+UtilService.prototype.clearDatasource=function(tree) {
+       if(tree.database==null)
+               return;
+       var dss=[];
+       var i=tree.database.GetDataSources();
+       while(i.hasMoreElements()) {
+               dss.push(i.getNext());
+       }
+       for(var i=0;i<dss.length;i++) {
+               var ds = dss[i].QueryInterface(Components.interfaces.nsIRDFDataSource);
+               var i = ds.GetAllResources();
+               ds.beginUpdateBatch();
+               while(i.hasMoreElements()) {
+                       var source = i.getNext();
+                       var j = ds.ArcLabelsOut(source);
+                       while(j.hasMoreElements()) {
+                               var predicate = j.getNext();
+                               var k = ds.GetTargets(source,predicate,true);
+                               while(k.hasMoreElements()) {
+                                       var target = k.getNext();
+                                       ds.Unassert(source,predicate,target);
+                               }
+                       }
+               }
+               ds.endUpdateBatch();
+       }
+       for(var i=0;i<dss.length;i++) {
+               var ds = dss[i].QueryInterface(Components.interfaces.nsIRDFDataSource);
+               tree.database.RemoveDataSource(ds);
+       }
+}
+
+UtilService.prototype.removeDatasources=function(tree) {
+       if(tree.database==null)
+               return;
+       var dss=[];
+       var i=tree.builder.database.GetDataSources();
+       while(i.hasMoreElements()) {
+               dss.push(i.getNext());
+       }
+       for(var i=0;i<dss.length;i++) {
+               var ds = dss[i].QueryInterface(Components.interfaces.nsIRDFDataSource);
+               tree.builder.database.RemoveDataSource(ds);
+       }
+}
+
+UtilService.prototype.setDatasource=function(tree,ds) {
+       this.removeDatasources(tree);
+       if(ds!=null)
+               tree.builder.database.AddDataSource(ds);
+       tree.builder.rebuild();
+}
+
+UtilService.prototype.addDatasource=function(tree,ds) {
+       if(ds!=null)
+               tree.builder.database.AddDataSource(ds);
+       tree.builder.rebuild();
+}
+
+UtilService.prototype.copyDatasource=function(ds) {
+       var memDS=Components.classes
+               ['@mozilla.org/rdf/datasource;1?name=in-memory-datasource'].
+                   createInstance(Components.interfaces.nsIRDFDataSource);
+       var i = ds.GetAllResources();
+       memDS.beginUpdateBatch();
+       while(i.hasMoreElements()) {
+               var source = i.getNext();
+               var j = ds.ArcLabelsOut(source);
+               while(j.hasMoreElements()) {
+                       var predicate = j.getNext();
+                       var k = ds.GetTargets(source,predicate,true);
+                       while(k.hasMoreElements()) {
+                               var target = k.getNext();
+                               memDS.Assert(source,predicate,target,true);
+                       }
+               }
+       }
+       memDS.endUpdateBatch();
+       
+       return memDS;
+}
+
+UtilService.prototype.getParentNode=function(ds,node) {
+       var iter=ds.ArcLabelsIn(node);
+       while(iter.hasMoreElements()) {
+           var arc=iter.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+           if(ChartletUtil.startsWith(arc.Value,"http://www.w3.org/1999/02/22-rdf-syntax-ns#_")) {
+               node = ds.GetSource(arc,node,true);
+               return node;
+           }
+       }
+       return null;
+}
+
+UtilService.prototype.getParentNodeS=function(ds,node) {
+       return this.getParentNode(ds,this.RDF.GetResource(node));
+}
+
+UtilService.prototype.appendNode=function(ds,parentNode,node) {
+       parentNode=this.RDFCUtils.MakeSeq(ds,parentNode);
+       parentNode.AppendElement(node);
+}
+
+UtilService.prototype.appendNodeRS=function(ds,parentNode,node) {
+       this.appendNode(ds,parentNode,this.RDF.GetResource(node));
+}
+
+UtilService.prototype.appendNodeSR=function(ds,parentNode,node) {
+       this.appendNode(ds,this.RDF.GetResource(parentNode),node);
+}
+
+UtilService.prototype.appendNodeSS=function(ds,parentNode,node) {
+       this.appendNode(ds,this.RDF.GetResource(parentNode),this.RDF.GetResource(node));
+}
+
+UtilService.prototype.removeReference = function(ds,res) {
+       var seqElems=[];
+       
+       var deltriplet=[];
+       var i=ds.ArcLabelsIn(res);
+       while(i.hasMoreElements()) {
+           var arc=i.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+           var j=ds.GetSources(arc,res,true);
+           while(j.hasMoreElements()) {
+               var source=j.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+               var m=/^http\:\/\/www\.w3\.org\/1999\/02\/22\-rdf\-syntax\-ns#_([1-9][0-9]*)$/.exec(arc.Value);
+               if(m.length==2) {
+                       var seq=ChartletUtil.RDFCUtils.MakeSeq(ds,source);
+                               seqElems.push({seq: seq, elem: res});                   
+               } else {
+                       deltriplet.push({
+                               source: source,
+                               property: arc,
+                               target: res
+                       });
+               }
+           }
+       }
+       
+       var i=ds.ArcLabelsOut(res);
+       while(i.hasMoreElements()) {
+           var arc=i.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+           var j=ds.GetTargets(res,arc,true);
+           while(j.hasMoreElements()) {
+               var target=j.getNext().QueryInterface(Components.interfaces.nsIRDFNode);
+               deltriplet.push({
+                       source: res,
+                       property: arc,
+                       target: target
+                       });
+           }
+       }
+       
+       ds.beginUpdateBatch();
+       for(var i=0;i<deltriplet.length;i++) {
+               var triplet=deltriplet[i];
+               ds.Unassert(triplet.source,triplet.property,triplet.target);
+       }
+       for(var i=0;i<seqElems.length;i++) {
+               seqElems[i].seq.RemoveElement(seqElems[i].elem,true);
+       }
+       ds.endUpdateBatch();
+}
+
+UtilService.prototype.removeReferenceS = function(ds,res) {
+       this.removeReference(ds,this.RDF.GetResource(res));
+}
+
+UtilService.prototype.xpGetSingleNode = function(node,xpath) {
+       var anode=node.ownerDocument.evaluate(xpath,node,null,
+               XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;
+       return anode;
+}
+
+UtilService.prototype.xpGetNodes = function(node,xpath,count) {
+       var nodes=[];
+    var xpr=node.ownerDocument.evaluate(xpath,
+        node,null,
+        XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+        null);
+    var node0=xpr.iterateNext();
+    while(node0!=null) {
+       nodes.push(node0);
+        node0=xpr.iterateNext();
+    }
+    count.value=nodes.length;
+       return nodes;
+}
+
+UtilService.prototype.xpGetStrings = function(node,xpath,count) {
+       var strings=[];
+    var xpr=node.ownerDocument.evaluate(xpath,
+        node,null,
+        XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+        null);
+    var node0=xpr.iterateNext();
+    while(node0!=null) {
+       if(node0.nodeType==Node.TEXT_NODE)
+               strings.push(node0.nodeValue);
+       else if(node0.firstChild!=null && node0.firstChild.nodeType==Node.TEXT_NODE)
+               strings.push(node0.firstChild.nodeValue);
+        node0=xpr.iterateNext();
+    }
+    count.value=strings.length;
+       return strings;
+}
+
+UtilService.prototype.xpGetString = function(node,xpath) {
+       var text=node.ownerDocument.evaluate(xpath,node,null,
+               XPathResult.STRING_TYPE,null).stringValue;
+       return text;
+}
+
+UtilService.prototype.getProfileDir=function() {
+       var file = Components.classes["@mozilla.org/file/directory_service;1"]
+       .getService(Components.interfaces.nsIProperties)
+        .get("ProfD", Components.interfaces.nsIFile);
+    return file;
+}
+
+UtilService.prototype.getProfilePath=function() {
+       return this.getProfileDir().path;
+}
+
+UtilService.prototype.getExtensionDir=function(uuid) {
+       var file = this.getProfileDir();
+       file.append("extensions");
+       file.append(uuid);
+       return file;
+}
+
+UtilService.prototype.getExtensionPath=function(uuid) {
+       return this.getExtensionDir(uuid).path;
+}
+
+UtilService.prototype.removeReferenceS=function(ds,res) {
+       this.removeReference(ds,this.RDF.GetResource(res));
+}
+
+UtilService.prototype.removeReference=function(ds,res) {
+
+       var seqElems=[];
+       
+       var deltriplet=[];
+       var i=ds.ArcLabelsIn(res);
+       while(i.hasMoreElements()) {
+           var arc=i.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+           var j=ds.GetSources(arc,res,true);
+           while(j.hasMoreElements()) {
+               var source=j.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+               var m=/^http\:\/\/www\.w3\.org\/1999\/02\/22\-rdf\-syntax\-ns#_([1-9][0-9]*)$/.exec(arc.Value);
+               if(m.length==2) {
+                       var seq=this.RDFCUtils.MakeSeq(ds,source);
+                               seqElems.push({seq: seq, elem: res});                   
+               } else {
+                       deltriplet.push({
+                               source: source,
+                               property: arc,
+                               target: res
+                       });
+               }
+           }
+       }
+       
+       var i=ds.ArcLabelsOut(res);
+       while(i.hasMoreElements()) {
+           var arc=i.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+           var j=ds.GetTargets(res,arc,true);
+           while(j.hasMoreElements()) {
+               var target=j.getNext().QueryInterface(Components.interfaces.nsIRDFNode);
+               deltriplet.push({
+                       source: res,
+                       property: arc,
+                       target: target
+                       });
+           }
+       }
+       
+       ds.beginUpdateBatch();
+       for(var i=0;i<deltriplet.length;i++) {
+               var triplet=deltriplet[i];
+               ds.Unassert(triplet.source,triplet.property,triplet.target);
+       }
+       for(var i=0;i<seqElems.length;i++) {
+               seqElems[i].seq.RemoveElement(seqElems[i].elem,true);
+       }
+       ds.endUpdateBatch();
+}
+
+UtilService.prototype.generateUuid=function() {
+       var uuid="";
+       var groups=[8,4,4,4,12];
+       for(var i=0;i<groups.length;i++) {
+               if(i>0)
+                       uuid+="-";
+               for(var j=0;j<groups[i];j++) {
+                       var d=Math.floor(Math.random()*16);
+                       if(d<10) {
+                               uuid+=String.fromCharCode("0".charCodeAt(0)+d);
+                       } else {
+                               uuid+=String.fromCharCode("a".charCodeAt(0)-10+d);
+                       }
+               }
+       }
+       return uuid;
+}
+
+UtilService.prototype.generateXPath = function(node) {
+       var node0=node;
+       var str="";
+       while(node.parentNode!=null) {
+               var str0="/";
+        if(node.nodeType==Node.TEXT_NODE) {
+            str0+="text()";
+        } else {
+            str0+=node.nodeName.toLowerCase();
+               }
+               var index=this.getNodeChildIndex(node);
+        str0+="["+(index+1)+"]";
+               str=str0+str;
+               node=node.parentNode;
+       }
+       str=node.nodeName+str;
+       if(str.substr(0,9)=="#document")
+               str=str.substring(9);
+       return str;
+}
+
+UtilService.prototype.getNodeChildIndex = function(child) {
+    var i=0;
+    var parent=child.parentNode;
+    var node=parent.firstChild;
+    while(node!=null) {
+        if(node==child)
+            return i;
+        if(node.nodeName==child.nodeName && 
+               (node.nodeType==Node.ELEMENT_NODE || node.nodeType==Node.TEXT_NODE))
+            i++;
+        node=node.nextSibling;
+    }
+    return -1;
+}
+
+UtilService.prototype.decodeURL = function(text) {
+       var decoder=Components.classes["@mozilla.org/intl/utf8converterservice;1"]
+               .getService(Components.interfaces.nsIUTF8ConverterService);
+       text=decoder.convertURISpecToUTF8(text,null);
+       var hc="0123456789ABCDEFabcdef"; 
+       var pt="";
+       var i=0;
+       while (i < text.length) {
+       var ch=text.charAt(i);
+       if (ch=="+") {
+               pt+=" ";
+                       i++;
+               } else if (ch=="%") {
+                       if (i < (text.length-2) 
+                                       && hc.indexOf(text.charAt(i+1)) != -1 
+                                       && hc.indexOf(text.charAt(i+2)) != -1 ) {
+                               pt+=unescape( text.substr(i,3) );
+                               i+=3;
+                       } else {
+                               pt+="?";
+                               i++;
+                       }
+               } else {
+                  pt+=ch;
+                  i++;
+               }
+       } 
+   return pt;
+}
+
+UtilService.prototype.encodeURL = function(text) {
+       var sc="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.!~*'()";
+       var h="0123456789ABCDEF";
+       var encoded="";
+       for (var i=0; i < text.length; i++ ) {
+               var ch=text.charAt(i);
+           if (ch==" ") {
+                   encoded+="+";
+               } else if (sc.indexOf(ch) != -1) {
+                   encoded+=ch;
+               } else {
+                   var charCode=ch.charCodeAt(0);
+                       if (charCode > 255) {
+                               encoded+="+";
+                       } else {
+                               encoded+="%"+h.charAt((charCode >> 4) & 0xF)+h.charAt(charCode & 0xF);
+                       }
+               }
+       }
+       return encoded;
+};
+
+UtilService.prototype.contentPost = function(url,body,target,targetName,features) {
+       if(target==null) {
+               var wwatch = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].getService().
+                       QueryInterface(Components.interfaces.nsIWindowWatcher);
+               target=wwatch.openWindow(null, "about:blank",
+                        targetName, features, null);
+       }
+       var webNav = target.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
+               getInterface(Components.interfaces.nsIWebNavigation);
+       var sis = null;
+       if(body!=null) {
+               sis=Components.classes["@mozilla.org/io/string-input-stream;1"].
+               createInstance(Components.interfaces.nsIStringInputStream);
+        sis.setData("Content-length: "+body.length+"\r\n\r\n"+body,-1);
+    }
+       webNav.loadURI(url,webNav.LOAD_FLAGS_NONE,null,sis,null);
+}
+
+UtilService.prototype.xmlEscape = function(str) {
+       str=str.replace(/&/g,"&amp;");
+       str=str.replace(/</g,"&lt;");
+       str=str.replace(/>/g,"&gt;");
+       return str;
+       str=str.replace(/'/g,"&apos;");
+       str=str.replace(/"/g,"&quot;");
+       var str0="";
+       for(var i=0;i<str.length;i++) {
+               var cc=str.charCodeAt(i);
+               if(cc>=0x80)
+                       str0+="&#"+cc+";";
+               else
+                       str0+=str[i];
+       }
+       return str0;
+}
+
+UtilService.prototype.getUTCTime = function() {
+       var date=new Date();
+       var t=date.getTime();
+       t+=date.getTimezoneOffset()*60*1000;
+       return t;
+}
+
+UtilService.prototype.formatNumberMinDigits = function(value,digits) {
+       var str=""+value;
+       while(str.length<digits)
+               str="0"+str;
+       return str;
+}
+
+UtilService.prototype.getExceptionStack = function(e) {
+       try {
+               var msg="";
+               var location=e.location;
+               while(location!=null) {
+                       msg+=location.filename+":"+location.lineNumber+"\n";
+                       location=location.caller;
+               }
+               return msg;
+       } catch(e0) {
+               return "[UtilService] error while getting exception frame: "+e0;
+       }
+}
+
+UtilService.prototype.removeChild = function(ds,parent,child) {
+       var seq=this.RDFCUtils.MakeSeq(ds,parent);
+       seq.RemoveElement(child,true);
+}
+
+UtilService.prototype.removeChildRS = function(ds,parent,child) {
+       var seq=this.RDFCUtils.MakeSeq(ds,parent);
+       seq.RemoveElement(this.RDF.GetResource(child),true);
+}
+
+UtilService.prototype.removeChildSR = function(ds,parent,child) {
+       var seq=this.RDFCUtils.MakeSeq(ds,this.RDF.GetResource(parent));
+       seq.RemoveElement(child,true);
+}
+
+UtilService.prototype.removeChildSS = function(ds,parent,child) {
+       var seq=this.RDFCUtils.MakeSeq(ds,this.RDF.GetResource(parent));
+       seq.RemoveElement(this.RDF.GetResource(child),true);
+}
+
+UtilService.prototype.getRDFNodeValue = function(node) {
+       if(node==null)
+               return null;
+       try {
+               var res=node.QueryInterface(Components.interfaces.nsIRDFResource);
+               return res.Value;
+       } catch(e) {}
+       try {
+               var lit=node.QueryInterface(Components.interfaces.nsIRDFLiteral);
+               return lit.Value;
+       } catch(e) {}
+       return null;
+}
+
+UtilService.prototype.QueryInterface = function(iid) {
+    if (!iid.equals(Components.interfaces.nsISupports) && 
+       !iid.equals(Components.interfaces.dhIUtilService)) {
+                       //dump("UtilService: requested invalid interface "+iid+"\n");
+            throw Components.results.NS_ERROR_NO_INTERFACE;
+        }
+    return this;
+}
+
+var vUtilServiceModule = {
+    firstTime: true,
+    
+    /*
+     * RegisterSelf is called at registration time (component installation
+     * or the only-until-release startup autoregistration) and is responsible
+     * for notifying the component manager of all components implemented in
+     * this module.  The fileSpec, location and type parameters are mostly
+     * opaque, and should be passed on to the registerComponent call
+     * unmolested.
+     */
+    registerSelf: function (compMgr, fileSpec, location, type) {
+
+        if (this.firstTime) {
+            this.firstTime = false;
+            throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
+        }
+        compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
+        compMgr.registerFactoryLocation(NS_UTIL_SERVICE_CID,
+                                        "UtilService",
+                                        NS_UTIL_SERVICE_PROG_ID, 
+                                        fileSpec,
+                                        location,
+                                        type);
+    },
+
+       unregisterSelf: function(compMgr, fileSpec, location) {
+       compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
+       compMgr.unregisterFactoryLocation(NS_UTIL_SERVICE_CID, fileSpec);
+       },
+
+    /*
+     * The GetClassObject method is responsible for producing Factory and
+     * SingletonFactory objects (the latter are specialized for services).
+     */
+    getClassObject: function (compMgr, cid, iid) {
+        if (!cid.equals(NS_UTIL_SERVICE_CID)) {
+               throw Components.results.NS_ERROR_NO_INTERFACE;
+               }
+
+        if (!iid.equals(Components.interfaces.nsIFactory)) {
+               throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+               }
+
+        return this.vUtilServiceFactory;
+    },
+
+    /* factory object */
+    vUtilServiceFactory: {
+        /*
+         * Construct an instance of the interface specified by iid, possibly
+         * aggregating it with the provided outer.  (If you don't know what
+         * aggregation is all about, you don't need to.  It reduces even the
+         * mightiest of XPCOM warriors to snivelling cowards.)
+         */
+        createInstance: function (outer, iid) {
+            if (outer != null) {
+                               throw Components.results.NS_ERROR_NO_AGGREGATION;
+               }
+
+                       if(Node==null)
+                               Node=Components.interfaces.nsIDOMNode;
+
+                       if(XPathResult==null)
+                               XPathResult=Components.interfaces.nsIDOMXPathResult;
+       
+                       return (new UtilService()).QueryInterface(iid);
+        }
+    },
+
+    /*
+     * The canUnload method signals that the component is about to be unloaded.
+     * C++ components can return false to indicate that they don't wish to be
+     * unloaded, but the return value from JS components' canUnload is ignored:
+     * mark-and-sweep will keep everything around until it's no longer in use,
+     * making unconditional ``unload'' safe.
+     *
+     * You still need to provide a (likely useless) canUnload method, though:
+     * it's part of the nsIModule interface contract, and the JS loader _will_
+     * call it.
+     */
+    canUnload: function(compMgr) {
+               return true;
+    }
+};
+
+function NSGetModule(compMgr, fileSpec) {
+    return vUtilServiceModule;
+}
index 53deaa1..8b8ccc7 100644 (file)
@@ -4,5 +4,9 @@ pref("dwhelper.alert-update-version", "");
 pref("dwhelper.menu-http-expiration",60000);
 pref("dwhelper.icon-animation",true);
 pref("dwhelper.ytlinks-enabled",true);
-pref("dwhelper.medialink-extensions","jpg|jpeg|gif|png|mpg|mpeg|avi|rm|wmv|mov|flv");
-pref("dwhelper.mediareq-extensions","flv|ram|mpg|mpeg|avi|rm|wmv|mov|asf");
+pref("dwhelper.medialink-extensions","jpg|jpeg|gif|png|mpg|mpeg|avi|rm|wmv|mov|flv|mp3");
+pref("dwhelper.mediareq-extensions","flv|ram|mpg|mpeg|avi|rm|wmv|mov|asf|mp3");
+pref("dwhelper.adult",false);
+pref("dwhelper.checked-adult",false);
+pref("dwhelper.context-menu",true);
+pref("extensions.{b9db16a4-6edc-47ec-a1f4-b86292ed211d}.description","chrome://dwhelper/locale/strings.properties");
\ No newline at end of file
index a0e1824..c2ae87e 100755 (executable)
@@ -5,7 +5,7 @@
 \r
   <Description about="urn:mozilla:install-manifest">\r
     <em:id>{b9db16a4-6edc-47ec-a1f4-b86292ed211d}</em:id>\r
-    <em:version>1.95</em:version>\r
+    <em:version>2.2.1</em:version>\r
     <em:type>2</em:type>\r
    \r
     <!-- Target Application this extension can install into, \r
@@ -16,7 +16,7 @@
       <Description>\r
         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>\r
         <em:minVersion>1.5</em:minVersion>\r
-        <em:maxVersion>2.0.0.*</em:maxVersion>\r
+        <em:maxVersion>3.0a2</em:maxVersion>\r
       </Description>\r
     </em:targetApplication>
     
     
        <em:file>
                <Description about="urn:mozilla:extension:file:dwhelper.jar">
-                 <em:package>content/</em:package>
-                  <em:locale>locale/en-US/</em:locale>
+                   <em:package>content/</em:package>
+                   <em:locale>locale/en-US/</em:locale>
                    <em:locale>locale/fr-FR/</em:locale>
-                 <em:skin>skin/classic/</em:skin>
+                   <em:locale>locale/nl-NL/</em:locale>
+                   <em:locale>locale/de-DE/</em:locale>
+                   <em:locale>locale/es-ES/</em:locale>
+                   <em:locale>locale/it-IT/</em:locale>
+                   <em:locale>locale/pt-BR/</em:locale>
+                   <em:skin>skin/classic/</em:skin>
                </Description>
        </em:file>
     \r