/*
* this is just a stub file to include various other scripts
*/
/* usapi/_core.js
* Author : Sven Kayser
* Copyright : (c) 2013 urbanstudio GmbH, Berlin
* Version dev150522
*
* Implements the core tool set for the usapi
*
*
* IE 9.0 and up
* FF 4.0 and up
* Chrome 10 and up
* Safari (Mac) 5.0 and up
* Opera 15.0 and up
*
* Older browser MAY be supported, but not explicitly
*
*/
var U = function(expr){
};
var USAPI = U;
U.internalObjectCounter=0;
U.cfg = {
"names" : {
"systemlogohtml" : "EBP·CMS",
"systemtitle" : "EBP",
"loginlogohtml" : "EBP·CMS"
},
"tiny" : {
"textcolor" : {
"colors" : "000000,005389,336DA1,1F9ADC,FF7A00,999900,CC0066,333333,666666,999999,CCCCCC",
"showColorpicker" : false
},
"fontsizes" : "8px,10px,12px,14px,16px,18px,20px,22px,24px,36px"
},
"system" : {
"platformcycle" : 40,
"cdn" : "https://cdn.eschenbach-partner.com",
"sass" : false,
"jscc" : {
"us_systax_extension" : true,
"closure_optimisation" : false,
"ecma6_compatibility_layer" : false
},
"admin" : {
"js" : ["admin","usapi","x-tag","jquery","jquery/migrate","jquery/ui","jquery/timepicker","jquery/datepicker","jquery/uniform"],
"css" : ["/admin/lib/admin.css","/admin/lib/uniform.default.css","/lib/jquery/smoothness_jquery-ui_1.9.1.css","/lib/jquery/timepicker/jquery-ui-timepicker-addon.css","/tools/sass/sass.php?cssfile=lib/usapi"],
"dateformat" : "d.m.Y",
"timeformat" : "h:i:s"
},
"html" : {
"js" : ["admin","usapi","jquery","jquery/migrate","jquery/ui","jquery/timepicker","jquery/datepicker","jquery/uniform"],
"css" : ["/admin/lib/uniform.default.css","/lib/jquery/smoothness_jquery-ui_1.9.1.css","/lib/jquery/timepicker/jquery-ui-timepicker-addon.css","/lib/usapi.css.php"],
"dateformat" : "d.m.Y",
"timeformat" : "h:i:s"
},
"registeredJS" : {
"tinymce" : {"js":"/lib/tinymce/jscripts/tiny_mce/tiny_mce_src.js","token":"tinymce","dep":["jquery"]},
"masonry" : {"js":"/lib/jquery/masonry.pkgd.min.js","token":"masonry","dep":["jquery"]},
"date.format" : {"js":"/lib/js/date.format.js","token":"date.format"},
"jquery/elastic" : {"js":"/lib/jquery/jquery.elastic.js", "token":"jquery/elastic","dep":["jquery"]},
"usapi/mediaselector" : {"js":"/lib/usapi/mediaselector.js", "token":"usapi/mediaselector","dep":["usapi"]},
"usapi/docselector" : {"js":"/lib/usapi/docselector.js", "token":"usapi/docselector","dep":["usapi"]},
"admin" : {"js":"/admin/lib/admin.js","token":"usapi/admin","dep":["usapi"]},
"x-tag" : {"js":"/lib/js/x-tag-components.js","token":"x-tag"},
"jquery" : {"js":"/lib/jquery/jquery-1.11.3.min.js","token":"jquery"},
"jquery/ui" : {"js":"/lib/jquery/jquery-ui-1.9.1.js","token":"jquery/ui","dep":["jquery"]},
"jquery/migrate" : {"js":"/lib/jquery/jquery-migrate-1.2.1.min.js","token":"jquery/migrate","dep":["jquery"]},
"jquery/timepicker" : {"js":"/lib/jquery/timepicker/jquery-ui-timepicker-addon.js","token":"jquery/timepicker","dep":["jquery","jquery/ui","jquery/datepicker" ]},
"jquery/datepicker" : {"js":"/lib/jquery/timepicker/jquery.ui.datepicker-de.js","token":"jquery/datepicker","dep":["jquery","jquery/ui"]},
"jquery/uniform" : {"js":"/admin/lib/jquery.uniform.min.js","token":"jquery/uniform","dep":["jquery","jquery/ui"]},
"usapi_frontend" : {"js":"/lib/usapi.js","token":"usapi","dep":["jquery"]},
"usapi" : {"js":"/admin/lib/usapi.js","token":"usapi","dep":["jquery"]},
"traceur" : {"js":"/lib/js/traceur-runtime.js","token":"traceur"},
"observe" : {"js":"/lib/js/observe.js","token":"observe"}
},
"palette" : ["CC0066","005389","336DA1","1F9ADC","FF7A00","999900","000000","333333","666666","999999","CCCCCC","FFFFFF"]
},
"mediathek" : {
"title" : "EBP · Mediathek",
"logohtml" : "EBP·Mediathek",
"extTypes" : {
"png" : "image",
"jpg" : "image",
"jpeg" : "image",
"gif" : "image",
"tiff" : "image",
"dcm" : "dicom",
"pdf" : "pdf",
"avi" : "video",
"mp4" : "video",
"wmv" : "video",
"m4v" : "video",
"mp3" : "audio",
"wav" : "audio",
"ogg" : "audio",
"doc" : "word",
"docx" : "word",
"xls" : "excel",
"xlsx" : "excel",
"ppt" : "powerpoint",
"pptx" : "powerpoint",
"txt" : "text",
"zip" : "archive"
},
"supportedTypes" : {
"image" : "Bilder",
"link" : "Links",
"videolink" : "Youtube-Links",
"video" : "Videos",
"audio" : "Audiodatein",
"word" : "Word",
"powerpoint" : "Powerpoint",
"excel" : "Excel",
"text" : "Text-Dateien",
"pdf" : "PDF",
"archive" : "ZIP-Dateien",
"dicom" : "Dicom"
},
"singleTypes" : {
"image" : "Bild",
"link" : "Link",
"videolink" : "Youtube-Link",
"video" : "Video",
"audio" : "Audiodatei",
"word" : "Word",
"powerpoint" : "Powerpoint",
"excel" : "Excel",
"text" : "Text-Datei",
"pdf" : "PDF",
"archive" : "ZIP-Datei",
"dicom" : "Dicom"
},
"pseudo" : {
"image" : "image",
"link" : "link",
"videolink" : "videolink",
"video" : "video",
"audio" : "audio",
"word" : "document",
"powerpoint" : "document",
"excel" : "document",
"text" : "document",
"pdf" : "document",
"dicom" : "document",
"archive" : "archive"
}
},
"mods" : {
"workgroups" : {
"custom_document_type_name" : "EBP",
"custom_document_type" : "ebp"
}
},
"lc" : {
"mod" : {
"text" : {
"edit_footer" : "Einfügen und kopieren über STRG+V und STRG+C. Elemente Doppelklicken um zu bearbeiten"
}
},
"mediathek" : {
"dialog" : {
"update_link" : "Sie haben diesen Link verändert. Die Daten zu Ihrem Link werden daher neu ausgelesen."
}
}
}
}
;
U.conf = U.cfg;
/* U.ready stack
* Mimics jQuerys $.ready()
*/
U.ready = function(cb,context)
{
if(document.readyState === "complete") cb.call(context || window);
else U.ready.stack.push({cb:cb,context:context||window});
}
U.ready.stack = [];
U.ready.eventcb = function(){
for(var n in U.ready.stack) U.ready.stack[n].cb.call(U.ready.stack[n].context);
document.removeEventListener("DOMContentLoaded",U.ready.eventcb);
};
U.ready.eventcb_legacy = function(){
for(var n in U.ready.stack) U.ready.stack[n].cb.call(U.ready.stack[n].context);
document.detachEvent("onreadystatechange", U.ready.eventcb_legacy);
};
if(document.addEventListener) document.addEventListener("DOMContentLoaded",U.ready.eventcb); else
if(document.attachEvent) document.attachEvent("onreadystatechange", U.ready.eventcb_legacy);
/* U.ready stack end */
U.objectFactory = new (function(){
var registeredObjects= [];
var classes= {};
classes.std = function(of,parent){
this.uid = Math.floor(Math.random()*100000000)+"-"+U.internalObjectCounter++;
registeredObjects[this.uid] = this;
var initialize;Object.defineProperty(this,'initialize',{enumerable:true,get:function(){return initialize;}});initialize= function()
{
if(isDef(parent.initialize)) parent.initialize.call(this);
}
var destroy;Object.defineProperty(this,'destroy',{enumerable:true,get:function(){return destroy;}});destroy= function()
{
U.log('destroy proto');
if(isDef(parent.destroy)) parent.destroy.call(this);
}
}
var registerClass;Object.defineProperty(this,'registerClass',{enumerable:true,get:function(){return registerClass;}});registerClass= function(classname,constructor)
{
if(isDef(classes[classname])) U.exception('usapi/objectFactory/registerClass:')
}
var create;Object.defineProperty(this,'create',{enumerable:true,get:function(){return create;}});create= function(o,classname)
{
if(!isDef(classname)) classname = "std";
return U.merge(new classes[classname](this,o),o);
}
});
U.O = U.objectFactory;
U.platform = new (function(){
var performance;Object.defineProperty(this,'performance',{enumerable:true,get:function(){return performance;}});performance= 0;
var performance_mean;Object.defineProperty(this,'performance_mean',{enumerable:true,get:function(){return performance_mean;}});performance_mean= 0;
var perfx= 0;
var tickcounter= 0;
var entries= [];
var ids= 0;
var cycle= function()
{
var start = window.performance.now();
tickcounter++;
for(var n in entries)
{
var entry = entries[n];
if(entry.skip > entry.step) entry.step++;
else
{
entry.step = 0;
entry.cb.call(entry.target);
}
}
var end = window.performance.now();
perfx += (end-start);
if(tickcounter==25)
{
performance = Math.floor((perfx/25)*1000);
performance_mean = (performance_mean+performance)/2;
perfx = 0;
tickcounter=0;
}
}
var cyclelength= U.conf.system.platformcycle;
var interval= window.setInterval(cycle,cyclelength);
var add;Object.defineProperty(this,'add',{enumerable:true,get:function(){return add;},set:function(val){ add=val}});add= function(cb,skip,target)
{
if(!skip)skip=0;
if(!target)target=window;
entries[ids]={cb:cb,skip:skip,step:0,target:target};
return ids++;
}
var remove;Object.defineProperty(this,'remove',{enumerable:true,get:function(){return remove;},set:function(val){ remove=val}});remove= function(entry)
{
}
})
U.explain = function(eid)
{
console.log('explain');
}
// Function.prototype.explain = function(){U.explain(this.eid)}
// Object.prototype.explain = function(){U.explain(this.eid)}
U.xelements = [];
// For those that still run InternetExploDer 8 or below
if(!window.console) window.console = function(){};
var isDef = function(variable)
{
return typeof(variable) != "undefined";
}
U.isDef = isDef;
U.log = function(m)
{
if(console && console.timeStamp) console.timeStamp(m);
}
U.log.eid = "usapi/log";
U.registerElement = function(tag,opts)
{
if(U.xelements.indexOf(tag) == -1)
{
U.xelements.push(tag);
document.register(tag,opts);
}
}
U.registerElement.eid = "usapi:registerElement";
U.go = function(to)
{
var doit = true;
if(U.softlink && U.softlink.isInitialized())
{
doit = U.softlink.ongo(to);
}
if(doit)location.href = to;
}
U.go.eid = "usapi/go";
U.exception = function(m)
{
this.message = m;
this.name = "USAPI Exception";
this.toString = function(){return this.name+": "+m}
}
U.exception.eid = "usapi:U_exception";
U.depJS = function(token)
{
if(!isDef(U.cfg.system.registeredJS)) throw new U.exception('No Javascript Modules registered. Check config.json');
if(!isDef(U.cfg.system[apptype])) U.cfg.system[apptype] = {};
if(!isDef(U.cfg.system[apptype].js)) U.cfg.system[apptype].js = [];
var regJS = U.cfg.system.registeredJS;
var loadedJS = U.cfg.system[apptype].js;
if(loadedJS.indexOf(token) < 0)
{
if(isDef(regJS[token]))
{
if(isDef(regJS[token].dep)) for(var n in regJS[token].dep) U.depJS(regJS[token].dep[n]);
if(U.loadJS(regJS[token].js))
{
U.cfg.system[apptype].js.push(token);
} else throw new Error('Failed to load ' + token);
} else {
if(U.loadJS(token))
{
U.cfg.system[apptype].js.push(token);
} else throw new Error('Failed to load ' + token);
}
} else return true;
}
U.depJS.eid = "usapi/depJS";
U.loadJS = function(js)
{
if(!(js.startsWith('http://') || js.startsWith('https://')) )
{
var xhr = new XMLHttpRequest();
xhr.open('GET',js,false);
xhr.send();
if(xhr.status === 200)
{
eval(xhr.responseText);return true;
} else return false;
}
}
U.loadJS.eid = "usapi/loadJS";
U.loadCSS = function(css,sy)
{
if(!U.isDef(sy)) sy = false;
if(!document.getElementById('dynstyle_' + css))
{
var xhr = new XMLHttpRequest();
xhr.open('GET',css,!sy);
if(!sy) xhr.onload = function(e)
{
if(xhr.readyState === 4)
{
if(xhr.status === 200)
{
var dynStyle = document.createElement('style');
dynStyle.innerHTML = xhr.responseText;
dynStyle.setAttribute('id','dynstyle_' + css);
document.getElementsByTagName('HEAD')[0].appendChild(dynStyle);
}
}
}
xhr.send();
if(sy && xhr.status == 200)
{
var dynStyle = document.createElement('style');
dynStyle.innerHTML = xhr.responseText;
dynStyle.setAttribute('id','dynstyle_' + css);
document.getElementsByTagName('HEAD')[0].appendChild(dynStyle);
}
}
}
U.loadCSS.eid = "usapi/loadCSS";
jQuery.fn.gap = function(side) {
var gap = 0;
var el = $(this[0]);
gap += parseInt(el.css('padding-' + side));
gap += parseInt(el.css('margin-' + side));
gap += parseInt(el.css('border-' + side + '-width'));
return(gap);
};
jQuery.fn.fullscreen = function()
{
var node = $(this[0])[0];
if (node.requestFullScreen)
{
if (!document.fullScreen)
{
node.requestFullscreen();
$(node).addClass('fullscreen');
} else {
document.exitFullScreen();
$(node).removeClass('fullscreen');
}
}
else if (node.mozRequestFullScreen)
{
if (!document.mozFullScreen)
{
node.mozRequestFullScreen();
$(node).addClass('fullscreen');
} else {
document.mozCancelFullScreen();
$(node).removeClass('fullscreen');
}
}
else if (node.webkitRequestFullScreen)
{
if (!document.webkitIsFullScreen)
{
node.webkitRequestFullScreen();
$(node).addClass('fullscreen');
} else {
document.webkitCancelFullScreen();
$(node).removeClass('fullscreen');
}
}
}
U.merge = function(){
for(var c=1; c= Math.pow(2,signedwidth-1)) ? dec - Math.pow(2,signedwidth) : dec;
else return dec;
}
U.hex2dec.eid = "usapi/hex2dec";
U.color = function(red,green,blue,alpha)
{
if(!U.isDef(alpha)) this.alpha = 100; else this.alpha = alpha;
if(red.length==6 || red.length==7)
{
//parse as HEX
if(red.length==6)
{
if(parseInt(red,16) == "NaN") throw new U.exception("usapi/color: hexdecimal value malformed: "+red);
this.red = parseInt(red.substring(0,2),16);
this.green = parseInt(red.substring(2,4),16);
this.blue = parseInt(red.substring(4,6),16);
} else if (red.length==7 && red.substring(0,1)=="#")
{
if(parseInt(red.substring(1),16) == "NaN") throw new U.exception("usapi/color: hexdecimal value malformed: "+red);
this.red = parseInt(red.substring(1,3),16);
this.green = parseInt(red.substring(3,5),16);
this.blue = parseInt(red.substring(5,7),16);
} else throw new U.exception("usapi/color: hexdecimal value malformed: "+red);
} else {
if(U.isDef(red) && U.isDef(green) && !U.isDef(blue))
{
// parse as HSL
var hue = red;
var light = green;
var limit = function(hue)
{
while(hue < 0) hue +=360;
while(hue >= 360) hue -=360;
hue-=180;if(hue<0)hue*=-1;
return Math.round(Math.min((Math.max(hue-60,0)/1.20)*2,100)*2.56);
}
var bred;
var bgreen;
var bblue;
if(light > 100) light=100;
if(light <=50){
var blackblend = light/50;
bred = Math.round(limit(hue)*blackblend);
bgreen = Math.round(limit(hue-120)*blackblend);
bblue = Math.round(limit(hue-240)*blackblend);
} else {
var whiteblend = (light-50)/50;
bred = limit(hue);
bgreen = limit(hue-120);
bblue = limit(hue-240);
bred = Math.round(bred + (256-bred)*(whiteblend));
bgreen = Math.round(bgreen + (256-bgreen)*(whiteblend));
bblue = Math.round(bblue + (256-bblue)*(whiteblend));
}
bred = Math.min(bred,255);
bgreen = Math.min(bgreen,255);
bblue = Math.min(bblue,255);
this.red = bred;
this.green = bgreen;
this.blue = bblue;
} else {
//parse as RGB
this.red = red;
this.green = green;
this.blue = blue;
}
}
var toCSS;Object.defineProperty(this,'toCSS',{enumerable:true,get:function(){return toCSS;},set:function(val){ toCSS=val}});toCSS= function()
{
if(this.alpha < 100) return "rgba("+Math.round(this.red)+","+Math.round(this.green)+","+Math.round(this.blue)+","+Math.round(this.alpha)/100+")";
else return "rgb("+Math.round(this.red)+","+Math.round(this.green)+","+Math.round(this.blue)+")";
}
var toHex;Object.defineProperty(this,'toHex',{enumerable:true,get:function(){return toHex;},set:function(val){ toHex=val}});toHex= function(includesharp)
{
var sharp = "";
if(includesharp)
{
sharp = "#";
}
if(this.alpha = 100)
{
var hred = Math.round(this.red).toString(16);
var hgreen = Math.round(this.green).toString(16);
var hblue = Math.round(this.blue).toString(16);
if(hred.length==1) hred = "0".concat(hred);
if(hgreen.length==1) hgreen = "0".concat(hgreen);
if(hblue.length==1) hblue = "0".concat(hblue);
return sharp+hred+hgreen+hblue;
}
else throw new U.exception('usapi/color: cannot convert color with alpha channel to hex');
}
var brightness;Object.defineProperty(this,'brightness',{enumerable:true,get:function(){return brightness;},set:function(val){ brightness=val}});brightness= function(amount)
{
if(amount>0)
{
this.red = this.red + (this.red -256)*(-1)*(amount/100);
this.green = this.green + (this.green-256)*(-1)*(amount/100);
this.blue = this.blue + (this.blue -256)*(-1)*(amount/100);
} else {
this.red = this.red * (1-(amount/100)*(-1));
this.green = this.green * (1-(amount/100)*(-1));
this.blue = this.blue * (1-(amount/100)*(-1));
}
}
var contrast;Object.defineProperty(this,'contrast',{enumerable:true,get:function(){return contrast;},set:function(val){ contrast=val}});contrast= function(amount)
{
throw new U.exception('usapi/color: NYI');
}
}
U.storage = function(name,value)
{
if(isDef(value))
{
localStorage.setItem("ustorage_"+name,JSON.stringify(value));
return value;
} else {
return JSON.parse(localStorage.getItem(name));
}
}
U.storage.bind = function(name,storageskip)
{
if(!storageskip) storageskip = 24;
var binderObject = {};
binderObject = U.storage(name);
if(!binderObject) binderObject = {};
U.platform.add(function(){
U.storage(name,binderObject);
},storageskip);
return binderObject;
}
var ajax = (function()
{
var ajaxproto = function(uri)
{
var self = this;
var async = true;
var mode = "plain";
var cb = function(){};
var method = "post";
var query = null;
var execute= function()
{
var xhr = new XMLHttpRequest();
var params = [];
if(mode == "plain")
{
for(var n in query) params.push(n + "=" + query[n]);
params = params.join("&");
} else
if(mode == "json")
{
params = {transfer:"json",data:JSON.stringigy(query)}; params = params.join("&");
}
if(async==true) xhr.onreadystatechange=function()
{
if(xhr.readyState == 4 && xhr.status==200) cb(xhr.responseText,xhr);
}
if(method == "post")
{
xhr.open(method,uri,async);
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.send(params);
} else {
xhr.open(method,uri+"?"+params,async); xhr.send();
}
if(async==false) cb(xhr.responseText,xhr);
if(async=="rpc") return cb(xhr.responseText,xhr);
}
var json;Object.defineProperty(this,'json',{enumerable:true,get:function(){return json;},set:function(val){ json=val}});json= function() { mode="json"; return self; }
var plain;Object.defineProperty(this,'plain',{enumerable:true,get:function(){return plain;},set:function(val){ plain=val}});plain= function() { mode="plain"; return self; }
var sync;Object.defineProperty(this,'sync',{enumerable:true,get:function(){return sync;},set:function(val){ sync=val}});sync= function(rcb) { async = false; cb=rcb; execute(); }
var async;Object.defineProperty(this,'async',{enumerable:true,get:function(){return async;},set:function(val){ async=val}});async= function(rcb) { async = true; cb=rcb; execute(); }
var rcp;Object.defineProperty(this,'rcp',{enumerable:true,get:function(){return rcp;},set:function(val){ rcp=val}});rcp= function(rcb) { async = false; cb=rcb; return execute(); }
var post;Object.defineProperty(this,'post',{enumerable:true,get:function(){return post;},set:function(val){ post=val}});post= function(values) { method = "post"; query=values; return self; }
var get;Object.defineProperty(this,'get',{enumerable:true,get:function(){return get;},set:function(val){ get=val}});get= function(values) { method = "get"; query=values; return self; }
}
U.ajax = function(uri)
{
if(uri) return new ajaxproto(uri); else throw new U.exception('usapi/ajax: URI required');
}
U.post = function()
{
var uri = "";
var query = {};
var cb = function(){};
for(var n in arguments)
{
if(typeof arguments[n] == "string") uri = arguments[n];
if(typeof arguments[n] == "function") cb = arguments[n];
if(typeof arguments[n] == "object") query = arguments[n];
}
U.ajax(uri).post(query).async(cb);
}
U.get = function()
{
var uri = "";
var query = {};
var cb = function(){};
for(var n in arguments)
{
if(typeof arguments[n] == "string") uri = arguments[n];
if(typeof arguments[n] == "function") cb = arguments[n];
if(typeof arguments[n] == "object") query = arguments[n];
}
U.ajax(uri).get(query).async(cb);
}
U.postSync = function()
{
var uri = "";
var query = {};
var cb = function(){};
for(var n in arguments)
{
if(typeof arguments[n] == "string") uri = arguments[n];
if(typeof arguments[n] == "function") cb = arguments[n];
if(typeof arguments[n] == "object") query = arguments[n];
}
U.ajax(uri).post(query).sync(cb);
}
U.getSync = function()
{
var uri = "";
var query = {};
var cb = function(){};
for(var n in arguments)
{
if(typeof arguments[n] == "string") uri = arguments[n];
if(typeof arguments[n] == "function") cb = arguments[n];
if(typeof arguments[n] == "object") query = arguments[n];
}
U.ajax(uri).get(query).sync(cb);
}
U.rpc = function()
{
}
})(U);
;
/*
* DOMinize.js
* Author : Sven Kayser
* Copyright : (c) 2013 urbanstudio GmbH, Berlin
*
* DOMinize.js subsequently aims to implement new features of the W3C-DOM, even in older browsers in standard W3C-syntax, instead of approaching implementing
* a heavyweight framework like jQuery or prototype.js. Because of this missing methods and properties are directly hooked into the prototypes. Routing
* and using native code as much as possible is highly emphazised. Bottomline this is not to create new usuabilty at all - just to implement missing
* things defined in the standard.
*
*
* IE 9.0 and up
* FF 4.0 and up
* Chrome 10 and up
* Safari (Mac) 5.0 and up
* Opera 15.0 and up
*
* Older browser MAY be supported, but not explicitly
*
*/
// Element.matches()
if(!Element.prototype.matches) // it exists? Great. (It will sometime in the future)
{
if(Element.prototype.msMatchesSelector) Element.prototype.matches = Element.prototype.msMatchSelector; else
if(Element.prototype.mozMatchesSelector) Element.prototype.matches = Element.prototype.mozMatchesSelector; else
if(Element.prototype.webkitMatchesSelector) Element.prototype.matches = Element.prototype.webkitMatchesSelector; else
{
}
}
if(!String.prototype.contains){String.prototype.contains = function(x){return this.indexOf(x) != -1};}
if (typeof String.prototype.startsWith != 'function') {
// see below for better implementation!
String.prototype.startsWith = function (str){
return this.indexOf(str) == 0;
};
}
U.delay = new (function(){
var delaystack= [];
var reset;Object.defineProperty(this,'reset',{enumerable:true,get:function(){return reset;}});reset= function(f,delay)
{
var timeout;
if(typeof(f) == "number" && delaystack[f])
{
window.clearTimeout(f);
timeout = window.setTimeout(delaystack[f],delay);
delaystack[delaystack[f].toString()] = timeout;
delaystack[timeout] = delaystack[f];
}
else if(typeof(f) == "function")
{
window.clearTimeout(delaystack[f.toString()]);
timeout = window.setTimeout(f,delay);
delaystack[f.toString()] = timeout;
delaystack[timeout] = f;
}
return timeout;
}
var set;Object.defineProperty(this,'set',{enumerable:true,get:function(){return set;}});set= function(f,delay)
{
if(typeof(f) == "number" && delaystack[f])
{
timeout = window.setTimeout(delaystack[f],delay);
delaystack[delaystack[f].toString()] = timeout;
delaystack[timeout] = delaystack[f];
}
else if(typeof(f) == "function")
{
timeout = window.setTimeout(f,delay);
delaystack[f.toString()] = timeout;
delaystack[timeout] = f;
}
return timeout;
}
var setHandler;Object.defineProperty(this,'setHandler',{enumerable:true,get:function(){return setHandler;}});setHandler= function(f,delay)
{
var timeout;
return function(e){
var context = this;
var ev = e;
timeout = window.setTimeout(function(){
f.call(context,ev);
},delay);
delaystack[f.toString()] = timeout;
delaystack[timeout] = f;
}
}
var resetHandler;Object.defineProperty(this,'resetHandler',{enumerable:true,get:function(){return resetHandler;}});resetHandler= function(f,delay)
{
var timeout;
return function(e){
var context = this;
var ev = e;
window.clearTimeout(delaystack[f.toString()]);
timeout = window.setTimeout(function(){
f.call(context,ev);
},delay);
delaystack[f.toString()] = timeout;
delaystack[timeout] = f;
}
}
var clear;Object.defineProperty(this,'clear',{enumerable:true,get:function(){return clear;}});clear= function(f)
{
if(typeof(f) == "number" && delaystack[f])
{
window.clearTimeout(f);
}
else if(typeof(f) == "function")
{
window.clearTimeout(delaystack[f.toString()]);
}
return timeout;
}
})();;
/**
* @author sven kayser (c) Copyright 2015 urban studio. All Rights Reserved.
* rev 150210
*
* dependency jquery, usapi
*
*/
U.coor = function(x,y)
{
var self = this;
self.posx = x || 0;
self.posy = y || 0;
self.movex = 0;
self.movey = 0;
self.X = function()
{
if(typeof(arguments[0]) == "number")
{
var newx = arguments[0];
self.movex = newx - self.posx;
self.posx = newx;
}
return self.posx;
}
self.Y = function()
{
if(typeof(arguments[0]) == "number")
{
var newy = arguments[0];
self.movey = newy - self.posy;
self.posy = newy;
}
return self.posy;
}
self.vec = function(coordinate)
{
var newx = coordinate.posx - self.posx;
var newy = coordinate.posy - self.posy;
var newcoor = new U.coor(newx,newy);
return newcoor;
}
self.add = function(coordinate)
{
var newx = coordinate.posx + self.posx;
var newy = coordinate.posy + self.posy;
var newcoor = new U.coor(newx,newy);
return newcoor;
}
self.clone = function()
{
return new U.coor(self.posx,self.posy);
}
return self;
}
U.mouse = new (function(){
var self = this;
var themouse = this;
var onProto = function(condition,func,opts)
{
var self = this;
opts = opts || {};
if(typeof(opts.mode) == "undefined") opts.mode = "AND";
self.mode = opts.mode;
if(typeof(opts.elements) == "undefined") opts.elements = false;
else
{
if(!opts.elements.length) opts.elements = [opts.elements];
}
if(opts.elements.jquery) opts.elements = opts.elements.get();
self.elements = opts.elements;
if(condition && func)
{
self.func = func || function(){};
if(typeof(condition) == "string")
{
self.condition = condition.split(",");
} else self.condition = condition;
} else throw "mouse.js: Condition and callback needed";
}
self.win = new U.coor();
self.page = new U.coor();
self.left = 0;
self.right = 0;
self.target = document;
self.onstack = [];
self.drain = function(e)
{
if(typeof(self.events[e.type]) == "function")
{
self.events[e.type](e);
return false;
} return true;
}
self.on = function(condition,func,opts)
{
self.onstack.push(new onProto(condition,func,opts));
}
self.onhandler = function(cond)
{
var conditions = cond;
if(typeof(conditions) == "string") conditions = [conditions];
if(self.left) conditions.push('left-hold');
if(self.right) conditions.push('right-hold');
if(self.right || self.left) conditions.push('any-hold');
var stack = self.onstack;
for(var n in stack)
{
var myon = stack[n];
var result;
if(myon.mode == "AND")
{
result = true;for(var m in myon.condition) result &= (conditions.indexOf(myon.condition[m])+1);
}
if(myon.mode == "OR")
{
result = false;for(var m in myon.condition) result |= (conditions.indexOf(myon.condition[m])+1);
}
if(result && myon.elements)
{
var match = false;
for(var m in myon.elements)
{
var matcher = myon.elements[m];
var target = self.target;
while(!match && target)
{
match |= matcher == self.target;target = target.parentNode;
}
if(match) break;
}
result = match;
}
if(result) myon.func(self);
}
}
self.initialize = function(){
document.onmousemove = self.events.mousemove;
document.onmousedown = self.events.mousedown;
document.onmouseup = self.events.mouseup;
document.onmouseout = self.events.mouseout;
}
self.events = {};
self.events.mouseup = function(e)
{
self.target = e.target;
if(e.button == 0 && self.left)
{
self.left = 0;self.onhandler('left-up');
}
if(e.button == 2 && self.right)
{
self.right = 0;self.onhandler('right-up');
}
self.onhandler('any-up');
}
self.events.mouseout = function(e)
{
}
self.events.mousedown = function(e)
{
self.target = e.target;
if(e.button == 0)
{
self.left = 1;self.onhandler('left-down');
}
if(e.button == 2)
{
self.right = 1;self.onhandler('right-down');
}
self.onhandler('any-down');
}
self.events.mousemove = function(e)
{
self.target = e.target;
self.win.X(e.clientX);
self.win.Y(e.clientY);
self.page.X(e.pageX);
self.page.Y(e.pageY);
self.onhandler('move');
}
var readyStateCheckInterval = setInterval(function() {
if (document.readyState === "complete") {
self.initialize();
clearInterval(readyStateCheckInterval);
}
}, 100);
});
;
;
U.onElement = function(){};
(function(){
var regevs = [];
var initialize = function()
{
document.getElementsByTagName('body')[0].addEventListener('DOMNodeInserted', function(e){iterate(e.target)});
U.onElement.parse_iterations = 0;
iterate(document.getElementsByTagName('body')[0]);
}
var xelements = [];
var ic = 0;
var parse = function(e,selectorObject)
{
U.onElement.parse_iterations++;
if(e.tagName && e.tagName.indexOf('-') > 0 && U.xelements.indexOf(e.tagName.toLowerCase()) == -1)
{
xelements.push(e.tagName.toLowerCase());
U.loadJS('/lib/usapi/x-elements/' + e.tagName.toLowerCase() + '.js');
}
if(typeof(e.parsed) == "undefined") e.parsed = {};
if(selectorObject)
{
if(typeof(e.parsed[selectorObject.selector]) == "undefined" && e.matches && (e.matches(selectorObject.selector)))
{
e.parsed[selectorObject.selector] = true;
selectorObject.callBack.call(e);
}
} else {
for(var y in regevs)
{
if(typeof(e.parsed[regevs[y].selector]) == "undefined" && (typeof(e.matches) != "undefined") && (e.matches(regevs[y].selector)))
{
e.parsed[regevs[y].selector] = true;
regevs[y].callBack.call(e);
}
}
}
}
U.onElement = function(selector,func)
{
if(!selector || typeof(selector) != "string") throw new Error('usapi/onElement . on : first argument must be a selector');
if(!func || typeof(func) != "function") throw new Error('usapi/onElement . on : second argument must be a function to call on elements first appearance / iteration');
var selectorObject = {selector:selector, callBack:func}
regevs.push(selectorObject);
iterate(document.getElementsByTagName('body')[0],selectorObject);
}
var iterate = function(v,selectorObject)
{
parse(v,selectorObject);
var children = v.children;
if(typeof(children) != "undefined")for(var x = 0;x < children.length;x++) iterate(children[x],selectorObject);
}
$(document).ready(initialize);
})()
U.onElement.on = U.onElement;
;
//Pageable Table revision 150209
U.pageable_table = function(table,tsize)
{
return new U.Pageable_table(table,tsize);
}
U.Pageable_table = function(table,tsize)
{
if($(table).attr('ispageable') == "true") return true;
var self = this;
var valuemap = false;
if(typeof(tsize) == "undefined") tsize = 25;
var reinitcase= true;
var tableid= $(table).attr('id');
var cookiename= "usapi_pageable_table:" + window.location.pathname + "#" + tableid;
$(table).attr('ispageable',true);
var oldtable= $(table)[0].outerHTML;
var me= $('\
\
'+oldtable+'\
\
');
$(table).replaceWith(me);
me.find('table')[0].pageable = self;
var entryCount;
var acPage= 1;
me.find('[name=pp]').val();
var pageCount;
var perPage= 0;
var tbody= $(me).find("> table > tbody");
var tableid= $(table).attr('id');
var theader= $('[ref=' + tableid +']');
var updateFilters;Object.defineProperty(this,'updateFilters',{enumerable:true,get:function(){return updateFilters;},set:function(val){ updateFilters=val}});updateFilters= function()
{
filterproc();
}
var sortcol= function()
{
var tbody = me.find('tbody')[0];
var sortcol = this;
if(sortcol.getAttribute('data-type')) var datatype = sortcol.getAttribute('data-type'); else var datatype = "string";
$(this).parent().find('.sortcol').each(function(){if(this != sortcol){$(this).removeClass('asc');$(this).removeClass('desc');}});
if($(this).hasClass('desc'))
{
$(this).removeClass('desc');$(this).addClass('asc');var mode = 1;
} else {
$(this).removeClass('asc');$(this).addClass('desc');var mode = 0;
}
var map = [];
var trs = tbody.childNodes;
for(var n = 0; n < trs.length; n++)
{
var thistr = trs[n];
var mapO = {};
mapO.fid = this.getAttribute('fid');
if(datatype == "string")
{
for(var m = 0; m < thistr.childNodes.length; m++)
{
if(thistr.childNodes[m].getAttribute('fid') && thistr.children[m].getAttribute('fid').contains(this.getAttribute('fid')))
{
mapO.subject= thistr.children[m].firstChild.innerHTML.toLowerCase().trim();
}
}
}
else if(datatype == "int")
{
for(var m = 0; m < thistr.childNodes.length; m++)
{
var chn = thistr.childNodes[m];
if(chn.getAttribute('fid') && chn.getAttribute('fid').contains(this.getAttribute('fid')))
{
if(chn.getAttribute('data') && chn.getAttribute('data').length)
{
mapO.subject= parseInt(thistr.children[m].getAttribute('data'));
}
else
{
mapO.subject= parseInt(thistr.children[m].firstChild.innerHTML);
}
}
}
}
mapO.row = trs[n];
map.push(mapO);
}
var changes = 1;
while(changes)
{
changes = 0;
for(var n = 0; n < (map.length - 1);n++)if( (map[n+mode].subject > map[n+1-mode].subject))
{
changes = 1;
var store = map[n];
map[n] = map[n+1];
map[n+1] = store;
}
}
reinitcase = 0;
tbody.innerHTML = "";
for(n = 0; n < map.length;n++) tbody.appendChild(map[n].row);
evaluateVisibility();
reinitcase = 1;
}
var createMap= function()
{
var map = [];
var tb = tbody[0];
var depth=0;
var submapme = function(tb,maprow)
{
for(var c = 0; c tr").removeClass('excluded');
var filters = [];
theader.find('.filter').each(function(u,i){
if(this.value != "")
{
var value = this.value;
var filter = this.getAttribute('filter');
var condition = this.getAttribute('condition');
var mode = "OR";
if(this.getAttribute('split'))
{
value = value.trim().split(this.getAttribute('split'));
}
if(this.getAttribute('mode')) mode = this.getAttribute('mode');
filters[filter] = {};
if(typeof(value) == "object") filters[filter].values = value;
else filters[filter].values = [value];
filters[filter].mode = mode;
filters[filter].condition = condition;
}
});
for(var n in valuemap){valuemap[n].visible = true;}
var depth=0;
var evalMap = function(map)
{
var tableret = false;
for(var n1 = 0; (n1 < map.length);n1++) // each row
{
var row = map[n1];
var ret = true;
for(var f1 in filters) // each filter
{
var filter = filters[f1];
if(filter.mode == "OR")
{
var ret2 = false;
if(typeof(map[n1].values[f1]) != "undefined") // each valueset
{
var fvalues = map[n1].values[f1];
for(var n2=0; (n2 < fvalues.length) && !ret2; n2++)
{
ret3 = false;
for(var n3=0; (n3 < filter.values.length) && !ret3; n3++)
{
ret3 |= U.Pageable_table.conditions[filter.condition](filter.values[n3],fvalues[n2]);
}
ret2 |= ret3;
}
}
}
if(filter.mode == "AND")
{
var ret2 = true;
var cm = 0;
if(typeof(map[n1].values[f1]) != "undefined") // each valueset
{
cm++;
var fvalues = map[n1].values[f1];
for(var n2=0; (n2 < filter.values.length) && ret2; n2++)
{
ret3 = false;
for(var n3=0; (n3 < fvalues.length) && !ret3; n3++) ret3 |= U.Pageable_table.conditions[filter.condition](filter.values[n2],fvalues[n3]);
ret2 &= ret3;
}
}
if(!cm) ret2 = false;
}
ret &= ret2;
}
tableret |= ret;
row.visible = ret;
}
}
evalMap(valuemap);
for(var n in valuemap)
{
if(valuemap[n].visible) valuemap[n].tr.classList.remove('excluded'); else valuemap[n].tr.classList.add('excluded');
}
}
if(theader.length)
{
if(U.delay)
{
theader.find('.filter').on('change',U.delay.resetHandler(filterproc,200));
theader.find('input[type=text].filter').on('keyup',U.delay.resetHandler(filterproc,200));
} else {
theader.find('.filter').on('change',filterproc);
theader.find('input[type=text].filter').on('keyup',filterproc);
}
}
var setHandlers = function()
{
$(me).on('click','input.selector',selecthandler);
$(me).find('.sitenav .site-back').on('click',function(){
pageswap(-1);
return false;
});
me.find('.sitenav .site-next').on('click',function(){
pageswap(1);
return false;
});
me.find('[name=pp]').on('change',reinit);
me.find('tbody')[0].addEventListener('DOMSubtreeModified',reinit,true);
me.find('thead').on('DOMSubtreeModified',evaluateCellVisibility)
me.find('.header.sortcol').on('click',sortcol);
}
var initialize = function()
{
valuemap = false;
if(me)
{
perPage = me.find('[name=pp]').val();
entryCount = me.find('> table > tbody > tr:not(.excluded)').length;
pageCount = Math.ceil(entryCount / perPage);
if(pageCount == 0) pageCount = 1; else if(acPage > pageCount) acPage = pageCount;
me.find('.site span').html(pageCount);
me.find('.site i').html(entryCount + " Ergebnisse");
if($(me).find('.header.selector')[0])
{
$(me).find('.markunmark').html('Alle markierenAlle abwählenAuswahl umkehrenSichtbare markierenSichtbare abwählenSichtbare Auswahl umkehren');
$(me).find('.markunmark #markall').on('click',markall);
$(me).find('.markunmark #unmarkall').on('click',unmarkall);
$(me).find('.markunmark #reverseall').on('click',reverseall);
$(me).find('.markunmark #unmarkvisible').on('click',unmarkvisible);
$(me).find('.markunmark #markvisible').on('click',markvisible);
$(me).find('.markunmark #reversevisible').on('click',reversevisible);
}
if( me.find('> table > thead >th.export').length )
{
me.find('a.export').show();
var csvblob = createExportBlob();
var csvbloburl = window.URL.createObjectURL(csvblob);
var filename = me.attr('id') + ".csv";
if(me.find('> table').attr('export')) filename = me.find('> table').attr('export');
me.find('a.export')[0].href = csvbloburl;
me.find('a.export')[0].download = filename;
} else {
me.find('a.export').hide();
}
evaluateVisibility();
}
}
var reinitwait;
var createExportBlob = function()
{
var str = "\uFEFF";
var columns = [];
var columnsnames = [];
me.find('th.export').each(function(i,v)
{
columns.push(v.getAttribute('fid'));
columnsnames.push('"' + v.innerHTML + '"');
});
str += columnsnames.join(';') + "\n";me.find('tbody tr:not(.excluded)').each(function(i,v)
{
var tarr = [];
var children = v.children;
for(var n in children)
{
var child = children[n];
if(child.tagName == "TD" && child.getAttribute('fid'))
{
var fid = child.getAttribute('fid');
var isin = false;
for(var m in columns) isin |= fid.contains(columns[m]);
if(isin)
if(child.firstChild) tarr.push('"' + child.firstChild.innerHTML.trim() + '"');
else tarr.push()
}
}
str += tarr.join(';') + "\n";
});
return new Blob([str]);
}
var selecthandler = function()
{
if($(this.parentNode.parentNode.parentNode).hasClass('yellow'))
{
$(this.parentNode.parentNode.parentNode).removeClass('yellow');
} else {
$(this.parentNode.parentNode.parentNode).addClass('yellow');
}
}
var markall;Object.defineProperty(this,'markall',{enumerable:true,get:function(){return markall;},set:function(val){ markall=val}});markall= function()
{
$(tbody).find(" > tr:not(.excluded) input.selector").prop('checked',true);
$(tbody).find(" > tr:not(.excluded)").addClass('yellow',false);
}
var unmarkall;Object.defineProperty(this,'unmarkall',{enumerable:true,get:function(){return unmarkall;},set:function(val){ unmarkall=val}});unmarkall= function()
{
$(tbody).find(" > tr:not(.excluded) input.selector").prop('checked',false);
$(tbody).find("> tr:not(.excluded)").removeClass('yellow',false);
}
var reverseall;Object.defineProperty(this,'reverseall',{enumerable:true,get:function(){return reverseall;},set:function(val){ reverseall=val}});reverseall= function()
{
$(tbody).find(" > tr:not(.excluded)").each(function()
{
if($(this).hasClass("yellow"))
{
$(this).find("input.selector").prop('checked',false);
$(this).removeClass('yellow',false);
}
else
{
$(this).find("input.selector").prop('checked',true);
$(this).addClass('yellow',false);
}
});
}
var markvisible;Object.defineProperty(this,'markvisible',{enumerable:true,get:function(){return markvisible;},set:function(val){ markvisible=val}});markvisible= function()
{
$(tbody).find(" > tr.visible input.selector").prop('checked',true);
$(tbody).find(" > tr.visible").addClass('yellow',false);
}
var unmarkvisible;Object.defineProperty(this,'unmarkvisible',{enumerable:true,get:function(){return unmarkvisible;},set:function(val){ unmarkvisible=val}});unmarkvisible= function()
{
$(tbody).find(" > tr.visible input.selector").prop('checked',false);
$(tbody).find(" > tr.visible").removeClass('yellow',false);
}
var reversevisible;Object.defineProperty(this,'reversevisible',{enumerable:true,get:function(){return reversevisible;},set:function(val){ reversevisible=val}});reversevisible= function()
{
$(tbody).find(" > tr.visible").each(function()
{
if($(this).hasClass("yellow"))
{
$(this).find("input.selector").prop('checked',false);
$(this).removeClass('yellow',false);
}
else
{
$(this).find("input.selector").prop('checked',true);
$(this).addClass('yellow',false);
}
});
}
var reinit;Object.defineProperty(this,'reinit',{enumerable:true,get:function(){return reinit;},set:function(val){ reinit=val}});reinit= function(e)
{
if(e) e.stopPropagation();
if(reinitcase)
{
clearTimeout(reinitwait)
reinitwait = setTimeout(initialize,100);
}
}
var evaluateCellVisibility= function()
{
var visType = "table-cell";
if(typeof(U.pageable_table.blocktable != "undefined") && U.pageable_table.blocktable == true) visType = 'inline-block';
var headers = me.find('thead th.header');
headers.each(function(i,v)
{
var att = v.getAttribute('fid');
if(att != null)
if($(v).hasClass('hidden'))
{
me.find('> table > tbody tr.visible td[fid~='+att+']').css('display','none');
} else {
me.find('> table > tbody tr.visible td[fid~='+att+']').css('display',visType);
}
});
}
var calcTableHeaderWidths;Object.defineProperty(this,'calcTableHeaderWidths',{enumerable:true,get:function(){return calcTableHeaderWidths;},set:function(val){ calcTableHeaderWidths=val}});calcTableHeaderWidths= function()
{
var aTr = tbody.find('tr.visible')[0];
if(aTr)
for(var n in aTr.children)
{
if(typeof(aTr.children[n]) == "object")
{
$(me.find('thead > tr > th')[n]).width($(aTr.children[n]).width());
}
}
}
var evaluateVisibility= function()
{
tbody[0].removeEventListener('DOMSubtreeModified',reinit,true);
tbody.find('> tr').each(function(){this.style.display = 'none'});
tbody.find('> tr').removeClass('visible');
var entries = tbody.find('> tr:not(.excluded) ');
perPage = me.find('[name=pp]').val();
if(perPage > 0)
for(var c = (acPage-1) * perPage; (c < acPage*perPage) && (c < entryCount);c++)
{
$(entries[c]).each(function(){this.style.display = 'table-row'});
$(entries[c]).addClass('visible');
} else $(entries).each(function(){this.style.display = 'table-row'});
evaluateCellVisibility();
calcTableHeaderWidths();
me.find('.site b').html(acPage);
if(acPage == 1) me.find('.sitenav .site-back').addClass('end');
else me.find('.sitenav .site-back').removeClass('end');
if(acPage == (pageCount)) me.find('.sitenav .site-next').addClass('end');
else me.find('.sitenav .site-next').removeClass('end');
var json = {};
json.acPage = acPage;
json.perPage = perPage;
US_createCookie(cookiename,JSON.stringify(json),0.02);
tbody[0].addEventListener('DOMSubtreeModified',reinit,true);
}
var pageswap = function(change)
{
if((acPage + change > 0) && (acPage + change <= pageCount)) acPage += change;
evaluateVisibility();
}
var json = US_readCookie(cookiename);
me.find('[name=pp]').val(tsize);
if(json)
{
var jd = JSON.parse(json);
me.find('[name=pp]').val(jd.perPage);
acPage = jd.acPage;
}
initialize();
setHandlers();
};
$(document).ready(function()
{
if(U.onElement) // Do we have the onElement-extension at our disposal?
{
U.onElement('table.pageable',function()
{
U.pageable_table(this);
});
}
});
U.Pageable_table.conditions = [];
U.Pageable_table.conditions['match'] = function(filterval,compval)
{
return compval && (compval.toLowerCase().indexOf(filterval.toLowerCase()) > -1);
}
U.Pageable_table.conditions['exact'] = function(filterval,compval)
{
return (filterval == compval);
}
U.Pageable_table.conditions['exactmatch'] = function(filterval,compval)
{
return (filterval.toLowerCase() == compval.toLowerCase());
}
U.Pageable_table.conditions['is_empty'] = function(filterval,compval)
{
if(filterval == "skip") return 1;
if(filterval == "false") return compval.trim().length > 0;
if(filterval == "true") return compval.trim().length == 0;
}
U.Pageable_table.conditions['eval_numeric'] = function(filterval,compval)
{
//var value = parseInt(compval.trim());
var value = parseFloat(compval.trim());
return eval(filterval);
}
/**
* @author sven kayser (c) Copyright 2015 urban studio. All Rights Reserved.
* rev 150210
*
* dependency mouse.js,jquery, usapi
*
*/
U.winman = new (function(){
var self = this;
var windows;Object.defineProperty(this,'windows',{enumerable:true,get:function(){return windows;},set:function(val){ windows=val}});windows= [];
var winZOffset= 100000;
var mouse;Object.defineProperty(this,'mouse',{enumerable:true,get:function(){return mouse;}});mouse= U.mouse;
var winc;Object.defineProperty(this,'winc',{enumerable:true,get:function(){return winc;},set:function(val){ winc=val}});winc= 0;
var inbox;
var initialize= function(){
getCSS();
self.stdoptions = {
nest : "body",
winid : "uawin",
fullscreen : false,
minY : $('#nav').outerHeight(),
classes : "uawin",
data : {},
tabs : [
{title : "new window",
content : ""}
],
conf : {
clipping : true,
moveable : true,
minimizeable : true,
resizeable : true,
hasHeadbar : true,
centermode : "golden",
autocenter : false,
castBlackbox : false,
autorender : true,
tabsinheadbar : false,
ifwindowtoobig : "fullscreen"
},
buttons : {
},
code : function(){},
html : "",
events : {}
};
$('body').append('');
$('body').append('');
$('.winman_taskbar_component').hide();
$(window).on('resize',function()
{
for(var n in windows)
{
windows[n].invoke('calculateSizes')();
}
})
}
var windowOrder= function()
{
}
var startApp;Object.defineProperty(this,'startApp',{enumerable:true,get:function(){return startApp;}});startApp= function(path,data)
{
var appPointer;
U.loadCSS(path + "/app.css",true);
$.ajax({async:false, url:path + "/config.js"}).done(function(d){
var conf = eval(d);
conf.js = path + "/app.js";
conf.path = path;
if(typeof(data) != "undefined") conf.data = data;
appPointer = createWindow(conf);
});
return appPointer;
}
var createConfirm;Object.defineProperty(this,'createConfirm',{enumerable:true,get:function(){return createConfirm;}});createConfirm= function(opt)
{
var defaults = {
buttons : { "ok": "close" },
html : "Willst du die Aktion wirklich ausführen?",
nest : "body",
winid : "uaconfirm",
title : "new window",
classes : "uawin uaconfirm",
conf : {
clipping : true,
moveable : false,
minimizeable : false,
resizeable : false,
hasHeadbar : false,
centermode : "golden",
fadeInAnimation : false,
autocenter : true,
castBlackbox : true
}
}
if(typeof(opt) == "undefined") opt = {};
if(opt.buttons) defaults.buttons = opt.buttons;
opt = $.extend(true,{},defaults,opt);
if(opt.dialogtype) opt.classes+=" " + opt.dialogtype;
if(opt.message) opt.html = opt.message;
var newWin = self.createWindow(opt);
$(newWin.me).find('.buttonbar button').addClass('button');
$(newWin.me).find('.buttonbar button').addClass('medium');
$(newWin.me).find('.buttonbar button:first-child').addClass('red').focus();
$(newWin.me).append($(''));
return newWin;
}
var createWindow;Object.defineProperty(this,'createWindow',{enumerable:true,get:function(){return createWindow;}});createWindow= function(opt)
{
if(typeof(opt) == "undefined") opt = {};
opt = $.extend(true,{},self.stdoptions,opt);
var newWin = new self.uawinProto(self,opt);
windows.push(newWin);
return newWin;
}
var getWindowById;Object.defineProperty(this,'getWindowById',{enumerable:true,get:function(){return getWindowById;}});getWindowById= function(id)
{
var ret = false;
for(var n in windows)
{
if(windows[n].id == id) ret = windows[n];
}
return ret;
}
var minimizeWindow;Object.defineProperty(this,'minimizeWindow',{enumerable:true,get:function(){return minimizeWindow;}});minimizeWindow= function(window,invoked)
{
if(typeof(invoked) == "undefined" || !invoked )
{
window.minimize();
}
}
var deleteWindow;Object.defineProperty(this,'deleteWindow',{enumerable:true,get:function(){return deleteWindow;}});deleteWindow= function(window)
{
var index = windows.indexOf(window);
windows.splice(index,1);
renderTaskbar();
}
var getScreenMiddle;Object.defineProperty(this,'getScreenMiddle',{enumerable:true,get:function(){return getScreenMiddle;}});getScreenMiddle= function()
{
return new U.coor(Math.floor($(window).width() / 2),Math.floor($(window).height() / 2));
}
var getScreenDimensions;Object.defineProperty(this,'getScreenDimensions',{enumerable:true,get:function(){return getScreenDimensions;}});getScreenDimensions= function()
{
return new U.coor($(window).width(),$(window).height());
}
var getCSS;Object.defineProperty(this,'getCSS',{enumerable:true,get:function(){return getCSS;}});getCSS= function()
{
var css = document.createElement('link');
css.href = '/lib/usapi/winman.css';
css.rel = 'stylesheet';
css.type = 'text/css';
document.getElementsByTagName('head')[0].appendChild(css);
}
var renderTaskbar;Object.defineProperty(this,'renderTaskbar',{enumerable:true,get:function(){return renderTaskbar;}});renderTaskbar= function()
{
var minimizedWins = [];
for(var i in windows) if(windows[i].isMinimized) minimizedWins.push(windows[i]);
var taskbar = $('#winman_taskbar');
taskbar.html("");
if(minimizedWins.length)
{
$('.winman_taskbar_component').show();
for(var i in minimizedWins)
{
var mWin = minimizedWins[i];
var newItem = document.createElement('div');
newItem.setAttribute('class','item');
newItem.innerHTML = mWin.name();
$(newItem).on('click',mWin.restore)
taskbar[0].appendChild(newItem);
}
} else $('.winman_taskbar_component').hide();
}
$(document).ready(initialize);
})
U.winman.uawinProto = function(_winman,_opt)
{
var self = this;
var isDragged = false;
var rbDrag = false;
var lbDrag = false;
var tbDrag = false;
var bbDrag = false;
var initialcoor = new U.coor();
var initialwinpos = new U.coor();
var savedPos= new U.coor();
var savedSize= new U.coor();
var nowPosition= new U.coor(0,0);
var nowDimension= new U.coor(0,0);
var isMaximized;Object.defineProperty(this,'isMaximized',{enumerable:true,get:function(){return isMaximized;}});isMaximized= false;
var isMinimized;Object.defineProperty(this,'isMinimized',{enumerable:true,get:function(){return isMinimized;}});isMinimized= false;
var data;
var opt;Object.defineProperty(this,'opt',{enumerable:true,get:function(){return opt;}});opt= _opt;
var winman;Object.defineProperty(this,'winman',{enumerable:true,get:function(){return winman;}});winman= _winman;
var inner;Object.defineProperty(this,'inner',{enumerable:true,get:function(){return inner;}});
var headbar;
var me;Object.defineProperty(this,'me',{enumerable:true,get:function(){return me;}});
var proc;Object.defineProperty(this,'proc',{enumerable:true,get:function(){return proc;}});proc= {};
var tabs;Object.defineProperty(this,'tabs',{enumerable:true,get:function(){return tabs;}});tabs= [];
var acTab;Object.defineProperty(this,'acTab',{enumerable:true,get:function(){return acTab;}});acTab= 0;
var id;Object.defineProperty(this,'id',{enumerable:true,get:function(){return id;}});
if(opt)
var title= _opt.title;
var invoke;Object.defineProperty(this,'invoke',{enumerable:true,get:function(){return invoke;},set:function(val){ invoke=val}});invoke= function(method)
{
return eval(method);
}
var initialize= function()
{
id = opt.winid;
var nest = $(opt.nest)[0];
var state = "open";
winc = winman.winc++;
attachToNest();
data = opt.data;
tabs = [];
for(var n in opt.tabs)
{
var newElement;
tabs[n] = {};
tabs[n].title = opt.tabs[n].title;
tabs[n].name = opt.tabs[n].name;
newElement = document.createElement('div');
newElement.innerHTML = opt.tabs[n].content;
tabs[n].content = newElement;
tabs[n].content.setAttribute('nr',n);
}
setTab(0);
render();
fadeInAnimator(opt.conf.fadeInAnimation);
if(opt.html) content(opt.html);
code(opt.js);
winman.mouse.on('move',mouseproc);
fire('ready');
}
var fadeInAnimator= function(animation)
{
var screenMiddle = winman.getScreenMiddle();
if(typeof(animation) == "string")
{
if(animation == "fadeInFromTop")
{
X((screenMiddle.X() - (W()/2)));
var theY = H()*(-1);
var fadeInterval = window.setInterval(function()
{
if(theY > 0){
window.clearInterval(fadeInterval);
Y(0);
} else {
activate();
Y(theY,true);
theY+= 20;
}
},10);
}
}
if(typeof(animation) == "function")
{
animation(self);
}
if(typeof(animation) == "undefined") centerWindow();
}
var attachToNest= function()
{
var nest = $(opt.nest)[0];
var classes = opt.classes.split(" ");
me = document.createElement('div');
me.setAttribute('class',classes.join(" "));
winc = winman.winc++;
me.setAttribute('winc',winc);
me.setAttribute('id','uawin_' + opt.winid)
nest.appendChild(me);
}
var setHandlers= function()
{
$(me).find('.button').on('mousedown',animations.btnpress);
$(me).find('.button').on('mouseup',animations.btnrelease);
$(me).find('.button').on('mouseout',animations.btnrelease);
$(me).find('.closebtn').on('click',close);
$(me).find('.minimizebtn').on('click',minimize)
$(me).find('.headbar').on('mousedown',animations.headbardown);
$(me).find('.rightborder').on('mousedown',animations.rightborderdown)
$(me).find('.leftborder').on('mousedown',animations.leftborderdown)
$(me).find('.bottomborder').on('mousedown',animations.bottomborderdown)
$(me).find('.topborder').on('mousedown',animations.topborderdown)
$(me).on('mousedown',animations.windowdown);
$(me).find('.headbar').on('dblclick',animations.maximize);
}
var animations= {};
animations.maximize = function(e)
{
if(isMaximized)
{
W(savedSize.X());
H(savedSize.Y());
X(savedPos.X());
Y(savedPos.Y());
isMaximized = false;
$(me).removeClass('maximized');
} else {
var sd = winman.getScreenDimensions();
savedPos.X(X());
savedPos.Y(Y());
savedSize.X(W());
savedSize.Y(H());
X(0);Y(0);W(sd.X());H(sd.Y());
isMaximized = true;
$(me).addClass('maximized');
}
}
animations.btnpress = function(e)
{
$(this).addClass('pressed');
return winman.mouse.drain(e);
}
animations.btnrelease = function()
{
$(this).removeClass('pressed');
}
animations.headbardown = function(e)
{
if(e.button == 0 && opt.conf.moveable) isDragged = true;
initialwinpos = new U.coor(X(),Y());
initialcoor = winman.mouse.win.clone();
return winman.mouse.drain(e);
}
animations.rightborderdown = function(e){if(e.button == 0) rbDrag = true;}
animations.leftborderdown = function(e){if(e.button == 0) lbDrag = true;}
animations.bottomborderdown = function(e){if(e.button == 0) bbDrag = true;}
animations.topborderdown = function(e){if(e.button == 0) tbDrag = true;}
animations.windowdown = function(e){
//
}
var hasButtonbar= function()
{
return Object.keys(opt.buttons).length;
}
var mouseproc= function(mouse)
{
if(!mouse.left)
{
isDragged = false;
rbDrag = false;
lbDrag = false;
tbDrag = false;
bbDrag = false;
}
if(isDragged)
{
var vector = initialcoor.vec(winman.mouse.win);
var newcoor = initialwinpos.add(vector);
X(newcoor.X());
Y(newcoor.Y());
}
if(rbDrag)
{
W(W() + mouse.win.movex);
}
if(lbDrag)
{
W(W() - mouse.win.movex);
X(X() + mouse.win.movex);
}
if(bbDrag)
{
H(H() + mouse.win.movey);
}
if(tbDrag)
{
H(H() - mouse.win.movey);
Y(Y() + mouse.win.movey);
}
}
var fullscreen= function()
{
var ret = false;
if(me.requestFullScreen) {
ret = me.requestFullScreen();
} else if(me.mozRequestFullScreen) {
ret = me.mozRequestFullScreen();
} else if(me.webkitRequestFullScreen) {
ret = me.webkitRequestFullScreen();
}
return ret;
}
var render;Object.defineProperty(this,'render',{enumerable:true,get:function(){return render;}});render= function()
{
var blackbox = document.createElement('div');
blackbox.setAttribute('class','blackbox');
inbox = document.createElement('div');
inbox.setAttribute('class','inbox');
var bg = document.createElement('div');
bg.setAttribute('class','bg');
inbox.appendChild(bg);
if(tabs.length > 1)
{
var tabbar = document.createElement('div');
me.setAttribute('tabbar','tabbar');
tabbar.setAttribute('class','tabbar');
for(var n in tabs)
{
var newTab = document.createElement('span');
if(n == acTab) newTab.setAttribute('class','active');
newTab.setAttribute('nr',n);
newTab.innerHTML = tabs[n].title;
tabbar.appendChild(newTab);
newTab.addEventListener("click",tabClickHandler)
}
}
if(opt.conf.hasHeadbar)
{
me.setAttribute('headbar','headbar');
headbar = document.createElement('div');
headbar.setAttribute('class','headbar');
inbox.appendChild(headbar);
var headbg = document.createElement('div');
headbg.setAttribute('class','headbg');
headbar.appendChild(headbg);
if(!opt.conf.tabsinheadbar )
{
var winname = document.createElement('div');
winname.setAttribute('class','winname');
winname.innerHTML = title;//self.tabs[self.acTab].title;
headbar.appendChild(winname);
}
if(tabs.length > 1 && opt.conf.tabsinheadbar) headbar.appendChild(tabbar);
if(opt.conf.minimizeable)
{
var minimizebutton = document.createElement('div');
minimizebutton.setAttribute('class','button minimizebtn');
headbar.appendChild(minimizebutton);
}
var closebtn = document.createElement('div');
closebtn.setAttribute('class','button closebtn');
headbar.appendChild(closebtn);
}
if(tabs.length > 1 && !opt.conf.tabsinheadbar) inbox.appendChild(tabbar);
for(var n in tabs)
{
if(n == acTab)
{
tabs[n].content.setAttribute("class","inner active " + tabs[n].name);
}
else
{
tabs[n].content.setAttribute("class","inner " + tabs[n].name );
}
inbox.appendChild(tabs[n].content); // this funnels the content Element for the selected tab into the visible window space
}
renderButtons();
if(opt.conf.resizeable)
{
var leftborder = document.createElement('div'); leftborder.setAttribute('class','resizer leftborder');inbox.appendChild(leftborder);
var rightborder = document.createElement('div');rightborder.setAttribute('class','resizer rightborder');inbox.appendChild(rightborder);
var topborder = document.createElement('div');topborder.setAttribute('class','resizer topborder');inbox.appendChild(topborder);
var bottomborder = document.createElement('div');bottomborder.setAttribute('class','resizer bottomborder'); inbox.appendChild(bottomborder);
}
me.innerHTML = "";
if(opt.conf.castBlackbox) me.appendChild(blackbox);
me.appendChild(inbox);
setHandlers();
headbar = $(me).find('.headbar');
calculateSizes();
}
var setButtons;Object.defineProperty(this,'setButtons',{enumerable:true,get:function(){return setButtons;},set:function(val){ setButtons=val}});setButtons= function(bo)
{
opt.buttons = bo;
renderButtons();
}
var renderButtons= function()
{
if(inbox.querySelector('div.buttonbar')) inbox.querySelector('div.buttonbar').remove();
if(hasButtonbar())
{
var buttonbar = document.createElement('div');
me.setAttribute('buttonbar','buttonbar');
buttonbar.setAttribute('class','buttonbar');
inbox.appendChild(buttonbar);
for(var n in opt.buttons)
{
newbutton = document.createElement('button');
if(typeof(opt.buttons[n]) == "object")
{
if(opt.buttons[n].disabled == true) newbutton.setAttribute('disabled','disabled');
newbutton.setAttribute('class',opt.buttons[n].class);
newbutton.innerHTML = opt.buttons[n].label;
newbutton.proc = opt.buttons[n].func;
}
if((typeof(opt.buttons[n]) == "string") || (typeof(opt.buttons[n]) == "function"))
{
var newbutton;
newbutton.innerHTML = n;
newbutton.proc = opt.buttons[n];
}
newbutton.onclick = buttonhandler;
buttonbar.appendChild(newbutton);
}
} else {
me.removeAttribute('buttonbar');
}
}
var buttonhandler= function()
{
var proc = this.proc;
var win = self;
if(typeof(proc) == "string")
{
if(proc == "close")
{
close();
}
} else {
var context = {};
context.window = self;
if(proc.call(self)) close();
}
}
var data;Object.defineProperty(this,'data',{enumerable:true,get:function(){return data;}});data= function(d)
{
if(arguments.length)
{
var data = arguments[0];
}
return data;
}
var Y;Object.defineProperty(this,'Y',{enumerable:true,get:function(){return Y;}});Y= function(unclip)
{
if(typeof(unclip)=="undefined") unclip = false;
if(arguments.length)
{
var Y = arguments[0];
if(opt.conf.clipping && !unclip)
{
if(Y < opt.minY) Y = opt.minY;
var screenDimensions = winman.getScreenDimensions();
if(Y+H() > screenDimensions.Y()) Y = screenDimensions.Y() - H();
}
nowPosition.Y(Y);
$(me).css('top',Y);
fire('move');
} else {
$(me).css('top',nowPosition.Y());
}
return nowPosition.Y();
}
var X;Object.defineProperty(this,'X',{enumerable:true,get:function(){return X;}});X= function(unclip)
{
if(typeof(unclip)=="undefined") unclip = false;
if(arguments.length)
{
var X = arguments[0];
if(opt.conf.clipping && !unclip)
{
if(X < 0) X = 0;
var screenDimensions = winman.getScreenDimensions();
if(X+W() > screenDimensions.X()) X = screenDimensions.X()-W();
}
nowPosition.X(X);
$(me).css('left',X);
fire('move');
} else {
$(me).css('left',nowPosition.X());
}
return nowPosition.X();
}
var W;Object.defineProperty(this,'W',{enumerable:true,get:function(){return W;}});W= function()
{
if(arguments.length)
{
var W = arguments[0];
if(opt.conf.clipping)
{
var screenDimensions = winman.getScreenDimensions();
if( (W + X()) > screenDimensions.X()) W = screenDimensions.X()-X();
}
$(me).css('width',W);
fire('resize');
calculateSizes();
fire('resizefinish');
}
return parseInt($(me).css('width'));
}
var H;Object.defineProperty(this,'H',{enumerable:true,get:function(){return H;}});H= function()
{
if(arguments.length)
{
var H = arguments[0];
if(opt.conf.clipping)
{
var screenDimensions = winman.getScreenDimensions();
if( (H + Y()) > screenDimensions.Y() - opt.minY) H = screenDimensions.Y()-Y();
}
$(me).css('height',H);
fire('resize');
calculateSizes();
fire('resizefinish');
}
return parseInt($(me).css('height'));
}
var minimize;Object.defineProperty(this,'minimize',{enumerable:true,get:function(){return minimize;}});minimize= function()
{
if(fire('onminimize'))
{
hide();
isMinimized = true;
winman.renderTaskbar();
} else return false;
}
var hide;Object.defineProperty(this,'hide',{enumerable:true,get:function(){return hide;}});hide= function()
{
$(me).fadeOut(500,function(){
});
}
var unrender;Object.defineProperty(this,'unrender',{enumerable:true,get:function(){return unrender;}});unrender= function()
{
$(me).fadeOut(500,function(){
$(me).remove();
});
}
var activate;Object.defineProperty(this,'activate',{enumerable:true,get:function(){return activate;}});activate= function()
{
$(me).show();
}
var restore;Object.defineProperty(this,'restore',{enumerable:true,get:function(){return restore;}});restore= function()
{
$(me).show();
X();Y();
//render();
isMinimized = false;
winman.renderTaskbar();
}
var close;Object.defineProperty(this,'close',{enumerable:true,get:function(){return close;}});close= function()
{
if(fire('closerequest'))
{
if(fire('close'))
{
unrender();
winman.deleteWindow(self);
return true;
} else return false;
} else return false;
}
var content;Object.defineProperty(this,'content',{enumerable:true,get:function(){return content;}});content= function()
{
if(arguments.length == 1)
{
if(typeof(arguments[0]) == "number")
{
return tabs[arguments[0]].content.innerHTML;
}
if(typeof(arguments[0]) == "string")
{
inner.innerHTML = arguments[0];
return inner.innerHTML;
}
}
if(arguments.length == 2)
{
if(typeof(arguments[0]) == "number")
{
tabs[arguments[0]-1].content.innerHTML = arguments[1];
return tabs[arguments[0]].content.innerHTML;
}
if(typeof(arguments[0]) == "string")
{
tabs[arguments[1]-1].content.innerHTML = arguments[0];
return tabs[arguments[1]-1].content.innerHTML;
}
}
return inner.innerHTML;
}
var setTab;Object.defineProperty(this,'setTab',{enumerable:true,get:function(){return setTab;}});setTab= function(nr)
{
if(tabs[nr])
{
acTab = nr;
inner = tabs[nr].content;
}
}
var tabClickHandler= function(e)
{
var nr = $(this).attr('nr');
if(fire('beforetabchange',nr))
{
$(this.parentNode).find('span').removeClass('active');
$(this).addClass('active');
setTab(nr);
$(me).find('.inner').hide();
$(me).find('.inner[nr=' + nr +']').show();
calculateSizes();
}
//render();
fire('tabchange');
}
var code;Object.defineProperty(this,'code',{enumerable:true,get:function(){return code;}});code= function()
{
var code;
if(arguments.length)
{
arg = arguments[0];
if(arg)
{
if(typeof(arg) == "function") code = arg;
if(typeof(arg) == "string")
{
$.ajaxSetup({async:false});
$.post(arg,function(d){
code = eval(d);
});
$.ajaxSetup({async:true});
}
proc = new code(self);
}
}
}
var name;Object.defineProperty(this,'name',{enumerable:true,get:function(){return name;}});name= function()
{
if(arguments.length)
{
$(headbar).find('.winname').html(arguments[0]);
title = arguments[0];
}
return title;
}
var centerWindow;Object.defineProperty(this,'centerWindow',{enumerable:true,get:function(){return centerWindow;}});centerWindow= function()
{
var screenMiddle = winman.getScreenMiddle();
if(opt.conf.centermode == "exact")
{
X(screenMiddle.X() - (W()/2));
Y(screenMiddle.Y() - (H()/2));
}
if(opt.conf.centermode == "golden")
{
X((screenMiddle.X() - (W()/2)));
Y((screenMiddle.Y() - (H()/2)) * 0.318*2);
}
if(opt.conf.centermode = "macstyle")
{
X((screenMiddle.X() - (W()/2)));
Y(0);
}
}
var calculateSizes= function()
{
if($(window).height() < H()) H($(window).height());
if($(window).width() < W()) W($(window).width());
if(opt.conf.hasHeadbar) var topheight = $(me).find('.headbar').outerHeight();
else var topheight = 0;
var tabheight = 0;
if(tabs.length > 1 && !opt.conf.tabsinheadbar)
tabheight += $(me).find('.tabbar').outerHeight();
var innerheight = H() - topheight;
var innerwidth = W();
var bg = $(me).find('.bg');
console.log(opt.conf.autocenter);
if(opt.conf.autocenter) centerWindow();
}
var fire;Object.defineProperty(this,'fire',{enumerable:true,get:function(){return fire;}});fire= function(name,add)
{
if(typeof(add) == "undefined") add = null;
return userEvents(name,add);
}
var userEvents = function(name,add)
{
var eventStack = events[name];
for(var n in eventStack)
{
var result = eventStack[n](add);
if(isDef(result) && result == false) return false;
}
return true;
}
var on;Object.defineProperty(this,'on',{enumerable:true,get:function(){return on;}});on= function(name,func)
{
var eventStack = events[name];
eventStack.push(func);
}
var off;Object.defineProperty(this,'off',{enumerable:true,get:function(){return off;}});off= function(name)
{
var eventStack = events[name];
eventStack = [];
}
var events = {
move : [],
movefinish : [],
resize : [],
ready : [],
close : [],
closerequest : [],
resizefinish : [],
tabchange : [],
beforetabchange : []
}
initialize();
return self;
};
;
U.wait = new (function(){
var self = this;
self.render = function(x)
{
return '';
}
self.animate = function(svg,x)
{
var n = function(x){if(x>8) return x-8; else return x;}
var animatestep = function()
{
c++;
if(c>8) c-=8;
svg.getElementById("wspot"+n(c+1)).setAttribute('fill','#eee');
svg.getElementById("wspot"+n(c+2)).setAttribute('fill','#ccc');
svg.getElementById("wspot"+n(c+3)).setAttribute('fill','#aaa');
svg.getElementById("wspot"+n(c+4)).setAttribute('fill','#888');
svg.getElementById("wspot"+n(c+5)).setAttribute('fill','#666');
svg.getElementById("wspot"+n(c+6)).setAttribute('fill','#888');
svg.getElementById("wspot"+n(c+7)).setAttribute('fill','#aaa');
svg.getElementById("wspot"+n(c+8)).setAttribute('fill','#ccc');
svg.getElementById("wspot"+n(c+1)).setAttribute('r',0.08*x);
svg.getElementById("wspot"+n(c+2)).setAttribute('r',0.07*x);
svg.getElementById("wspot"+n(c+3)).setAttribute('r',0.06*x);
svg.getElementById("wspot"+n(c+4)).setAttribute('r',0.05*x);
svg.getElementById("wspot"+n(c+5)).setAttribute('r',0.04*x);
svg.getElementById("wspot"+n(c+6)).setAttribute('r',0.05*x);
svg.getElementById("wspot"+n(c+7)).setAttribute('r',0.06*x);
svg.getElementById("wspot"+n(c+8)).setAttribute('r',0.07*x);
U.delay.set(animatestep,125);
}
var c = 1;
U.delay.set(animatestep,125);
}
});
$(document).ready(function()
{
if(U.onElement) // Do we have the onElement-extension at our disposal?
{
U.onElement.on('waiter',function()
{
var x = this.getAttribute('size');
var svg = $(U.wait.render(x));
$(this).replaceWith(svg);
U.wait.animate(svg[0],x);
});
}
});;