Helpviewer/JavaScriptResources.py

changeset 0
de9c2efb9d02
child 13
1af94a91f439
diff -r 000000000000 -r de9c2efb9d02 Helpviewer/JavaScriptResources.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Helpviewer/JavaScriptResources.py	Mon Dec 28 16:03:33 2009 +0000
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2009 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module containing some HTML resources.
+"""
+
+fetchLinks_js = """
+(function (){
+    var links = new Array;
+    var it = document.evaluate('/html/head/link', document, null, XPathResult.ANY_TYPE, null);
+    var link = it.iterateNext();
+    while (link) {
+        var obj = new Object;
+        obj.rel = link.rel;
+        obj.type = link.type;
+        obj.href = link.href;
+        obj.title = link.title;
+        links.push(obj);
+        link = it.iterateNext();
+    }
+    return links;
+})();
+"""
+
+parseForms_js = """
+(function (){
+    var forms = new Array;
+    for (var i = 0; i < document.forms.length; ++i) {
+        var form = document.forms[i];
+        var formObject = new Object;
+        formObject.name = form.name;
+        formObject.index = i
+        var elements = new Array;
+        for (var j = 0; j < form.elements.length; ++j) {
+            var e = form.elements[j];
+            var element = new Object;
+            element.name = e.name;
+            element.value = e.value;
+            element.type = e.type;
+            element.autocomplete = e.attributes.getNamedItem("autocomplete");
+            if (element.autocomplete != null)
+                element.autocomplete = element.autocomplete.value;
+            elements.push(element);
+        }
+        formObject.elements = elements;
+        forms.push(formObject);
+    }
+    return forms;
+}());
+"""

eric ide

mercurial