mirror of
https://github.com/OpenFOAM/ThirdParty-6.git
synced 2025-12-08 06:57:43 +00:00
ParaView-5.0.1: Added the source-tree to ThirdParty-dev and patched as described in the README file
Resolves bug-report http://bugs.openfoam.org/view.php?id=2098
This commit is contained in:
30
ParaView-5.0.1/VTK/Web/JavaScript/Ext/pure/README.md
Normal file
30
ParaView-5.0.1/VTK/Web/JavaScript/Ext/pure/README.md
Normal file
@ -0,0 +1,30 @@
|
||||
<h1>PURE Unobtrusive Rendering Engine</h1>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<div style="background-color:#DDEEFF;border:1px solid #CCCCCC;padding:10px;">
|
||||
<big>Please see the <a href="http://beebole.com/pure/documentation/">documentation</a> for more information</big><br /> <br />
|
||||
<big>If you have a question or an issue post it on: <a href="http://groups.google.com/group/Pure-Unobtrusive-Rendering-Engine">the discussion group</a></big>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p>Copyright © 2013 Michael Cvilic - BeeBole</p>
|
||||
|
||||
<p>Permission is hereby granted, free of charge, to any person obtaining a copy<br/>
|
||||
of this software and associated documentation files (the "Software"), to deal<br/>
|
||||
in the Software without restriction, including without limitation the rights<br/>
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br/>
|
||||
copies of the Software, and to permit persons to whom the Software is<br/>
|
||||
furnished to do so, subject to the following conditions:</p>
|
||||
|
||||
<p>The above copyright notice and this permission notice shall be included in<br/>
|
||||
all copies or substantial portions of the Software.</p>
|
||||
|
||||
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br/>
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br/>
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br/>
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br/>
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br/>
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br/>
|
||||
THE SOFTWARE.</p>
|
||||
20
ParaView-5.0.1/VTK/Web/JavaScript/Ext/pure/package.json
Normal file
20
ParaView-5.0.1/VTK/Web/JavaScript/Ext/pure/package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name" : "pure",
|
||||
"description" : "PURE Unobtrusive Rendering Engine, keep your HTML clean of any logic",
|
||||
"url" : "http://beebole.com/pure/",
|
||||
"keywords" : ["unobtrusive", "templating", "engine", "think different"],
|
||||
"author" : "Mic Cvilic <mic@beebole.com>",
|
||||
"contributors" : [],
|
||||
"dependencies" : [],
|
||||
"lib" : ".",
|
||||
"main" : "pure.js",
|
||||
"version" : "2.82.0",
|
||||
"repository" : {
|
||||
"type" : "git",
|
||||
"url" : "http://github.com/pure/pure.git"
|
||||
},
|
||||
"licenses": [{
|
||||
"type": "The MIT License",
|
||||
"url": "http://www.opensource.org/licenses/mit-license.php"}
|
||||
]
|
||||
}
|
||||
860
ParaView-5.0.1/VTK/Web/JavaScript/Ext/pure/pure.js
Normal file
860
ParaView-5.0.1/VTK/Web/JavaScript/Ext/pure/pure.js
Normal file
@ -0,0 +1,860 @@
|
||||
/*!
|
||||
PURE Unobtrusive Rendering Engine for HTML
|
||||
|
||||
Licensed under the MIT licenses.
|
||||
More information at: http://www.opensource.org
|
||||
|
||||
Copyright (c) 2013 Michael Cvilic - BeeBole.com
|
||||
|
||||
Thanks to Rog Peppe for the functional JS jump
|
||||
revision: 2.82
|
||||
*/
|
||||
|
||||
var $p = function(){
|
||||
var args = arguments,
|
||||
sel = args[0],
|
||||
ctxt = false;
|
||||
|
||||
if(typeof sel === 'string'){
|
||||
ctxt = args[1] || false;
|
||||
}else if(sel && !sel[0] && !sel.length){
|
||||
sel = [sel];
|
||||
}
|
||||
return $p.core(sel, ctxt);
|
||||
},
|
||||
pure = $p;
|
||||
|
||||
$p.core = function(sel, ctxt, plugins){
|
||||
//get an instance of the plugins
|
||||
var templates = [], i, ii,
|
||||
// set the signature string that will be replaced at render time
|
||||
Sig = '_s' + Math.floor( Math.random() * 1000000 ) + '_',
|
||||
// another signature to prepend to attributes and avoid checks: style, height, on[events]...
|
||||
attPfx = '_a' + Math.floor( Math.random() * 1000000 ) + '_',
|
||||
// rx to parse selectors, e.g. "+tr.foo[class]"
|
||||
selRx = /^(\+)?([^\@\+]+)?\@?([^\+]+)?(\+)?$/,
|
||||
// set automatically attributes for some tags
|
||||
autoAttr = {
|
||||
IMG:'src',
|
||||
INPUT:'value'
|
||||
},
|
||||
// check if the argument is an array - thanks salty-horse (Ori Avtalion)
|
||||
isArray = Array.isArray ?
|
||||
function(o) {
|
||||
return Array.isArray(o);
|
||||
} :
|
||||
function(o) {
|
||||
return Object.prototype.toString.call(o) === "[object Array]";
|
||||
};
|
||||
|
||||
plugins = plugins || getPlugins();
|
||||
|
||||
//search for the template node(s)
|
||||
switch(typeof sel){
|
||||
case 'string':
|
||||
templates = plugins.find(ctxt || document, sel);
|
||||
if(templates.length === 0) {
|
||||
error('The template "' + sel + '" was not found');
|
||||
}
|
||||
break;
|
||||
case 'undefined':
|
||||
error('The root of the template is undefined, check your selector');
|
||||
break;
|
||||
default:
|
||||
templates = sel;
|
||||
}
|
||||
|
||||
for( i = 0, ii = templates.length; i < ii; i++){
|
||||
plugins[i] = templates[i];
|
||||
}
|
||||
plugins.length = ii;
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
core functions
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
// error utility
|
||||
function error(e){
|
||||
if(typeof console !== 'undefined'){
|
||||
console.log(e);
|
||||
//debugger;
|
||||
}
|
||||
throw('pure error: ' + e);
|
||||
}
|
||||
|
||||
//return a new instance of plugins
|
||||
function getPlugins(){
|
||||
var plugins = $p.plugins,
|
||||
f = function(){};
|
||||
f.prototype = plugins;
|
||||
|
||||
// do not overwrite functions if external definition
|
||||
f.prototype.compile = plugins.compile || compile;
|
||||
f.prototype.render = plugins.render || render;
|
||||
f.prototype.autoRender = plugins.autoRender || autoRender;
|
||||
f.prototype.find = plugins.find || find;
|
||||
|
||||
// give the compiler and the error handling to the plugin context
|
||||
f.prototype._compiler = compiler;
|
||||
f.prototype._error = error;
|
||||
|
||||
return new f();
|
||||
}
|
||||
|
||||
// returns the outer HTML of a node
|
||||
function outerHTML(node){
|
||||
// if IE, Chrome take the internal method otherwise build one
|
||||
return node.outerHTML || (
|
||||
function(n){
|
||||
var div = document.createElement('div'), h;
|
||||
div.appendChild( n.cloneNode(true) );
|
||||
h = div.innerHTML;
|
||||
div = null;
|
||||
return h;
|
||||
}(node));
|
||||
}
|
||||
|
||||
// returns the string generator function
|
||||
function wrapquote(qfn, f){
|
||||
return function(ctxt){
|
||||
return qfn( String( f.call(ctxt.item || ctxt.context, ctxt) ) ) ;
|
||||
};
|
||||
}
|
||||
|
||||
// default find using querySelector when available on the browser
|
||||
function find(n, sel){
|
||||
if(typeof n === 'string'){
|
||||
sel = n;
|
||||
n = false;
|
||||
}
|
||||
return (n||document).querySelectorAll( sel );
|
||||
}
|
||||
|
||||
// create a function that concatenates constant string
|
||||
// sections (given in parts) and the results of called
|
||||
// functions to fill in the gaps between parts (fns).
|
||||
// fns[n] fills in the gap between parts[n-1] and parts[n];
|
||||
// fns[0] is unused.
|
||||
// this is the inner template evaluation loop.
|
||||
function concatenator(parts, fns){
|
||||
return function(ctxt){
|
||||
var strs = [ parts[ 0 ] ],
|
||||
n = parts.length,
|
||||
fnVal, pVal, attLine, pos, i;
|
||||
try{
|
||||
for(i = 1; i < n; i++){
|
||||
fnVal = fns[i].call( this, ctxt );
|
||||
pVal = parts[i];
|
||||
|
||||
// if the value is empty and attribute, remove it
|
||||
if(fnVal === ''){
|
||||
attLine = strs[ strs.length - 1 ];
|
||||
if( ( pos = attLine.search( /[^\s]+=\"?$/ ) ) > -1){
|
||||
strs[ strs.length - 1 ] = attLine.substring( 0, pos );
|
||||
pVal = pVal.substr( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
strs[ strs.length ] = fnVal;
|
||||
strs[ strs.length ] = pVal;
|
||||
}
|
||||
return strs.join('');
|
||||
}catch(e){
|
||||
if(console && console.log){
|
||||
console.log(
|
||||
e.stack ||
|
||||
e.message + ' (' + e.type + ( e['arguments'] ? ', ' + e['arguments'].join('-') : '' ) + '). Use Firefox or Chromium/Chrome to get a full stack of the error. ' );
|
||||
}
|
||||
return '';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// parse and check the loop directive
|
||||
function parseloopspec(p){
|
||||
var m = p.match( /^(\w+)\s*<-\s*(\S+)?$/ );
|
||||
if(m === null){
|
||||
error('bad loop spec: "' + p + '"');
|
||||
}
|
||||
if(m[1] === 'item'){
|
||||
error('"item<-..." is a reserved word for the current running iteration.\n\nPlease choose another name for your loop.');
|
||||
}
|
||||
if( !m[2] || m[2].toLowerCase() === 'context' ){ //undefined or space(IE)
|
||||
m[2] = function(ctxt){return ctxt.context;};
|
||||
}else if( (m[2] && m[2].indexOf('context') === 0 ) ){ //undefined or space(IE)
|
||||
m[2] = dataselectfn( m[2].replace(/^context\.?/, '') );
|
||||
}
|
||||
return {name: m[1], sel: m[2]};
|
||||
}
|
||||
|
||||
// parse a data selector and return a function that
|
||||
// can traverse the data accordingly, given a context.
|
||||
function dataselectfn (sel){
|
||||
if( typeof(sel) === 'function' ){
|
||||
//handle false values in function directive
|
||||
return function ( ctxt ){
|
||||
var r = sel.call( ctxt.item || ctxt.context || ctxt, ctxt );
|
||||
return !r && r !== 0 ? '' : r;
|
||||
};
|
||||
}
|
||||
//check for a valid js variable name with hyphen(for properties only), $, _ and :
|
||||
var m = sel.match(/^[\da-zA-Z\$_\@][\w\$:\-]*(\.[\w\$:\-]*[^\.])*$/),
|
||||
found = false, s = sel, parts = [], pfns = [], i = 0, retStr;
|
||||
|
||||
if(m === null){
|
||||
// check if literal
|
||||
if(/\'|\"/.test( s.charAt(0) )){
|
||||
if(/\'|\"/.test( s.charAt(s.length-1) )){
|
||||
retStr = s.substring(1, s.length-1);
|
||||
return function(){ return retStr; };
|
||||
}
|
||||
}else{
|
||||
// check if literal + #{var}
|
||||
while((m = s.match(/#\{([^{}]+)\}/)) !== null){
|
||||
found = true;
|
||||
parts[i++] = s.slice(0, m.index);
|
||||
pfns[i] = dataselectfn(m[1]);
|
||||
s = s.slice(m.index + m[0].length, s.length);
|
||||
}
|
||||
}
|
||||
if(!found){ //constant, return it
|
||||
return function(){ return sel; };
|
||||
}
|
||||
parts[i] = s;
|
||||
return concatenator(parts, pfns);
|
||||
}
|
||||
m = sel.split('.');
|
||||
return function(ctxt){
|
||||
var data = ctxt.context || ctxt,
|
||||
v = ctxt[m[0]],
|
||||
i = 0,
|
||||
n,
|
||||
dm;
|
||||
|
||||
if(v && typeof v.item !== 'undefined'){
|
||||
i += 1;
|
||||
if(m[i] === 'pos'){
|
||||
//allow pos to be kept by string. Tx to Adam Freidin
|
||||
return v.pos;
|
||||
}
|
||||
data = v.item;
|
||||
}
|
||||
n = m.length;
|
||||
|
||||
while( i < n ){
|
||||
if(!data){break;}
|
||||
dm = data[ m[i] ];
|
||||
//if it is a function call it
|
||||
data = typeof dm === 'function' ? dm.call( data ) : dm;
|
||||
i++;
|
||||
}
|
||||
|
||||
return (!data && data !== 0) ? '':data;
|
||||
};
|
||||
}
|
||||
|
||||
// wrap in an object the target node/attr and their properties
|
||||
function gettarget(dom, sel, isloop){
|
||||
var osel, prepend, selector, attr, append, target = [], m,
|
||||
setstr, getstr, quotefn, isStyle, isClass, attName, setfn;
|
||||
if( typeof sel === 'string' ){
|
||||
osel = sel;
|
||||
m = sel.match(selRx);
|
||||
if( !m ){
|
||||
error( 'bad selector syntax: ' + sel );
|
||||
}
|
||||
|
||||
prepend = m[1];
|
||||
selector = m[2];
|
||||
attr = m[3];
|
||||
append = m[4];
|
||||
|
||||
if(selector === '.' || ( !selector && attr ) ){
|
||||
target[0] = dom;
|
||||
}else{
|
||||
target = plugins.find(dom, selector);
|
||||
}
|
||||
if(!target || target.length === 0){
|
||||
return error('The node "' + sel + '" was not found in the template:\n' + outerHTML(dom).replace(/\t/g,' '));
|
||||
}
|
||||
}else{
|
||||
// autoRender node
|
||||
prepend = sel.prepend;
|
||||
attr = sel.attr;
|
||||
append = sel.append;
|
||||
target = [dom];
|
||||
}
|
||||
|
||||
if( prepend || append ){
|
||||
if( prepend && append ){
|
||||
error('append/prepend cannot take place at the same time');
|
||||
}else if( isloop ){
|
||||
error('no append/prepend/replace modifiers allowed for loop target');
|
||||
}else if( append && isloop ){
|
||||
error('cannot append with loop (sel: ' + osel + ')');
|
||||
}
|
||||
}
|
||||
|
||||
if(attr){
|
||||
isStyle = (/^style$/i).test(attr);
|
||||
isClass = (/^class$/i).test(attr);
|
||||
attName = isClass ? 'className' : attr;
|
||||
setstr = function(node, s) {
|
||||
node.setAttribute(attPfx + attr, s);
|
||||
if ( node[attName] && !isStyle) {
|
||||
try{node[attName] = '';}catch(e){} //FF4 gives an error sometimes
|
||||
}
|
||||
if (node.nodeType === 1) {
|
||||
node.removeAttribute(attr);
|
||||
if(isClass){
|
||||
node.removeAttribute(attName);
|
||||
}
|
||||
}
|
||||
};
|
||||
if (isStyle || isClass) {//IE no quotes special care
|
||||
if(isStyle){
|
||||
getstr = function(n){ return n.style.cssText; };
|
||||
}else{
|
||||
getstr = function(n){ return n.className; };
|
||||
}
|
||||
}else {
|
||||
getstr = function(n){ return n.getAttribute(attr); };
|
||||
}
|
||||
quotefn = function(s){ return s.replace(/\"/g, '"'); };
|
||||
if(prepend){
|
||||
setfn = function(node, s){ setstr( node, s + getstr( node )); };
|
||||
}else if(append){
|
||||
setfn = function(node, s){ setstr( node, getstr( node ) + s); };
|
||||
}else{
|
||||
setfn = function(node, s){ setstr( node, s ); };
|
||||
}
|
||||
}else{
|
||||
if (isloop) {
|
||||
setfn = function(node, s) {
|
||||
var pn = node.parentNode;
|
||||
if (pn) {
|
||||
//replace node with s
|
||||
pn.insertBefore(document.createTextNode(s), node.nextSibling);
|
||||
pn.removeChild(node);
|
||||
}else{
|
||||
error('The template root, can\'t be looped.');
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (prepend) {
|
||||
setfn = function(node, s) { node.insertBefore(document.createTextNode(s), node.firstChild); };
|
||||
} else if (append) {
|
||||
setfn = function(node, s) { node.appendChild(document.createTextNode(s));};
|
||||
} else {
|
||||
setfn = function(node, s) {
|
||||
while (node.firstChild) { node.removeChild(node.firstChild); }
|
||||
node.appendChild(document.createTextNode(s));
|
||||
};
|
||||
}
|
||||
}
|
||||
quotefn = function(s) { return s; };
|
||||
}
|
||||
return { attr: attr, nodes: target, set: setfn, sel: osel, quotefn: quotefn };
|
||||
}
|
||||
|
||||
function setsig(target, n){
|
||||
var sig = Sig + n + ':', i;
|
||||
for(i = 0; i < target.nodes.length; i++){
|
||||
// could check for overlapping targets here.
|
||||
target.set( target.nodes[i], sig );
|
||||
}
|
||||
}
|
||||
|
||||
// read de loop data, and pass it to the inner rendering function
|
||||
function loopfn(name, dselect, inner, sorter, filter){
|
||||
return function(ctxt){
|
||||
var a = dselect(ctxt),
|
||||
old = ctxt[name],
|
||||
temp = { items : a },
|
||||
filtered = 0,
|
||||
length,
|
||||
strs = [],
|
||||
buildArg = function(idx, temp, ftr, len){
|
||||
//keep the current loop. Tx to Adam Freidin
|
||||
var save_pos = ctxt.pos,
|
||||
save_item = ctxt.item,
|
||||
save_items = ctxt.items;
|
||||
ctxt.pos = temp.pos = idx;
|
||||
ctxt.item = temp.item = a[ idx ];
|
||||
ctxt.items = a;
|
||||
//if array, set a length property - filtered items
|
||||
if(typeof len !== 'undefined'){ (ctxt.length = len); }
|
||||
//if filter directive
|
||||
if(typeof ftr === 'function' && ftr.call(ctxt.item, ctxt) === false){
|
||||
filtered++;
|
||||
return;
|
||||
}
|
||||
strs.push( inner.call(ctxt.item, ctxt ) );
|
||||
//restore the current loop
|
||||
ctxt.pos = save_pos;
|
||||
ctxt.item = save_item;
|
||||
ctxt.items = save_items;
|
||||
},
|
||||
prop, i, ii;
|
||||
ctxt[name] = temp;
|
||||
if( isArray(a) ){
|
||||
length = a.length || 0;
|
||||
// if sort directive
|
||||
if(typeof sorter === 'function'){
|
||||
a.sort(function(a, b){
|
||||
return sorter.call(ctxt, a, b);
|
||||
});
|
||||
}
|
||||
//loop on array
|
||||
for(i = 0, ii = length; i < ii; i++){
|
||||
buildArg(i, temp, filter, length - filtered);
|
||||
}
|
||||
}else{
|
||||
if(a && typeof sorter !== 'undefined'){
|
||||
error('sort is only available on arrays, not objects');
|
||||
}
|
||||
//loop on collections
|
||||
for( prop in a ){
|
||||
if( a.hasOwnProperty( prop ) ){
|
||||
buildArg(prop, temp, filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( typeof old !== 'undefined'){
|
||||
ctxt[name] = old;
|
||||
}else{
|
||||
delete ctxt[name];
|
||||
}
|
||||
return strs.join('');
|
||||
};
|
||||
}
|
||||
// generate the template for a loop node
|
||||
function loopgen(dom, sel, loop, fns){
|
||||
var already = false, ls, sorter, filter, prop, dsel, spec, itersel, target, nodes, node, inner;
|
||||
for(prop in loop){
|
||||
if(loop.hasOwnProperty(prop)){
|
||||
if(prop === 'sort'){
|
||||
sorter = loop.sort;
|
||||
}else if(prop === 'filter'){
|
||||
filter = loop.filter;
|
||||
}else if(already){
|
||||
error('cannot have more than one loop on a target');
|
||||
}else{
|
||||
ls = prop;
|
||||
already = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!ls){
|
||||
error('Error in the selector: ' + sel + '\nA directive action must be a string, a function or a loop(<-)');
|
||||
}
|
||||
dsel = loop[ls];
|
||||
// if it's a simple data selector then we default to contents, not replacement.
|
||||
if(typeof(dsel) === 'string' || typeof(dsel) === 'function'){
|
||||
loop = {};
|
||||
loop[ls] = {root: dsel};
|
||||
return loopgen(dom, sel, loop, fns);
|
||||
}
|
||||
|
||||
spec = parseloopspec(ls);
|
||||
itersel = dataselectfn(spec.sel);
|
||||
target = gettarget(dom, sel, true);
|
||||
nodes = target.nodes;
|
||||
|
||||
for(i = 0; i < nodes.length; i++){
|
||||
node = nodes[i];
|
||||
inner = compiler(node, dsel);
|
||||
fns[fns.length] = wrapquote(target.quotefn, loopfn(spec.name, itersel, inner, sorter, filter));
|
||||
target.nodes = [node]; // N.B. side effect on target.
|
||||
setsig(target, fns.length - 1);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
function getAutoNodes(n, data){
|
||||
var ns = n.getElementsByTagName('*'),
|
||||
an = [],
|
||||
openLoops = {a:[],l:{}},
|
||||
cspec,
|
||||
isNodeValue,
|
||||
i, ii, j, jj, ni, cs, cj;
|
||||
//for each node found in the template
|
||||
for(i = -1, ii = ns.length; i < ii; i++){
|
||||
ni = i > -1 ?ns[i]:n;
|
||||
if(ni.nodeType === 1 && ni.className !== ''){
|
||||
//when a className is found
|
||||
cs = ni.className.split(' ');
|
||||
// for each className
|
||||
for(j = 0, jj=cs.length;j<jj;j++){
|
||||
cj = cs[j];
|
||||
// check if it is related to a context property
|
||||
cspec = checkClass(cj, ni.tagName);
|
||||
// if so, store the node, plus the type of data
|
||||
if(cspec !== false){
|
||||
isNodeValue = (/nodevalue/i).test(cspec.attr);
|
||||
if(cspec.sel.indexOf('@') > -1 || isNodeValue){
|
||||
ni.className = ni.className.replace('@'+cspec.attr, '');
|
||||
if(isNodeValue){
|
||||
cspec.attr = false;
|
||||
}
|
||||
}
|
||||
an.push({n:ni, cspec:cspec});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkClass(c, tagName){
|
||||
// read the class
|
||||
var ca = c.match(selRx),
|
||||
attr = ca[3] || autoAttr[tagName],
|
||||
cspec = {prepend:!!ca[1], prop:ca[2], attr:attr, append:!!ca[4], sel:c},
|
||||
i, ii, loopi, loopil, val;
|
||||
// check in existing open loops
|
||||
for(i = openLoops.a.length-1; i >= 0; i--){
|
||||
loopi = openLoops.a[i];
|
||||
loopil = loopi.l[0];
|
||||
val = loopil && loopil[cspec.prop];
|
||||
if(typeof val !== 'undefined'){
|
||||
cspec.prop = loopi.p + '.' + cspec.prop;
|
||||
if(openLoops.l[cspec.prop] === true){
|
||||
val = val[0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// not found check first level of data
|
||||
if(typeof val === 'undefined'){
|
||||
val = dataselectfn(cspec.prop)(isArray(data) ? data[0] : data);
|
||||
// nothing found return
|
||||
if(val === ''){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// set the spec for autoNode
|
||||
if(isArray(val)){
|
||||
openLoops.a.push( {l:val, p:cspec.prop} );
|
||||
openLoops.l[cspec.prop] = true;
|
||||
cspec.t = 'loop';
|
||||
}else{
|
||||
cspec.t = 'str';
|
||||
}
|
||||
return cspec;
|
||||
}
|
||||
|
||||
return an;
|
||||
|
||||
}
|
||||
|
||||
// returns a function that, given a context argument,
|
||||
// will render the template defined by dom and directive.
|
||||
function compiler(dom, directive, data, ans){
|
||||
var fns = [], j, jj, cspec, n, target, nodes, itersel, node, inner, dsel, sels, sel, sl, i, h, parts, pfns = [], p;
|
||||
// autoRendering nodes parsing -> auto-nodes
|
||||
ans = ans || (data && getAutoNodes(dom, data));
|
||||
if(data){
|
||||
// for each auto-nodes
|
||||
while(ans.length > 0){
|
||||
cspec = ans[0].cspec;
|
||||
n = ans[0].n;
|
||||
ans.splice(0, 1);
|
||||
if(cspec.t === 'str'){
|
||||
// if the target is a value
|
||||
target = gettarget(n, cspec, false);
|
||||
setsig(target, fns.length);
|
||||
fns[fns.length] = wrapquote(target.quotefn, dataselectfn(cspec.prop));
|
||||
}else{
|
||||
// if the target is a loop
|
||||
itersel = dataselectfn(cspec.sel);
|
||||
target = gettarget(n, cspec, true);
|
||||
nodes = target.nodes;
|
||||
for(j = 0, jj = nodes.length; j < jj; j++){
|
||||
node = nodes[j];
|
||||
inner = compiler(node, false, data, ans);
|
||||
fns[fns.length] = wrapquote(target.quotefn, loopfn(cspec.sel, itersel, inner));
|
||||
target.nodes = [node];
|
||||
setsig(target, fns.length - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// read directives
|
||||
for(sel in directive){
|
||||
if(directive.hasOwnProperty(sel)){
|
||||
i = 0;
|
||||
dsel = directive[sel];
|
||||
sels = sel.split(/\s*,\s*/); //allow selector separation by quotes
|
||||
sl = sels.length;
|
||||
do{
|
||||
if(typeof(dsel) === 'function' || typeof(dsel) === 'string'){
|
||||
// set the value for the node/attr
|
||||
sel = sels[i];
|
||||
target = gettarget(dom, sel, false);
|
||||
setsig(target, fns.length);
|
||||
fns[fns.length] = wrapquote(target.quotefn, dataselectfn(dsel));
|
||||
}else{
|
||||
// loop on node
|
||||
loopgen(dom, sel, dsel, fns);
|
||||
}
|
||||
}while(++i < sl);
|
||||
}
|
||||
}
|
||||
// convert node to a string
|
||||
h = outerHTML(dom);
|
||||
// IE adds an unremovable "selected, value" attribute
|
||||
// hard replace while waiting for a better solution
|
||||
h = h.replace(/<([^>]+)\s(value\=""|selected)\s?([^>]*)>/ig, "<$1 $3>");
|
||||
|
||||
// remove attribute prefix
|
||||
h = h.split(attPfx).join('');
|
||||
|
||||
// slice the html string at "Sig"
|
||||
parts = h.split( Sig );
|
||||
// for each slice add the return string of
|
||||
for(i = 1; i < parts.length; i++){
|
||||
p = parts[i];
|
||||
// part is of the form "fn-number:..." as placed there by setsig.
|
||||
pfns[i] = fns[ parseInt(p, 10) ];
|
||||
parts[i] = p.substring( p.indexOf(':') + 1 );
|
||||
}
|
||||
return concatenator(parts, pfns);
|
||||
}
|
||||
// compile the template with directive
|
||||
// if a context is passed, the autoRendering is triggered automatically
|
||||
// return a function waiting the data as argument
|
||||
function compile(directive, ctxt, template){
|
||||
var rfn = compiler( ( template || this[0] ).cloneNode(true), directive, ctxt);
|
||||
return function(context){
|
||||
return rfn({context:context});
|
||||
};
|
||||
}
|
||||
//compile with the directive as argument
|
||||
// run the template function on the context argument
|
||||
// return an HTML string
|
||||
// should replace the template and return this
|
||||
function render(ctxt, directive){
|
||||
var fn = typeof directive === 'function' && directive, i, ii;
|
||||
for(i = 0, ii = this.length; i < ii; i++){
|
||||
this[i] = replaceWith( this[i], (fn || plugins.compile( directive, false, this[i] ))( ctxt, false ));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// compile the template with autoRender
|
||||
// run the template function on the context argument
|
||||
// return an HTML string
|
||||
function autoRender(ctxt, directive){
|
||||
var fn = plugins.compile( directive, ctxt, this[0] ), i, ii;
|
||||
for(i = 0, ii = this.length; i < ii; i++){
|
||||
this[i] = replaceWith( this[i], fn( ctxt, false));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
function replaceWith(elm, html) {
|
||||
var ne,
|
||||
ep = elm.parentNode,
|
||||
depth = 0,
|
||||
tmp;
|
||||
if(!ep){ //if no parents
|
||||
ep = document.createElement('DIV');
|
||||
ep.appendChild(elm);
|
||||
}
|
||||
switch (elm.tagName) {
|
||||
case 'BODY': //thanks to milan.adamovsky@gmail.com
|
||||
ep.removeChild(elm);
|
||||
ep.innerHTML += html;
|
||||
return ep.getElementsByTagName('BODY')[0];
|
||||
case 'TBODY': case 'THEAD': case 'TFOOT':
|
||||
html = '<TABLE>' + html + '</TABLE>';
|
||||
depth = 1;
|
||||
break;
|
||||
case 'TR':
|
||||
html = '<TABLE><TBODY>' + html + '</TBODY></TABLE>';
|
||||
depth = 2;
|
||||
break;
|
||||
case 'TD': case 'TH':
|
||||
html = '<TABLE><TBODY><TR>' + html + '</TR></TBODY></TABLE>';
|
||||
depth = 3;
|
||||
break;
|
||||
case 'OPTGROUP': case 'OPTION':
|
||||
html = '<SELECT>' + html + '</SELECT>';
|
||||
depth = 1;
|
||||
break;
|
||||
}
|
||||
tmp = document.createElement('SPAN');
|
||||
tmp.style.display = 'none';
|
||||
document.body.appendChild(tmp);
|
||||
tmp.innerHTML = html;
|
||||
ne = tmp.firstChild;
|
||||
while (depth--) {
|
||||
ne = ne.firstChild;
|
||||
}
|
||||
ep.insertBefore(ne, elm);
|
||||
ep.removeChild(elm);
|
||||
document.body.removeChild(tmp);
|
||||
elm = ne;
|
||||
|
||||
ne = ep = null;
|
||||
return elm;
|
||||
}
|
||||
|
||||
return plugins;
|
||||
};
|
||||
|
||||
$p.plugins = {};
|
||||
|
||||
$p.libs = {
|
||||
dojo:function(){
|
||||
return function(n, sel){
|
||||
return dojo.query(sel, n);
|
||||
};
|
||||
},
|
||||
domassistant:function(){
|
||||
DOMAssistant.attach({
|
||||
publicMethods : [ 'compile', 'render', 'autoRender'],
|
||||
compile:function(directive, ctxt){
|
||||
return $p([this]).compile(directive, ctxt);
|
||||
},
|
||||
render:function(ctxt, directive){
|
||||
return $( $p([this]).render(ctxt, directive) )[0];
|
||||
},
|
||||
autoRender:function(ctxt, directive){
|
||||
return $( $p([this]).autoRender(ctxt, directive) )[0];
|
||||
}
|
||||
});
|
||||
return function(n, sel){
|
||||
return $(n).cssSelect(sel);
|
||||
};
|
||||
},
|
||||
ext:function(){//Thanks to Greg Steirer
|
||||
return function(n, sel){
|
||||
return Ext.query(sel, n);
|
||||
};
|
||||
},
|
||||
jquery:function(){
|
||||
jQuery.fn.extend({
|
||||
directives:function(directive){
|
||||
this._pure_d = directive; return this;
|
||||
},
|
||||
compile:function(directive, ctxt){
|
||||
return $p(this).compile(this._pure_d || directive, ctxt);
|
||||
},
|
||||
render:function(ctxt, directive){
|
||||
return jQuery( $p( this ).render( ctxt, this._pure_d || directive ) );
|
||||
},
|
||||
autoRender:function(ctxt, directive){
|
||||
return jQuery( $p( this ).autoRender( ctxt, this._pure_d || directive ) );
|
||||
}
|
||||
});
|
||||
return function(n, sel){
|
||||
return jQuery(n).find(sel);
|
||||
};
|
||||
},
|
||||
mootools:function(){
|
||||
Element.implement({
|
||||
compile:function(directive, ctxt){
|
||||
return $p(this).compile(directive, ctxt);
|
||||
},
|
||||
render:function(ctxt, directive){
|
||||
return $p([this]).render(ctxt, directive);
|
||||
},
|
||||
autoRender:function(ctxt, directive){
|
||||
return $p([this]).autoRender(ctxt, directive);
|
||||
}
|
||||
});
|
||||
return function(n, sel){
|
||||
return $(n).getElements(sel);
|
||||
};
|
||||
},
|
||||
prototype:function(){
|
||||
Element.addMethods({
|
||||
compile:function(element, directive, ctxt){
|
||||
return $p([element]).compile(directive, ctxt);
|
||||
},
|
||||
render:function(element, ctxt, directive){
|
||||
return $p([element]).render(ctxt, directive);
|
||||
},
|
||||
autoRender:function(element, ctxt, directive){
|
||||
return $p([element]).autoRender(ctxt, directive);
|
||||
}
|
||||
});
|
||||
return function(n, sel){
|
||||
n = n === document ? n.body : n;
|
||||
return typeof n === 'string' ? $$(n) : $(n).select(sel);
|
||||
};
|
||||
},
|
||||
sizzle:function(){
|
||||
return function(n, sel){
|
||||
return Sizzle(sel, n);
|
||||
};
|
||||
},
|
||||
sly:function(){
|
||||
return function(n, sel){
|
||||
return Sly(sel, n);
|
||||
};
|
||||
},
|
||||
yui:function(){ //Thanks to https://github.com/soljin
|
||||
if(typeof document.querySelector === 'undefined'){
|
||||
YUI().use("node",function(Y){
|
||||
$p.plugins.find = function(n, sel){
|
||||
return Y.NodeList.getDOMNodes(Y.one(n).all(sel));
|
||||
};
|
||||
});
|
||||
}
|
||||
YUI.add("pure-yui",function(Y){
|
||||
Y.Node.prototype.directives = function(directive){
|
||||
this._pure_d = directive; return this;
|
||||
};
|
||||
Y.Node.prototype.compile = function(directive, ctxt){
|
||||
return $p([this._node]).compile(this._pure_d || directive, ctxt);
|
||||
};
|
||||
Y.Node.prototype.render = function(ctxt, directive){
|
||||
return Y.one($p([this._node]).render(ctxt, this._pure_d || directive));
|
||||
};
|
||||
Y.Node.prototype.autoRender = function(ctxt, directive){
|
||||
return Y.one($p([this._node]).autoRender(ctxt, this._pure_d || directive));
|
||||
};
|
||||
},"0.1",{requires:["node"]});
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// get lib specifics if available
|
||||
(function(){
|
||||
var libSel,
|
||||
libkey =
|
||||
(typeof dojo !== 'undefined' && 'dojo') ||
|
||||
(typeof DOMAssistant !== 'undefined' && 'domassistant') ||
|
||||
(typeof Ext !== 'undefined' && 'ext') ||
|
||||
(typeof jQuery !== 'undefined' && 'jquery') ||
|
||||
(typeof MooTools !== 'undefined' && 'mootools') ||
|
||||
(typeof Prototype !== 'undefined' && 'prototype') ||
|
||||
(typeof Sizzle !== 'undefined' && 'sizzle') ||
|
||||
(typeof Sly !== 'undefined' && 'sly') ||
|
||||
(typeof YUI !== 'undefined' && 'yui');
|
||||
|
||||
//add library methods
|
||||
if(libkey){
|
||||
libSel = $p.libs[libkey]();
|
||||
}
|
||||
|
||||
//if no native selector available
|
||||
if( typeof document.querySelector === 'undefined' ){
|
||||
//take it from the JS lib
|
||||
if( typeof libSel === 'function' ){
|
||||
$p.plugins.find = libSel;
|
||||
//if nothing throw an error
|
||||
}else if( !libSel ){
|
||||
throw('you need a JS library with a CSS selector engine');
|
||||
}
|
||||
}
|
||||
|
||||
//for node.js
|
||||
if(typeof exports !== 'undefined'){
|
||||
exports.$p = $p;
|
||||
}
|
||||
}());
|
||||
36
ParaView-5.0.1/VTK/Web/JavaScript/Ext/pure/pure.min.js
vendored
Normal file
36
ParaView-5.0.1/VTK/Web/JavaScript/Ext/pure/pure.min.js
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
/*!
|
||||
PURE Unobtrusive Rendering Engine for HTML
|
||||
|
||||
Licensed under the MIT licenses.
|
||||
More information at: http://www.opensource.org
|
||||
|
||||
Copyright (c) 2013 Michael Cvilic - BeeBole.com
|
||||
|
||||
Thanks to Rog Peppe for the functional JS jump
|
||||
revision: 2.82
|
||||
*/
|
||||
var $p=function(){var d=arguments,e=d[0],o=false;if(typeof e==="string")o=d[1]||false;else if(e&&!e[0]&&!e.length)e=[e];return $p.core(e,o)},pure=$p;
|
||||
$p.core=function(d,e,o){function u(a){typeof console!=="undefined"&&console.log(a);throw"pure error: "+a;}function O(){var a=$p.plugins,b=function(){};b.prototype=a;b.prototype.compile=a.compile||P;b.prototype.render=a.render||Q;b.prototype.autoRender=a.autoRender||R;b.prototype.find=a.find||S;b.prototype._compiler=B;b.prototype._error=u;return new b}function G(a){return a.outerHTML||function(b){var g=document.createElement("div");g.appendChild(b.cloneNode(true));return g.innerHTML}(a)}function C(a,
|
||||
b){return function(g){return a(String(b.call(g.item||g.context,g)))}}function S(a,b){if(typeof a==="string"){b=a;a=false}return(a||document).querySelectorAll(b)}function H(a,b){return function(g){var c=[a[0]],i=a.length,h,k,l,f,n;try{for(n=1;n<i;n++){h=b[n].call(this,g);k=a[n];if(h===""){l=c[c.length-1];if((f=l.search(/[^\s]+=\"?$/))>-1){c[c.length-1]=l.substring(0,f);k=k.substr(1)}}c[c.length]=h;c[c.length]=k}return c.join("")}catch(m){if(console&&console.log)console.log(m.stack||m.message+" ("+
|
||||
m.type+(m.arguments?", "+m.arguments.join("-"):"")+"). Use Firefox or Chromium/Chrome to get a full stack of the error. ");return""}}}function T(a){var b=a.match(/^(\w+)\s*<-\s*(\S+)?$/);b===null&&u('bad loop spec: "'+a+'"');b[1]==="item"&&u('"item<-..." is a reserved word for the current running iteration.\n\nPlease choose another name for your loop.');if(!b[2]||b[2].toLowerCase()==="context")b[2]=function(g){return g.context};else if(b[2]&&b[2].indexOf("context")===0)b[2]=x(b[2].replace(/^context\.?/,
|
||||
""));return{name:b[1],sel:b[2]}}function x(a){if(typeof a==="function")return function(f){f=a.call(f.item||f.context||f,f);return!f&&f!==0?"":f};var b=a.match(/^[\da-zA-Z\$_\@][\w\$:\-]*(\.[\w\$:\-]*[^\.])*$/),g=false,c=a,i=[],h=[],k=0,l;if(b===null){if(/\'|\"/.test(c.charAt(0))){if(/\'|\"/.test(c.charAt(c.length-1))){l=c.substring(1,c.length-1);return function(){return l}}}else for(;(b=c.match(/#\{([^{}]+)\}/))!==null;){g=true;i[k++]=c.slice(0,b.index);h[k]=x(b[1]);c=c.slice(b.index+b[0].length,
|
||||
c.length)}if(!g)return function(){return a};i[k]=c;return H(i,h)}b=a.split(".");return function(f){var n=f.context||f,m=f[b[0]];f=0;var s;if(m&&typeof m.item!=="undefined"){f+=1;if(b[f]==="pos")return m.pos;n=m.item}for(m=b.length;f<m;){if(!n)break;s=n[b[f]];n=typeof s==="function"?s.call(n):s;f++}return!n&&n!==0?"":n}}function D(a,b,g){var c,i,h,k,l,f=[],n,m,s,t,r;if(typeof b==="string"){c=b;(l=b.match(I))||u("bad selector syntax: "+b);i=l[1];h=l[2];k=l[3];l=l[4];if(h==="."||!h&&k)f[0]=a;else f=
|
||||
o.find(a,h);if(!f||f.length===0)return u('The node "'+b+'" was not found in the template:\n'+G(a).replace(/\t/g," "))}else{i=b.prepend;k=b.attr;l=b.append;f=[a]}if(i||l)if(i&&l)u("append/prepend cannot take place at the same time");else if(g)u("no append/prepend/replace modifiers allowed for loop target");else l&&g&&u("cannot append with loop (sel: "+c+")");if(k){s=/^style$/i.test(k);r=(t=/^class$/i.test(k))?"className":k;n=function(j,q){j.setAttribute(J+k,q);if(j[r]&&!s)try{j[r]=""}catch(p){}if(j.nodeType===
|
||||
1){j.removeAttribute(k);t&&j.removeAttribute(r)}};m=s||t?s?function(j){return j.style.cssText}:function(j){return j.className}:function(j){return j.getAttribute(k)};a=function(j){return j.replace(/\"/g,""")};i=i?function(j,q){n(j,q+m(j))}:l?function(j,q){n(j,m(j)+q)}:function(j,q){n(j,q)}}else{i=g?function(j,q){var p=j.parentNode;if(p){p.insertBefore(document.createTextNode(q),j.nextSibling);p.removeChild(j)}else u("The template root, can't be looped.")}:i?function(j,q){j.insertBefore(document.createTextNode(q),
|
||||
j.firstChild)}:l?function(j,q){j.appendChild(document.createTextNode(q))}:function(j,q){for(;j.firstChild;)j.removeChild(j.firstChild);j.appendChild(document.createTextNode(q))};a=function(j){return j}}return{attr:k,nodes:f,set:i,sel:c,quotefn:a}}function E(a,b){var g=K+b+":",c;for(c=0;c<a.nodes.length;c++)a.set(a.nodes[c],g)}function L(a,b,g,c,i){return function(h){var k=b(h),l=h[a],f={items:k},n=0,m,s=[],t=function(j,q,p,y){var z=h.pos,v=h.item,U=h.items;h.pos=q.pos=j;h.item=q.item=k[j];h.items=
|
||||
k;if(typeof y!=="undefined")h.length=y;if(typeof p==="function"&&p.call(h.item,h)===false)n++;else{s.push(g.call(h.item,h));h.pos=z;h.item=v;h.items=U}},r;h[a]=f;if(F(k)){m=k.length||0;typeof c==="function"&&k.sort(function(j,q){return c.call(h,j,q)});for(r=0;r<m;r++)t(r,f,i,m-n)}else{k&&typeof c!=="undefined"&&u("sort is only available on arrays, not objects");for(m in k)k.hasOwnProperty(m)&&t(m,f,i)}if(typeof l!=="undefined")h[a]=l;else delete h[a];return s.join("")}}function M(a,b,g,c){var i=false,
|
||||
h,k,l,f,n;for(f in g)if(g.hasOwnProperty(f))if(f==="sort")k=g.sort;else if(f==="filter")l=g.filter;else if(i)u("cannot have more than one loop on a target");else{h=f;i=true}h||u("Error in the selector: "+b+"\nA directive action must be a string, a function or a loop(<-)");i=g[h];if(typeof i==="string"||typeof i==="function"){g={};g[h]={root:i};return M(a,b,g,c)}g=T(h);h=x(g.sel);a=D(a,b,true);b=a.nodes;for(w=0;w<b.length;w++){f=b[w];n=B(f,i);c[c.length]=C(a.quotefn,L(g.name,h,n,k,l));a.nodes=[f];
|
||||
E(a,c.length-1)}return a}function V(a,b){function g(j,q){var p=j.match(I);p={prepend:!!p[1],prop:p[2],attr:p[3]||W[q],append:!!p[4],sel:j};var y,z,v;for(y=h.a.length-1;y>=0;y--){z=h.a[y];v=(v=z.l[0])&&v[p.prop];if(typeof v!=="undefined"){p.prop=z.p+"."+p.prop;if(h.l[p.prop]===true)v=v[0];break}}if(typeof v==="undefined"){v=x(p.prop)(F(b)?b[0]:b);if(v==="")return false}if(F(v)){h.a.push({l:v,p:p.prop});h.l[p.prop]=true;p.t="loop"}else p.t="str";return p}var c=a.getElementsByTagName("*"),i=[],h={a:[],
|
||||
l:{}},k,l,f,n,m,s,t,r;f=-1;for(n=c.length;f<n;f++){t=f>-1?c[f]:a;if(t.nodeType===1&&t.className!==""){r=t.className.split(" ");m=0;for(s=r.length;m<s;m++){k=r[m];k=g(k,t.tagName);if(k!==false){l=/nodevalue/i.test(k.attr);if(k.sel.indexOf("@")>-1||l){t.className=t.className.replace("@"+k.attr,"");if(l)k.attr=false}i.push({n:t,cspec:k})}}}}return i}function B(a,b,g,c){var i=[],h,k,l,f,n,m,s,t,r,j=[];c=c||g&&V(a,g);if(g)for(;c.length>0;){l=c[0].cspec;f=c[0].n;c.splice(0,1);if(l.t==="str"){f=D(f,l,false);
|
||||
E(f,i.length);i[i.length]=C(f.quotefn,x(l.prop))}else{m=x(l.sel);f=D(f,l,true);n=f.nodes;h=0;for(k=n.length;h<k;h++){s=n[h];t=B(s,false,g,c);i[i.length]=C(f.quotefn,L(l.sel,m,t));f.nodes=[s];E(f,i.length-1)}}}for(r in b)if(b.hasOwnProperty(r)){g=0;c=b[r];l=r.split(/\s*,\s*/);m=l.length;do if(typeof c==="function"||typeof c==="string"){r=l[g];f=D(a,r,false);E(f,i.length);i[i.length]=C(f.quotefn,x(c))}else M(a,r,c,i);while(++g<m)}a=G(a);a=a.replace(/<([^>]+)\s(value\=""|selected)\s?([^>]*)>/ig,"<$1 $3>");
|
||||
a=a.split(J).join("");a=a.split(K);for(g=1;g<a.length;g++){b=a[g];j[g]=i[parseInt(b,10)];a[g]=b.substring(b.indexOf(":")+1)}return H(a,j)}function P(a,b,g){var c=B((g||this[0]).cloneNode(true),a,b);return function(i){return c({context:i})}}function Q(a,b){var g=typeof b==="function"&&b,c,i;c=0;for(i=this.length;c<i;c++)this[c]=N(this[c],(g||o.compile(b,false,this[c]))(a,false));return this}function R(a,b){var g=o.compile(b,a,this[0]),c,i;c=0;for(i=this.length;c<i;c++)this[c]=N(this[c],g(a,false));
|
||||
return this}function N(a,b){var g,c=a.parentNode,i=0,h;if(!c){c=document.createElement("DIV");c.appendChild(a)}switch(a.tagName){case "BODY":c.removeChild(a);c.innerHTML+=b;return c.getElementsByTagName("BODY")[0];case "TBODY":case "THEAD":case "TFOOT":b="<TABLE>"+b+"</TABLE>";i=1;break;case "TR":b="<TABLE><TBODY>"+b+"</TBODY></TABLE>";i=2;break;case "TD":case "TH":b="<TABLE><TBODY><TR>"+b+"</TR></TBODY></TABLE>";i=3;break;case "OPTGROUP":case "OPTION":b="<SELECT>"+b+"</SELECT>";i=1;break}h=document.createElement("SPAN");
|
||||
h.style.display="none";document.body.appendChild(h);h.innerHTML=b;for(g=h.firstChild;i--;)g=g.firstChild;c.insertBefore(g,a);c.removeChild(a);document.body.removeChild(h);return a=g}var A=[],w,K="_s"+Math.floor(Math.random()*1E6)+"_",J="_a"+Math.floor(Math.random()*1E6)+"_",I=/^(\+)?([^\@\+]+)?\@?([^\+]+)?(\+)?$/,W={IMG:"src",INPUT:"value"},F=Array.isArray?function(a){return Array.isArray(a)}:function(a){return Object.prototype.toString.call(a)==="[object Array]"};o=o||O();switch(typeof d){case "string":A=
|
||||
o.find(e||document,d);A.length===0&&u('The template "'+d+'" was not found');break;case "undefined":u("The root of the template is undefined, check your selector");break;default:A=d}w=0;for(d=A.length;w<d;w++)o[w]=A[w];o.length=d;return o};$p.plugins={};
|
||||
$p.libs={dojo:function(){return function(d,e){return dojo.query(e,d)}},domassistant:function(){DOMAssistant.attach({publicMethods:["compile","render","autoRender"],compile:function(d,e){return $p([this]).compile(d,e)},render:function(d,e){return $($p([this]).render(d,e))[0]},autoRender:function(d,e){return $($p([this]).autoRender(d,e))[0]}});return function(d,e){return $(d).cssSelect(e)}},ext:function(){return function(d,e){return Ext.query(e,d)}},jquery:function(){jQuery.fn.extend({directives:function(d){this._pure_d=
|
||||
d;return this},compile:function(d,e){return $p(this).compile(this._pure_d||d,e)},render:function(d,e){return jQuery($p(this).render(d,this._pure_d||e))},autoRender:function(d,e){return jQuery($p(this).autoRender(d,this._pure_d||e))}});return function(d,e){return jQuery(d).find(e)}},mootools:function(){Element.implement({compile:function(d,e){return $p(this).compile(d,e)},render:function(d,e){return $p([this]).render(d,e)},autoRender:function(d,e){return $p([this]).autoRender(d,e)}});return function(d,
|
||||
e){return $(d).getElements(e)}},prototype:function(){Element.addMethods({compile:function(d,e,o){return $p([d]).compile(e,o)},render:function(d,e,o){return $p([d]).render(e,o)},autoRender:function(d,e,o){return $p([d]).autoRender(e,o)}});return function(d,e){d=d===document?d.body:d;return typeof d==="string"?$$(d):$(d).select(e)}},sizzle:function(){return function(d,e){return Sizzle(e,d)}},sly:function(){return function(d,e){return Sly(e,d)}},yui:function(){typeof document.querySelector==="undefined"&&
|
||||
YUI().use("node",function(d){$p.plugins.find=function(e,o){return d.NodeList.getDOMNodes(d.one(e).all(o))}});YUI.add("pure-yui",function(d){d.Node.prototype.directives=function(e){this._pure_d=e;return this};d.Node.prototype.compile=function(e,o){return $p([this._node]).compile(this._pure_d||e,o)};d.Node.prototype.render=function(e,o){return d.one($p([this._node]).render(e,this._pure_d||o))};d.Node.prototype.autoRender=function(e,o){return d.one($p([this._node]).autoRender(e,this._pure_d||o))}},"0.1",
|
||||
{requires:["node"]});return true}};
|
||||
(function(){var d,e=typeof dojo!=="undefined"&&"dojo"||typeof DOMAssistant!=="undefined"&&"domassistant"||typeof Ext!=="undefined"&&"ext"||typeof jQuery!=="undefined"&&"jquery"||typeof MooTools!=="undefined"&&"mootools"||typeof Prototype!=="undefined"&&"prototype"||typeof Sizzle!=="undefined"&&"sizzle"||typeof Sly!=="undefined"&&"sly"||typeof YUI!=="undefined"&&"yui";if(e)d=$p.libs[e]();if(typeof document.querySelector==="undefined")if(typeof d==="function")$p.plugins.find=d;else if(!d)throw"you need a JS library with a CSS selector engine";
|
||||
if(typeof exports!=="undefined")exports.$p=$p})();
|
||||
Reference in New Issue
Block a user