diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2008-10-21 00:49:01 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2008-10-21 00:49:01 +0000 |
commit | fe5db5028511da9bfd7036b0430761563cef0c39 (patch) | |
tree | 7e2229793969287c44f8514da51e4472c3c6bdeb /themes/openwrt.org | |
parent | f35cea8c53ef5d7be0c5b1e4a915f5583eab3df1 (diff) |
* luci/themes:
- create new package luci-theme-base
- add new base package to package feed
- make openwrt.org and openwrtlight themes depend on theme-base
Diffstat (limited to 'themes/openwrt.org')
4 files changed, 3 insertions, 485 deletions
diff --git a/themes/openwrt.org/htdocs/luci-static/openwrt.org/Dropdowns.js b/themes/openwrt.org/htdocs/luci-static/openwrt.org/Dropdowns.js deleted file mode 100644 index ff2f0e665..000000000 --- a/themes/openwrt.org/htdocs/luci-static/openwrt.org/Dropdowns.js +++ /dev/null @@ -1,120 +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 onmouseover(evt) { - XHTML1.addClass(evt.currentTarget, "over"); - if( isIE6 ) hideSelects(); - } - - function onmouseout(evt) { - XHTML1.removeClass(evt.currentTarget, "over"); - if( isIE6 ) showSelects(); - } - - function onfocus(evt) { - for(var element = evt.currentTarget; element; element = element.parentNode) { - if(XHTML1.isElement(element, "li")) { - XHTML1.addClass(element, "focus"); - } - } - if( isIE6 ) hideSelects(); - } - - function onblur(evt) { - for(var element = evt.currentTarget; element; element = element.parentNode) { - if(XHTML1.isElement(element, "li")) { - XHTML1.removeClass(element, "focus"); - } - } - if( isIE6 ) showSelects(); - } - - if(document.all) { - var liElements = XHTML1.getElementsByTagName("li"); - for(var i = 0; i < liElements.length; i++) { - var li = liElements[i]; - for(var element = li.parentNode; element; element = element.parentNode) { - if(XHTML1.isElement(element, "ul") && XHTML1.containsClass(element, "dropdowns")) { - XHTML1.addEventListener(li, "mouseover", onmouseover); - XHTML1.addEventListener(li, "mouseout", onmouseout); - break; - } - } - } - } - - 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); - break; - } - } - } -} - -if(XHTML1.isDOMSupported()) { - XHTML1.addEventListener(window, "load", initDropdowns); -} diff --git a/themes/openwrt.org/htdocs/luci-static/openwrt.org/VarType.js b/themes/openwrt.org/htdocs/luci-static/openwrt.org/VarType.js deleted file mode 100644 index d4668109d..000000000 --- a/themes/openwrt.org/htdocs/luci-static/openwrt.org/VarType.js +++ /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/openwrt.org/htdocs/luci-static/openwrt.org/XHTML1.js b/themes/openwrt.org/htdocs/luci-static/openwrt.org/XHTML1.js deleted file mode 100644 index a7d4f7ddd..000000000 --- a/themes/openwrt.org/htdocs/luci-static/openwrt.org/XHTML1.js +++ /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; - } -}; diff --git a/themes/openwrt.org/luasrc/view/themes/openwrt.org/header.htm b/themes/openwrt.org/luasrc/view/themes/openwrt.org/header.htm index b2912b3a5..e658bfc67 100644 --- a/themes/openwrt.org/luasrc/view/themes/openwrt.org/header.htm +++ b/themes/openwrt.org/luasrc/view/themes/openwrt.org/header.htm @@ -46,9 +46,9 @@ require("luci.http").prepare_content("application/xhtml+xml") <!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/ie7.css" /><![endif]--> <% if node and node.css then %><link rel="stylesheet" type="text/css" media="screen" href="<%=resource%>/<%=node.css%>" /> <% end -%> -<script type="text/javascript" src="<%=media%>/VarType.js"></script> -<script type="text/javascript" src="<%=media%>/XHTML1.js"></script> -<script type="text/javascript" src="<%=media%>/Dropdowns.js"></script> +<script type="text/javascript" src="<%=resource%>/VarType.js"></script> +<script type="text/javascript" src="<%=resource%>/XHTML1.js"></script> +<script type="text/javascript" src="<%=resource%>/Dropdowns.js"></script> <title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. node.title or '')) %> - LuCI</title> </head> <body class="lang_<%=luci.i18n.context.lang%>"> |