themes: remove obsolete javascript files that haven't been used in over two years
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 21 Nov 2012 17:36:40 +0000 (17:36 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 21 Nov 2012 17:36:40 +0000 (17:36 +0000)
themes/base/htdocs/luci-static/resources/Dropdowns.js [deleted file]
themes/base/htdocs/luci-static/resources/VarType.js [deleted file]
themes/base/htdocs/luci-static/resources/XHTML1.js [deleted file]

diff --git a/themes/base/htdocs/luci-static/resources/Dropdowns.js b/themes/base/htdocs/luci-static/resources/Dropdowns.js
deleted file mode 100644 (file)
index a8d12b9..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
-Copyright (C) 2008  Alina Friedrichsen <x-alina@gmx.net>
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-*/
-
-function initDropdowns() {
-       var aSelects = XHTML1.getElementsByTagName("select");
-       var isIE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
-
-       function showPlaceholder(sel) {
-               if( ! sel._ph ) {
-                       var box = sel.getBoundingClientRect();
-                       sel._dm = sel.currentStyle.display;
-                       sel._ph = document.createElement('input');
-                       sel.parentNode.insertBefore(sel._ph, sel);
-                       sel._ph.style.width  = ( box.right - box.left ) + 'px';
-                       sel._ph.style.height = ( box.bottom - box.top ) + 'px';
-                       sel._ph.style.margin = sel.currentStyle.margin;
-               }
-
-               sel._ph.value = sel.options[sel.selectedIndex].text;
-               sel._ph.style.display = sel._dm;
-               sel.style.display = 'none';
-       }
-
-       function hidePlaceholder(sel) {
-               if( sel._ph ) sel._ph.style.display = 'none';
-               sel.style.display = sel._dm;
-       }
-
-       function hideSelects() {
-               for(var i = 0; i < aSelects.length; i++) {
-                       showPlaceholder(aSelects[i]);
-               }
-       }
-
-       function showSelects() {
-               for(var i = 0; i < aSelects.length; i++) {
-                       hidePlaceholder(aSelects[i]);
-               }
-       }
-
-       function isEmptyObject(obj) {
-               for(var i in obj) {
-                       return false;
-               }
-               return true;
-       }
-
-       var nextUniqueID = 1;
-       var elementsNeeded = {};
-       var menusShown = {};
-       var menusToHide = {};
-       var delayHideTimerId;
-       var delayHideAllTime = 1000;
-       var delayHideTime = 400;
-       function delayHide() {
-               for(var i in menusToHide) {
-                       XHTML1.removeClass(menusToHide[i], "focus");
-               }
-               delayHideTimerId = null;
-       }
-
-       function updatePopup() {
-               if(isIE6) {
-                       if(isEmptyObject(elementsNeeded)) {
-                               showSelects();
-                       }
-                       else{
-                               hideSelects();
-                       }
-               }
-
-               var menusShownOld = menusShown;
-               menusShown = {};
-               for(var id in elementsNeeded) {
-                       var element = elementsNeeded[id];
-                       for(element = findLi(element); element; element = findLi(element.parentNode)) {
-                               XHTML1.addClass(element, "focus");
-                               if(!element.uniqueID) {
-                                       element.uniqueID = nextUniqueID++;
-                               }
-                               element.style.zIndex = 1000;
-                               menusShown[element.uniqueID] = element;
-                               delete menusToHide[element.uniqueID];
-                       }
-               }
-               for(var id in menusShownOld) {
-                       if(!menusShown[id]) {
-                               if(delayHideTimerId) {
-                                       clearTimeout(delayHideTimerId);
-                                       delayHideTimerId = 0;
-                                       delayHide();
-                               }
-                               menusToHide[id] = menusShownOld[id];
-                               menusToHide[id].style.zIndex = 999;
-                       }
-               }
-               if(menusToHide || isEmptyObject(elementsNeeded)) {
-                       if(delayHideTimerId) {
-                               clearTimeout(delayHideTimerId);
-                       }
-                       delayHideTimerId = setTimeout(delayHide, isEmptyObject(elementsNeeded) ? delayHideAllTime : delayHideTime);
-               }
-       }
-
-       function findLi(element) {
-               for(; element; element = element.parentNode) {
-                       if(XHTML1.isElement(element, "li")) {
-                               return element;
-                       }
-               }
-       }
-
-       function onmouseover(evt) {
-               var li = findLi(evt.currentTarget);
-               if(li && !li.focused) {
-                       if(!li.uniqueID) {
-                               li.uniqueID = nextUniqueID++;
-                       }
-                       elementsNeeded[li.uniqueID] = li;
-               }
-               XHTML1.addClass(evt.currentTarget, "over");
-               updatePopup();
-       }
-
-       function onmouseout(evt) {
-               var li = findLi(evt.currentTarget);
-               if(li && !li.focused && li.uniqueID) {
-                       delete elementsNeeded[li.uniqueID];
-               }
-               XHTML1.removeClass(evt.currentTarget, "over");
-               updatePopup();
-       }
-
-       function onfocus(evt) {
-               var li = findLi(evt.currentTarget);
-               if(li) {
-                       li.focused = true;
-                       if(!li.uniqueID) {
-                               li.uniqueID = nextUniqueID++;
-                       }
-                       elementsNeeded[li.uniqueID] = li;
-               }
-               updatePopup();
-       }
-
-       function onblur(evt) {
-               var li = findLi(evt.currentTarget);
-               if(li) {
-                       li.focused = false;
-                       delete elementsNeeded[li.uniqueID];
-               }
-               updatePopup();
-       }
-
-       var aElements = XHTML1.getElementsByTagName("a");
-       for(var i = 0; i < aElements.length; i++) {
-               var a = aElements[i];
-               for(var element = a.parentNode; element; element = element.parentNode) {
-                       if(XHTML1.isElement(element, "ul") && XHTML1.containsClass(element, "dropdowns")) {
-                               XHTML1.addEventListener(a, "focus", onfocus);
-                               XHTML1.addEventListener(a, "blur", onblur);
-                               XHTML1.addEventListener(a, "mouseover", onmouseover);
-                               XHTML1.addEventListener(a, "mouseout", onmouseout);
-                               break;
-                       }
-               }
-       }
-
-       XHTML1.addEventListener(document, "click", function() {
-               if (delayHideTimerId) {
-                       clearTimeout(delayHideTimerId);
-                       delayHideTimerId = 0;
-                       delayHide();
-               }
-       });
-}
-
-if(XHTML1.isDOMSupported()) {
-       XHTML1.addEventListener(window, "load", initDropdowns);
-}
diff --git a/themes/base/htdocs/luci-static/resources/VarType.js b/themes/base/htdocs/luci-static/resources/VarType.js
deleted file mode 100644 (file)
index d466810..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-Copyright (C) 2008  Alina Friedrichsen <x-alina@gmx.net>
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-*/
-
-function VarType() {
-}
-
-VarType.isNull = function(obj) {
-       if(typeof obj == "undefined") return true;
-       if(typeof obj == "object" && (!obj)) return true;
-       return false;
-};
-
-VarType.toFloat = function(value) {
-       value = Number(value);
-       return value;
-};
-
-VarType.toDecimal = function(value) {
-       value = Number(value);
-       if(!isFinite(value)) value = 0.0;
-       return value;
-};
-
-VarType.toInt = function(value) {
-       value = Number(value);
-       if(!isFinite(value)) value = 0.0;
-       value = Math.floor(value);
-       return value;
-};
-
-VarType.toUInt = function(value) {
-       value = Number(value);
-       if(!isFinite(value)) value = 0.0;
-       else if(value < 0.0) value = 0.0;
-       value = Math.floor(value);
-       return value;
-};
-
-VarType.toStr = function(value) {
-       if(VarType.isNull(value)) value = "";
-       value = String(value);
-       return value;
-};
-
-VarType.toBool = function(value) {
-       value = Boolean(value);
-       return value;
-};
-
-VarType.needObject = function(obj) {
-       if(typeof obj != "object" || (!obj)) throw new TypeError();
-};
-
-VarType.needInstanceOf = function(obj, type) {
-       if(!(obj instanceof type)) throw new TypeError();
-};
-
-VarType.needFunction = function(obj) {
-       if(typeof obj != "function") throw new TypeError();
-};
-
-VarType.needNode = function(obj, type) {
-       VarType.needObject(obj);
-       if(VarType.isNull(obj.nodeType)) throw new TypeError();
-       if(!VarType.isNull(type)) {
-               type = VarType.toInt(type);
-               if(obj.nodeType != type) throw new TypeError();
-       }
-};
diff --git a/themes/base/htdocs/luci-static/resources/XHTML1.js b/themes/base/htdocs/luci-static/resources/XHTML1.js
deleted file mode 100644 (file)
index a7d4f7d..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
-Copyright (C) 2007, 2008  Alina Friedrichsen <x-alina@gmx.net>
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-*/
-
-var XMLNS_XMLNS = "http://www.w3.org/2000/xmlns/";
-var XMLNS_XML = "http://www.w3.org/XML/1998/namespace";
-var XMLNS_XHTML = "http://www.w3.org/1999/xhtml";
-
-function W3CDOM_Event(currentTarget) {
-       VarType.needObject(currentTarget);
-       this.currentTarget = currentTarget;
-       this.preventDefault = function() { window.event.returnValue = false; };
-       return this;
-}
-
-function XHTML1() {
-}
-
-XHTML1.isDOMSupported = function() {
-       if(!document.getElementById) return false;
-       if(!(window.addEventListener || window.attachEvent)) return false;
-       return true;
-};
-
-XHTML1.isXHTML = function() {
-       if(document.documentElement.nodeName == "HTML") return false;
-       return true;
-};
-
-XHTML1.addEventListener = function(target, type, listener) {
-       VarType.needObject(target);
-       type = VarType.toStr(type);
-       VarType.needFunction(listener);
-
-       if(target.addEventListener) {
-               target.addEventListener(type, listener, false);
-       }
-       else if(target.attachEvent) {
-               target.attachEvent("on" + type, function() { listener(new W3CDOM_Event(target)); } );
-       }
-};
-
-XHTML1.createElement = function(tagName) {
-       tagName = VarType.toStr(tagName);
-
-       if(XHTML1.isXHTML()) {
-               return document.createElementNS(XMLNS_XHTML, tagName.toLowerCase());
-       }
-
-       return document.createElement(tagName.toUpperCase());
-};
-
-XHTML1.getElementsByTagName = function(tagName) {
-       tagName = VarType.toStr(tagName);
-
-       if(XHTML1.isXHTML()) {
-               return document.getElementsByTagNameNS(XMLNS_XHTML, tagName.toLowerCase());
-       }
-
-       return document.getElementsByTagName(tagName.toUpperCase());
-};
-
-XHTML1.isElement = function(node, tagName) {
-       VarType.needNode(node);
-       tagName = VarType.toStr(tagName);
-
-       if(node.nodeType == 1) {
-               if(XHTML1.isXHTML()) {
-                       if(node.namespaceURI == XMLNS_XHTML) {
-                               if(node.localName == tagName.toLowerCase()) return true;
-                       }
-               } else {
-                       if(node.nodeName == tagName.toUpperCase()) return true;
-               }
-       }
-
-       return false;
-};
-
-XHTML1.getAttribute = function(element, name) {
-       VarType.needNode(element, 1);
-       name = VarType.toStr(name);
-
-       name = name.toLowerCase();
-
-       if(XHTML1.isXHTML()) {
-               return element.getAttributeNS(null, name);
-       }
-
-       if(name == "class") {
-               return element.className;
-       }
-
-       return element.getAttribute(name);
-};
-
-XHTML1.setAttribute = function(element, name, value) {
-       VarType.needNode(element, 1);
-       name = VarType.toStr(name);
-       value = VarType.toStr(value);
-
-       name = name.toLowerCase();
-
-       if(XHTML1.isXHTML()) {
-               element.setAttributeNS(null, name, value);
-               return;
-       }
-
-       if(name == "class") {
-               element.className = value;
-               return;
-       }
-
-       element.setAttribute(name, value);
-};
-
-XHTML1.removeAttribute = function(element, name) {
-       VarType.needNode(element, 1);
-       name = VarType.toStr(name);
-
-       name = name.toLowerCase();
-
-       if(XHTML1.isXHTML()) {
-               element.removeAttributeNS(null, name);
-               return;
-       }
-
-       if(name == "class") {
-               element.className = "";
-               return;
-       }
-
-       element.removeAttribute(name);
-};
-
-XHTML1.containsClass = function(element, className) {
-       VarType.needNode(element, 1);
-       className = VarType.toStr(className).replace(/^\s+/g, "").replace(/\s+$/g, "");
-
-       var classString = XHTML1.getAttribute(element, "class").replace(/\s+/g, " ").replace(/^\s+/g, "").replace(/\s+$/g, "");
-       var classArray = classString.split(" ");
-       for(var i = 0; i < classArray.length; i++) {
-               if(classArray[i] == className) return true;
-       }
-
-       return false;
-};
-
-XHTML1.addClass = function(element, className) {
-       VarType.needNode(element, 1);
-       className = VarType.toStr(className).replace(/^\s+/g, "").replace(/\s+$/g, "");
-
-       var classString = XHTML1.getAttribute(element, "class").replace(/\s+/g, " ").replace(/^\s+/g, "").replace(/\s+$/g, "");
-       var classArray = classString.split(" ");
-       classString = "";
-       for(var i = 0; i < classArray.length; i++) {
-               if(classArray[i] != className) {
-                       if(classString == "") classString = classArray[i];
-                       else classString += " " + classArray[i];
-               }
-       }
-
-       if(classString == "") classString = className;
-       else classString += " " + className;
-
-       XHTML1.setAttribute(element, "class", classString);
-};
-
-XHTML1.removeClass = function(element, className) {
-       VarType.needNode(element, 1);
-       className = VarType.toStr(className).replace(/^\s+/g, "").replace(/\s+$/g, "");
-
-       var classString = XHTML1.getAttribute(element, "class").replace(/\s+/g, " ").replace(/^\s+/g, "").replace(/\s+$/g, "");
-       var classArray = classString.split(" ");
-       classString = "";
-       for(var i = 0; i < classArray.length; i++) {
-               if(classArray[i] != className) {
-                       if(classString == "") classString = classArray[i];
-                       else classString += " " + classArray[i];
-               }
-       }
-
-       XHTML1.setAttribute(element, "class", classString);
-};
-
-XHTML1.removeAllChildren = function(node) {
-       VarType.needNode(node);
-
-       while(node.lastChild) {
-               node.removeChild(node.lastChild);
-       }
-};
-
-XHTML1.getTextContent = function(node) {
-       VarType.needNode(node);
-
-       if(typeof node.textContent != "undefined") {
-               return node.textContent;
-       }
-
-       switch(node.nodeType) {
-               case 1:
-               case 2:
-               case 5:
-               case 6:
-               case 11:
-                       var textContent = "";
-                       for(node = node.firstChild; node; node = node.nextSibling) {
-                               if(node.nodeType == 7) continue;
-                               if(node.nodeType == 8) continue;
-                               textContent += VarType.toStr(XHTML1.getTextContent(node));
-                       }
-                       return textContent;
-               case 3:
-               case 4:
-               case 7:
-               case 8:
-                       return node.nodeValue;
-       }
-
-       return null;
-};
-
-XHTML1.setTextContent = function(node, value) {
-       VarType.needNode(node);
-       value = VarType.toStr(value);
-
-       if(typeof node.textContent != "undefined") {
-               node.textContent = value;
-       }
-
-       switch(node.nodeType) {
-               case 1:
-               case 2:
-               case 5:
-               case 6:
-               case 11:
-                       XHTML1.removeAllChildren(node);
-                       if(value != "") {
-                               node.appendChild(document.createTextNode(value));
-                       }
-                       break;
-               case 3:
-               case 4:
-               case 7:
-               case 8:
-                       node.nodeValue = value;
-                       break;
-       }
-};