Current File : /home/pacjaorg/wpt.pacja.org/km/media/vendor/debugbar/openhandler.min.js |
if(typeof PhpDebugBar>"u"){var PhpDebugBar={};PhpDebugBar.$=jQuery}(function(n){var o=function(t){return PhpDebugBar.utils.csscls(t,"phpdebugbar-openhandler-")};PhpDebugBar.OpenHandler=PhpDebugBar.Widget.extend({className:"phpdebugbar-openhandler",defaults:{items_per_page:20},render:function(){var t=this;this.$el.appendTo("body").hide(),this.$closebtn=n('<a><i class="phpdebugbar-fa phpdebugbar-fa-times"></i></a>'),this.$table=n("<tbody />"),n("<div>PHP DebugBar | Open</div>").addClass(o("header")).append(this.$closebtn).appendTo(this.$el),n('<table><thead><tr><th width="150">Date</th><th width="55">Method</th><th>URL</th><th width="125">IP</th><th width="100">Filter data</th></tr></thead></table>').append(this.$table).appendTo(this.$el),this.$actions=n("<div />").addClass(o("actions")).appendTo(this.$el),this.$closebtn.on("click",function(){t.hide()}),this.$loadmorebtn=n("<a>Load more</a>").appendTo(this.$actions).on("click",function(){t.find(t.last_find_request,t.last_find_request.offset+t.get("items_per_page"),t.handleFind.bind(t))}),this.$showonlycurrentbtn=n("<a>Show only current URL</a>").appendTo(this.$actions).on("click",function(){t.$table.empty(),t.find({uri:window.location.pathname},0,t.handleFind.bind(t))}),this.$showallbtn=n("<a>Show all</a>").appendTo(this.$actions).on("click",function(){t.refresh()}),this.$clearbtn=n("<a>Delete all</a>").appendTo(this.$actions).on("click",function(){t.clear(function(){t.hide()})}),this.addSearch(),this.$overlay=n("<div />").addClass(o("overlay")).hide().appendTo("body"),this.$overlay.on("click",function(){t.hide()})},refresh:function(){this.$table.empty(),this.$loadmorebtn.show(),this.find({},0,this.handleFind.bind(this))},addSearch:function(){var t=this,e=n("<button />").text("Search").attr("type","submit").on("click",function(d){t.$table.empty();var i={},s=n(this).parent().serializeArray();n.each(s,function(){this.value&&(i[this.name]=this.value)}),t.find(i,0,t.handleFind.bind(t)),d.preventDefault()});n("<form />").append("<br/><b>Filter results</b><br/>").append('Method: <select name="method"><option></option><option>GET</option><option>POST</option><option>PUT</option><option>DELETE</option></select><br/>').append('Uri: <input type="text" name="uri"><br/>').append('IP: <input type="text" name="ip"><br/>').append(e).appendTo(this.$actions)},handleFind:function(t){var e=this;n.each(t,function(d,i){var s=n("<a />").text("Load dataset").on("click",function(a){e.hide(),e.load(i.id,function(h){e.callback(i.id,h)}),a.preventDefault()}),c=n("<a />").text(i.method).on("click",function(a){e.$table.empty(),e.find({method:i.method},0,e.handleFind.bind(e)),a.preventDefault()}),l=n("<a />").text(i.uri).on("click",function(a){e.hide(),e.load(i.id,function(h){e.callback(i.id,h)}),a.preventDefault()}),p=n("<a />").text(i.ip).on("click",function(a){e.$table.empty(),e.find({ip:i.ip},0,e.handleFind.bind(e)),a.preventDefault()}),r=n("<a />").text("Show URL").on("click",function(a){e.$table.empty(),e.find({uri:i.uri},0,e.handleFind.bind(e)),a.preventDefault()});n("<tr />").append("<td>"+i.datetime+"</td>").append("<td>"+i.method+"</td>").append(n("<td />").append(l)).append(n("<td />").append(p)).append(n("<td />").append(r)).appendTo(e.$table)}),t.length<this.get("items_per_page")&&this.$loadmorebtn.hide()},show:function(t){this.callback=t,this.$el.show(),this.$overlay.show(),this.refresh()},hide:function(){this.$el.hide(),this.$overlay.hide()},find:function(t,e,d){var i=n.extend({},t,{max:this.get("items_per_page"),offset:e||0});this.last_find_request=i,this.ajax(i,d)},load:function(t,e){this.ajax({op:"get",id:t},e)},clear:function(t){this.ajax({op:"clear"},t)},ajax:function(t,e){n.ajax({dataType:"json",url:this.get("url"),data:t,success:e,ignoreDebugBarAjaxHandler:!0})}})})(PhpDebugBar.$);