All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.javascripts.portal.min.js Maven / Gradle / Ivy

The newest version!
/*
 * Portal v1.0rc3
 * http://github.com/flowersinthesand/portal
 * 
 * Copyright 2011-2013, Donghwan Kim 
 * Licensed under the Apache License, Version 2.0
 * http://www.apache.org/licenses/LICENSE-2.0
 */
(function(){function z(a){var c=[],b,e,g,d,h,m,l=function(b,n){n=n||[];e=!a||[b,n];g=!0;m=d||0;d=0;for(h=c.length;m';return encodeURI(decodeURI(c.firstChild.href))}, iterate:function(a){var c;(function f(){c=setTimeout(function(){!1!==a()&&f()},1)})();return function(){clearTimeout(c)}},each:function(a,c){var b;for(b=0;ba?"0"+a:a}var e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f", "\r":"\\r",'"':'\\"',"\\":"\\\\"};return window.JSON&&window.JSON.stringify?window.JSON.stringify(a):function h(a,e){var f,n,g,k=e[a];g=typeof k;k&&("object"===typeof k&&"function"===typeof k.toJSON)&&(k=k.toJSON(a),g=typeof k);switch(g){case "string":return c(k);case "number":return isFinite(k)?String(k):"null";case "boolean":return String(k);case "object":if(!k)return"null";switch(x.call(k)){case "[object Date]":return isFinite(k.valueOf())?'"'+k.getUTCFullYear()+"-"+b(k.getUTCMonth()+1)+"-"+b(k.getUTCDate())+ "T"+b(k.getUTCHours())+":"+b(k.getUTCMinutes())+":"+b(k.getUTCSeconds())+'Z"':"null";case "[object Array]":n=k.length;g=[];for(f=0;ft.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[];e.support.browser[t[1]||""]=!0;e.support.browser.version=t[2]||"0";if(e.support.browser.msie||e.support.browser.mozilla&&"1"===e.support.browser.version.split(".")[0])e.support.storage=!1;e.find=function(a){var c;if(!arguments.length){for(c in p)if(p[c])return p[c];return null}return p[e.support.getAbsoluteURL(a)]||null};e.open= function(a,c){var b=a=e.support.getAbsoluteURL(a),f,g=a,d,h,m,l={},A=0,n={},q=[],k,u,s,r={};f=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/.exec(g.toLowerCase());var j={option:function(a,b){if(void 0===b)return d[a];d[a]=b;return this},data:function(a,b){if(void 0===b)return r[a];r[a]=b;return this},state:function(){return m},on:function(a,b){var c;if("object"===typeof a){for(c in a)j.on(c,a[c]);return this}c=l[a];if(!c){if(l.message.locked())return this;c=l[a]=z();c.order=l.message.order}c.add(b); return this},off:function(a,b){var c=l[a];c&&c.remove(b);return this},one:function(a,b){function c(){j.off(a,c);b.apply(j,arguments)}b.guid=b.guid||v++;c.guid=b.guid;return j.on(a,c)},fire:function(a){var b=l[a];b&&b.fire(j,y.call(arguments,1));return this},open:function(){var a,b,c=function(){var a,c;if(!b){b=!0;for(a=r.candidates=y.call(d.transports);!h&&a.length;)c=a.shift(),r.transport=c,r.url=j.buildURL(),h=e.transports[c](j,d);s&&s++;h?(j.fire("connecting"),h.open()):j.fire("close","notransport")}}, f=function(){b||(b=!0,j.fire("close","canceled"))};k&&clearTimeout(k);r={};for(a in l)l[a].unlock();h=void 0;m="preparing";d.sharing&&(r.transport="session",h=e.transports.session(j,d));h?c():d.prepare.call(j,c,f,d);return this},send:function(a,b,c,f){var g;if("opened"!==m)return q.push(arguments),this;g={id:++A,socket:d.id,type:a,data:b,reply:!(!c&&!f)};g.reply&&("session"===r.transport?(g.doneCallback=c,g.failCallback=f):n[A]={done:c,fail:f});h.send(e.support.isBinary(b)?b:d.outbound.call(j,g)); return this},close:function(){d.reconnect=!1;k&&clearTimeout(k);if(w||!h||!h.feedback)j.fire("close",w?"error":"aborted");h&&h.close();return this},broadcast:function(a,b){var c=r.broadcastable;c&&c.broadcast({type:"fire",data:{type:a,data:b}});return this},_fire:function(a,b){var c;if(b){for(a=d.streamParser.call(j,a);a.length;)j._fire(a.shift());return this}e.support.isBinary(a)?c=[{type:"message",data:a}]:(c=d.inbound.call(j,a),c=null==c?[]:!e.support.isArray(c)?[c]:c);e.support.each(c,function(a, b){var c,e=[b.type,b.data];d.lastEventId=b.id;b.reply&&e.push(function(a){c||(c=!0,j.send("reply",{id:b.id,data:a}))});j.fire.apply(j,e).fire("_message",e)});return this},buildURL:function(a){return d.urlBuilder.call(j,g,e.support.extend({id:d.id,transport:r.transport,heartbeat:d.heartbeat,lastEventId:d.lastEventId,_:v++},d.params,a))}};d=e.support.extend({},e.defaults,c);c&&c.transports&&(d.transports=y.call(c.transports));d.url=g;d.id=d.idGenerator.call(j);d.crossDomain=!(!f||!(f[1]!=location.protocol|| f[2]!=location.hostname||(f[3]||("http:"===f[1]?80:443))!=(location.port||("http:"===location.protocol?80:443))));e.support.each(["connecting","open","message","close","waiting"],function(a,b){l[b]=z("message"!==b);l[b].order=a;var c=j[b],d=function(a){return j.on(b,a)};j[b]=!c?d:function(a){return(e.support.isFunction(a)?d:c).apply(this,arguments)}});j.on({connecting:function(){function a(){clearTimeout(b)}m="connecting";var b;0',document.body.appendChild(b));d=b.firstChild.contentWindow;return{init:function(){d.callbacks=[c];d.fire=function(a){var b;for(b=0;bd._heartbeat&&(a(),j.one("close",b));l.connecting.lock();for(k=u=s=null;q.length;)j.send.apply(j,q.shift())},close:function(){m="closed";var a,b,c=l.close.order;for(a in l)b=l[a],b.order';d.firstChild.value=c;e.support.on(d.lastChild,"load",function(){document.body.removeChild(d);b()});document.body.appendChild(d);d.submit()};return{send:function(a){d.push(a);g||(g=!0,b())}}},sse:function(a,c){var b,f=window.EventSource;if(f){if(c.crossDomain)try{if(!e.support.corsable||!("withCredentials"in new f("about:blank")))return}catch(g){return}return e.support.extend(e.transports.httpbase(a,c),{open:function(){var d= a.data("url");b=!c.crossDomain?new f(d):new f(d,{withCredentials:c.credentials});b.onopen=function(b){a.data("event",b).fire("open")};b.onmessage=function(b){a.data("event",b)._fire(b.data)};b.onerror=function(c){b.close();a.data("event",c).fire("close","done")}},close:function(){b.close()}})}},stream:function(a){a.data("candidates").unshift("streamxhr","streamxdr","streamiframe")},streamxhr:function(a,c){var b;if(!(e.support.browser.msie&&10>+e.support.browser.version||c.crossDomain&&!e.support.corsable))return e.support.extend(e.transports.httpbase(a, c),{open:function(){var f;b=e.support.xhr();b.onreadystatechange=function(){function c(){var d=a.data("index"),e=b.responseText.length;d?e>d&&a._fire(b.responseText.substring(d,e),!0):a.fire("open")._fire(b.responseText,!0);a.data("index",e)}3===b.readyState&&200===b.status?e.support.browser.opera&&!f?f=e.support.iterate(c):c():4===b.readyState&&(f&&f(),a.fire("close",200===b.status?"done":"error"))};b.open(c.method||"GET",a.data("url"));e.support.corsable&&(b.withCredentials=c.credentials);b.send(null)}, close:function(){b.abort()}})},streamiframe:function(a,c){var b,f,g=window.ActiveXObject;if(g&&!c.crossDomain){try{new g("htmlfile")}catch(d){return}return e.support.extend(e.transports.httpbase(a,c),{open:function(){var d,m;b=new g("htmlfile");b.open();b.close();d=b.createElement("iframe");d.src=a.data("url");b.body.appendChild(d);m=d.contentDocument||d.contentWindow.document;f=e.support.iterate(function(){function b(){var a=g.cloneNode(!0);a.appendChild(m.createTextNode("."));a=a.innerText;return a.substring(0, a.length-1)}var g;if(m.firstChild){c.initIframe&&c.initIframe.call(a,d);g=m.body.lastChild;if(!g)return a.fire("close","error"),!1;a.fire("open")._fire(b(),!0);g.innerText="";f=e.support.iterate(function(){var c=b();c&&(g.innerText="",a._fire(c,!0));if("complete"===m.readyState)return a.fire("close","done"),!1});return!1}})},close:function(){f();b.execCommand("Stop")}})}},streamxdr:function(a,c){var b,f=window.XDomainRequest;if(f&&c.xdrURL&&c.xdrURL.call(a,"t"))return e.support.extend(e.transports.httpbase(a, c),{open:function(){var e=c.xdrURL.call(a,a.data("url"));a.data("url",e);b=new f;b.onprogress=function(){var c=a.data("index"),e=b.responseText.length;c?a._fire(b.responseText.substring(c,e),!0):a.fire("open")._fire(b.responseText,!0);a.data("index",e)};b.onerror=function(){a.fire("close","error")};b.onload=function(){a.fire("close","done")};b.open(c.method||"GET",e);b.send()},close:function(){b.abort()}})},longpoll:function(a){a.data("candidates").unshift("longpollajax","longpollxdr","longpolljsonp")}, longpollajax:function(a,c){var b,f,g=0;if(!c.crossDomain||e.support.corsable)return e.support.extend(e.transports.httpbase(a,c),{open:function(){function d(){var h=a.buildURL({count:++g});a.data("url",h);b=e.support.xhr();b.onreadystatechange=function(){var c;!f&&4===b.readyState&&(200===b.status?(c=b.responseText)||1===g?(1===g&&a.fire("open"),c&&a._fire(c),d()):a.fire("close","done"):a.fire("close","error"))};b.open(c.method||"GET",h);e.support.corsable&&(b.withCredentials=c.credentials);b.send(null)} c.longpollTest?d():setTimeout(function(){a.fire("open");d()},50)},close:function(){f=!0;b.abort()}})},longpollxdr:function(a,c){var b,f=0,g=window.XDomainRequest;if(g&&c.xdrURL&&c.xdrURL.call(a,"t"))return e.support.extend(e.transports.httpbase(a,c),{open:function(){function d(){var e=c.xdrURL.call(a,a.buildURL({count:++f}));a.data("url",e);b=new g;b.onload=function(){var c=b.responseText;c||1===f?(1===f&&a.fire("open"),c&&a._fire(c),d()):a.fire("close","done")};b.onerror=function(){a.fire("close", "error")};b.open(c.method||"GET",e);b.send()}c.longpollTest?d():setTimeout(function(){a.fire("open");d()},50)},close:function(){b.abort()}})},longpolljsonp:function(a,c){var b,f,g=0,d=B.pop()||"socket_"+ ++v;return e.support.extend(e.transports.httpbase(a,c),{open:function(){function e(){var c=a.buildURL({callback:d,count:++g}),l=document.head||document.getElementsByTagName("head")[0]||document.documentElement;a.data("url",c);b=document.createElement("script");b.async=!0;b.src=c;b.clean=function(){b.clean= b.onerror=b.onload=b.onreadystatechange=null;l&&b.parentNode&&l.removeChild(b)};b.onload=b.onreadystatechange=function(){if(!b.readyState||/loaded|complete/.test(b.readyState))b.clean(),f?(f=!1,e()):1===g?(a.fire("open"),e()):a.fire("close","done")};b.onerror=function(){b.clean();a.fire("close","error")};l.insertBefore(b,l.firstChild)}window[d]=function(b){f=!0;1===g&&a.fire("open");a._fire(b)};a.one("close",function(){window[d]=function(){};B.push(d)});c.longpollTest?e():setTimeout(function(){a.fire("open"); e()},50)},close:function(){b.clean&&b.clean()}})}};e.finalize=function(){var a,c;for(a in p)c=p[a],"closed"!==c.state()&&c.close(),delete p[a]};e.support.on(window,"unload",function(){w=!0;e.finalize()});e.support.on(window,"online",function(){var a,c;for(a in p)c=p[a],"waiting"===c.state()&&c.open()});e.support.on(window,"offline",function(){var a,c;for(a in p)c=p[a],"opened"===c.state()&&c.fire("close","error")});window.portal=e})();




© 2015 - 2025 Weber Informatics LLC | Privacy Policy