Initial commit: apps.prometeysev.ru
This commit is contained in:
commit
96ccabcd8b
6561 files changed
+1270349
No files matched your search
@@ -0,0 +1,25 @@
|
||||
var baseUrl, toolbar;
|
||||
|
||||
var elem = document.getElementById('__debug_kit_app');
|
||||
if (elem) {
|
||||
window.__debugKitId = elem.getAttribute('data-id');
|
||||
window.__debugKitBaseUrl = elem.getAttribute('data-url');
|
||||
window.__debugKitWebroot = elem.getAttribute('data-webroot');
|
||||
elem = null;
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
toolbar = new Toolbar({
|
||||
toolbar: $('#toolbar'),
|
||||
content: $('#panel-content-container'),
|
||||
panelButtons: $('.panel'),
|
||||
panelClose: $('#panel-close'),
|
||||
keyboardScope : $(document),
|
||||
currentRequest: __debugKitId,
|
||||
originalRequest: __debugKitId,
|
||||
baseUrl: __debugKitBaseUrl,
|
||||
webroot: __debugKitWebroot,
|
||||
});
|
||||
|
||||
toolbar.initialize();
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
/*! jQuery v1.11.0 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
|
||||
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k="".trim,l={},m="1.11.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(l.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:k&&!k.call("\ufeff\xa0")?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||n.guid++,e):void 0},now:function(){return+new Date},support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s="sizzle"+-new Date,t=a.document,u=0,v=0,w=eb(),x=eb(),y=eb(),z=function(a,b){return a===b&&(j=!0),0},A="undefined",B=1<<31,C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=D.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",M=L.replace("w","w#"),N="\\["+K+"*("+L+Line truncated
|
||||
}}function S(a,b,c){if(n.acceptData(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!Q(d):!n.isEmptyObject(d))return}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--)d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d]));n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},W=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},X=/^(?:checkbox|radio)$/i;!function(){var a=z.createDocumentFragment(),b=z.createElement("div"),c=z.createElement("input");if(b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a>",l.leadingWhitespace=3===b.firstChild.nodeType,l.tbody=!b.getElementsByTagName("tbody").length,l.htmlSerialize=!!b.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==z.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,a.appendChild(c),l.appendChecked=c.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,a.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){l.noCloneEvent=!1}),b.cloneNode(!0).click()),null==l.deleteExpando){l.deleteExpando=!0;try{delete b.test}catch(d){l.deleteExpando=!1}}a=b=c=null}(),function(){var b,c,d=z.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(l[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),l[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var Y=/^(?:input|select|textarea)$/i,Z=/^key/,$=/^(?:mouse|contextmenu)|click/,_=/^(?:focusinfocus|focusoutblur)$/,ab=/^([^.]*)(?:\.(.+)|)$/;function bb(){return!0}function cb(){return!1}function db(){try{return z.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof n===L||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(F)||[""],h=b.length;while(h--)f=ab.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=nLine truncated
|
||||
},a,b,arguments.length>1)},show:function(){return Wb(this,!0)},hide:function(){return Wb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function $b(a,b,c,d,e){return new $b.prototype.init(a,b,c,d,e)}n.Tween=$b,$b.prototype={constructor:$b,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=$b.propHooks[this.prop];return a&&a.get?a.get(this):$b.propHooks._default.get(this)},run:function(a){var b,c=$b.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):$b.propHooks._default.set(this),this}},$b.prototype.init.prototype=$b.prototype,$b.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},$b.propHooks.scrollTop=$b.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=$b.prototype.init,n.fx.step={};var _b,ac,bc=/^(?:toggle|show|hide)$/,cc=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),dc=/queueHooks$/,ec=[jc],fc={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=cc.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&cc.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function gc(){return setTimeout(function(){_b=void 0}),_b=n.now()}function hc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=U[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function ic(a,b,c){for(var d,e=(fc[b]||[]).concat(fc["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function jc(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&V(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k=Gb(a.nodeName),"none"===j&&(j=k),"inline"===j&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==k?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],bc.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||n.style(a,d)}if(!n.isEmptyObject(o)){r?"hidden"in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o)n.style(a,b,o[b])});for(d in o)g=ic(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function kc(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function lc(a,b,c){var d,e,f=0,g=ec.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=_b||gc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:_b||gc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(kc(k,j.opts.specialEasing);g>f;f++)if(d=ec[f].call(j,a,k,j.opts))return d;return n.map(k,ic,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)Line truncated
|
||||
+317
@@ -0,0 +1,317 @@
|
||||
function Toolbar(options) {
|
||||
this.toolbar = options.toolbar;
|
||||
this.panelButtons = options.panelButtons;
|
||||
this.content = options.content;
|
||||
this.panelClose = options.panelClose;
|
||||
this.keyboardScope = options.keyboardScope;
|
||||
this.currentRequest = options.currentRequest;
|
||||
this.originalRequest = options.originalRequest;
|
||||
this.baseUrl = options.baseUrl;
|
||||
this.webroot = options.webroot;
|
||||
}
|
||||
|
||||
Toolbar.prototype = {
|
||||
_currentPanel: null,
|
||||
_lastPanel: null,
|
||||
_state: 0,
|
||||
_localStorageAvailable: null,
|
||||
currentRequest: null,
|
||||
originalRequest: null,
|
||||
ajaxRequests: [],
|
||||
|
||||
states: [
|
||||
'collapse',
|
||||
'toolbar'
|
||||
],
|
||||
|
||||
toggle: function() {
|
||||
var state = this.nextState();
|
||||
this.updateButtons(state);
|
||||
this.updateToolbarState(state);
|
||||
window.parent.postMessage(state, window.location.origin);
|
||||
},
|
||||
|
||||
state: function() {
|
||||
return this.states[this._state];
|
||||
},
|
||||
|
||||
nextState: function() {
|
||||
this._state++;
|
||||
if (this._state == this.states.length) {
|
||||
this._state = 0;
|
||||
}
|
||||
this.saveState();
|
||||
return this.state();
|
||||
},
|
||||
|
||||
localStorageAvailable: function() {
|
||||
if (this._localStorageAvailable === null) {
|
||||
if (!window.localStorage) {
|
||||
this._localStorageAvailable = false;
|
||||
} else {
|
||||
try {
|
||||
window.localStorage.setItem('testKey', '1');
|
||||
window.localStorage.removeItem('testKey');
|
||||
this._localStorageAvailable = true;
|
||||
} catch (error) {
|
||||
this._localStorageAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return this._localStorageAvailable;
|
||||
},
|
||||
|
||||
saveState: function() {
|
||||
if (!this.localStorageAvailable()) {
|
||||
return;
|
||||
}
|
||||
window.localStorage.setItem('toolbar_state', this._state);
|
||||
},
|
||||
|
||||
loadState: function() {
|
||||
if (!this.localStorageAvailable()) {
|
||||
return;
|
||||
}
|
||||
var old = window.localStorage.getItem('toolbar_state');
|
||||
if (!old) {
|
||||
old = 0;
|
||||
}
|
||||
if (old == 0) {
|
||||
return this.hideContent();
|
||||
}
|
||||
if (old == 1) {
|
||||
return this.toggle();
|
||||
}
|
||||
},
|
||||
|
||||
updateToolbarState: function(state) {
|
||||
if (state === 'toolbar') {
|
||||
this.toolbar.addClass('open');
|
||||
}
|
||||
if (state === 'collapse') {
|
||||
this.toolbar.removeClass('open');
|
||||
}
|
||||
},
|
||||
|
||||
updateButtons: function(state) {
|
||||
if (state === 'toolbar') {
|
||||
this.panelButtons.show();
|
||||
}
|
||||
if (state === 'collapse') {
|
||||
this.panelButtons.hide();
|
||||
}
|
||||
},
|
||||
|
||||
isExpanded: function() {
|
||||
return this.content.hasClass('enabled');
|
||||
},
|
||||
|
||||
hideContent: function() {
|
||||
// slide out - css animation
|
||||
this.content.removeClass('enabled');
|
||||
// remove the active state on buttons
|
||||
this.currentPanelButton().removeClass('panel-active');
|
||||
var _this = this;
|
||||
|
||||
// Hardcode timer as one does.
|
||||
setTimeout(function() {
|
||||
_this._currentPanel = null;
|
||||
window.parent.postMessage(_this.state(), window.location.origin);
|
||||
}, 250);
|
||||
},
|
||||
|
||||
loadPanel: function(id) {
|
||||
if (id === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var url = this.baseUrl + 'debug-kit/panels/view/' + id;
|
||||
var contentArea = this.content.find('#panel-content');
|
||||
var _this = this;
|
||||
var timer;
|
||||
var loader = $('#loader');
|
||||
|
||||
if (this._lastPanel != id) {
|
||||
timer = setTimeout(function() {
|
||||
loader.addClass('loading');
|
||||
}, 500);
|
||||
}
|
||||
|
||||
this._currentPanel = id;
|
||||
this._lastPanel = id;
|
||||
|
||||
window.parent.postMessage('expand', window.location.origin);
|
||||
|
||||
$.get(url, function(response) {
|
||||
clearTimeout(timer);
|
||||
loader.removeClass('loading');
|
||||
|
||||
// Slide panel into place - css transitions.
|
||||
_this.content.addClass('enabled');
|
||||
contentArea.html(response);
|
||||
_this.bindNeatArray();
|
||||
});
|
||||
},
|
||||
|
||||
bindNeatArray: function() {
|
||||
var sortButton = this.content.find('.neat-array-sort');
|
||||
var _this = this;
|
||||
sortButton.click(function() {
|
||||
if (!$(this).prop('checked')) {
|
||||
document.cookie = 'debugKit_sort=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=' + _this.webroot;
|
||||
} else {
|
||||
document.cookie = 'debugKit_sort=1; path=' + _this.webroot;
|
||||
}
|
||||
_this.loadPanel(_this.currentPanel());
|
||||
});
|
||||
|
||||
var lists = this.content.find('.depth-0');
|
||||
lists.find('ul').hide()
|
||||
.parent().addClass('expandable collapsed');
|
||||
|
||||
lists.on('click', 'li', function(event) {
|
||||
event.stopPropagation();
|
||||
var el = $(this);
|
||||
el.children('ul').toggle();
|
||||
el.toggleClass('expanded')
|
||||
.toggleClass('collapsed');
|
||||
});
|
||||
},
|
||||
|
||||
currentPanel: function() {
|
||||
return this._currentPanel;
|
||||
},
|
||||
|
||||
currentPanelButton: function() {
|
||||
return this.toolbar.find("[data-id='" + this.currentPanel() + "']");
|
||||
},
|
||||
|
||||
keyboardListener: function() {
|
||||
var _this = this;
|
||||
this.keyboardScope.keydown(function(event) {
|
||||
// Check for Esc key
|
||||
if (event.keyCode === 27) {
|
||||
// Close active panel
|
||||
if (_this.isExpanded()) {
|
||||
return _this.hideContent();
|
||||
}
|
||||
// Collapse the toolbar
|
||||
if (_this.state() === 'toolbar') {
|
||||
return _this.toggle();
|
||||
}
|
||||
}
|
||||
// Check for left arrow
|
||||
if (event.keyCode === 37 && _this.isExpanded()) {
|
||||
_this.panelButtons.removeClass('panel-active');
|
||||
var prevPanel = _this.currentPanelButton().prev();
|
||||
if (prevPanel.hasClass('panel')) {
|
||||
prevPanel.addClass('panel-active');
|
||||
return _this.loadPanel(prevPanel.data('id'));
|
||||
}
|
||||
}
|
||||
// Check for right arrow
|
||||
if (event.keyCode === 39 && _this.isExpanded()) {
|
||||
_this.panelButtons.removeClass('panel-active');
|
||||
var nextPanel = _this.currentPanelButton().next();
|
||||
if (nextPanel.hasClass('panel')) {
|
||||
nextPanel.addClass('panel-active');
|
||||
return _this.loadPanel(nextPanel.data('id'));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
mouseListener: function() {
|
||||
var _this = this;
|
||||
this.toolbar.find('.panel-button-left').on('click', function(e) {
|
||||
_this.scroll('left');
|
||||
return false;
|
||||
});
|
||||
this.toolbar.find('.panel-button-right').on('click', function(e) {
|
||||
_this.scroll('right');
|
||||
return false;
|
||||
});
|
||||
|
||||
this.panelButtons.on('click', function(e) {
|
||||
_this.panelButtons.removeClass('panel-active');
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var id = $(this).attr('data-id');
|
||||
var samePanel = _this.currentPanel() === id;
|
||||
|
||||
if (_this.isExpanded() && samePanel) {
|
||||
_this.hideContent();
|
||||
}
|
||||
if (samePanel) {
|
||||
return false;
|
||||
}
|
||||
$(this).addClass('panel-active');
|
||||
_this.loadPanel(id);
|
||||
});
|
||||
|
||||
this.toolbar.on('click', function(e) {
|
||||
_this.toggle();
|
||||
return false;
|
||||
});
|
||||
|
||||
this.panelClose.on('click', function(e) {
|
||||
_this.hideContent();
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
windowOrigin: function() {
|
||||
// IE does not have access to window.location.origin
|
||||
if (!window.location.origin) {
|
||||
window.location.origin = window.location.protocol + '//' +
|
||||
window.location.hostname +
|
||||
(window.location.port ? ':' + window.location.port : '');
|
||||
}
|
||||
},
|
||||
|
||||
onMessage: function(event) {
|
||||
if (typeof(event.data) === 'string' && event.data.indexOf('ajax-completed$$') === 0) {
|
||||
this.onRequest(JSON.parse(event.data.split('$$')[1]));
|
||||
}
|
||||
},
|
||||
|
||||
onRequest: function(request) {
|
||||
this.ajaxRequests.push(request);
|
||||
$('.panel-summary:contains(xhr)').text("" + this.ajaxRequests.length + ' xhr');
|
||||
},
|
||||
|
||||
scroll: function(direction) {
|
||||
var scrollValue = 300;
|
||||
var operator = direction === 'left' ? '-=' : '+=';
|
||||
var buttons = this.toolbar.find('.toolbar-inner li');
|
||||
var cakeButton = this.toolbar.find('#panel-button');
|
||||
var firstButton = buttons.first();
|
||||
var lastButton = buttons.last();
|
||||
|
||||
// If the toolbar is scrolled to the left, don't go farther.
|
||||
if (direction === 'right' && firstButton.position().left == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var buttonWidth = lastButton.width();
|
||||
// If the last button's right side is left of the cake button, don't scroll further.
|
||||
if (direction === 'left' && lastButton.offset().left + buttonWidth < cakeButton.offset().left) {
|
||||
return;
|
||||
}
|
||||
var css = {left: operator + scrollValue};
|
||||
$('.toolbar-inner li', this.button).animate(css)
|
||||
},
|
||||
|
||||
initialize: function() {
|
||||
this.windowOrigin();
|
||||
this.mouseListener();
|
||||
this.keyboardListener();
|
||||
this.loadState();
|
||||
|
||||
var self = this;
|
||||
window.addEventListener('message', function(event) {
|
||||
self.onMessage(event);
|
||||
}, false);
|
||||
}
|
||||
};
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
var __debugKitId,
|
||||
__debugKitBaseUrl;
|
||||
var elem = document.getElementById('__debug_kit');
|
||||
if (elem) {
|
||||
__debugKitId = elem.getAttribute('data-id');
|
||||
__debugKitBaseUrl = elem.getAttribute('data-url');
|
||||
elem = null;
|
||||
}
|
||||
|
||||
(function(win, doc) {
|
||||
var iframe;
|
||||
var bodyOverflow;
|
||||
|
||||
var onMessage = function(event) {
|
||||
if (event.data === 'collapse') {
|
||||
iframe.height = 40;
|
||||
iframe.width = 40;
|
||||
doc.body.style.overflow = bodyOverflow;
|
||||
return;
|
||||
}
|
||||
if (event.data === 'toolbar') {
|
||||
iframe.height = 40;
|
||||
iframe.width = '100%';
|
||||
doc.body.style.overflow = bodyOverflow;
|
||||
return;
|
||||
}
|
||||
if (event.data === 'expand') {
|
||||
iframe.width = '100%';
|
||||
iframe.height = '100%';
|
||||
doc.body.style.overflow = 'hidden';
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
var onReady = function() {
|
||||
if (!win.__debugKitId) {
|
||||
return;
|
||||
}
|
||||
var body = doc.body;
|
||||
|
||||
// Cannot use css text, because of CSP compatibility.
|
||||
iframe = doc.createElement('iframe');
|
||||
iframe.style.position = 'fixed';
|
||||
iframe.style.bottom = 0;
|
||||
iframe.style.right = 0;
|
||||
iframe.style.border = 0;
|
||||
iframe.style.outline = 0;
|
||||
iframe.style.overflow = 'hidden';
|
||||
iframe.style.zIndex = 99999;
|
||||
iframe.height = 40;
|
||||
iframe.width = 40;
|
||||
iframe.src = __debugKitBaseUrl + 'debug-kit/toolbar/' + __debugKitId;
|
||||
|
||||
body.appendChild(iframe);
|
||||
bodyOverflow = body.style.overflow;
|
||||
|
||||
window.addEventListener('message', onMessage, false);
|
||||
};
|
||||
|
||||
var logAjaxRequest = function(original) {
|
||||
return function() {
|
||||
if (this.readyState === 4 && this.getResponseHeader('X-DEBUGKIT-ID')) {
|
||||
var params = {
|
||||
requestId: this.getResponseHeader('X-DEBUGKIT-ID'),
|
||||
status: this.status,
|
||||
date: new Date,
|
||||
method: this._arguments && this._arguments[0],
|
||||
url: this._arguments && this._arguments[1],
|
||||
type: this.getResponseHeader('Content-Type')
|
||||
};
|
||||
iframe.contentWindow.postMessage('ajax-completed$$' + JSON.stringify(params), window.location.origin);
|
||||
}
|
||||
if (original) {
|
||||
return original.apply(this, [].slice.call(arguments));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var proxyAjaxOpen = function() {
|
||||
var proxied = window.XMLHttpRequest.prototype.open;
|
||||
window.XMLHttpRequest.prototype.open = function() {
|
||||
this._arguments = arguments;
|
||||
return proxied.apply(this, [].slice.call(arguments));
|
||||
};
|
||||
};
|
||||
|
||||
var proxyAjaxSend = function() {
|
||||
var proxied = window.XMLHttpRequest.prototype.send;
|
||||
window.XMLHttpRequest.prototype.send = function() {
|
||||
this.onreadystatechange = logAjaxRequest(this.onreadystatechange);
|
||||
return proxied.apply(this, [].slice.call(arguments));
|
||||
};
|
||||
};
|
||||
|
||||
// Bind on ready callbacks to DOMContentLoaded (native js) and turbolinks:load
|
||||
// Turbolinks replaces the body and merges the head of an HTML page.
|
||||
// Since the body is already loaded (DOMContentLoaded), the event is not triggered.
|
||||
if (doc.addEventListener) {
|
||||
// This ensures that all event listeners get applied only once.
|
||||
if (!window.__debugKitListenersApplied) {
|
||||
// The DOMContentLoaded is for all pages that do not have Turbolinks
|
||||
doc.addEventListener('DOMContentLoaded', onReady, false);
|
||||
doc.addEventListener('DOMContentLoaded', proxyAjaxOpen, false);
|
||||
doc.addEventListener('DOMContentLoaded', proxyAjaxSend, false);
|
||||
|
||||
// turbolinks:load is the alternative DOMContentLoaded Event of Turbolinks
|
||||
// https://github.com/turbolinks/turbolinks
|
||||
// https://github.com/cakephp/debug_kit/pull/664
|
||||
doc.addEventListener('turbolinks:load', onReady, false);
|
||||
doc.addEventListener('turbolinks:load', proxyAjaxOpen, false);
|
||||
doc.addEventListener('turbolinks:load', proxyAjaxSend, false);
|
||||
window.__debugKitListenersApplied = true;
|
||||
}
|
||||
} else {
|
||||
throw new Error('Unable to add event listener for DebugKit. Please use a browser' +
|
||||
'that supports addEventListener().');
|
||||
}
|
||||
}(window, document));
|
||||
Reference in new issue
Block a user