/web/acc/phpsysinfo/js/vendor/README |
---|
0,0 → 1,58 |
versions, links and simple description of used jquery files |
=========================================================== |
bootstrap-modal.js |
--------- |
VERSION : 4.3.1 |
URL : https://getbootstrap.com/ |
DESC : Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web |
USED : used for the entire bootstrap userinterface |
bootstrap-util.js |
--------- |
VERSION : 4.3.1 |
URL : https://getbootstrap.com/ |
DESC : Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web |
USED : used for the entire bootstrap userinterface |
transparency.js |
--------- |
VERSION : 0.10.0 |
URL : https://leonidas.github.io/transparency/ |
DESC : Transparency is a minimal template engine for jQuery. It maps JSON objects to DOM elements with zero configuration. Just call .render() |
USED : used for the entire bootstrap userinterface |
html5shiv-printshiv.js |
--------- |
VERSION : 3.7.3 |
URL : https://github.com/aFarkas/html5shiv/ |
DESC : Enabling HTML5 Shiv Script and Print Support on old IE6-9 Browser Safari 4.x and Firefox 3.x |
USED : used for the entire bootstrap userinterface |
console-shim.js |
--------- |
VERSION : |
URL : https://github.com/liamnewmarch/console-shim/ |
DESC : Shim to make browsers store console messages without Dev Tools open (e.g. IE9) |
USED : used for the entire bootstrap userinterface |
sorttable.js |
--------- |
VERSION : 2+2014.12.25.12_fix-noinit-noforeach |
URL : https://www.kryogenix.org/code/browser/sorttable/ |
DESC : Make all your tables sortable |
USED : used for the entire bootstrap userinterface |
bootstrap-ie8.js |
--------- |
VERSION : 4.3.100 |
URL : https://namiltd.github.io/bootstrap-ie/ |
DESC : Bootstrap 4 compatibility module for IE8 |
USED : used for the entire bootstrap userinterface on IE8 |
bootstrap-ie9.js |
--------- |
VERSION : 4.3.100 |
URL : https://namiltd.github.io/bootstrap-ie/ |
DESC : Bootstrap 4 compatibility module for IE9 |
USED : used for the entire bootstrap userinterface on IE9 |
/web/acc/phpsysinfo/js/vendor/bootstrap-ie8.js |
---|
0,0 → 1,707 |
/* Bootstrap 4 for IE8 - v4.3.100 */ |
/* https://github.com/namiltd/bootstrap-ie */ |
// create the nodeType constants if the Node object is not defined |
if (!window.Node){ |
var Node = { |
ELEMENT_NODE : 1, |
ATTRIBUTE_NODE : 2, |
TEXT_NODE : 3, |
CDATA_SECTION_NODE : 4, |
ENTITY_REFERENCE_NODE : 5, |
ENTITY_NODE : 6, |
PROCESSING_INSTRUCTION_NODE : 7, |
COMMENT_NODE : 8, |
DOCUMENT_NODE : 9, |
DOCUMENT_TYPE_NODE : 10, |
DOCUMENT_FRAGMENT_NODE : 11, |
NOTATION_NODE : 12 |
}; |
} |
(function() { |
if (!Object.keys) { |
Object.keys = function(obj) { |
if (obj !== Object(obj)) { |
throw new TypeError('Object.keys called on a non-object'); |
} |
var keys = []; |
for (var i in obj) { |
if (Object.prototype.hasOwnProperty.call(obj, i)) { |
keys.push(i); |
} |
} |
return keys; |
}; |
} |
}()); |
(function() { |
if (!Object.create) { |
Object.create = function(proto, props) { |
if (typeof props !== "undefined") { |
throw "The multiple-argument version of Object.create is not provided by this browser and cannot be shimmed."; |
} |
function ctor() { } |
ctor.prototype = proto; |
return new ctor(); |
}; |
} |
}()); |
(function() { |
if (!Array.prototype.forEach) { |
Array.prototype.forEach = function(fn, scope) { |
for(var i = 0, len = this.length; i < len; ++i) { |
fn.call(scope, this[i], i, this); |
} |
}; |
} |
}()); |
// ES 15.2.3.6 Object.defineProperty ( O, P, Attributes ) |
// Partial support for most common case - getters, setters, and values |
(function() { |
if (!Object.defineProperty || |
!(function () { try { Object.defineProperty({}, 'x', {}); return true; } catch (e) { return false; } } ())) { |
var orig = Object.defineProperty; |
Object.defineProperty = function (o, prop, desc) { |
// In IE8 try built-in implementation for defining properties on DOM prototypes. |
if (orig) { try { return orig(o, prop, desc); } catch (e) {} } |
if (o !== Object(o)) { throw TypeError("Object.defineProperty called on non-object"); } |
if (Object.prototype.__defineGetter__ && ('get' in desc)) { |
Object.prototype.__defineGetter__.call(o, prop, desc.get); |
} |
if (Object.prototype.__defineSetter__ && ('set' in desc)) { |
Object.prototype.__defineSetter__.call(o, prop, desc.set); |
} |
if ('value' in desc) { |
o[prop] = desc.value; |
} |
return o; |
}; |
} |
}()); |
(function() { |
if (!Function.prototype.bind) { |
Function.prototype.bind = function (oThis) { |
if (typeof this !== "function") { |
// closest thing possible to the ECMAScript 5 internal IsCallable function |
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); |
} |
var aArgs = Array.prototype.slice.call(arguments, 1), |
fToBind = this, |
fNOP = function () {}, |
fBound = function () { |
return fToBind.apply(this instanceof fNOP && oThis ? this: oThis, aArgs.concat(Array.prototype.slice.call(arguments))); |
}; |
fNOP.prototype = this.prototype; |
fBound.prototype = new fNOP(); |
return fBound; |
}; |
} |
}()); |
(function() { |
if (!Array.prototype.indexOf) { |
Array.prototype.indexOf = function(elt /*, from*/) { |
var len = this.length >>> 0; |
var from = Number(arguments[1]) || 0; |
from = (from < 0) ? Math.ceil(from) : Math.floor(from); |
if (from < 0) { |
from += len; |
} |
for (; from < len; from++) { |
if (from in this && this[from] === elt) { |
return from; |
} |
} |
return -1; |
}; |
} |
}()); |
(function() { |
var _slice = Array.prototype.slice; |
Array.prototype.slice = function() { |
if(this instanceof Array) { |
return _slice.apply(this, arguments); |
} else { |
var result = []; |
var start = (arguments.length >= 1) ? arguments[0] : 0; |
var end = (arguments.length >= 2) ? arguments[1] : this.length; |
for(var i=start; i<end; i++) { |
result.push(this[i]); |
} |
return result; |
} |
}; |
})(); |
// adds classList support (as Array) to Element.prototype for IE8-9 |
(function() { |
Object.defineProperty(Element.prototype, 'classList', { |
get:function(){ |
var element=this,domTokenList=(element.getAttribute('class')||'').replace(/^\s+|\s$/g,'').split(/\s+/g); |
if (domTokenList[0]==='') domTokenList.splice(0,1); |
function setClass(){ |
if (domTokenList.length > 0) element.setAttribute('class', domTokenList.join(' ')); |
else element.removeAttribute('class'); |
} |
domTokenList.toggle=function(className,force){ |
if (force!==undefined){ |
if (force) domTokenList.add(className); |
else domTokenList.remove(className); |
} |
else { |
if (domTokenList.indexOf(className)!==-1) domTokenList.splice(domTokenList.indexOf(className),1); |
else domTokenList.push(className); |
} |
setClass(); |
}; |
domTokenList.add=function(){ |
var args=[].slice.call(arguments); |
for (var i=0,l=args.length;i<l;i++){ |
if (domTokenList.indexOf(args[i])===-1) domTokenList.push(args[i]); |
} |
setClass(); |
}; |
domTokenList.remove=function(){ |
var args=[].slice.call(arguments); |
for (var i=0,l=args.length;i<l;i++){ |
if (domTokenList.indexOf(args[i])!==-1) domTokenList.splice(domTokenList.indexOf(args[i]),1); |
} |
setClass(); |
}; |
domTokenList.item=function(i){ |
return domTokenList[i]; |
}; |
domTokenList.contains=function(className){ |
return domTokenList.indexOf(className)!==-1; |
}; |
domTokenList.replace=function(oldClass,newClass){ |
if (domTokenList.indexOf(oldClass)!==-1) domTokenList.splice(domTokenList.indexOf(oldClass),1,newClass); |
setClass(); |
}; |
domTokenList.value = (element.getAttribute('class')||''); |
return domTokenList; |
} |
}); |
})(); |
/** |
* Modified code based on remPolyfill.js (c) Nicolas Bouvrette https://github.com/nbouvrette/remPolyfill |
* |
* Customizations: |
* |
* 1) Added new method `addCallBackWhenReady` to perform callbacks once the polyfill has been applied (especially useful for |
* onload scrolling events. |
* 2) Added REM support. |
* |
**/ |
/** |
* For browsers that do not support REM units, fallback to pixels. |
*/ |
window.remPolyfill = { |
/** @property Number|null - The body's font size. |
* @private */ |
bodyFontSize: null, |
/** |
* Get the body font size. |
* |
* @returns {Number} - The body font size in pixel (number only). |
*/ |
getBodyFontSize: function() { |
if (!this.bodyFontSize) { |
if (!document.body) { |
var bodyElement = document.createElement('body'); |
document.documentElement.appendChild(bodyElement); |
this.bodyFontSize = parseFloat(this.getStyle(document.body, 'fontSize')); |
document.documentElement.removeChild(bodyElement); |
bodyElement = null; |
} else { |
this.bodyFontSize = parseFloat(this.getStyle(document.body, 'fontSize')); |
} |
} |
return this.bodyFontSize; |
}, |
/** |
* Get the style of an element for a given property. |
* |
* @private |
* |
* @param {HTMLElement} element - The HTML element. |
* @param {string} property - The property of the style to get. |
*/ |
getStyle: function(element, property) { |
if (typeof window.getComputedStyle !== 'undefined') { |
return window.getComputedStyle(element, null).getPropertyValue(property); |
} else { |
return element.currentStyle[property]; |
} |
}, |
/** |
* Implement this script on a given element. |
* |
* @private |
* |
* @param {string} cssText - The CSS text of the link element. |
*/ |
replaceCSS: function (cssText) { |
if (cssText) { |
// Replace all properties containing REM units with their pixel equivalents. |
return cssText.replace( |
/([\d]+\.[\d]+|\.[\d]+|[\d]+)rem/g, function (fullMatch, groupMatch) { |
return Math.round(parseFloat(groupMatch * remPolyfill.getBodyFontSize())) + 'px';} |
).replace( |
/calc\s*\(\s*\(\s*([\d]+)\s*px\s*([\+-])\s*([\d]+)\s*px\s*\)\s*\*\s*(-?[\d]+)\s*\)/g, function (fullMatch, MatchArg1, MatchSign, MatchArg2, MatchArg3) { |
return ((parseInt(MatchArg1)+(MatchSign=='-'?-1:1)*parseInt(MatchArg2))*parseInt(MatchArg3))+'px';} |
).replace( |
/calc\s*\(\s*([\d]+)\s*px\s*([\+-])\s*([\d]+)\s*px\s*\)/g, function (fullMatch, MatchArg1, MatchSign, MatchArg2) { |
return (parseInt(MatchArg1)+(MatchSign=='-'?-1:1)*parseInt(MatchArg2))+'px';} |
).replace( |
/::/g, ':' |
).replace( |
/:disabled/g, '._disabled' |
).replace( |
/:invalid/g, '._invalid' |
).replace( |
/:valid/g, '._valid' |
).replace( |
/background-color\s*:\s*rgba\s*\(\s*([\d]+)\s*,\s*([\d]+)\s*,\s*([\d]+)\s*,\s*([\d\.]+)\s*\)/g, function (fullMatch, MatchR, MatchG, MatchB, MatchA) { |
var ARGBhex = (4294967296+16777216*Math.round(parseFloat(MatchA)*255)+65536*parseInt(MatchR)+256*parseInt(MatchG)+parseInt(MatchB)).toString(16).substr(1); |
return 'filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#'+ARGBhex+', endColorstr=#'+ARGBhex+')';} |
).replace( |
/rgba\s*\(\s*([\d]+)\s*,\s*([\d]+)\s*,\s*([\d]+)\s*,\s*([\d\.]+)\s*\)/g, function (fullMatch, MatchR, MatchG, MatchB, MatchA) { |
var MR = parseInt(MatchR), MG = parseInt(MatchG), MB = parseInt(MatchB), MA = parseFloat(MatchA); |
if ((MR==255)&&(MG==255)&&(MB==255)) { //dark background |
return 'rgb(' + Math.round(MA * 255) + ', ' + Math.round(MA * 255) + ', ' + Math.round(MA * 255) +')'; |
} else { //else |
return 'rgb(' + Math.round((1-MA) * 255 + MA * MR) + ', ' + Math.round((1-MA) * 255 + MA * MG) + ', ' + Math.round((1-MA) * 255 + MA * MB) +')'; |
} |
} |
).replace( |
/opacity\s*:\s*([\d]+\.[\d]+|\.[\d]+|[\d]+)/g, function (fullMatch, groupMatch) { |
return 'filter:alpha(opacity=' + Math.round(parseFloat(groupMatch * 100)) + ')';} |
); |
} |
}, |
/** |
* Implement this script on a given element. |
* |
* @param {HTMLLinkElement} linkElement - The link element to polyfill. |
*/ |
implement: function (linkElement) { |
if (!linkElement.href) { |
return; |
} |
var request = null; |
if (window.XMLHttpRequest) { |
request = new XMLHttpRequest(); |
} else if (window.ActiveXObject) { |
try { |
request = new ActiveXObject("Msxml2.XMLHTTP"); |
} catch (exception) { |
try { |
request = new ActiveXObject("Microsoft.XMLHTTP"); |
} catch (exception) { |
request = null; |
} |
} |
} |
if (!request) { |
return; |
} |
request.open('GET', linkElement.href, true); |
request.onreadystatechange = function() { |
if ( request.readyState === 4 ) { |
linkElement.styleSheet.cssText = remPolyfill.replaceCSS(request.responseText); |
} |
}; |
request.send(null); |
} |
}; |
var linkElements = document.querySelectorAll('link[rel=stylesheet]'); |
for (var linkElementId in linkElements) { |
if (Object.prototype.hasOwnProperty.call(linkElements, linkElementId)) { |
remPolyfill.implement(linkElements[linkElementId]); |
} |
} |
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ |
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ |
(function (w) { |
"use strict"; |
w.matchMedia = w.matchMedia || function (doc, undefined) { |
var bool, docElem = doc.documentElement, refNode = docElem.firstElementChild || docElem.firstChild, |
fakeBody = doc.createElement("body"), div = doc.createElement("div"); |
div.id = "mq-test-1"; |
div.style.cssText = "position:absolute;top:-100em"; |
fakeBody.style.background = "none"; |
fakeBody.appendChild(div); |
return function (q) { |
div.innerHTML = '­<style media="' + q + '"> #mq-test-1 { width: 42px; }</style>'; |
docElem.insertBefore(fakeBody, refNode); |
bool = div.offsetWidth === 42; |
docElem.removeChild(fakeBody); |
return { |
matches: bool, |
media: q |
}; |
}; |
}(w.document); |
})(this); |
/* Respond.js: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */ |
(function (w) { |
"use strict"; |
//exposed namespace |
var respond = {}; |
w.respond = respond; |
//define update even in native-mq-supporting browsers, to avoid errors |
respond.update = function () { |
}; |
//define ajax obj |
var requestQueue = [], |
xmlHttp = function () { |
var xmlhttpmethod = false; |
try { |
xmlhttpmethod = new w.XMLHttpRequest(); |
} catch (e) { |
xmlhttpmethod = new w.ActiveXObject("Microsoft.XMLHTTP"); |
} |
return function () { |
return xmlhttpmethod; |
}; |
}(), |
//tweaked Ajax functions from Quirksmode |
ajax = function (url, callback) { |
var req = xmlHttp(); |
if (!req) { |
return; |
} |
try { |
req.open("GET", url, true); |
req.onreadystatechange = function () { |
if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) { |
return; |
} |
callback( remPolyfill.replaceCSS(req.responseText) ); |
}; |
if (req.readyState === 4) { |
return; |
} |
req.send(null); |
} |
catch ( e ) { |
} |
}, isUnsupportedMediaQuery = function (query) { |
return query.replace(respond.regex.minmaxwh, '').match(respond.regex.other); |
}; |
//expose for testing |
respond.ajax = ajax; |
respond.queue = requestQueue; |
respond.unsupportedmq = isUnsupportedMediaQuery; |
respond.regex = { |
media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi, |
keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi, |
comments: /\/\*[^*]*\*+([^/][^*]*\*+)*\//gi, |
urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, |
findStyles: /@media *([^\{]+)\{([\S\s]+?)$/, |
only: /(only\s+)?([a-zA-Z]+)\s?/, |
minw: /\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/, |
maxw: /\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/, |
minmaxwh: /\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi, |
other: /\([^\)]*\)/g |
}; |
//expose media query support flag for external use |
respond.mediaQueriesSupported = w.matchMedia && w.matchMedia("only all") !== null && w.matchMedia("only all").matches; |
//if media queries are supported, exit here |
if (respond.mediaQueriesSupported) { |
return; |
} |
respond.callbackQueue = []; |
respond.addCallBackWhenReady = function (callback) { |
respond.callbackQueue.push(callback); |
}; |
respond.callback = function () { |
if (respond.callbackQueue.length) { |
for (var callback in respond.callbackQueue) { |
respond.callbackQueue[callback](); |
} |
} |
}; |
//define vars |
var doc = w.document, |
docElem = doc.documentElement, |
mediastyles = [], |
rules = [], |
appendedEls = [], |
parsedSheets = {}, |
resizeThrottle = 30, |
head = doc.getElementsByTagName("head")[0] || docElem, |
base = doc.getElementsByTagName("base")[0], |
links = head.getElementsByTagName("link"), |
lastCall, |
resizeDefer, |
//cached container for 1em value, populated the first time it's needed |
eminpx, |
// returns the value of 1em in pixels |
getEmValue = function () { |
var ret, |
div = doc.createElement('div'), |
body = doc.body, |
originalHTMLFontSize = docElem.style.fontSize, |
originalBodyFontSize = body && body.style.fontSize, |
fakeUsed = false; |
div.style.cssText = "position:absolute;font-size:1em;width:1em"; |
if (!body) { |
body = fakeUsed = doc.createElement("body"); |
body.style.background = "none"; |
} |
// 1em in a media query is the value of the default font size of the browser |
// reset docElem and body to ensure the correct value is returned |
docElem.style.fontSize = "100%"; |
body.style.fontSize = "100%"; |
body.appendChild(div); |
if (fakeUsed) { |
docElem.insertBefore(body, docElem.firstChild); |
} |
ret = div.offsetWidth; |
if (fakeUsed) { |
docElem.removeChild(body); |
} else { |
body.removeChild(div); |
} |
// restore the original values |
docElem.style.fontSize = originalHTMLFontSize; |
if (originalBodyFontSize) { |
body.style.fontSize = originalBodyFontSize; |
} |
//also update eminpx before returning |
ret = eminpx = parseFloat(ret); |
return ret; |
}, |
//enable/disable styles |
applyMedia = function (fromResize) { |
var name = "clientWidth", |
docElemProp = docElem[name], |
currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[name] || docElemProp, |
styleBlocks = {}, |
lastLink = links[links.length - 1], |
now = new Date().getTime(); |
//throttle resize calls |
if (fromResize && lastCall && now - lastCall < resizeThrottle) { |
w.clearTimeout(resizeDefer); |
resizeDefer = w.setTimeout(applyMedia, resizeThrottle); |
return; |
} else { |
lastCall = now; |
} |
for (var i in mediastyles) { |
if (mediastyles.hasOwnProperty(i)) { |
var thisstyle = mediastyles[i], |
min = thisstyle.minw, |
max = thisstyle.maxw, |
minnull = min === null, |
maxnull = max === null, |
em = "em"; |
if (!!min) { |
min = parseFloat(min) * (min.indexOf(em) > -1 ? ( eminpx || getEmValue() ) : 1); |
} |
if (!!max) { |
max = parseFloat(max) * (max.indexOf(em) > -1 ? ( eminpx || getEmValue() ) : 1); |
} |
// if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true |
if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) { |
if (!styleBlocks[thisstyle.media]) { |
styleBlocks[thisstyle.media] = []; |
} |
styleBlocks[thisstyle.media].push(rules[thisstyle.rules]); |
} |
} |
} |
//remove any existing respond style element(s) |
for (var j in appendedEls) { |
if (appendedEls.hasOwnProperty(j)) { |
if (appendedEls[j] && appendedEls[j].parentNode === head) { |
head.removeChild(appendedEls[j]); |
} |
} |
} |
appendedEls.length = 0; |
//inject active styles, grouped by media type |
for (var k in styleBlocks) { |
if (styleBlocks.hasOwnProperty(k)) { |
var ss = doc.createElement("style"), |
css = styleBlocks[k].join("\n"); |
ss.type = "text/css"; |
ss.media = k; |
//originally, ss was appended to a documentFragment and sheets were appended in bulk. |
//this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one! |
head.insertBefore(ss, lastLink.nextSibling); |
if (ss.styleSheet) { |
ss.styleSheet.cssText = css; |
} else { |
ss.appendChild(doc.createTextNode(css)); |
} |
//push to appendedEls to track for later removal |
appendedEls.push(ss); |
} |
} |
}, |
//find media blocks in css text, convert to style blocks |
translate = function (styles, href, media) { |
var qs = styles.replace(respond.regex.comments, "") |
.replace(respond.regex.keyframes, "") |
.match(respond.regex.media), |
ql = qs && qs.length || 0; |
//try to get CSS path |
href = href.substring(0, href.lastIndexOf("/")); |
var repUrls = function (css) { |
return css.replace(respond.regex.urls, "$1" + href + "$2$3"); |
}, useMedia = !ql && media; |
//if path exists, tack on trailing slash |
if (href.length) { |
href += "/"; |
} |
//if no internal queries exist, but media attr does, use that |
//note: this currently lacks support for situations where a media attr is specified on a link AND |
//its associated stylesheet has internal CSS media queries. |
//In those cases, the media attribute will currently be ignored. |
if (useMedia) { |
ql = 1; |
} |
for (var i = 0; i < ql; i++) { |
var fullq, thisq, eachq, eql; |
//media attr |
if (useMedia) { |
fullq = media; |
rules.push(repUrls(styles)); |
//parse for styles |
} else { |
fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1; |
rules.push(RegExp.$2 && repUrls(RegExp.$2)); |
} |
eachq = fullq.split(","); |
eql = eachq.length; |
for (var j = 0; j < eql; j++) { |
thisq = eachq[j]; |
if (isUnsupportedMediaQuery(thisq)) { |
continue; |
} |
mediastyles.push({ |
media: thisq.split("(")[0].match(respond.regex.only) && RegExp.$2 || "all", |
rules: rules.length - 1, |
hasquery: thisq.indexOf("(") > -1, |
minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""), |
maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || "") |
}); |
} |
} |
applyMedia(); |
}, |
//recurse through request queue, get css text |
makeRequests = function () { |
if (requestQueue.length) { |
var thisRequest = requestQueue.shift(); |
ajax(thisRequest.href, function (styles) { |
translate(styles, thisRequest.href, thisRequest.media); |
parsedSheets[thisRequest.href] = true; |
// by wrapping recursive function call in setTimeout |
// we prevent "Stack overflow" error in IE7 |
w.setTimeout(function () { |
makeRequests(); |
}, 0); |
}); |
} else { |
respond.callback(); |
} |
}, |
//loop stylesheets, send text content to translate |
ripCSS = function () { |
for (var i = 0; i < links.length; i++) { |
var sheet = links[i], |
href = sheet.href, |
media = sheet.media, |
isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet"; |
//only links plz and prevent re-parsing |
if (!!href && isCSS && !parsedSheets[href]) { |
// selectivizr exposes css through the rawCssText expando |
if (sheet.styleSheet && sheet.styleSheet.rawCssText) { |
translate(sheet.styleSheet.rawCssText, href, media); |
parsedSheets[href] = true; |
} else { |
if (!/^([a-zA-Z:]*\/\/)/.test(href) && !base || |
href.replace(RegExp.$1, "").split("/")[0] === w.location.host) { |
// IE7 doesn't handle urls that start with '//' for ajax request |
// manually add in the protocol |
if (href.substring(0, 2) === "//") { |
href = w.location.protocol + href; |
} |
requestQueue.push({ |
href: href, |
media: media |
}); |
} |
} |
} |
} |
makeRequests(); |
}; |
//translate CSS |
ripCSS(); |
//expose update for re-running respond later on |
respond.update = ripCSS; |
//expose getEmValue |
respond.getEmValue = getEmValue; |
//adjust on resize |
function callMedia() { |
applyMedia(true); |
} |
if (w.addEventListener) { |
w.addEventListener("resize", callMedia, false); |
} |
else if (w.attachEvent) { |
w.attachEvent("onresize", callMedia); |
} |
})(this); |
/web/acc/phpsysinfo/js/vendor/bootstrap-ie9.js |
---|
0,0 → 1,135 |
/* Bootstrap 4 for IE9 - v4.3.100 */ |
/* https://github.com/namiltd/bootstrap-ie */ |
/** |
* Modified code based on remPolyfill.js (c) Nicolas Bouvrette https://github.com/nbouvrette/remPolyfill |
* |
* Customizations: |
* |
* 1) Added new method `addCallBackWhenReady` to perform callbacks once the polyfill has been applied (especially useful for |
* onload scrolling events. |
* 2) Added REM support. |
* |
**/ |
// adds classList support (as Array) to Element.prototype for IE8-9 |
(function() { |
Object.defineProperty(Element.prototype, 'classList', { |
get:function(){ |
var element=this,domTokenList=(element.getAttribute('class')||'').replace(/^\s+|\s$/g,'').split(/\s+/g); |
if (domTokenList[0]==='') domTokenList.splice(0,1); |
function setClass(){ |
if (domTokenList.length > 0) element.setAttribute('class', domTokenList.join(' ')); |
else element.removeAttribute('class'); |
} |
domTokenList.toggle=function(className,force){ |
if (force!==undefined){ |
if (force) domTokenList.add(className); |
else domTokenList.remove(className); |
} |
else { |
if (domTokenList.indexOf(className)!==-1) domTokenList.splice(domTokenList.indexOf(className),1); |
else domTokenList.push(className); |
} |
setClass(); |
}; |
domTokenList.add=function(){ |
var args=[].slice.call(arguments); |
for (var i=0,l=args.length;i<l;i++){ |
if (domTokenList.indexOf(args[i])===-1) domTokenList.push(args[i]); |
} |
setClass(); |
}; |
domTokenList.remove=function(){ |
var args=[].slice.call(arguments); |
for (var i=0,l=args.length;i<l;i++){ |
if (domTokenList.indexOf(args[i])!==-1) domTokenList.splice(domTokenList.indexOf(args[i]),1); |
} |
setClass(); |
}; |
domTokenList.item=function(i){ |
return domTokenList[i]; |
}; |
domTokenList.contains=function(className){ |
return domTokenList.indexOf(className)!==-1; |
}; |
domTokenList.replace=function(oldClass,newClass){ |
if (domTokenList.indexOf(oldClass)!==-1) domTokenList.splice(domTokenList.indexOf(oldClass),1,newClass); |
setClass(); |
}; |
domTokenList.value = (element.getAttribute('class')||''); |
return domTokenList; |
} |
}); |
})(); |
/** |
* For browsers that do not support REM units, fallback to pixels. |
*/ |
window.remPolyfill = { |
/** |
* Implement this script on a given element. |
* |
* @private |
* |
* @param {string} cssText - The CSS text of the link element. |
*/ |
replaceCSS: function (cssText) { |
if (cssText) { |
// Replace all properties containing REM units with their pixel equivalents. |
return cssText.replace( |
/:invalid/g, '._invalid' |
).replace( |
/:valid/g, '._valid' |
); |
} |
}, |
/** |
* Implement this script on a given element. |
* |
* @param {HTMLLinkElement} linkElement - The link element to polyfill. |
*/ |
implement: function (linkElement) { |
if (!linkElement.href) { |
return; |
} |
var request = null; |
if (window.XMLHttpRequest) { |
request = new XMLHttpRequest(); |
} else if (window.ActiveXObject) { |
try { |
request = new ActiveXObject("Msxml2.XMLHTTP"); |
} catch (exception) { |
try { |
request = new ActiveXObject("Microsoft.XMLHTTP"); |
} catch (exception) { |
request = null; |
} |
} |
} |
if (!request) { |
return; |
} |
request.open('GET', linkElement.href, true); |
request.onreadystatechange = function() { |
if ( request.readyState === 4 ) { |
linkElement.styleSheet.cssText = remPolyfill.replaceCSS(request.responseText); |
} |
}; |
request.send(null); |
} |
}; |
var linkElements = document.querySelectorAll('link[rel=stylesheet]'); |
for (var linkElementId in linkElements) { |
if (Object.prototype.hasOwnProperty.call(linkElements, linkElementId)) { |
remPolyfill.implement(linkElements[linkElementId]); |
} |
} |
/web/acc/phpsysinfo/js/vendor/bootstrap-modal.js |
---|
0,0 → 1,649 |
/*! |
* Bootstrap modal.js v4.3.1 (https://getbootstrap.com/) |
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) |
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
*/ |
(function (global, factory) { |
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) : |
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) : |
(global = global || self, global.Modal = factory(global.jQuery, global.Util)); |
}(this, function ($, Util) { 'use strict'; |
$ = $ && $.hasOwnProperty('default') ? $['default'] : $; |
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util; |
function _defineProperties(target, props) { |
for (var i = 0; i < props.length; i++) { |
var descriptor = props[i]; |
descriptor.enumerable = descriptor.enumerable || false; |
descriptor.configurable = true; |
if ("value" in descriptor) descriptor.writable = true; |
Object.defineProperty(target, descriptor.key, descriptor); |
} |
} |
function _createClass(Constructor, protoProps, staticProps) { |
if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
if (staticProps) _defineProperties(Constructor, staticProps); |
return Constructor; |
} |
function _defineProperty(obj, key, value) { |
if (key in obj) { |
Object.defineProperty(obj, key, { |
value: value, |
enumerable: true, |
configurable: true, |
writable: true |
}); |
} else { |
obj[key] = value; |
} |
return obj; |
} |
function _objectSpread(target) { |
for (var i = 1; i < arguments.length; i++) { |
var source = arguments[i] != null ? arguments[i] : {}; |
var ownKeys = Object.keys(source); |
if (typeof Object.getOwnPropertySymbols === 'function') { |
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { |
return Object.getOwnPropertyDescriptor(source, sym).enumerable; |
})); |
} |
ownKeys.forEach(function (key) { |
_defineProperty(target, key, source[key]); |
}); |
} |
return target; |
} |
/** |
* ------------------------------------------------------------------------ |
* Constants |
* ------------------------------------------------------------------------ |
*/ |
var NAME = 'modal'; |
var VERSION = '4.3.1'; |
var DATA_KEY = 'bs.modal'; |
var EVENT_KEY = "." + DATA_KEY; |
var DATA_API_KEY = '.data-api'; |
var JQUERY_NO_CONFLICT = $.fn[NAME]; |
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key |
var Default = { |
backdrop: true, |
keyboard: true, |
focus: true, |
show: true |
}; |
var DefaultType = { |
backdrop: '(boolean|string)', |
keyboard: 'boolean', |
focus: 'boolean', |
show: 'boolean' |
}; |
var Event = { |
HIDE: "hide" + EVENT_KEY, |
HIDDEN: "hidden" + EVENT_KEY, |
SHOW: "show" + EVENT_KEY, |
SHOWN: "shown" + EVENT_KEY, |
FOCUSIN: "focusin" + EVENT_KEY, |
RESIZE: "resize" + EVENT_KEY, |
CLICK_DISMISS: "click.dismiss" + EVENT_KEY, |
KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY, |
MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY, |
MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY, |
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY |
}; |
var ClassName = { |
SCROLLABLE: 'modal-dialog-scrollable', |
SCROLLBAR_MEASURER: 'modal-scrollbar-measure', |
BACKDROP: 'modal-backdrop', |
OPEN: 'modal-open', |
FADE: 'fade', |
SHOW: 'show' |
}; |
var Selector = { |
DIALOG: '.modal-dialog', |
MODAL_BODY: '.modal-body', |
DATA_TOGGLE: '[data-toggle="modal"]', |
DATA_DISMISS: '[data-dismiss="modal"]', |
FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', |
STICKY_CONTENT: '.sticky-top' |
/** |
* ------------------------------------------------------------------------ |
* Class Definition |
* ------------------------------------------------------------------------ |
*/ |
}; |
var Modal = |
/*#__PURE__*/ |
function () { |
function Modal(element, config) { |
this._config = this._getConfig(config); |
this._element = element; |
this._dialog = element.querySelector(Selector.DIALOG); |
this._backdrop = null; |
this._isShown = false; |
this._isBodyOverflowing = false; |
this._ignoreBackdropClick = false; |
this._isTransitioning = false; |
this._scrollbarWidth = 0; |
} // Getters |
var _proto = Modal.prototype; |
// Public |
_proto.toggle = function toggle(relatedTarget) { |
return this._isShown ? this.hide() : this.show(relatedTarget); |
}; |
_proto.show = function show(relatedTarget) { |
var _this = this; |
if (this._isShown || this._isTransitioning) { |
return; |
} |
if ($(this._element).hasClass(ClassName.FADE)) { |
this._isTransitioning = true; |
} |
var showEvent = $.Event(Event.SHOW, { |
relatedTarget: relatedTarget |
}); |
$(this._element).trigger(showEvent); |
if (this._isShown || showEvent.isDefaultPrevented()) { |
return; |
} |
this._isShown = true; |
this._checkScrollbar(); |
this._setScrollbar(); |
this._adjustDialog(); |
this._setEscapeEvent(); |
this._setResizeEvent(); |
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) { |
return _this.hide(event); |
}); |
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () { |
$(_this._element).one(Event.MOUSEUP_DISMISS, function (event) { |
if ($(event.target).is(_this._element)) { |
_this._ignoreBackdropClick = true; |
} |
}); |
}); |
this._showBackdrop(function () { |
return _this._showElement(relatedTarget); |
}); |
}; |
_proto.hide = function hide(event) { |
var _this2 = this; |
if (event) { |
event.preventDefault(); |
} |
if (!this._isShown || this._isTransitioning) { |
return; |
} |
var hideEvent = $.Event(Event.HIDE); |
$(this._element).trigger(hideEvent); |
if (!this._isShown || hideEvent.isDefaultPrevented()) { |
return; |
} |
this._isShown = false; |
var transition = $(this._element).hasClass(ClassName.FADE); |
if (transition) { |
this._isTransitioning = true; |
} |
this._setEscapeEvent(); |
this._setResizeEvent(); |
$(document).off(Event.FOCUSIN); |
$(this._element).removeClass(ClassName.SHOW); |
$(this._element).off(Event.CLICK_DISMISS); |
$(this._dialog).off(Event.MOUSEDOWN_DISMISS); |
if (transition) { |
var transitionDuration = Util.getTransitionDurationFromElement(this._element); |
$(this._element).one(Util.TRANSITION_END, function (event) { |
return _this2._hideModal(event); |
}).emulateTransitionEnd(transitionDuration); |
} else { |
this._hideModal(); |
} |
}; |
_proto.dispose = function dispose() { |
[window, this._element, this._dialog].forEach(function (htmlElement) { |
return $(htmlElement).off(EVENT_KEY); |
}); |
/** |
* `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API` |
* Do not move `document` in `htmlElements` array |
* It will remove `Event.CLICK_DATA_API` event that should remain |
*/ |
$(document).off(Event.FOCUSIN); |
$.removeData(this._element, DATA_KEY); |
this._config = null; |
this._element = null; |
this._dialog = null; |
this._backdrop = null; |
this._isShown = null; |
this._isBodyOverflowing = null; |
this._ignoreBackdropClick = null; |
this._isTransitioning = null; |
this._scrollbarWidth = null; |
}; |
_proto.handleUpdate = function handleUpdate() { |
this._adjustDialog(); |
} // Private |
; |
_proto._getConfig = function _getConfig(config) { |
config = _objectSpread({}, Default, config); |
Util.typeCheckConfig(NAME, config, DefaultType); |
return config; |
}; |
_proto._showElement = function _showElement(relatedTarget) { |
var _this3 = this; |
var transition = $(this._element).hasClass(ClassName.FADE); |
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { |
// Don't move modal's DOM position |
document.body.appendChild(this._element); |
} |
this._element.style.display = 'block'; |
this._element.removeAttribute('aria-hidden'); |
this._element.setAttribute('aria-modal', true); |
if ($(this._dialog).hasClass(ClassName.SCROLLABLE)) { |
this._dialog.querySelector(Selector.MODAL_BODY).scrollTop = 0; |
} else { |
this._element.scrollTop = 0; |
} |
if (transition) { |
Util.reflow(this._element); |
} |
$(this._element).addClass(ClassName.SHOW); |
if (this._config.focus) { |
this._enforceFocus(); |
} |
var shownEvent = $.Event(Event.SHOWN, { |
relatedTarget: relatedTarget |
}); |
var transitionComplete = function transitionComplete() { |
if (_this3._config.focus) { |
_this3._element.focus(); |
} |
_this3._isTransitioning = false; |
$(_this3._element).trigger(shownEvent); |
}; |
if (transition) { |
var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); |
$(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); |
} else { |
transitionComplete(); |
} |
}; |
_proto._enforceFocus = function _enforceFocus() { |
var _this4 = this; |
$(document).off(Event.FOCUSIN) // Guard against infinite focus loop |
.on(Event.FOCUSIN, function (event) { |
if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) { |
_this4._element.focus(); |
} |
}); |
}; |
_proto._setEscapeEvent = function _setEscapeEvent() { |
var _this5 = this; |
if (this._isShown && this._config.keyboard) { |
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) { |
if (event.which === ESCAPE_KEYCODE) { |
event.preventDefault(); |
_this5.hide(); |
} |
}); |
} else if (!this._isShown) { |
$(this._element).off(Event.KEYDOWN_DISMISS); |
} |
}; |
_proto._setResizeEvent = function _setResizeEvent() { |
var _this6 = this; |
if (this._isShown) { |
$(window).on(Event.RESIZE, function (event) { |
return _this6.handleUpdate(event); |
}); |
} else { |
$(window).off(Event.RESIZE); |
} |
}; |
_proto._hideModal = function _hideModal() { |
var _this7 = this; |
this._element.style.display = 'none'; |
this._element.setAttribute('aria-hidden', true); |
this._element.removeAttribute('aria-modal'); |
this._isTransitioning = false; |
this._showBackdrop(function () { |
$(document.body).removeClass(ClassName.OPEN); |
_this7._resetAdjustments(); |
_this7._resetScrollbar(); |
$(_this7._element).trigger(Event.HIDDEN); |
}); |
}; |
_proto._removeBackdrop = function _removeBackdrop() { |
if (this._backdrop) { |
$(this._backdrop).remove(); |
this._backdrop = null; |
} |
}; |
_proto._showBackdrop = function _showBackdrop(callback) { |
var _this8 = this; |
var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : ''; |
if (this._isShown && this._config.backdrop) { |
this._backdrop = document.createElement('div'); |
this._backdrop.className = ClassName.BACKDROP; |
if (animate) { |
this._backdrop.classList.add(animate); |
} |
$(this._backdrop).appendTo(document.body); |
$(this._element).on(Event.CLICK_DISMISS, function (event) { |
if (_this8._ignoreBackdropClick) { |
_this8._ignoreBackdropClick = false; |
return; |
} |
if (event.target !== event.currentTarget) { |
return; |
} |
if (_this8._config.backdrop === 'static') { |
_this8._element.focus(); |
} else { |
_this8.hide(); |
} |
}); |
if (animate) { |
Util.reflow(this._backdrop); |
} |
$(this._backdrop).addClass(ClassName.SHOW); |
if (!callback) { |
return; |
} |
if (!animate) { |
callback(); |
return; |
} |
var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); |
$(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); |
} else if (!this._isShown && this._backdrop) { |
$(this._backdrop).removeClass(ClassName.SHOW); |
var callbackRemove = function callbackRemove() { |
_this8._removeBackdrop(); |
if (callback) { |
callback(); |
} |
}; |
if ($(this._element).hasClass(ClassName.FADE)) { |
var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); |
$(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); |
} else { |
callbackRemove(); |
} |
} else if (callback) { |
callback(); |
} |
} // ---------------------------------------------------------------------- |
// the following methods are used to handle overflowing modals |
// todo (fat): these should probably be refactored out of modal.js |
// ---------------------------------------------------------------------- |
; |
_proto._adjustDialog = function _adjustDialog() { |
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; |
if (!this._isBodyOverflowing && isModalOverflowing) { |
this._element.style.paddingLeft = this._scrollbarWidth + "px"; |
} |
if (this._isBodyOverflowing && !isModalOverflowing) { |
this._element.style.paddingRight = this._scrollbarWidth + "px"; |
} |
}; |
_proto._resetAdjustments = function _resetAdjustments() { |
this._element.style.paddingLeft = ''; |
this._element.style.paddingRight = ''; |
}; |
_proto._checkScrollbar = function _checkScrollbar() { |
var rect = document.body.getBoundingClientRect(); |
this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; |
this._scrollbarWidth = this._getScrollbarWidth(); |
}; |
_proto._setScrollbar = function _setScrollbar() { |
var _this9 = this; |
if (this._isBodyOverflowing) { |
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set |
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set |
var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT)); |
var stickyContent = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT)); // Adjust fixed content padding |
$(fixedContent).each(function (index, element) { |
var actualPadding = element.style.paddingRight; |
var calculatedPadding = $(element).css('padding-right'); |
$(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); |
}); // Adjust sticky content margin |
$(stickyContent).each(function (index, element) { |
var actualMargin = element.style.marginRight; |
var calculatedMargin = $(element).css('margin-right'); |
$(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); |
}); // Adjust body padding |
var actualPadding = document.body.style.paddingRight; |
var calculatedPadding = $(document.body).css('padding-right'); |
$(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); |
} |
$(document.body).addClass(ClassName.OPEN); |
}; |
_proto._resetScrollbar = function _resetScrollbar() { |
// Restore fixed content padding |
var fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT)); |
$(fixedContent).each(function (index, element) { |
var padding = $(element).data('padding-right'); |
$(element).removeData('padding-right'); |
element.style.paddingRight = padding ? padding : ''; |
}); // Restore sticky content |
var elements = [].slice.call(document.querySelectorAll("" + Selector.STICKY_CONTENT)); |
$(elements).each(function (index, element) { |
var margin = $(element).data('margin-right'); |
if (typeof margin !== 'undefined') { |
$(element).css('margin-right', margin).removeData('margin-right'); |
} |
}); // Restore body padding |
var padding = $(document.body).data('padding-right'); |
$(document.body).removeData('padding-right'); |
document.body.style.paddingRight = padding ? padding : ''; |
}; |
_proto._getScrollbarWidth = function _getScrollbarWidth() { |
// thx d.walsh |
var scrollDiv = document.createElement('div'); |
scrollDiv.className = ClassName.SCROLLBAR_MEASURER; |
document.body.appendChild(scrollDiv); |
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; |
document.body.removeChild(scrollDiv); |
return scrollbarWidth; |
} // Static |
; |
Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { |
return this.each(function () { |
var data = $(this).data(DATA_KEY); |
var _config = _objectSpread({}, Default, $(this).data(), typeof config === 'object' && config ? config : {}); |
if (!data) { |
data = new Modal(this, _config); |
$(this).data(DATA_KEY, data); |
} |
if (typeof config === 'string') { |
if (typeof data[config] === 'undefined') { |
throw new TypeError("No method named \"" + config + "\""); |
} |
data[config](relatedTarget); |
} else if (_config.show) { |
data.show(relatedTarget); |
} |
}); |
}; |
_createClass(Modal, null, [{ |
key: "VERSION", |
get: function get() { |
return VERSION; |
} |
}, { |
key: "Default", |
get: function get() { |
return Default; |
} |
}]); |
return Modal; |
}(); |
/** |
* ------------------------------------------------------------------------ |
* Data Api implementation |
* ------------------------------------------------------------------------ |
*/ |
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { |
var _this10 = this; |
var target; |
var selector = Util.getSelectorFromElement(this); |
if (selector) { |
target = document.querySelector(selector); |
} |
var config = $(target).data(DATA_KEY) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data()); |
if (this.tagName === 'A' || this.tagName === 'AREA') { |
event.preventDefault(); |
} |
var $target = $(target).one(Event.SHOW, function (showEvent) { |
if (showEvent.isDefaultPrevented()) { |
// Only register focus restorer if modal will actually get shown |
return; |
} |
$target.one(Event.HIDDEN, function () { |
if ($(_this10).is(':visible')) { |
_this10.focus(); |
} |
}); |
}); |
Modal._jQueryInterface.call($(target), config, this); |
}); |
/** |
* ------------------------------------------------------------------------ |
* jQuery |
* ------------------------------------------------------------------------ |
*/ |
$.fn[NAME] = Modal._jQueryInterface; |
$.fn[NAME].Constructor = Modal; |
$.fn[NAME].noConflict = function () { |
$.fn[NAME] = JQUERY_NO_CONFLICT; |
return Modal._jQueryInterface; |
}; |
return Modal; |
})); |
/web/acc/phpsysinfo/js/vendor/bootstrap-util.js |
---|
0,0 → 1,171 |
/*! |
* Bootstrap util.js v4.3.1 (https://getbootstrap.com/) |
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) |
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
*/ |
(function (global, factory) { |
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) : |
typeof define === 'function' && define.amd ? define(['jquery'], factory) : |
(global = global || self, global.Util = factory(global.jQuery)); |
}(this, function ($) { 'use strict'; |
$ = $ && $.hasOwnProperty('default') ? $['default'] : $; |
/** |
* -------------------------------------------------------------------------- |
* Bootstrap (v4.3.1): util.js |
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) |
* -------------------------------------------------------------------------- |
*/ |
/** |
* ------------------------------------------------------------------------ |
* Private TransitionEnd Helpers |
* ------------------------------------------------------------------------ |
*/ |
var TRANSITION_END = 'transitionend'; |
var MAX_UID = 1000000; |
var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) |
function toType(obj) { |
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); |
} |
function getSpecialTransitionEndEvent() { |
return { |
bindType: TRANSITION_END, |
delegateType: TRANSITION_END, |
handle: function handle(event) { |
if ($(event.target).is(this)) { |
return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params |
} |
return undefined; // eslint-disable-line no-undefined |
} |
}; |
} |
function transitionEndEmulator(duration) { |
var _this = this; |
var called = false; |
$(this).one(Util.TRANSITION_END, function () { |
called = true; |
}); |
setTimeout(function () { |
if (!called) { |
Util.triggerTransitionEnd(_this); |
} |
}, duration); |
return this; |
} |
function setTransitionEndSupport() { |
$.fn.emulateTransitionEnd = transitionEndEmulator; |
$.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); |
} |
/** |
* -------------------------------------------------------------------------- |
* Public Util Api |
* -------------------------------------------------------------------------- |
*/ |
var Util = { |
TRANSITION_END: 'bsTransitionEnd', |
getUID: function getUID(prefix) { |
do { |
// eslint-disable-next-line no-bitwise |
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here |
} while (document.getElementById(prefix)); |
return prefix; |
}, |
getSelectorFromElement: function getSelectorFromElement(element) { |
var selector = element.getAttribute('data-target'); |
if (!selector || selector === '#') { |
var hrefAttr = element.getAttribute('href'); |
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; |
} |
try { |
return document.querySelector(selector) ? selector : null; |
} catch (err) { |
return null; |
} |
}, |
getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { |
if (!element) { |
return 0; |
} // Get transition-duration of the element |
var transitionDuration = $(element).css('transition-duration'); |
var transitionDelay = $(element).css('transition-delay'); |
var floatTransitionDuration = parseFloat(transitionDuration); |
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found |
if (!floatTransitionDuration && !floatTransitionDelay) { |
return 0; |
} // If multiple durations are defined, take the first |
transitionDuration = transitionDuration.split(',')[0]; |
transitionDelay = transitionDelay.split(',')[0]; |
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; |
}, |
reflow: function reflow(element) { |
return element.offsetHeight; |
}, |
triggerTransitionEnd: function triggerTransitionEnd(element) { |
$(element).trigger(TRANSITION_END); |
}, |
// TODO: Remove in v5 |
supportsTransitionEnd: function supportsTransitionEnd() { |
return Boolean(TRANSITION_END); |
}, |
isElement: function isElement(obj) { |
return (obj[0] || obj).nodeType; |
}, |
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { |
for (var property in configTypes) { |
if (Object.prototype.hasOwnProperty.call(configTypes, property)) { |
var expectedTypes = configTypes[property]; |
var value = config[property]; |
var valueType = value && Util.isElement(value) ? 'element' : toType(value); |
if (!new RegExp(expectedTypes).test(valueType)) { |
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); |
} |
} |
} |
}, |
findShadowRoot: function findShadowRoot(element) { |
if (!document.documentElement.attachShadow) { |
return null; |
} // Can find the shadow root otherwise it'll return the document |
if (typeof element.getRootNode === 'function') { |
var root = element.getRootNode(); |
return root instanceof ShadowRoot ? root : null; |
} |
if (element instanceof ShadowRoot) { |
return element; |
} // when we don't find a shadow root |
if (!element.parentNode) { |
return null; |
} |
return Util.findShadowRoot(element.parentNode); |
} |
}; |
setTransitionEndSupport(); |
return Util; |
})); |
/web/acc/phpsysinfo/js/vendor/console-shim.js |
---|
0,0 → 1,32 |
/* https://github.com/liamnewmarch/console-shim 2014 CC-BY @liamnewmarch */ |
if (!('console' in window)) { |
(function() { |
var Console, __console; |
Console = function() { |
var check, key, log, methods, _i, _len, _ref; |
this.__buffer = []; |
log = function() { |
return this.__buffer.push(arguments); |
}; |
methods = 'assert count debug dir dirxml error exception info log trace warn'; |
_ref = methods.split(' '); |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
key = _ref[_i]; |
this[key] = log; |
} |
check = setInterval(function() { |
var data, func, _j, _len1, _ref1, _ref2; |
if ((((_ref1 = window.console) != null ? _ref1.log : void 0) != null) && !console.__buffer) { |
clearInterval(check); |
func = Function.prototype.bind ? Function.prototype.bind.call(console.log, console) : console.log; |
_ref2 = __console.__buffer; |
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { |
data = _ref2[_j]; |
func.apply(console, data); |
} |
} |
}, 1000); |
}; |
return __console = window.console = new Console(); |
})(); |
} |
/web/acc/phpsysinfo/js/vendor/html5shiv-printshiv.js |
---|
0,0 → 1,524 |
/** |
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed |
*/ |
;(function(window, document) { |
/*jshint evil:true */ |
/** version */ |
var version = '3.7.3'; |
/** Preset options */ |
var options = window.html5 || {}; |
/** Used to skip problem elements */ |
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i; |
/** Not all elements can be cloned in IE **/ |
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i; |
/** Detect whether the browser supports default html5 styles */ |
var supportsHtml5Styles; |
/** Name of the expando, to work with multiple documents or to re-shiv one document */ |
var expando = '_html5shiv'; |
/** The id for the the documents expando */ |
var expanID = 0; |
/** Cached data for each document */ |
var expandoData = {}; |
/** Detect whether the browser supports unknown elements */ |
var supportsUnknownElements; |
(function() { |
try { |
var a = document.createElement('a'); |
a.innerHTML = '<xyz></xyz>'; |
//if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles |
supportsHtml5Styles = ('hidden' in a); |
supportsUnknownElements = a.childNodes.length == 1 || (function() { |
// assign a false positive if unable to shiv |
(document.createElement)('a'); |
var frag = document.createDocumentFragment(); |
return ( |
typeof frag.cloneNode == 'undefined' || |
typeof frag.createDocumentFragment == 'undefined' || |
typeof frag.createElement == 'undefined' |
); |
}()); |
} catch(e) { |
// assign a false positive if detection fails => unable to shiv |
supportsHtml5Styles = true; |
supportsUnknownElements = true; |
} |
}()); |
/*--------------------------------------------------------------------------*/ |
/** |
* Creates a style sheet with the given CSS text and adds it to the document. |
* @private |
* @param {Document} ownerDocument The document. |
* @param {String} cssText The CSS text. |
* @returns {StyleSheet} The style element. |
*/ |
function addStyleSheet(ownerDocument, cssText) { |
var p = ownerDocument.createElement('p'), |
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement; |
p.innerHTML = 'x<style>' + cssText + '</style>'; |
return parent.insertBefore(p.lastChild, parent.firstChild); |
} |
/** |
* Returns the value of `html5.elements` as an array. |
* @private |
* @returns {Array} An array of shived element node names. |
*/ |
function getElements() { |
var elements = html5.elements; |
return typeof elements == 'string' ? elements.split(' ') : elements; |
} |
/** |
* Extends the built-in list of html5 elements |
* @memberOf html5 |
* @param {String|Array} newElements whitespace separated list or array of new element names to shiv |
* @param {Document} ownerDocument The context document. |
*/ |
function addElements(newElements, ownerDocument) { |
var elements = html5.elements; |
if(typeof elements != 'string'){ |
elements = elements.join(' '); |
} |
if(typeof newElements != 'string'){ |
newElements = newElements.join(' '); |
} |
html5.elements = elements +' '+ newElements; |
shivDocument(ownerDocument); |
} |
/** |
* Returns the data associated to the given document |
* @private |
* @param {Document} ownerDocument The document. |
* @returns {Object} An object of data. |
*/ |
function getExpandoData(ownerDocument) { |
var data = expandoData[ownerDocument[expando]]; |
if (!data) { |
data = {}; |
expanID++; |
ownerDocument[expando] = expanID; |
expandoData[expanID] = data; |
} |
return data; |
} |
/** |
* returns a shived element for the given nodeName and document |
* @memberOf html5 |
* @param {String} nodeName name of the element |
* @param {Document} ownerDocument The context document. |
* @returns {Object} The shived element. |
*/ |
function createElement(nodeName, ownerDocument, data){ |
if (!ownerDocument) { |
ownerDocument = document; |
} |
if(supportsUnknownElements){ |
return ownerDocument.createElement(nodeName); |
} |
if (!data) { |
data = getExpandoData(ownerDocument); |
} |
var node; |
if (data.cache[nodeName]) { |
node = data.cache[nodeName].cloneNode(); |
} else if (saveClones.test(nodeName)) { |
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode(); |
} else { |
node = data.createElem(nodeName); |
} |
// Avoid adding some elements to fragments in IE < 9 because |
// * Attributes like `name` or `type` cannot be set/changed once an element |
// is inserted into a document/fragment |
// * Link elements with `src` attributes that are inaccessible, as with |
// a 403 response, will cause the tab/window to crash |
// * Script elements appended to fragments will execute when their `src` |
// or `text` property is set |
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node; |
} |
/** |
* returns a shived DocumentFragment for the given document |
* @memberOf html5 |
* @param {Document} ownerDocument The context document. |
* @returns {Object} The shived DocumentFragment. |
*/ |
function createDocumentFragment(ownerDocument, data){ |
if (!ownerDocument) { |
ownerDocument = document; |
} |
if(supportsUnknownElements){ |
return ownerDocument.createDocumentFragment(); |
} |
data = data || getExpandoData(ownerDocument); |
var clone = data.frag.cloneNode(), |
i = 0, |
elems = getElements(), |
l = elems.length; |
for(;i<l;i++){ |
clone.createElement(elems[i]); |
} |
return clone; |
} |
/** |
* Shivs the `createElement` and `createDocumentFragment` methods of the document. |
* @private |
* @param {Document|DocumentFragment} ownerDocument The document. |
* @param {Object} data of the document. |
*/ |
function shivMethods(ownerDocument, data) { |
if (!data.cache) { |
data.cache = {}; |
data.createElem = ownerDocument.createElement; |
data.createFrag = ownerDocument.createDocumentFragment; |
data.frag = data.createFrag(); |
} |
ownerDocument.createElement = function(nodeName) { |
//abort shiv |
if (!html5.shivMethods) { |
return data.createElem(nodeName); |
} |
return createElement(nodeName, ownerDocument, data); |
}; |
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' + |
'var n=f.cloneNode(),c=n.createElement;' + |
'h.shivMethods&&(' + |
// unroll the `createElement` calls |
getElements().join().replace(/[\w\-:]+/g, function(nodeName) { |
data.createElem(nodeName); |
data.frag.createElement(nodeName); |
return 'c("' + nodeName + '")'; |
}) + |
');return n}' |
)(html5, data.frag); |
} |
/*--------------------------------------------------------------------------*/ |
/** |
* Shivs the given document. |
* @memberOf html5 |
* @param {Document} ownerDocument The document to shiv. |
* @returns {Document} The shived document. |
*/ |
function shivDocument(ownerDocument) { |
if (!ownerDocument) { |
ownerDocument = document; |
} |
var data = getExpandoData(ownerDocument); |
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) { |
data.hasCSS = !!addStyleSheet(ownerDocument, |
// corrects block display not defined in IE6/7/8/9 |
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' + |
// adds styling not present in IE6/7/8/9 |
'mark{background:#FF0;color:#000}' + |
// hides non-rendered elements |
'template{display:none}' |
); |
} |
if (!supportsUnknownElements) { |
shivMethods(ownerDocument, data); |
} |
return ownerDocument; |
} |
/*--------------------------------------------------------------------------*/ |
/** |
* The `html5` object is exposed so that more elements can be shived and |
* existing shiving can be detected on iframes. |
* @type Object |
* @example |
* |
* // options can be changed before the script is included |
* html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false }; |
*/ |
var html5 = { |
/** |
* An array or space separated string of node names of the elements to shiv. |
* @memberOf html5 |
* @type Array|String |
*/ |
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video', |
/** |
* current version of html5shiv |
*/ |
'version': version, |
/** |
* A flag to indicate that the HTML5 style sheet should be inserted. |
* @memberOf html5 |
* @type Boolean |
*/ |
'shivCSS': (options.shivCSS !== false), |
/** |
* Is equal to true if a browser supports creating unknown/HTML5 elements |
* @memberOf html5 |
* @type boolean |
*/ |
'supportsUnknownElements': supportsUnknownElements, |
/** |
* A flag to indicate that the document's `createElement` and `createDocumentFragment` |
* methods should be overwritten. |
* @memberOf html5 |
* @type Boolean |
*/ |
'shivMethods': (options.shivMethods !== false), |
/** |
* A string to describe the type of `html5` object ("default" or "default print"). |
* @memberOf html5 |
* @type String |
*/ |
'type': 'default', |
// shivs the document according to the specified `html5` object options |
'shivDocument': shivDocument, |
//creates a shived element |
createElement: createElement, |
//creates a shived documentFragment |
createDocumentFragment: createDocumentFragment, |
//extends list of elements |
addElements: addElements |
}; |
/*--------------------------------------------------------------------------*/ |
// expose html5 |
window.html5 = html5; |
// shiv the document |
shivDocument(document); |
/*------------------------------- Print Shiv -------------------------------*/ |
/** Used to filter media types */ |
var reMedia = /^$|\b(?:all|print)\b/; |
/** Used to namespace printable elements */ |
var shivNamespace = 'html5shiv'; |
/** Detect whether the browser supports shivable style sheets */ |
var supportsShivableSheets = !supportsUnknownElements && (function() { |
// assign a false negative if unable to shiv |
var docEl = document.documentElement; |
return !( |
typeof document.namespaces == 'undefined' || |
typeof document.parentWindow == 'undefined' || |
typeof docEl.applyElement == 'undefined' || |
typeof docEl.removeNode == 'undefined' || |
typeof window.attachEvent == 'undefined' |
); |
}()); |
/*--------------------------------------------------------------------------*/ |
/** |
* Wraps all HTML5 elements in the given document with printable elements. |
* (eg. the "header" element is wrapped with the "html5shiv:header" element) |
* @private |
* @param {Document} ownerDocument The document. |
* @returns {Array} An array wrappers added. |
*/ |
function addWrappers(ownerDocument) { |
var node, |
nodes = ownerDocument.getElementsByTagName('*'), |
index = nodes.length, |
reElements = RegExp('^(?:' + getElements().join('|') + ')$', 'i'), |
result = []; |
while (index--) { |
node = nodes[index]; |
if (reElements.test(node.nodeName)) { |
result.push(node.applyElement(createWrapper(node))); |
} |
} |
return result; |
} |
/** |
* Creates a printable wrapper for the given element. |
* @private |
* @param {Element} element The element. |
* @returns {Element} The wrapper. |
*/ |
function createWrapper(element) { |
var node, |
nodes = element.attributes, |
index = nodes.length, |
wrapper = element.ownerDocument.createElement(shivNamespace + ':' + element.nodeName); |
// copy element attributes to the wrapper |
while (index--) { |
node = nodes[index]; |
node.specified && wrapper.setAttribute(node.nodeName, node.nodeValue); |
} |
// copy element styles to the wrapper |
wrapper.style.cssText = element.style.cssText; |
return wrapper; |
} |
/** |
* Shivs the given CSS text. |
* (eg. header{} becomes html5shiv\:header{}) |
* @private |
* @param {String} cssText The CSS text to shiv. |
* @returns {String} The shived CSS text. |
*/ |
function shivCssText(cssText) { |
var pair, |
parts = cssText.split('{'), |
index = parts.length, |
reElements = RegExp('(^|[\\s,>+~])(' + getElements().join('|') + ')(?=[[\\s,>+~#.:]|$)', 'gi'), |
replacement = '$1' + shivNamespace + '\\:$2'; |
while (index--) { |
pair = parts[index] = parts[index].split('}'); |
pair[pair.length - 1] = pair[pair.length - 1].replace(reElements, replacement); |
parts[index] = pair.join('}'); |
} |
return parts.join('{'); |
} |
/** |
* Removes the given wrappers, leaving the original elements. |
* @private |
* @params {Array} wrappers An array of printable wrappers. |
*/ |
function removeWrappers(wrappers) { |
var index = wrappers.length; |
while (index--) { |
wrappers[index].removeNode(); |
} |
} |
/*--------------------------------------------------------------------------*/ |
/** |
* Shivs the given document for print. |
* @memberOf html5 |
* @param {Document} ownerDocument The document to shiv. |
* @returns {Document} The shived document. |
*/ |
function shivPrint(ownerDocument) { |
var shivedSheet, |
wrappers, |
data = getExpandoData(ownerDocument), |
namespaces = ownerDocument.namespaces, |
ownerWindow = ownerDocument.parentWindow; |
if (!supportsShivableSheets || ownerDocument.printShived) { |
return ownerDocument; |
} |
if (typeof namespaces[shivNamespace] == 'undefined') { |
namespaces.add(shivNamespace); |
} |
function removeSheet() { |
clearTimeout(data._removeSheetTimer); |
if (shivedSheet) { |
shivedSheet.removeNode(true); |
} |
shivedSheet= null; |
} |
ownerWindow.attachEvent('onbeforeprint', function() { |
removeSheet(); |
var imports, |
length, |
sheet, |
collection = ownerDocument.styleSheets, |
cssText = [], |
index = collection.length, |
sheets = Array(index); |
// convert styleSheets collection to an array |
while (index--) { |
sheets[index] = collection[index]; |
} |
// concat all style sheet CSS text |
while ((sheet = sheets.pop())) { |
// IE does not enforce a same origin policy for external style sheets... |
// but has trouble with some dynamically created stylesheets |
if (!sheet.disabled && reMedia.test(sheet.media)) { |
try { |
imports = sheet.imports; |
length = imports.length; |
} catch(er){ |
length = 0; |
} |
for (index = 0; index < length; index++) { |
sheets.push(imports[index]); |
} |
try { |
cssText.push(sheet.cssText); |
} catch(er){} |
} |
} |
// wrap all HTML5 elements with printable elements and add the shived style sheet |
cssText = shivCssText(cssText.reverse().join('')); |
wrappers = addWrappers(ownerDocument); |
shivedSheet = addStyleSheet(ownerDocument, cssText); |
}); |
ownerWindow.attachEvent('onafterprint', function() { |
// remove wrappers, leaving the original elements, and remove the shived style sheet |
removeWrappers(wrappers); |
clearTimeout(data._removeSheetTimer); |
data._removeSheetTimer = setTimeout(removeSheet, 500); |
}); |
ownerDocument.printShived = true; |
return ownerDocument; |
} |
/*--------------------------------------------------------------------------*/ |
// expose API |
html5.type += ' print'; |
html5.shivPrint = shivPrint; |
// shiv for print |
shivPrint(document); |
if(typeof module == 'object' && module.exports){ |
module.exports = html5; |
} |
}(typeof window !== "undefined" ? window : this, document)); |
/web/acc/phpsysinfo/js/vendor/sorttable.js |
---|
0,0 → 1,413 |
/* |
SortTable |
version 2+2014.12.25_fix-noinit-noforeach |
7th April 2007 |
Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ |
25th December 2014 |
Fixed behavior of multiple sortable tables in same page. |
Redefinition of sortfwdind and sortrevind icons. |
Mieczyslaw Nalewaj (namiltd@users.sourceforge.net) |
19th November 2015 |
Disabled autostart after loading. |
You have to run sorttable.init() at the beginning of the code, |
or makeSortable for each table. |
Mieczyslaw Nalewaj (namiltd@users.sourceforge.net) |
Instructions: |
Download this file |
Add <script src="sorttable.js"></script> to your HTML |
Add class="sortable" to any table you'd like to make sortable |
Click on the headers to sort |
Thanks to many, many people for contributions and suggestions. |
Licenced as X11: http://www.kryogenix.org/code/browser/licence.html |
This basically means: do what you want with it. |
*/ |
sorttable = { |
init: function() { |
// quit if this function has already been called |
if (arguments.callee.done) return; |
// flag this function so we don't do the same thing twice |
arguments.callee.done = true; |
if (!document.createElement || !document.getElementsByTagName) return; |
sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; |
allTables=document.getElementsByTagName('table'); |
for (var i=0; i < allTables.length; i++) { |
if (allTables[i].className.search(/\bsortable\b/) != -1) { |
sorttable.makeSortable(allTables[i]); |
} |
} |
}, |
makeSortable: function(table) { |
if (table.getElementsByTagName('thead').length == 0) { |
// table doesn't have a tHead. Since it should have, create one and |
// put the first table row in it. |
the = document.createElement('thead'); |
the.appendChild(table.rows[0]); |
table.insertBefore(the,table.firstChild); |
} |
// Safari doesn't support table.tHead, sigh |
if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; |
if (table.tHead.rows.length != 1) return; // can't cope with two header rows |
// Sorttable v1 put rows with a class of "sortbottom" at the bottom (as |
// "total" rows, for example). This is B&R, since what you're supposed |
// to do is put them in a tfoot. So, if there are sortbottom rows, |
// for backwards compatibility, move them to tfoot (creating it if needed). |
sortbottomrows = []; |
for (var i=0; i<table.rows.length; i++) { |
if (table.rows[i].className.search(/\bsortbottom\b/) != -1) { |
sortbottomrows[sortbottomrows.length] = table.rows[i]; |
} |
} |
if (sortbottomrows) { |
if (table.tFoot == null) { |
// table doesn't have a tfoot. Create one. |
tfo = document.createElement('tfoot'); |
table.appendChild(tfo); |
} |
for (var i=0; i<sortbottomrows.length; i++) { |
tfo.appendChild(sortbottomrows[i]); |
} |
delete sortbottomrows; |
} |
// work through each column and calculate its type |
headrow = table.tHead.rows[0].cells; |
for (var i=0; i<headrow.length; i++) { |
// manually override the type with a sorttable_type attribute |
if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col |
mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/); |
if (mtch) { override = mtch[1]; } |
if (mtch && typeof sorttable["sort_"+override] == 'function') { |
headrow[i].sorttable_sortfunction = sorttable["sort_"+override]; |
} else { |
headrow[i].sorttable_sortfunction = sorttable.guessType(table,i); |
} |
// make it clickable to sort |
headrow[i].sorttable_columnindex = i; |
headrow[i].sorttable_tbody = table.tBodies[0]; |
dean_addEvent(headrow[i],"click", sorttable.innerSortFunction = function(e) { |
if (this.className.search(/\bsorttable_sorted\b/) != -1) { |
// if we're already sorted by this column, just |
// reverse the table, which is quicker |
sorttable.reverse(this.sorttable_tbody); |
this.className = this.className.replace('sorttable_sorted', |
'sorttable_sorted_reverse'); |
this.removeChild(document.getElementById('sorttable_sortfwdind'+$(this).parent().parent().parent()[0].id)); |
sortrevind = document.createElement('span'); |
sortrevind.id = "sorttable_sortrevind"+$(this).parent().parent().parent()[0].id; |
sortrevind.innerHTML = ' ▲'; |
this.appendChild(sortrevind); |
return; |
} |
if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { |
// if we're already sorted by this column in reverse, just |
// re-reverse the table, which is quicker |
sorttable.reverse(this.sorttable_tbody); |
this.className = this.className.replace('sorttable_sorted_reverse', |
'sorttable_sorted'); |
this.removeChild(document.getElementById('sorttable_sortrevind'+$(this).parent().parent().parent()[0].id)); |
sortfwdind = document.createElement('span'); |
sortfwdind.id = "sorttable_sortfwdind"+$(this).parent().parent().parent()[0].id; |
sortfwdind.innerHTML = ' ▼'; |
this.appendChild(sortfwdind); |
return; |
} |
// remove sorttable_sorted classes |
theadrow = this.parentNode; |
for (var i=0; i < theadrow.childNodes.length; i++) { |
if (theadrow.childNodes[i].nodeType == 1) { // an element |
theadrow.childNodes[i].className = theadrow.childNodes[i].className.replace('sorttable_sorted_reverse',''); |
theadrow.childNodes[i].className = theadrow.childNodes[i].className.replace('sorttable_sorted',''); |
} |
} |
sortfwdind = document.getElementById('sorttable_sortfwdind'+$(this).parent().parent().parent()[0].id); |
if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } |
sortrevind = document.getElementById('sorttable_sortrevind'+$(this).parent().parent().parent()[0].id); |
if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } |
this.className += ' sorttable_sorted'; |
sortfwdind = document.createElement('span'); |
sortfwdind.id = "sorttable_sortfwdind"+$(this).parent().parent().parent()[0].id; |
sortfwdind.innerHTML = ' ▼'; |
this.appendChild(sortfwdind); |
// build an array to sort. This is a Schwartzian transform thing, |
// i.e., we "decorate" each row with the actual sort key, |
// sort based on the sort keys, and then put the rows back in order |
// which is a lot faster because you only do getInnerText once per row |
row_array = []; |
col = this.sorttable_columnindex; |
rows = this.sorttable_tbody.rows; |
for (var j=0; j<rows.length; j++) { |
row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]]; |
} |
/* If you want a stable sort, uncomment the following line */ |
//sorttable.shaker_sort(row_array, this.sorttable_sortfunction); |
/* and comment out this one */ |
row_array.sort(this.sorttable_sortfunction); |
tb = this.sorttable_tbody; |
for (var j=0; j<row_array.length; j++) { |
tb.appendChild(row_array[j][1]); |
} |
delete row_array; |
}); |
} |
} |
}, |
guessType: function(table, column) { |
// guess the type of a column based on its first non-blank row |
sortfn = sorttable.sort_alpha; |
for (var i=0; i<table.tBodies[0].rows.length; i++) { |
text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]); |
if (text != '') { |
if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) { |
return sorttable.sort_numeric; |
} |
// check for a date: dd/mm/yyyy or dd/mm/yy |
// can have / or . or - as separator |
// can be mm/dd as well |
possdate = text.match(sorttable.DATE_RE); |
if (possdate) { |
// looks like a date |
first = parseInt(possdate[1]); |
second = parseInt(possdate[2]); |
if (first > 12) { |
// definitely dd/mm |
return sorttable.sort_ddmm; |
} else if (second > 12) { |
return sorttable.sort_mmdd; |
} else { |
// looks like a date, but we can't tell which, so assume |
// that it's dd/mm (English imperialism!) and keep looking |
sortfn = sorttable.sort_ddmm; |
} |
} |
} |
} |
return sortfn; |
}, |
getInnerText: function(node) { |
// gets the text we want to use for sorting for a cell. |
// strips leading and trailing whitespace. |
// this is *not* a generic getInnerText function; it's special to sorttable. |
// for example, you can override the cell text with a customkey attribute. |
// it also gets .value for <input> fields. |
if (!node) return ""; |
hasInputs = (typeof node.getElementsByTagName == 'function') && |
node.getElementsByTagName('input').length; |
if (node.getAttribute("sorttable_customkey") != null) { |
return node.getAttribute("sorttable_customkey"); |
} |
else if (typeof node.textContent != 'undefined' && !hasInputs) { |
return node.textContent.replace(/^\s+|\s+$/g, ''); |
} |
else if (typeof node.innerText != 'undefined' && !hasInputs) { |
return node.innerText.replace(/^\s+|\s+$/g, ''); |
} |
else if (typeof node.text != 'undefined' && !hasInputs) { |
return node.text.replace(/^\s+|\s+$/g, ''); |
} |
else { |
switch (node.nodeType) { |
case 3: |
if (node.nodeName.toLowerCase() == 'input') { |
return node.value.replace(/^\s+|\s+$/g, ''); |
} |
case 4: |
return node.nodeValue.replace(/^\s+|\s+$/g, ''); |
break; |
case 1: |
case 11: |
var innerText = ''; |
for (var i = 0; i < node.childNodes.length; i++) { |
innerText += sorttable.getInnerText(node.childNodes[i]); |
} |
return innerText.replace(/^\s+|\s+$/g, ''); |
break; |
default: |
return ''; |
} |
} |
}, |
reverse: function(tbody) { |
// reverse the rows in a tbody |
newrows = []; |
for (var i=0; i<tbody.rows.length; i++) { |
newrows[newrows.length] = tbody.rows[i]; |
} |
for (var i=newrows.length-1; i>=0; i--) { |
tbody.appendChild(newrows[i]); |
} |
delete newrows; |
}, |
/* sort functions |
each sort function takes two parameters, a and b |
you are comparing a[0] and b[0] */ |
sort_numeric: function(a,b) { |
aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); |
if (isNaN(aa)) aa = 0; |
bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); |
if (isNaN(bb)) bb = 0; |
return aa-bb; |
}, |
sort_alpha: function(a,b) { |
if (a[0]==b[0]) return 0; |
if (a[0]<b[0]) return -1; |
return 1; |
}, |
sort_ddmm: function(a,b) { |
mtch = a[0].match(sorttable.DATE_RE); |
y = mtch[3]; m = mtch[2]; d = mtch[1]; |
if (m.length == 1) m = '0'+m; |
if (d.length == 1) d = '0'+d; |
dt1 = y+m+d; |
mtch = b[0].match(sorttable.DATE_RE); |
y = mtch[3]; m = mtch[2]; d = mtch[1]; |
if (m.length == 1) m = '0'+m; |
if (d.length == 1) d = '0'+d; |
dt2 = y+m+d; |
if (dt1==dt2) return 0; |
if (dt1<dt2) return -1; |
return 1; |
}, |
sort_mmdd: function(a,b) { |
mtch = a[0].match(sorttable.DATE_RE); |
y = mtch[3]; d = mtch[2]; m = mtch[1]; |
if (m.length == 1) m = '0'+m; |
if (d.length == 1) d = '0'+d; |
dt1 = y+m+d; |
mtch = b[0].match(sorttable.DATE_RE); |
y = mtch[3]; d = mtch[2]; m = mtch[1]; |
if (m.length == 1) m = '0'+m; |
if (d.length == 1) d = '0'+d; |
dt2 = y+m+d; |
if (dt1==dt2) return 0; |
if (dt1<dt2) return -1; |
return 1; |
}, |
shaker_sort: function(list, comp_func) { |
// A stable sort function to allow multi-level sorting of data |
// see: http://en.wikipedia.org/wiki/Cocktail_sort |
// thanks to Joseph Nahmias |
var b = 0; |
var t = list.length - 1; |
var swap = true; |
while(swap) { |
swap = false; |
for(var i = b; i < t; ++i) { |
if ( comp_func(list[i], list[i+1]) > 0 ) { |
var q = list[i]; list[i] = list[i+1]; list[i+1] = q; |
swap = true; |
} |
} // for |
t--; |
if (!swap) break; |
for(var i = t; i > b; --i) { |
if ( comp_func(list[i], list[i-1]) < 0 ) { |
var q = list[i]; list[i] = list[i-1]; list[i-1] = q; |
swap = true; |
} |
} // for |
b++; |
} // while(swap) |
} |
}; |
// written by Dean Edwards, 2005 |
// with input from Tino Zijdel, Matthias Miller, Diego Perini |
// http://dean.edwards.name/weblog/2005/10/add-event/ |
function dean_addEvent(element, type, handler) { |
if (element.addEventListener) { |
element.addEventListener(type, handler, false); |
} else { |
// assign each event handler a unique ID |
if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++; |
// create a hash table of event types for the element |
if (!element.events) element.events = {}; |
// create a hash table of event handlers for each element/event pair |
var handlers = element.events[type]; |
if (!handlers) { |
handlers = element.events[type] = {}; |
// store the existing event handler (if there is one) |
if (element["on" + type]) { |
handlers[0] = element["on" + type]; |
} |
} |
// store the event handler in the hash table |
handlers[handler.$$guid] = handler; |
// assign a global event handler to do all the work |
element["on" + type] = handleEvent; |
} |
}; |
// a counter used to create unique IDs |
dean_addEvent.guid = 1; |
function removeEvent(element, type, handler) { |
if (element.removeEventListener) { |
element.removeEventListener(type, handler, false); |
} else { |
// delete the event handler from the hash table |
if (element.events && element.events[type]) { |
delete element.events[type][handler.$$guid]; |
} |
} |
}; |
function handleEvent(event) { |
var returnValue = true; |
// grab the event object (IE uses a global event object) |
event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event); |
// get a reference to the hash table of event handlers |
var handlers = this.events[event.type]; |
// execute each event handler |
for (var i in handlers) { |
this.$$handleEvent = handlers[i]; |
if (this.$$handleEvent(event) === false) { |
returnValue = false; |
} |
} |
return returnValue; |
}; |
function fixEvent(event) { |
// add W3C standard event methods |
event.preventDefault = fixEvent.preventDefault; |
event.stopPropagation = fixEvent.stopPropagation; |
return event; |
}; |
fixEvent.preventDefault = function() { |
this.returnValue = false; |
}; |
fixEvent.stopPropagation = function() { |
this.cancelBubble = true; |
}; |
/web/acc/phpsysinfo/js/vendor/transparency.js |
---|
0,0 → 1,789 |
/* ======================================================================== |
* transparency.js v0.10.0 |
* http://leonidas.github.io/transparency/ |
* Licensed under MIT (https://github.com/leonidas/transparency/blob/master/LICENSE) |
* ======================================================================== */ |
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ |
var $, Context, Transparency, helpers, _, |
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; |
_ = require('../lib/lodash.js'); |
helpers = require('./helpers'); |
Context = require('./context'); |
Transparency = {}; |
Transparency.render = function(context, models, directives, options) { |
var log, _base; |
if (models == null) { |
models = []; |
} |
if (directives == null) { |
directives = {}; |
} |
if (options == null) { |
options = {}; |
} |
log = options.debug && console ? helpers.consoleLogger : helpers.nullLogger; |
log("Transparency.render:", context, models, directives, options); |
if (!context) { |
return; |
} |
if (!_.isArray(models)) { |
models = [models]; |
} |
context = (_base = helpers.data(context)).context || (_base.context = new Context(context, Transparency)); |
return context.render(models, directives, options).el; |
}; |
Transparency.matcher = function(element, key) { |
return element.el.id === key || __indexOf.call(element.classNames, key) >= 0 || element.el.name === key || element.el.getAttribute('data-bind') === key; |
}; |
Transparency.clone = function(node) { |
return $(node).clone()[0]; |
}; |
Transparency.jQueryPlugin = helpers.chainable(function(models, directives, options) { |
var context, _i, _len, _results; |
_results = []; |
for (_i = 0, _len = this.length; _i < _len; _i++) { |
context = this[_i]; |
_results.push(Transparency.render(context, models, directives, options)); |
} |
return _results; |
}); |
if ((typeof jQuery !== "undefined" && jQuery !== null) || (typeof Zepto !== "undefined" && Zepto !== null)) { |
$ = jQuery || Zepto; |
if ($ != null) { |
$.fn.render = Transparency.jQueryPlugin; |
} |
} |
if (typeof module !== "undefined" && module !== null ? module.exports : void 0) { |
module.exports = Transparency; |
} |
if (typeof window !== "undefined" && window !== null) { |
window.Transparency = Transparency; |
} |
if (typeof define !== "undefined" && define !== null ? define.amd : void 0) { |
define(function() { |
return Transparency; |
}); |
} |
},{"../lib/lodash.js":7,"./context":3,"./helpers":5}],2:[function(require,module,exports){ |
var Attribute, AttributeFactory, BooleanAttribute, Class, Html, Text, helpers, _, |
__hasProp = {}.hasOwnProperty, |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; |
_ = require('../lib/lodash'); |
helpers = require('./helpers'); |
module.exports = AttributeFactory = { |
Attributes: {}, |
createAttribute: function(element, name) { |
var Attr; |
Attr = AttributeFactory.Attributes[name] || Attribute; |
return new Attr(element, name); |
} |
}; |
Attribute = (function() { |
function Attribute(el, name) { |
this.el = el; |
this.name = name; |
this.templateValue = this.el.getAttribute(this.name) || ''; |
} |
Attribute.prototype.set = function(value) { |
this.el[this.name] = value; |
return this.el.setAttribute(this.name, value.toString()); |
}; |
return Attribute; |
})(); |
BooleanAttribute = (function(_super) { |
var BOOLEAN_ATTRIBUTES, name, _i, _len; |
__extends(BooleanAttribute, _super); |
BOOLEAN_ATTRIBUTES = ['hidden', 'async', 'defer', 'autofocus', 'formnovalidate', 'disabled', 'autofocus', 'formnovalidate', 'multiple', 'readonly', 'required', 'checked', 'scoped', 'reversed', 'selected', 'loop', 'muted', 'autoplay', 'controls', 'seamless', 'default', 'ismap', 'novalidate', 'open', 'typemustmatch', 'truespeed']; |
for (_i = 0, _len = BOOLEAN_ATTRIBUTES.length; _i < _len; _i++) { |
name = BOOLEAN_ATTRIBUTES[_i]; |
AttributeFactory.Attributes[name] = BooleanAttribute; |
} |
function BooleanAttribute(el, name) { |
this.el = el; |
this.name = name; |
this.templateValue = this.el.getAttribute(this.name) || false; |
} |
BooleanAttribute.prototype.set = function(value) { |
this.el[this.name] = value; |
if (value) { |
return this.el.setAttribute(this.name, this.name); |
} else { |
return this.el.removeAttribute(this.name); |
} |
}; |
return BooleanAttribute; |
})(Attribute); |
Text = (function(_super) { |
__extends(Text, _super); |
AttributeFactory.Attributes['text'] = Text; |
function Text(el, name) { |
var child; |
this.el = el; |
this.name = name; |
this.templateValue = ((function() { |
var _i, _len, _ref, _results; |
_ref = this.el.childNodes; |
_results = []; |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
child = _ref[_i]; |
if (child.nodeType === helpers.TEXT_NODE) { |
_results.push(child.nodeValue); |
} |
} |
return _results; |
}).call(this)).join(''); |
this.children = _.toArray(this.el.children); |
if (!(this.textNode = this.el.firstChild)) { |
this.el.appendChild(this.textNode = this.el.ownerDocument.createTextNode('')); |
} else if (this.textNode.nodeType !== helpers.TEXT_NODE) { |
this.textNode = this.el.insertBefore(this.el.ownerDocument.createTextNode(''), this.textNode); |
} |
} |
Text.prototype.set = function(text) { |
var child, _i, _len, _ref, _results; |
while (child = this.el.firstChild) { |
this.el.removeChild(child); |
} |
this.textNode.nodeValue = text; |
this.el.appendChild(this.textNode); |
_ref = this.children; |
_results = []; |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
child = _ref[_i]; |
_results.push(this.el.appendChild(child)); |
} |
return _results; |
}; |
return Text; |
})(Attribute); |
Html = (function(_super) { |
__extends(Html, _super); |
AttributeFactory.Attributes['html'] = Html; |
function Html(el) { |
this.el = el; |
this.templateValue = ''; |
this.children = _.toArray(this.el.children); |
} |
Html.prototype.set = function(html) { |
var child, _i, _len, _ref, _results; |
while (child = this.el.firstChild) { |
this.el.removeChild(child); |
} |
this.el.innerHTML = html + this.templateValue; |
_ref = this.children; |
_results = []; |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
child = _ref[_i]; |
_results.push(this.el.appendChild(child)); |
} |
return _results; |
}; |
return Html; |
})(Attribute); |
Class = (function(_super) { |
__extends(Class, _super); |
AttributeFactory.Attributes['class'] = Class; |
function Class(el) { |
Class.__super__.constructor.call(this, el, 'class'); |
} |
return Class; |
})(Attribute); |
},{"../lib/lodash":7,"./helpers":5}],3:[function(require,module,exports){ |
var Context, Instance, after, before, chainable, cloneNode, _ref; |
_ref = require('./helpers'), before = _ref.before, after = _ref.after, chainable = _ref.chainable, cloneNode = _ref.cloneNode; |
Instance = require('./instance'); |
module.exports = Context = (function() { |
var attach, detach; |
detach = chainable(function() { |
this.parent = this.el.parentNode; |
if (this.parent) { |
this.nextSibling = this.el.nextSibling; |
return this.parent.removeChild(this.el); |
} |
}); |
attach = chainable(function() { |
if (this.parent) { |
if (this.nextSibling) { |
return this.parent.insertBefore(this.el, this.nextSibling); |
} else { |
return this.parent.appendChild(this.el); |
} |
} |
}); |
function Context(el, Transparency) { |
this.el = el; |
this.Transparency = Transparency; |
this.template = cloneNode(this.el); |
this.instances = [new Instance(this.el, this.Transparency)]; |
this.instanceCache = []; |
} |
Context.prototype.render = before(detach)(after(attach)(chainable(function(models, directives, options) { |
var children, index, instance, model, _i, _len, _results; |
while (models.length < this.instances.length) { |
this.instanceCache.push(this.instances.pop().remove()); |
} |
while (models.length > this.instances.length) { |
instance = this.instanceCache.pop() || new Instance(cloneNode(this.template), this.Transparency); |
this.instances.push(instance.appendTo(this.el)); |
} |
_results = []; |
for (index = _i = 0, _len = models.length; _i < _len; index = ++_i) { |
model = models[index]; |
instance = this.instances[index]; |
children = []; |
_results.push(instance.prepare(model, children).renderValues(model, children).renderDirectives(model, index, directives).renderChildren(model, children, directives, options)); |
} |
return _results; |
}))); |
return Context; |
})(); |
},{"./helpers":5,"./instance":6}],4:[function(require,module,exports){ |
var AttributeFactory, Checkbox, Element, ElementFactory, Input, Radio, Select, TextArea, VoidElement, helpers, _, |
__hasProp = {}.hasOwnProperty, |
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; |
_ = require('../lib/lodash.js'); |
helpers = require('./helpers'); |
AttributeFactory = require('./attributeFactory'); |
module.exports = ElementFactory = { |
Elements: { |
input: {} |
}, |
createElement: function(el) { |
var El, name; |
if ('input' === (name = el.nodeName.toLowerCase())) { |
El = ElementFactory.Elements[name][el.type.toLowerCase()] || Input; |
} else { |
El = ElementFactory.Elements[name] || Element; |
} |
return new El(el); |
} |
}; |
Element = (function() { |
function Element(el) { |
this.el = el; |
this.attributes = {}; |
this.childNodes = _.toArray(this.el.childNodes); |
this.nodeName = this.el.nodeName.toLowerCase(); |
this.classNames = this.el.className.split(' '); |
this.originalAttributes = {}; |
} |
Element.prototype.empty = function() { |
var child; |
while (child = this.el.firstChild) { |
this.el.removeChild(child); |
} |
return this; |
}; |
Element.prototype.reset = function() { |
var attribute, name, _ref, _results; |
_ref = this.attributes; |
_results = []; |
for (name in _ref) { |
attribute = _ref[name]; |
_results.push(attribute.set(attribute.templateValue)); |
} |
return _results; |
}; |
Element.prototype.render = function(value) { |
return this.attr('text', value); |
}; |
Element.prototype.attr = function(name, value) { |
var attribute, _base; |
attribute = (_base = this.attributes)[name] || (_base[name] = AttributeFactory.createAttribute(this.el, name, value)); |
if (value != null) { |
attribute.set(value); |
} |
return attribute; |
}; |
Element.prototype.renderDirectives = function(model, index, attributes) { |
var directive, name, value, _results; |
_results = []; |
for (name in attributes) { |
if (!__hasProp.call(attributes, name)) continue; |
directive = attributes[name]; |
if (!(typeof directive === 'function')) { |
continue; |
} |
value = directive.call(model, { |
element: this.el, |
index: index, |
value: this.attr(name).templateValue |
}); |
if (value != null) { |
_results.push(this.attr(name, value)); |
} else { |
_results.push(void 0); |
} |
} |
return _results; |
}; |
return Element; |
})(); |
Select = (function(_super) { |
__extends(Select, _super); |
ElementFactory.Elements['select'] = Select; |
function Select(el) { |
Select.__super__.constructor.call(this, el); |
this.elements = helpers.getElements(el); |
} |
Select.prototype.render = function(value) { |
var option, _i, _len, _ref, _results; |
value = value.toString(); |
_ref = this.elements; |
_results = []; |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
option = _ref[_i]; |
if (option.nodeName === 'option') { |
_results.push(option.attr('selected', option.el.value === value)); |
} |
} |
return _results; |
}; |
return Select; |
})(Element); |
VoidElement = (function(_super) { |
var VOID_ELEMENTS, nodeName, _i, _len; |
__extends(VoidElement, _super); |
function VoidElement() { |
return VoidElement.__super__.constructor.apply(this, arguments); |
} |
VOID_ELEMENTS = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']; |
for (_i = 0, _len = VOID_ELEMENTS.length; _i < _len; _i++) { |
nodeName = VOID_ELEMENTS[_i]; |
ElementFactory.Elements[nodeName] = VoidElement; |
} |
VoidElement.prototype.attr = function(name, value) { |
if (name !== 'text' && name !== 'html') { |
return VoidElement.__super__.attr.call(this, name, value); |
} |
}; |
return VoidElement; |
})(Element); |
Input = (function(_super) { |
__extends(Input, _super); |
function Input() { |
return Input.__super__.constructor.apply(this, arguments); |
} |
Input.prototype.render = function(value) { |
return this.attr('value', value); |
}; |
return Input; |
})(VoidElement); |
TextArea = (function(_super) { |
__extends(TextArea, _super); |
function TextArea() { |
return TextArea.__super__.constructor.apply(this, arguments); |
} |
ElementFactory.Elements['textarea'] = TextArea; |
return TextArea; |
})(Input); |
Checkbox = (function(_super) { |
__extends(Checkbox, _super); |
function Checkbox() { |
return Checkbox.__super__.constructor.apply(this, arguments); |
} |
ElementFactory.Elements['input']['checkbox'] = Checkbox; |
Checkbox.prototype.render = function(value) { |
return this.attr('checked', Boolean(value)); |
}; |
return Checkbox; |
})(Input); |
Radio = (function(_super) { |
__extends(Radio, _super); |
function Radio() { |
return Radio.__super__.constructor.apply(this, arguments); |
} |
ElementFactory.Elements['input']['radio'] = Radio; |
return Radio; |
})(Checkbox); |
},{"../lib/lodash.js":7,"./attributeFactory":2,"./helpers":5}],5:[function(require,module,exports){ |
var ElementFactory, expando, html5Clone, _getElements; |
ElementFactory = require('./elementFactory'); |
exports.before = function(decorator) { |
return function(method) { |
return function() { |
decorator.apply(this, arguments); |
return method.apply(this, arguments); |
}; |
}; |
}; |
exports.after = function(decorator) { |
return function(method) { |
return function() { |
method.apply(this, arguments); |
return decorator.apply(this, arguments); |
}; |
}; |
}; |
exports.chainable = exports.after(function() { |
return this; |
}); |
exports.onlyWith$ = function(fn) { |
if ((typeof jQuery !== "undefined" && jQuery !== null) || (typeof Zepto !== "undefined" && Zepto !== null)) { |
return (function($) { |
return fn(arguments); |
})(jQuery || Zepto); |
} |
}; |
exports.getElements = function(el) { |
var elements; |
elements = []; |
_getElements(el, elements); |
return elements; |
}; |
_getElements = function(template, elements) { |
var child, _results; |
child = template.firstChild; |
_results = []; |
while (child) { |
if (child.nodeType === exports.ELEMENT_NODE) { |
elements.push(new ElementFactory.createElement(child)); |
_getElements(child, elements); |
} |
_results.push(child = child.nextSibling); |
} |
return _results; |
}; |
exports.ELEMENT_NODE = 1; |
exports.TEXT_NODE = 3; |
html5Clone = function() { |
return document.createElement('nav').cloneNode(true).outerHTML !== '<:nav></:nav>'; |
}; |
exports.cloneNode = (typeof document === "undefined" || document === null) || html5Clone() ? function(node) { |
return node.cloneNode(true); |
} : function(node) { |
var cloned, element, _i, _len, _ref; |
cloned = Transparency.clone(node); |
if (cloned.nodeType === exports.ELEMENT_NODE) { |
cloned.removeAttribute(expando); |
_ref = cloned.getElementsByTagName('*'); |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
element = _ref[_i]; |
element.removeAttribute(expando); |
} |
} |
return cloned; |
}; |
expando = 'transparency'; |
exports.data = function(element) { |
return element[expando] || (element[expando] = {}); |
}; |
exports.nullLogger = function() {}; |
exports.consoleLogger = function() { |
return console.log(arguments); |
}; |
exports.log = exports.nullLogger; |
},{"./elementFactory":4}],6:[function(require,module,exports){ |
var Instance, chainable, helpers, _, |
__hasProp = {}.hasOwnProperty; |
_ = require('../lib/lodash.js'); |
chainable = (helpers = require('./helpers')).chainable; |
module.exports = Instance = (function() { |
function Instance(template, Transparency) { |
this.Transparency = Transparency; |
this.queryCache = {}; |
this.childNodes = _.toArray(template.childNodes); |
this.elements = helpers.getElements(template); |
} |
Instance.prototype.remove = chainable(function() { |
var node, _i, _len, _ref, _results; |
_ref = this.childNodes; |
_results = []; |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
node = _ref[_i]; |
_results.push(node.parentNode.removeChild(node)); |
} |
return _results; |
}); |
Instance.prototype.appendTo = chainable(function(parent) { |
var node, _i, _len, _ref, _results; |
_ref = this.childNodes; |
_results = []; |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
node = _ref[_i]; |
_results.push(parent.appendChild(node)); |
} |
return _results; |
}); |
Instance.prototype.prepare = chainable(function(model) { |
var element, _i, _len, _ref, _results; |
_ref = this.elements; |
_results = []; |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
element = _ref[_i]; |
element.reset(); |
_results.push(helpers.data(element.el).model = model); |
} |
return _results; |
}); |
Instance.prototype.renderValues = chainable(function(model, children) { |
var element, key, value, _results; |
if (_.isElement(model) && (element = this.elements[0])) { |
return element.empty().el.appendChild(model); |
} else if (typeof model === 'object') { |
_results = []; |
for (key in model) { |
if (!__hasProp.call(model, key)) continue; |
value = model[key]; |
if (value != null) { |
if (_.isString(value) || _.isNumber(value) || _.isBoolean(value) || _.isDate(value)) { |
_results.push((function() { |
var _i, _len, _ref, _results1; |
_ref = this.matchingElements(key); |
_results1 = []; |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
element = _ref[_i]; |
_results1.push(element.render(value)); |
} |
return _results1; |
}).call(this)); |
} else if (typeof value === 'object') { |
_results.push(children.push(key)); |
} else { |
_results.push(void 0); |
} |
} |
} |
return _results; |
} |
}); |
Instance.prototype.renderDirectives = chainable(function(model, index, directives) { |
var attributes, element, key, _results; |
_results = []; |
for (key in directives) { |
if (!__hasProp.call(directives, key)) continue; |
attributes = directives[key]; |
if (!(typeof attributes === 'object')) { |
continue; |
} |
if (typeof model !== 'object') { |
model = { |
value: model |
}; |
} |
_results.push((function() { |
var _i, _len, _ref, _results1; |
_ref = this.matchingElements(key); |
_results1 = []; |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
element = _ref[_i]; |
_results1.push(element.renderDirectives(model, index, attributes)); |
} |
return _results1; |
}).call(this)); |
} |
return _results; |
}); |
Instance.prototype.renderChildren = chainable(function(model, children, directives, options) { |
var element, key, _i, _len, _results; |
_results = []; |
for (_i = 0, _len = children.length; _i < _len; _i++) { |
key = children[_i]; |
_results.push((function() { |
var _j, _len1, _ref, _results1; |
_ref = this.matchingElements(key); |
_results1 = []; |
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { |
element = _ref[_j]; |
_results1.push(this.Transparency.render(element.el, model[key], directives[key], options)); |
} |
return _results1; |
}).call(this)); |
} |
return _results; |
}); |
Instance.prototype.matchingElements = function(key) { |
var el, elements, _base; |
elements = (_base = this.queryCache)[key] || (_base[key] = (function() { |
var _i, _len, _ref, _results; |
_ref = this.elements; |
_results = []; |
for (_i = 0, _len = _ref.length; _i < _len; _i++) { |
el = _ref[_i]; |
if (this.Transparency.matcher(el, key)) { |
_results.push(el); |
} |
} |
return _results; |
}).call(this)); |
helpers.log("Matching elements for '" + key + "':", elements); |
return elements; |
}; |
return Instance; |
})(); |
},{"../lib/lodash.js":7,"./helpers":5}],7:[function(require,module,exports){ |
var _ = {}; |
_.toString = Object.prototype.toString; |
_.toArray = function(obj) { |
var arr = new Array(obj.length); |
for (var i = 0; i < obj.length; i++) { |
arr[i] = obj[i]; |
} |
return arr; |
}; |
_.isString = function(obj) { return _.toString.call(obj) == '[object String]'; }; |
_.isNumber = function(obj) { return _.toString.call(obj) == '[object Number]'; }; |
_.isArray = Array.isArray || function(obj) { |
return _.toString.call(obj) === '[object Array]'; |
}; |
_.isDate = function(obj) { |
return _.toString.call(obj) === '[object Date]'; |
}; |
_.isElement = function(obj) { |
return !!(obj && obj.nodeType === 1); |
}; |
_.isPlainValue = function(obj) { |
var type; |
type = typeof obj; |
return (type !== 'object' && type !== 'function') || exports.isDate(obj); |
}; |
_.isBoolean = function(obj) { |
return obj === true || obj === false; |
}; |
module.exports = _; |
},{}]},{},[1]); |
/web/acc/phpsysinfo/plugins/bat/bat_bootstrap.html |
---|
0,0 → 1,22 |
<div class="col-lg-6" id="block_bat" style="display:none;"> |
<div class="card" id="panel_bat" style="display:none;"> |
<div class="card-header"><span class="lang_plugin_bat_001">Battery Status</span> |
<div id="reload_bat" class="reload" title="reload"></div> |
</div> |
<div class="card-body"> |
<div class="table-responsive"> |
<table id="bat" class="table table-hover table-sm"> |
<thead> |
<tr> |
<th><span class="lang_plugin_bat_006">Battery</span></th> |
<th><span class="lang_plugin_bat_007">Value</span></th> |
<th></th> |
</tr> |
</thead> |
<tbody id="bat-data"> |
</tbody> |
</table> |
</div> |
</div> |
</div> |
</div> |
/web/acc/phpsysinfo/plugins/bat/class.bat.inc.php |
---|
0,0 → 1,777 |
<?php |
/** |
* BAT Plugin, which displays battery state |
* |
* @category PHP |
* @package PSI_Plugin_BAT |
* @author Erkan V |
* @copyright 2009 phpSysInfo |
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version |
* @version $Id: class.bat.inc.php 661 2012-08-27 11:26:39Z namiltd $ |
* @link http://phpsysinfo.sourceforge.net |
*/ |
class BAT extends PSI_Plugin |
{ |
/** |
* variable, which holds the content of the command |
* @var array |
*/ |
private $_filecontent = array(); |
/** |
* variable, which holds the result before the xml is generated out of this array |
* @var array |
*/ |
private $_result = array(); |
/** |
* read the data into an internal array and also call the parent constructor |
* |
* @param String $enc encoding |
*/ |
public function __construct($enc) |
{ |
parent::__construct(__CLASS__, $enc); |
$buffer = array(); |
switch (strtolower(PSI_PLUGIN_BAT_ACCESS)) { |
case 'command': |
if (PSI_OS == 'WINNT') { |
$_cim = null; //root\CIMv2 |
$_wmi = null; //root\WMI |
try { |
// initialize the wmi object |
$objLocatorCIM = new COM('WbemScripting.SWbemLocator'); |
$_cim = $objLocatorCIM->ConnectServer('', 'root\CIMv2'); |
// initialize the wmi object |
$objLocatorWMI = new COM('WbemScripting.SWbemLocator'); |
$_wmi = $objLocatorWMI->ConnectServer('', 'root\WMI'); |
} catch (Exception $e) { |
$this->global_error->addError("WMI connect error", "PhpSysInfo can not connect to the WMI interface for security reasons.\nCheck an authentication mechanism for the directory where phpSysInfo is installed."); |
} |
$bufferWB = CommonFunctions::getWMI($_cim, 'Win32_Battery', array('Caption', 'Name', 'EstimatedChargeRemaining', 'DesignVoltage', 'BatteryStatus', 'Chemistry')); |
if (sizeof($bufferWB)>0) { |
$bufferWPB = CommonFunctions::getWMI($_cim, 'Win32_PortableBattery', array('DesignVoltage', 'Chemistry', 'DesignCapacity', 'FullChargeCapacity', 'Manufacturer')); |
$bufferBS = CommonFunctions::getWMI($_wmi, 'BatteryStatus', array('RemainingCapacity', 'Voltage')); |
$bufferBCC = CommonFunctions::getWMI($_wmi, 'BatteryCycleCount', array('CycleCount')); |
$bufferBFCC = CommonFunctions::getWMI($_wmi, 'BatteryFullChargedCapacity', array('FullChargedCapacity')); |
$sobWB = sizeof($bufferWB); |
if (sizeof($bufferWPB) != $sobWB) { |
$bufferWPB = array(); |
} |
if (sizeof($bufferBS) != $sobWB) { |
$bufferBS = array(); |
} |
if (sizeof($bufferBCC) != $sobWB) { |
$bufferBCC = array(); |
} |
if (sizeof($bufferBFCC) != $sobWB) { |
$bufferBFCC = array(); |
} |
for ($bi = 0; $bi < $sobWB; $bi++) { |
$buffer[$bi]['state'] = ''; |
$buffer[$bi]['info'] = ''; |
$capacity = ''; |
if (isset($bufferWB[$bi]['EstimatedChargeRemaining'])) { |
$capacity = $bufferWB[$bi]['EstimatedChargeRemaining']; |
} |
if (isset($bufferWB[$bi]['BatteryStatus'])) { |
switch ($bufferWB[$bi]['BatteryStatus']) { |
case 1: $batstat = 'Discharging'; break; |
case 2: $batstat = 'AC connected'; break; |
case 3: $batstat = 'Fully Charged'; break; |
case 4: $batstat = 'Low'; break; |
case 5: $batstat = 'Critical'; break; |
case 6: $batstat = 'Charging'; break; |
case 7: $batstat = 'Charging and High'; break; |
case 8: $batstat = 'Charging and Low'; break; |
case 9: $batstat = 'Charging and Critical'; break; |
case 10: $batstat = 'Undefined'; break; |
case 11: $batstat = 'Partially Charged'; break; |
default: $batstat = ''; |
} |
if ($batstat != '') $buffer[$bi]['state'] .= 'POWER_SUPPLY_STATUS='.$batstat."\n"; |
} |
$techn = ''; |
if (isset($bufferWB[$bi]['Chemistry'])) { |
switch ($bufferWB[$bi]['Chemistry']) { |
case 1: $techn = 'Other'; break; |
case 2: $techn = 'Unknown'; break; |
case 3: $techn = 'PbAc'; break; |
case 4: $techn = 'NiCd'; break; |
case 5: $techn = 'NiMH'; break; |
case 6: $techn = 'Li-ion'; break; |
case 7: $techn = 'Zinc-air'; break; |
case 8: $techn = 'Li-poly'; break; |
} |
} |
if (isset($bufferWPB[$bi]['DesignVoltage'])) { |
$buffer[$bi]['info'] .= 'POWER_SUPPLY_VOLTAGE_MIN_DESIGN='.($bufferWPB[$bi]['DesignVoltage']*1000)."\n"; |
} |
if (isset($bufferWPB[$bi]['Manufacturer'])) { |
$buffer[$bi]['info'] .= 'POWER_SUPPLY_MANUFACTURER='.$bufferWPB[$bi]['Manufacturer']."\n"; |
} |
// sometimes Chemistry from Win32_Battery returns 2 but Win32_PortableBattery returns e.g. 6 |
if ((($techn == '') || ($techn == 'Unknown')) && isset($bufferWPB[$bi]['Chemistry'])) { |
switch ($bufferWPB[$bi]['Chemistry']) { |
case 1: $techn = 'Other'; break; |
case 2: $techn = 'Unknown'; break; |
case 3: $techn = 'PbAc'; break; |
case 4: $techn = 'NiCd'; break; |
case 5: $techn = 'NiMH'; break; |
case 6: $techn = 'Li-ion'; break; |
case 7: $techn = 'Zinc-air'; break; |
case 8: $techn = 'Li-poly'; break; |
} |
} |
if ($techn != '') $buffer[$bi]['info'] .= 'POWER_SUPPLY_TECHNOLOGY='.$techn."\n"; |
if (sizeof($bufferBS)>0) { |
$hasvolt = false; |
if (isset($bufferBS[$bi]['Voltage']) && ($bufferBS[$bi]['Voltage']>0)) { |
$buffer[$bi]['state'] .= 'POWER_SUPPLY_VOLTAGE_NOW='.($bufferBS[$bi]['Voltage']*1000)."\n"; |
$hasvolt = true; |
} elseif (isset($bufferWB[$bi]['DesignVoltage']) && ($bufferWB[$bi]['DesignVoltage']>0)) { |
$buffer[$bi]['state'] .= 'POWER_SUPPLY_VOLTAGE_NOW='.($bufferWB[$bi]['DesignVoltage']*1000)."\n"; |
$hasvolt = true; |
} |
if (isset($bufferBS[$bi]['RemainingCapacity']) && |
(($bufferBS[$bi]['RemainingCapacity']>0) || ($hasvolt && ($bufferBS[$bi]['RemainingCapacity']==0)))) { |
$buffer[$bi]['state'] .= 'POWER_SUPPLY_ENERGY_NOW='.($bufferBS[$bi]['RemainingCapacity']*1000)."\n"; |
$capacity = ''; |
} |
} |
if (isset($bufferWB[$bi]['Caption'])) { |
$buffer[$bi]['state'] .= 'POWER_SUPPLY_NAME='.$bufferWB[$bi]['Caption']."\n"; |
} |
if (isset($bufferWB[$bi]['Name'])) { |
$buffer[$bi]['state'] .= 'POWER_SUPPLY_MODEL_NAME='.$bufferWB[$bi]['Name']."\n"; |
} |
if (!isset($bufferWPB[$bi]['FullChargeCapacity']) && isset($bufferBFCC[$bi]['FullChargedCapacity'])) { |
$bufferWPB[$bi]['FullChargeCapacity'] = $bufferBFCC[$bi]['FullChargedCapacity']; |
} |
if (isset($bufferWPB[$bi]['FullChargeCapacity'])) { |
$buffer[$bi]['info'] .= 'POWER_SUPPLY_ENERGY_FULL='.($bufferWPB[$bi]['FullChargeCapacity']*1000)."\n"; |
if ($capacity != '') $buffer[$bi]['state'] .= 'POWER_SUPPLY_ENERGY_NOW='.(round($capacity*$bufferWPB[$bi]['FullChargeCapacity']*10)."\n"); |
if (isset($bufferWPB[$bi]['DesignCapacity']) && ($bufferWPB[$bi]['DesignCapacity']>0)) |
$buffer[$bi]['info'] .= 'POWER_SUPPLY_ENERGY_FULL_DESIGN='.($bufferWPB[$bi]['DesignCapacity']*1000)."\n"; |
} elseif (isset($bufferWPB[$bi]['DesignCapacity']) && ($bufferWPB[$bi]['DesignCapacity']>0)) { |
$buffer[$bi]['info'] .= 'POWER_SUPPLY_ENERGY_FULL_DESIGN='.($bufferWPB[$bi]['DesignCapacity']*1000)."\n"; |
if ($capacity != '') $buffer[$bi]['state'] .= 'POWER_SUPPLY_ENERGY_NOW='.(round($capacity*$bufferWPB[$bi]['DesignCapacity']*10)."\n"); |
} else { |
if ($capacity != '') $buffer[$bi]['state'] .= 'POWER_SUPPLY_CAPACITY='.$capacity."\n"; |
} |
if (isset($bufferBCC[$bi]['CycleCount']) && ($bufferBCC[$bi]['CycleCount']>0)) { |
$buffer[$bi]['info'] .= 'POWER_SUPPLY_CYCLE_COUNT='.$bufferBCC[$bi]['CycleCount']."\n"; |
} |
} |
} |
} elseif (PSI_OS == 'Darwin') { |
$buffer[0]['info'] = ''; |
CommonFunctions::executeProgram('ioreg', '-w0 -l -n AppleSmartBattery -r', $buffer[0]['info'], false); |
if ($buffer[0]['info'] !== '') { |
$buffer[0]['info'] .= "POWER_SUPPLY_NAME=AppleSmartBattery\n"; |
} |
} elseif (PSI_OS == 'FreeBSD') { |
$buffer[0]['info'] = ''; |
CommonFunctions::executeProgram('acpiconf', '-i batt', $buffer[0]['info'], false); |
if ($buffer[0]['info'] !== '') { |
$buffer[0]['info'] .= "POWER_SUPPLY_NAME=batt\n"; |
} |
} elseif (PSI_OS == 'OpenBSD') { |
$buffer[0]['info'] = ''; |
CommonFunctions::executeProgram('sysctl', 'hw.sensors.acpibat0', $buffer[0]['info'], false); |
if ($buffer[0]['info'] !== '') { |
$buffer[0]['info'] .= "POWER_SUPPLY_NAME=acpibat0\n"; |
} |
} else { |
$itemcount = 0; |
if ((PSI_OS == 'Linux') && defined('PSI_PLUGIN_BAT_UPOWER') && PSI_PLUGIN_BAT_UPOWER) { |
$info = ''; |
CommonFunctions::executeProgram('upower', '-d', $info, false); |
if ($info !== '') { |
$infoarray = preg_split("/(?=^Device:|^Daemon:)/m", $info); |
foreach ($infoarray as $infoitem) { //upower detection |
if (preg_match('/^Device: \/org\/freedesktop\/UPower\/devices\//', $infoitem) |
&& !preg_match('/^Device: \/org\/freedesktop\/UPower\/devices\/line_power/', $infoitem) |
&& !preg_match('/^Device: \/org\/freedesktop\/UPower\/devices\/DisplayDevice/', $infoitem)) { |
$buffer[$itemcount++]['info'] = $infoitem; |
} |
} |
} |
} |
if ($itemcount == 0) { |
$batdevices = glob('/proc/acpi/battery/BAT*/info', GLOB_NOSORT); |
if (is_array($batdevices) && (($total = count($batdevices)) > 0)) { |
for ($i = 0; $i < $total; $i++) { |
$infoitem = ''; |
$stateitem = ''; |
$rfts_bi = CommonFunctions::rfts($batdevices[$i], $infoitem, 0, 4096, false); |
$rfts_bs = CommonFunctions::rfts(preg_replace('/\/info$/', '/state', $batdevices[$i]), $stateitem, 0, 4096, false); |
if (($rfts_bi && ($infoitem!=='')) || ($rfts_bs && ($stateitem!==''))) { |
if (preg_match('/^\/proc\/acpi\/battery\/(.+)\/info$/', $batdevices[$i], $batname)) { |
if ($infoitem!=='') { |
$infoitem .= 'POWER_SUPPLY_NAME='.$batname[1]."\n"; |
} else { |
$stateitem.= 'POWER_SUPPLY_NAME='.$batname[1]."\n"; |
} |
} |
if ($infoitem!=='') { |
$buffer[$itemcount]['info'] = $infoitem; |
} |
if ($stateitem!=='') { |
$buffer[$itemcount]['state'] = $stateitem; |
} |
$itemcount++; |
} |
} |
} |
} |
if ($itemcount == 0) { |
$batdevices = glob('/sys/class/power_supply/[Bb][Aa][Tt]*/present', GLOB_NOSORT); |
if (is_array($batdevices) && (($total = count($batdevices)) > 0)) { |
for ($i = 0; $i < $total; $i++) { |
$pbuffer = ''; |
if (CommonFunctions::rfts($batdevices[$i], $pbuffer, 1, 4096, false) && trim($pbuffer[0]==="1")) { |
$infoitem = ''; |
$stateitem = ''; |
CommonFunctions::rfts(preg_replace('/\/present$/', '/uevent', $batdevices[$i]), $infoitem, 0, 4096, false); |
if ((($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/voltage_min_design'))!==null) |
|| (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/voltage_max'))!==null)) { |
$stateitem .= 'POWER_SUPPLY_VOLTAGE_MIN_DESIGN='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/voltage_max_design'))!==null) { |
$stateitem .= 'POWER_SUPPLY_VOLTAGE_MAX_DESIGN='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/voltage_now'))!==null) { |
$stateitem .= 'POWER_SUPPLY_VOLTAGE_NOW='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/energy_full'))!==null) { |
$stateitem .= 'POWER_SUPPLY_ENERGY_FULL='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/energy_now'))!==null) { |
$stateitem .= 'POWER_SUPPLY_ENERGY_NOW='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/charge_full'))!==null) { |
$stateitem .= 'POWER_SUPPLY_CHARGE_FULL='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/charge_now'))!==null) { |
$stateitem .= 'POWER_SUPPLY_CHARGE_NOW='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/capacity'))!==null) { |
$stateitem .= 'POWER_SUPPLY_CAPACITY='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/technology'))!==null) { |
$stateitem .= 'POWER_SUPPLY_TECHNOLOGY='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/status'))!==null) { |
$stateitem .= 'POWER_SUPPLY_STATUS='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/batt_temp'))!==null) { |
$stateitem .= 'POWER_SUPPLY_TEMP='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/batt_vol'))!==null) { |
$stateitem .= 'POWER_SUPPLY_VOLTAGE_NOW='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/health'))!==null) { |
$stateitem .= 'POWER_SUPPLY_HEALTH='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/manufacturer'))!==null) { |
$stateitem .= 'POWER_SUPPLY_MANUFACTURER='.$buffer1."\n"; |
} |
if (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/temp'))!==null) { |
$stateitem .= 'POWER_SUPPLY_TEMP='.$buffer1."\n"; |
} |
if (defined('PSI_PLUGIN_BAT_SHOW_SERIAL') && PSI_PLUGIN_BAT_SHOW_SERIAL |
&& (($buffer1 = CommonFunctions::rolv($batdevices[$i], '/\/present$/', '/serial_number'))!==null)) { |
$stateitem .= 'POWER_SUPPLY_SERIAL_NUMBER='.$buffer1."\n"; |
} |
if (($stateitem!=='') || ($infoitem!=='')) { |
if (preg_match('/^\/sys\/class\/power_supply\/(.+)\/present$/', $batdevices[$i], $batname)) { |
$stateitem .= 'POWER_SUPPLY_NAME='.$batname[1]."\n"; |
} |
if ($infoitem!=='') { |
$buffer[$itemcount]['info'] = $infoitem; |
} |
if ($stateitem!=='') { |
$buffer[$itemcount]['state'] = $stateitem; |
} |
$itemcount++; |
} |
} |
} |
} |
} |
} |
break; |
case 'data': |
CommonFunctions::rfts(PSI_APP_ROOT."/data/bat_info.txt", $info); |
$itemcount = 0; |
$infoarray = preg_split("/(?=^Device:|^Daemon:)/m", $info); |
foreach ($infoarray as $infoitem) { //upower detection |
if (preg_match('/^Device: \/org\/freedesktop\/UPower\/devices\//', $infoitem) |
&& !preg_match('/^Device: \/org\/freedesktop\/UPower\/devices\/line_power/', $infoitem) |
&& !preg_match('/^Device: \/org\/freedesktop\/UPower\/devices\/DisplayDevice/', $infoitem)) { |
$buffer[$itemcount++]['info'] = $infoitem; |
} |
} |
if ($itemcount == 0) { |
$buffer[0]['info'] = $info; |
} |
CommonFunctions::rfts(PSI_APP_ROOT."/data/bat_state.txt", $buffer[0]['state']); |
break; |
default: |
$this->global_error->addConfigError("__construct()", "[bat] ACCESS"); |
break; |
} |
for ($bi = 0; $bi < sizeof($buffer); $bi++) { |
if (isset($buffer[$bi]['info'])) { |
$this->_filecontent[$bi]['info'] = preg_split("/\n/", $buffer[$bi]['info'], -1, PREG_SPLIT_NO_EMPTY); |
} |
if (isset($buffer[$bi]['state'])) { |
$this->_filecontent[$bi]['state'] = preg_split("/\n/", $buffer[$bi]['state'], -1, PREG_SPLIT_NO_EMPTY); |
} |
} |
} |
/** |
* doing all tasks to get the required informations that the plugin needs |
* result is stored in an internal array |
* |
* @return void |
*/ |
public function execute() |
{ |
if (empty($this->_filecontent)) { |
return; |
} |
for ($bi = 0; $bi < sizeof($this->_filecontent); $bi++) { |
$bat = array(); |
if (isset($this->_filecontent[$bi]['info'])) foreach ($this->_filecontent[$bi]['info'] as $roworig) { |
$roworig = trim($roworig); |
if (preg_match('/^[dD]esign capacity:\s*(.*) (.*)$/', $roworig, $data) |
|| preg_match('/^energy-full-design:\s*(.*) (.*)$/', $roworig, $data)) { |
$bat['design_capacity'] = str_replace(',', '.', $data[1])+0; |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = trim($data[2]); |
} elseif ($bat['capacity_unit'] != trim($data[2])) { |
$bat['capacity_unit'] = "???"; |
} |
} elseif (preg_match('/^[lL]ast full capacity:\s*(.*) (.*)$/', $roworig, $data) |
|| preg_match('/^energy-full:\s*(.*) (.*)$/', $roworig, $data)) { |
$bat['full_capacity'] = str_replace(',', '.', $data[1])+0; |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = trim($data[2]); |
} elseif ($bat['capacity_unit'] != trim($data[2])) { |
$bat['capacity_unit'] = "???"; |
} |
} elseif (preg_match('/^energy:\s*(.*) (.*)$/', $roworig, $data)) { |
$bat['remaining_capacity'] = str_replace(',', '.', $data[1])+0; |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = trim($data[2]); |
} elseif ($bat['capacity_unit'] != trim($data[2])) { |
$bat['capacity_unit'] = "???"; |
} |
} elseif (preg_match('/^cycle count:\s*(.*)$/', $roworig, $data) && ($data[1]>0)) { |
$bat['cycle_count'] = $data[1]; |
} elseif (preg_match('/^[dD]esign voltage:\s*(.*) (.*)$/', $roworig, $data)) { |
if ($data[2]=="mV") { // uV or mV detection |
$bat['design_voltage'] = $data[1]; |
} else { |
$bat['design_voltage'] = round($data[1]/1000); |
} |
} elseif (preg_match('/^battery type:\s*(.*)$/', $roworig, $data) |
|| preg_match('/^technology:\s*(.*)$/', $roworig, $data)) { |
$bat['battery_type'] = $data[1]; |
} elseif (preg_match('/^OEM info:\s*(.*)$/', $roworig, $data) |
|| preg_match('/^vendor:\s*(.*)$/', $roworig, $data)) { |
$bat['manufacturer'] = $data[1]; |
} elseif (preg_match('/^state:\s*(.*)$/', $roworig, $data)) { |
$bat['charging_state'] = $data[1]; |
} elseif (preg_match('/^voltage:\s*(.*) V$/', $roworig, $data)) { |
$bat['present_voltage'] = str_replace(',', '.', $data[1])*1000; |
} elseif (preg_match('/^percentage:\s*(.*)%$/', $roworig, $data)) { |
$bat['capacity'] = $data[1]; |
} elseif (preg_match('/^Device:\s*\/org\/freedesktop\/UPower\/devices\/([^_]*)_/', $roworig, $data)) { |
$bat['name'] = $data[1]; |
} elseif (preg_match('/^native-path:\s*(.*)$/', $roworig, $data) && isset($data[1][0]) && ($data[1][0]!=='/')) { |
$bat['name'] = $data[1]; |
} elseif (preg_match('/^model:\s*(.*)$/', $roworig, $data) |
|| preg_match('/^[Mm]odel number:\s*(.*)$/', $roworig, $data)) { |
$bat['model'] = $data[1]; |
} elseif (defined('PSI_PLUGIN_BAT_SHOW_SERIAL') && PSI_PLUGIN_BAT_SHOW_SERIAL |
&& (preg_match('/^serial:\s*(.*)$/', $roworig, $data) |
|| preg_match('/^[Ss]erial number:\s*(.*)$/', $roworig, $data))) { |
$bat['serialnumber'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_CYCLE_COUNT=(.*)$/', $roworig, $data) && ($data[1]>0)) { |
$bat['cycle_count'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_VOLTAGE_MIN_DESIGN=(.*)$/', $roworig, $data)) { |
if ($data[1]<100000) { // uV or mV detection |
$bat['design_voltage'] = $data[1]; |
} else { |
$bat['design_voltage'] = round($data[1]/1000); |
} |
} elseif (preg_match('/^POWER_SUPPLY_VOLTAGE_MAX_DESIGN=(.*)$/', $roworig, $data)) { |
if ($data[1]<100000) { // uV or mV detection |
$bat['design_voltage_max'] = $data[1]; |
} else { |
$bat['design_voltage_max'] = round($data[1]/1000); |
} |
} elseif (preg_match('/^POWER_SUPPLY_ENERGY_FULL=(.*)$/', $roworig, $data)) { |
$bat['full_capacity'] = ($data[1]/1000); |
if ($data[1]>=1000000000) { // µWh or nWh detection |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "µWh"; |
} elseif ($bat['capacity_unit'] != "µWh") { |
$bat['capacity_unit'] = "???"; |
} |
} else { |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "mWh"; |
} elseif ($bat['capacity_unit'] != "mWh") { |
$bat['capacity_unit'] = "???"; |
} |
} |
} elseif (preg_match('/^POWER_SUPPLY_CHARGE_FULL=(.*)$/', $roworig, $data)) { |
$bat['full_capacity'] = ($data[1]/1000); |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "mAh"; |
} elseif ($bat['capacity_unit'] != "mAh") { |
$bat['capacity_unit'] = "???"; |
} |
} elseif (preg_match('/^POWER_SUPPLY_ENERGY_NOW=(.*)$/', $roworig, $data)) { |
if (!isset($bat['capacity_unit']) || ($bat['capacity_unit'] == "mWh")) { |
$bat['capacity_unit'] = "mWh"; |
$bat['remaining_capacity'] = ($data[1]/1000); |
} |
} elseif (preg_match('/^POWER_SUPPLY_CHARGE_NOW=(.*)$/', $roworig, $data)) { |
if (!isset($bat['capacity_unit']) || ($bat['capacity_unit'] == "mAh")) { |
$bat['capacity_unit'] = "mAh"; |
$bat['remaining_capacity'] = ($data[1]/1000); |
} |
/* auxiary */ |
} elseif (preg_match('/^POWER_SUPPLY_ENERGY_FULL_DESIGN=(.*)$/', $roworig, $data)) { |
$bat['design_capacity'] = ($data[1]/1000); |
if ($data[1]>=1000000000) { // µWh or nWh detection |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "µWh"; |
} elseif ($bat['capacity_unit'] != "µWh") { |
$bat['capacity_unit'] = "???"; |
} |
} else { |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "mWh"; |
} elseif ($bat['capacity_unit'] != "mWh") { |
$bat['capacity_unit'] = "???"; |
} |
} |
} elseif (preg_match('/^POWER_SUPPLY_CHARGE_FULL_DESIGN=(.*)$/', $roworig, $data)) { |
$bat['design_capacity'] = ($data[1]/1000); |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "mAh"; |
} elseif ($bat['capacity_unit'] != "mAh") { |
$bat['capacity_unit'] = "???"; |
} |
} elseif (preg_match('/^POWER_SUPPLY_VOLTAGE_NOW=(.*)$/', $roworig, $data)) { |
if ($data[1]<100000) { // uV or mV detection |
$bat['present_voltage'] = $data[1]; |
} else { |
$bat['present_voltage'] = round($data[1]/1000); |
} |
} elseif (preg_match('/^POWER_SUPPLY_CAPACITY=(.*)$/', $roworig, $data)) { |
$bat['capacity'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_TEMP=(.*)$/', $roworig, $data)) { |
$bat['battery_temperature'] = $data[1]/10; |
} elseif (preg_match('/^POWER_SUPPLY_TECHNOLOGY=(.*)$/', $roworig, $data)) { |
$bat['battery_type'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_STATUS=(.*)$/', $roworig, $data)) { |
$bat['charging_state'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_HEALTH=(.*)$/', $roworig, $data)) { |
$bat['battery_condition'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_MANUFACTURER=(.*)$/', $roworig, $data)) { |
$bat['manufacturer'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_NAME=(.*)$/', $roworig, $data)) { |
$bat['name'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_MODEL_NAME=(.*)$/', $roworig, $data)) { |
$bat['model'] = $data[1]; |
} elseif (defined('PSI_PLUGIN_BAT_SHOW_SERIAL') && PSI_PLUGIN_BAT_SHOW_SERIAL |
&& preg_match('/^POWER_SUPPLY_SERIAL_NUMBER=(.*)$/', $roworig, $data)) { |
$bat['serialnumber'] = $data[1]; |
/* Darwin */ |
} elseif (preg_match('/^"MaxCapacity"\s*=\s*(.*)$/', $roworig, $data)) { |
$bat['full_capacity'] = $data[1]; |
} elseif (preg_match('/^"CurrentCapacity"\s*=\s*(.*)$/', $roworig, $data)) { |
$bat['remaining_capacity'] = $data[1]; |
} elseif (preg_match('/^"Voltage"\s*=\s*(.*)$/', $roworig, $data)) { |
$bat['present_voltage'] = $data[1]; |
} elseif (preg_match('/^"BatteryType"\s*=\s*"(.*)"$/', $roworig, $data)) { |
$bat['battery_type'] = $data[1]; |
} elseif (preg_match('/^"Temperature"\s*=\s*(.*)$/', $roworig, $data)) { |
if ($data[1]>0) $bat['battery_temperature'] = $data[1]/100; |
} elseif (preg_match('/^"DesignCapacity"\s*=\s*(.*)$/', $roworig, $data)) { |
$bat['design_capacity'] = $data[1]; |
} elseif (preg_match('/^"CycleCount"\s*=\s*(.*)$/', $roworig, $data) && ($data[1]>0)) { |
$bat['cycle_count'] = $data[1]; |
} elseif (preg_match('/^"DeviceName"\s*=\s*\"?([^\"]*)\"?$/', $roworig, $data)) { |
$bat['model'] = $data[1]; |
} elseif (defined('PSI_PLUGIN_BAT_SHOW_SERIAL') && PSI_PLUGIN_BAT_SHOW_SERIAL |
&& preg_match('/^"BatterySerialNumber"\s*=\s*\"?([^\"]*)\"?$/', $roworig, $data)) { |
$bat['serialnumber'] = $data[1]; |
/* auxiary */ |
} elseif (preg_match('/^"FullyCharged"\s*=\s*Yes$/', $roworig, $data)) { |
$bat['charging_state_f'] = true; |
} elseif (preg_match('/^"IsCharging"\s*=\s*Yes$/', $roworig, $data)) { |
$bat['charging_state_i'] = true; |
} elseif (preg_match('/^"ExternalConnected"\s*=\s*Yes$/', $roworig, $data)) { |
$bat['charging_state_e'] = true; |
/* FreeBSD */ |
} elseif (preg_match('/^Type:\s*(.*)$/', $roworig, $data)) { |
$bat['battery_type'] = $data[1]; |
} elseif (preg_match('/^State:\s*(.*)$/', $roworig, $data)) { |
$bat['charging_state'] = $data[1]; |
} elseif (preg_match('/^Present voltage:\s*(.*) (.*)$/', $roworig, $data)) { |
if ($data[2]=="mV") { // uV or mV detection |
$bat['present_voltage'] = $data[1]; |
} else { |
$bat['present_voltage'] = round($data[1]/1000); |
} |
} elseif (preg_match('/^Voltage:\s*(.*) (.*)$/', $roworig, $data)) { |
if ($data[2]=="mV") { // uV or mV detection |
$bat['present_voltage'] = $data[1]; |
} else { |
$bat['present_voltage'] = round($data[1]/1000); |
} |
} elseif (preg_match('/^Remaining capacity:\s*(.*)%$/', $roworig, $data)) { |
$bat['capacity'] = $data[1]; |
/* OpenBSD */ |
} elseif (preg_match('/^hw.sensors.acpibat0.volt0=(.*) VDC \(voltage\)$/', $roworig, $data)) { |
$bat['design_voltage'] = 1000*$data[1]; |
} elseif (preg_match('/^hw.sensors.acpibat0.volt1=(.*) VDC \(current voltage\)$/', $roworig, $data)) { |
$bat['present_voltage'] = 1000*$data[1]; |
} elseif (preg_match('/^hw.sensors.acpibat0.watthour0=(.*) Wh \(last full capacity\)$/', $roworig, $data)) { |
$bat['full_capacity'] = 1000*$data[1]; |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "mWh"; |
} elseif ($bat['capacity_unit'] != "mWh") { |
$bat['capacity_unit'] = "???"; |
} |
} elseif (preg_match('/^hw.sensors.acpibat0.watthour4=(.*) Wh \(design capacity\)$/', $roworig, $data)) { |
$bat['design_capacity'] = 1000*$data[1]; |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "mWh"; |
} elseif ($bat['capacity_unit'] != "mWh") { |
$bat['capacity_unit'] = "???"; |
} |
} elseif (preg_match('/^hw.sensors.acpibat0.watthour3=(.*) Wh \(remaining capacity\)/', $roworig, $data)) { |
$bat['remaining_capacity'] = 1000*$data[1]; |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "mWh"; |
} elseif ($bat['capacity_unit'] != "mWh") { |
$bat['capacity_unit'] = "???"; |
} |
} elseif (preg_match('/^hw.sensors.acpibat0.raw0=.* \((.*)\)/', $roworig, $data)) { |
$bat['charging_state'] = $data[1]; |
} |
} |
if (isset($this->_filecontent[$bi]['state'])) foreach ($this->_filecontent[$bi]['state'] as $roworig) { |
$roworig = trim($roworig); |
if (preg_match('/^remaining capacity:\s*(.*) (.*)$/', $roworig, $data)) { |
if (!isset($bat['capacity_unit']) || ($bat['capacity_unit'] == trim($data[2]))) { |
$bat['capacity_unit'] = trim($data[2]); |
$bat['remaining_capacity'] = $data[1]; |
} |
} elseif (preg_match('/^present voltage:\s*(.*) (.*)$/', $roworig, $data)) { |
if ($data[2]=="mV") { // uV or mV detection |
$bat['present_voltage'] = $data[1]; |
} else { |
$bat['present_voltage'] = round($data[1]/1000); |
} |
} elseif (preg_match('/^charging state:\s*(.*)$/', $roworig, $data)) { |
$bat['charging_state'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_VOLTAGE_MIN_DESIGN=(.*)$/', $roworig, $data)) { |
if ($data[1]<100000) { // uV or mV detection |
$bat['design_voltage'] = $data[1]; |
} else { |
$bat['design_voltage'] = round($data[1]/1000); |
} |
} elseif (preg_match('/^POWER_SUPPLY_VOLTAGE_MAX_DESIGN=(.*)$/', $roworig, $data)) { |
if ($data[1]<100000) { // uV or mV detection |
$bat['design_voltage_max'] = $data[1]; |
} else { |
$bat['design_voltage_max'] = round($data[1]/1000); |
} |
} elseif (preg_match('/^POWER_SUPPLY_ENERGY_FULL=(.*)$/', $roworig, $data)) { |
$bat['full_capacity'] = ($data[1]/1000); |
if ($data[1]>=1000000000) { // µWh or nWh detection |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "µWh"; |
} elseif ($bat['capacity_unit'] != "µWh") { |
$bat['capacity_unit'] = "???"; |
} |
} else { |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "mWh"; |
} elseif ($bat['capacity_unit'] != "mWh") { |
$bat['capacity_unit'] = "???"; |
} |
} |
} elseif (preg_match('/^POWER_SUPPLY_CHARGE_FULL=(.*)$/', $roworig, $data)) { |
$bat['full_capacity'] = ($data[1]/1000); |
if (!isset($bat['capacity_unit'])) { |
$bat['capacity_unit'] = "mAh"; |
} elseif ($bat['capacity_unit'] != "mAh") { |
$bat['capacity_unit'] = "???"; |
} |
} elseif (preg_match('/^POWER_SUPPLY_ENERGY_NOW=(.*)$/', $roworig, $data)) { |
if (!isset($bat['capacity_unit']) || ($bat['capacity_unit'] == "mWh")) { |
$bat['capacity_unit'] = "mWh"; |
$bat['remaining_capacity'] = ($data[1]/1000); |
} |
} elseif (preg_match('/^POWER_SUPPLY_CHARGE_NOW=(.*)$/', $roworig, $data)) { |
if (!isset($bat['capacity_unit']) || ($bat['capacity_unit'] == "mAh")) { |
$bat['capacity_unit'] = "mAh"; |
$bat['remaining_capacity'] = ($data[1]/1000); |
} |
} elseif (preg_match('/^POWER_SUPPLY_VOLTAGE_NOW=(.*)$/', $roworig, $data)) { |
if ($data[1]<100000) { // uV or mV detection |
$bat['present_voltage'] = $data[1]; |
} else { |
$bat['present_voltage'] = round($data[1]/1000); |
} |
} elseif (preg_match('/^POWER_SUPPLY_CAPACITY=(.*)$/', $roworig, $data)) { |
$bat['capacity'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_TEMP=(.*)$/', $roworig, $data)) { |
$bat['battery_temperature'] = $data[1]/10; |
} elseif (preg_match('/^POWER_SUPPLY_TECHNOLOGY=(.*)$/', $roworig, $data)) { |
$bat['battery_type'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_STATUS=(.*)$/', $roworig, $data)) { |
$bat['charging_state'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_HEALTH=(.*)$/', $roworig, $data)) { |
$bat['battery_condition'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_MANUFACTURER=(.*)$/', $roworig, $data)) { |
$bat['manufacturer'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_NAME=(.*)$/', $roworig, $data)) { |
$bat['name'] = $data[1]; |
} elseif (preg_match('/^POWER_SUPPLY_MODEL_NAME=(.*)$/', $roworig, $data)) { |
$bat['model'] = $data[1]; |
} elseif (defined('PSI_PLUGIN_BAT_SHOW_SERIAL') && PSI_PLUGIN_BAT_SHOW_SERIAL |
&& preg_match('/^POWER_SUPPLY_SERIAL_NUMBER=(.*)$/', $roworig, $data)) { |
$bat['serialnumber'] = $data[1]; |
} |
} |
if (sizeof($bat)>0) $this->_result[$bi] = $bat; |
} |
} |
/** |
* generates the XML content for the plugin |
* |
* @return SimpleXMLElement entire XML content for the plugin |
*/ |
public function xml() |
{ |
foreach ($this->_result as $bat_item) { |
$xmlbat = $this->xml->addChild("Bat"); |
if (isset($bat_item['name'])) { |
$xmlbat->addAttribute("Name", $bat_item['name']); |
} |
if (isset($bat_item['model']) && ($bat_item['model'] !== "1")) { |
$xmlbat->addAttribute("Model", $bat_item['model']); |
} |
if (defined('PSI_PLUGIN_BAT_SHOW_SERIAL') && PSI_PLUGIN_BAT_SHOW_SERIAL |
&& isset($bat_item['serialnumber']) |
&& ($bat_item['serialnumber'] !== "") |
&& ($bat_item['serialnumber'] !== "0") |
&& ($bat_item['serialnumber'] !== "0000")) { |
$xmlbat->addAttribute("SerialNumber", $bat_item['serialnumber']); |
} |
if (isset($bat_item['manufacturer'])) { |
$xmlbat->addAttribute("Manufacturer", $bat_item['manufacturer']); |
} |
if ((!isset($bat_item['remaining_capacity']) || (isset($bat_item['full_capacity']) && ($bat_item['full_capacity'] == 0))) && |
isset($bat_item['capacity']) && ($bat_item['capacity']>=0)) { |
if (isset($bat_item['capacity_unit']) && ($bat_item['capacity_unit'] !== "???") |
&& (isset($bat_item['full_capacity']) && ($bat_item['full_capacity'] > 0))) { |
$xmlbat->addAttribute("CapacityUnit", $bat_item['capacity_unit']); |
$xmlbat->addAttribute("RemainingCapacity", round($bat_item['capacity']*$bat_item['full_capacity']/100)); |
$xmlbat->addAttribute("FullCapacity", $bat_item['full_capacity']); |
if (isset($bat_item['design_capacity'])) { |
$xmlbat->addAttribute("DesignCapacity", $bat_item['design_capacity']); |
} |
} else { |
$xmlbat->addAttribute("FullCapacity", 100); |
$xmlbat->addAttribute("RemainingCapacity", $bat_item['capacity']); |
$xmlbat->addAttribute("CapacityUnit", "%"); |
} |
} else { |
if (isset($bat_item['full_capacity'])) { |
if (isset($bat_item['design_capacity'])) { |
$xmlbat->addAttribute("DesignCapacity", $bat_item['design_capacity']); |
} |
$xmlbat->addAttribute("FullCapacity", $bat_item['full_capacity']); |
} elseif (isset($bat_item['design_capacity'])) { |
$xmlbat->addAttribute("FullCapacity", $bat_item['design_capacity']); |
} |
if (isset($bat_item['remaining_capacity'])) { |
$xmlbat->addAttribute("RemainingCapacity", $bat_item['remaining_capacity']); |
} |
if (isset($bat_item['capacity_unit'])) { |
$xmlbat->addAttribute("CapacityUnit", $bat_item['capacity_unit']); |
} |
} |
if (isset($bat_item['design_voltage']) && ($bat_item['design_voltage']>0)) { |
$xmlbat->addAttribute("DesignVoltage", $bat_item['design_voltage']); |
if (isset($bat_item['design_voltage_max']) && ($bat_item['design_voltage_max']>0) && ($bat_item['design_voltage_max'] != $bat_item['design_voltage'])) { |
$xmlbat->addAttribute("DesignVoltageMax", $bat_item['design_voltage_max']); |
} |
} elseif (isset($bat_item['design_voltage_max']) && ($bat_item['design_voltage_max']>0)) { |
$xmlbat->addAttribute("DesignVoltage", $bat_item['design_voltage_max']); |
} |
if (isset($bat_item['present_voltage'])) { |
$xmlbat->addAttribute("PresentVoltage", $bat_item['present_voltage']); |
} |
if (isset($bat_item['charging_state'])) { |
$xmlbat->addAttribute("ChargingState", $bat_item['charging_state']); |
} else { |
if (isset($bat_item['charging_state_i'])) { |
$xmlbat->addAttribute("ChargingState", 'Charging'); |
} elseif (!isset($bat_item['charging_state_e'])) { |
$xmlbat->addAttribute("ChargingState", 'Discharging'); |
} elseif (isset($bat_item['charging_state_f'])) { |
$xmlbat->addAttribute("ChargingState", 'Fully Charged'); |
} else { |
$xmlbat->addAttribute("ChargingState", 'Unknown state'); |
} |
} |
if (isset($bat_item['battery_type'])) { |
$xmlbat->addAttribute("BatteryType", $bat_item['battery_type']); |
} |
if (isset($bat_item['battery_temperature'])) { |
$xmlbat->addAttribute("BatteryTemperature", $bat_item['battery_temperature']); |
} |
if (isset($bat_item['battery_condition'])) { |
$xmlbat->addAttribute("BatteryCondition", $bat_item['battery_condition']); |
} |
if (isset($bat_item['cycle_count'])) { |
$xmlbat->addAttribute("CycleCount", $bat_item['cycle_count']); |
} |
} |
return $this->xml->getSimpleXmlElement(); |
} |
} |