This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.7 KiB
65 lines
1.7 KiB
/* |
|
--- |
|
name : Sheet.DOM |
|
description : Sheet.DOM adds some handy stuff for working with the browser's native CSS capabilities. |
|
|
|
authors : Thomas Aylott |
|
copyright : © 2010 Thomas Aylott |
|
license : MIT |
|
|
|
provides : Sheet.DOM |
|
... |
|
*/ |
|
;(function(document,styleSheets){ |
|
|
|
if (typeof Sheet == 'undefined') Sheet = {} |
|
if (Sheet.DOM == null) Sheet.DOM = {} |
|
|
|
Sheet.DOM.createSheetNode = function(raw){ |
|
var sheet = Sheet.DOM.createSheet(raw) |
|
var node = sheet.ownerNode |
|
node.parentNode.removeChild(node) |
|
return node |
|
} |
|
|
|
var UID = 0 |
|
|
|
Sheet.DOM.createSheet = createStyleSheetWithCSS |
|
function createStyleSheetWithCSS(css){ |
|
var styleElement = document.createElement("style") |
|
styleElement.appendChild(document.createTextNode(css)) |
|
styleElement.setAttribute('name', styleElement.id = "SheetRuler-" + +new Date) |
|
document.getElementsByTagName('head')[0].appendChild(styleElement) |
|
|
|
return styleElement.sheet || styleElement.styleSheet |
|
} |
|
|
|
Sheet.DOM.createStyle = function(raw){ |
|
var div = document.createElement('div') |
|
div.innerHTML = '<p style="' + String_escapeHTML.call(raw) + '"></p>' |
|
return div.firstChild.style |
|
} |
|
|
|
Sheet.DOM.createSheetStyle = function(raw){ |
|
var className = 'Sheet' + +new Date |
|
var sheet = Sheet.DOM.createSheet("." + className + "{" + raw + "}") |
|
return (sheet.rules || sheet.cssRules)[0].style |
|
} |
|
|
|
Sheet.DOM.createRule = function(selector,style){ |
|
var rule = selector + "{" + style + "}" |
|
|
|
var sheet = Sheet.DOM.createSheet(rule) |
|
var rules = sheet.rules || sheet.cssRules |
|
return rules[rules.length - 1] |
|
} |
|
|
|
Sheet.DOM.createStyleWrapped = function(raw){ |
|
return {style:Sheet.DOM.createStyle(raw)} |
|
} |
|
|
|
function String_escapeHTML(){ |
|
return ('' + this).replace(/&/g,'&').replace(/</g,'<').replace(/"/g,'"') |
|
} |
|
|
|
}(document, document.styleSheets));
|
|
|