- md5
- bf3c505ca4d9e2d3ded5e1affd800cb2
- sha1
- 416ee311b09bcd8b22c740aec67a20851b7ca078
- sha256
- 6fc1eeb324a46538e41c57fc150b5f41accebe5bc6133cfcba0e9a437bf3880c
!function(t){var e=PhpDebugBar.utils.makecsscls("phpdebugbar-widgets-");PhpDebugBar.Widgets.SQLQueriesWidget=PhpDebugBar.Widget.extend({className:e("sqlqueries"),onFilterClick:function(a){t(a).toggleClass(e("excluded"));var s=[];this.$toolbar.find(e(".filter")+e(".excluded")).each(function(){s.push(this.rel)}),this.$list.$el.find("li[connection="+t(a).attr("rel")+"]").toggle(),this.set("exclude",s)},onFilterDupesClick:function(a){t(a).toggleClass(e("excluded"));var s=[];this.$toolbar.find(e(".filter")+e(".excluded")).each(function(){s.push(this.rel)}),this.$list.$el.find("li[dupeindex="+t(a).attr("rel")+"]").toggle(),this.set("exclude",s)},onCopyToClipboard:function(e){!function(t){if(document.selection)(e=document.body.createTextRange()).moveToElementText(t),e.select();else if(window.getSelection){var e;(e=document.createRange()).selectNodeContents(t),window.getSelection().removeAllRanges(),window.getSelection().addRange(e)}!function(){try{document.execCommand("copy"),alert("Query copied to the clipboard")}catch(t){console.log("Oops, unable to copy")}}(),window.getSelection().removeAllRanges()}(t(e).parent("li").find("code").get(0))},render:function(){this.$status=t("<div />").addClass(e("status")).appendTo(this.$el),this.$toolbar=t("<div></div>").addClass(e("toolbar")).appendTo(this.$el);var a=[],s=this;this.$list=new PhpDebugBar.Widgets.ListWidget({itemRenderer:function(l,i){if(t("<code />").addClass(e("sql")).html(PhpDebugBar.Widgets.highlight(i.sql,"sql")).appendTo(l),i.duration_str&&t('<span title="Duration" />').addClass(e("duration")).text(i.duration_str).appendTo(l),i.memory_str&&t('<span title="Memory usage" />').addClass(e("memory")).text(i.memory_str).appendTo(l),void 0!==i.row_count&&t('<span title="Row count" />').addClass(e("row-count")).text(i.row_count).appendTo(l),void 0!==i.stmt_id&&i.stmt_id&&t('<span title="Prepared statement ID" />').addClass(e("stmt-id")).text(i.stmt_id).appendTo(l),i.connection&&(t('<span title="Connection" />').addClass(e("database")).text(i.connection).appendTo(l),l.attr("connection",i.connection),-1==t.inArray(i.connection,a)&&(a.push(i.connection),t("<a />").addClass(e("filter")).text(i.connection).attr("rel",i.connection).on("click",function(){s.onFilterClick(this)}).appendTo(s.$toolbar),a.length>1&&(s.$toolbar.show(),s.$list.$el.css("margin-bottom","20px")))),void 0===i.is_success||i.is_success||(l.addClass(e("error")),l.append(t("<span />").addClass(e("error")).text("["+i.error_code+"] "+i.error_message))),i.params&&!t.isEmptyObject(i.params)){var n=t('<table><tr><th colspan="2">Params</th></tr></table>').addClass(e("params")).appendTo(l);for(var d in i.params)"function"!=typeof i.params[d]&&n.append('<tr><td class="'+e("name")+'">'+d+'</td><td class="'+e("value")+'">'+i.params[d]+"</td></tr>");l.css("cursor","pointer").click(function(){n.is(":visible")?n.hide():n.show()})}var o,r;if(i.explain&&!t.isEmptyObject(i.explain)){var p=t('<span title="Explain" />').text("Explain").addClass(e("eye")).css("cursor","pointer").on("click",function(){o.is(":visible")?(o.hide(),p.addClass(e("eye")),p.removeClass(e("eye-dash"))):(o.show(),p.addClass(e("eye-dash")),p.removeClass(e("eye")))}).appendTo(l);o=t('<table><thead><tr><th colspan="10">Explain</th></tr><tr><th>Id</th><th>Select Type</th><th>Table</th><th>Type</th><th>Possible Keys</th><th>Key</th><th>Key Len</th><th>Ref</th><th>Rows</th><th>Extra</th></tr></thead></table>').addClass(e("callstack"))}if(i.callstack&&!t.isEmptyObject(i.callstack)){var c=t('<span title="Call Stack" />').text("Stack").addClass(e("eye")).css("cursor","pointer").on("click",function(){r.is(":visible")?(r.hide(),c.addClass(e("eye")),c.removeClass(e("eye-dash"))):(r.show(),c.addClass(e("eye-dash")),c.removeClass(e("eye")))}).appendTo(l);r=t('<table><thead><tr><th colspan="3">Call Stack</th></tr></thead></table>').addClass(e("callstack"))}if(void 0!==i.caller&&i.caller){var h=i.caller.replace(s.root_path,"");if(s.xdebug_link){var u=i.caller.split(":");t("<a />").text(h).addClass(e("editor-link")).attr("href",s.xdebug_link.replace("%f",u[0]).replace("%l",u[1])).appendTo(l)}else t('<span title="Caller" />').text(h).addClass(e("stmt-id")).appendTo(l)}if(t('<span title="Copy to clipboard" />').text("Copy").addClass(e("copy-clipboard")).css("cursor","pointer").on("click",function(t){s.onCopyToClipboard(this),t.stopPropagation()}).appendTo(l),r)for(var m in r.appendTo(l),i.callstack){var f=(b=i.callstack[m])[3]?b[3].replace(s.root_path,"")+":"+b[4]:"",g=(h=b[2].replace(s.root_path,""),b[1]?"caller":"");f&&s.xdebug_link&&(f='<a href="'+s.xdebug_link.replace("%f",b[3]).replace("%l",b[4])+'">'+f+"</a>"),r.append('<tr class="'+g+'"><th>'+b[0]+"</th><td>"+h+"</td><td>"+f+"</td></tr>")}if(o)for(m in o.appendTo(l),i.explain){var b=i.explain[m];o.append("<tr><td>"+b.id+"</td><td>"+b.select_type+"</td><td>"+b.table+"</td><td>"+b.type+"</td><td>"+b.possible_keys+"</td><td>"+b.key+"</td><td>"+b.key_len+"</td><td>"+b.ref+"</td><td>"+b.rows+"</td><td>"+b.Extra+"</td></tr>")}l.attr("dupeindex","dupe-0")}}),this.$list.$el.appendTo(this.$el),this.bindAttr("data",function(a){if(a.length<=0)return!1;this.root_path=a.root_path,this.xdebug_link=a.xdebug_link,this.$list.set("data",a.statements),this.$status.empty();for(var l={},i=0,n=0,d=0;d<a.statements.length;d++){var o=a.statements[d].sql;a.statements[d].params&&!t.isEmptyObject(a.statements[d].params)&&(o+=" {"+t.param(a.statements[d].params,!1)+"}"),l[o]=l[o]||{keys:[]},l[o].keys.push(d)}var r=0;for(var o in l)if(l[o].keys.length>1){n+=l[o].keys.length,r++;for(d=0;d<l[o].keys.length;d++)this.$list.$el.find("."+e("list-item")).eq(l[o].keys[d]).addClass(e("sql-duplicate")).attr("dupeindex","dupe-"+r)}else i++;if(n){for(d=0;d<=r;d++)t("<a />").addClass(e("filter")).text(d?"Duplicates "+d:"Uniques").attr("rel","dupe-"+d).on("click",function(){s.onFilterDupesClick(this)}).appendTo(s.$toolbar);s.$toolbar.show(),s.$list.$el.css("margin-bottom","20px")}var p=t("<span />").text(a.nb_statements+" statements were executed").appendTo(this.$status);a.nb_failed_statements&&p.append(", "+a.nb_failed_statements+" of which failed"),n&&(p.append(", "+n+" of which were duplicates"),p.append(", "+i+" unique")),a.accumulated_duration_str&&this.$status.append(t('<span title="Accumulated duration" />').addClass(e("duration")).text(a.accumulated_duration_str)),a.memory_usage_str&&this.$status.append(t('<span title="Memory usage" />').addClass(e("memory")).text(a.memory_usage_str))})}})}(PhpDebugBar.$);
The same content is in 11 releases, Joomla 4.0.0-alpha5 to 4.0.0-beta3. See them all, or every version of this file.