[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/plg_system_debug/widgets/sqlqueries/ -> widget.min.js (source)

   1  !function(e){var t=PhpDebugBar.utils.makecsscls("phpdebugbar-widgets-");PhpDebugBar.Widgets.SQLQueriesWidget=PhpDebugBar.Widget.extend({className:t("sqlqueries"),onFilterClick:function(a){e(a).toggleClass(t("excluded"));var s=[];this.$toolbar.find(t(".filter")+t(".excluded")).each((function(){s.push(this.rel)})),this.$list.$el.find("li[connection="+e(a).attr("rel")+"]").toggle(),this.set("exclude",s)},onFilterDupesClick:function(a){e(a).toggleClass(t("excluded"));var s=[];this.$toolbar.find(t(".filter")+t(".excluded")).each((function(){s.push(this.rel)})),this.$list.$el.find("li[dupeindex="+e(a).attr("rel")+"]").toggle(),this.set("exclude",s)},onCopyToClipboard:function(t){var a=e(t).parent("li").find("code").get(0);!function(e){if(document.selection)(t=document.body.createTextRange()).moveToElementText(e),t.select();else if(window.getSelection){var t;(t=document.createRange()).selectNodeContents(e),window.getSelection().removeAllRanges(),window.getSelection().addRange(t)}!function(){try{document.execCommand("copy"),alert("Query copied to the clipboard")}catch(e){console.log("Oops, unable to copy")}}(),window.getSelection().removeAllRanges()}(a)},render:function(){this.$status=e("<div />").addClass(t("status")).appendTo(this.$el),this.$toolbar=e("<div></div>").addClass(t("toolbar")).appendTo(this.$el);var a=[],s=this;this.$list=new PhpDebugBar.Widgets.ListWidget({itemRenderer:function(n,i){var l,o,d;if(e("<code />").addClass(t("sql")).html(PhpDebugBar.Widgets.highlight(i.sql,"sql")).appendTo(n),i.duration_str&&e('<span title="Duration" />').addClass(t("duration")).text(i.duration_str).appendTo(n),i.memory_str&&e('<span title="Memory usage" />').addClass(t("memory")).text(i.memory_str).appendTo(n),void 0!==i.row_count&&e('<span title="Row count" />').addClass(t("row-count")).text(i.row_count).appendTo(n),void 0!==i.stmt_id&&i.stmt_id&&e('<span title="Prepared statement ID" />').addClass(t("stmt-id")).text(i.stmt_id).appendTo(n),i.connection&&(e('<span title="Connection" />').addClass(t("database")).text(i.connection).appendTo(n),n.attr("connection",i.connection),-1==e.inArray(i.connection,a)&&(a.push(i.connection),e("<a />").addClass(t("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||(n.addClass(t("error")),n.append(e("<span />").addClass(t("error")).text("["+i.error_code+"] "+i.error_message))),i.params&&!e.isEmptyObject(i.params))var r=e('<span title="Params" />').text("Params").addClass(t("eye")).css("cursor","pointer").on("click",(function(){l&&l.is(":visible")?(l.hide(),r.addClass(t("eye")),r.removeClass(t("eye-dash"))):(!function(){if(l)l.show();else{var a;for(var s in(l=e("<table>").addClass(t("params")).appendTo(n)).append('<tr><th colspan="3">Query Parameters</th></tr>'),l.append("<tr><td>ID</td><td>Value</td><td>Data Type</td></tr>"),i.params)a=i.params[s],l.append("<tr><td>"+s+"</td><td>"+a.value+"</td><td>"+a.dataType+"</td></tr>");l.show()}}(),r.addClass(t("eye-dash")),r.removeClass(t("eye")))})).appendTo(n);if(i.explain&&!e.isEmptyObject(i.explain))var p=e('<span title="Explain" />').text("Explain").addClass(t("eye")).css("cursor","pointer").on("click",(function(){o&&o.is(":visible")?(o.hide(),p.addClass(t("eye")),p.removeClass(t("eye-dash"))):(!function(){if(o)o.show();else{var a,s,l;for(a in(o=e("<table>").addClass(t("explain")).appendTo(n)).append("<tr><th>"+i.explain_col.join("</th><th>")+"</th></tr>"),i.explain)l=[],s=i.explain[a],i.explain_col.forEach((function(e){l.push(s[e])})),o.append("<tr><td>"+l.join("</td><td>")+"</td></tr>");o.show()}}(),p.addClass(t("eye-dash")),p.removeClass(t("eye")))})).appendTo(n);if(i.callstack&&!e.isEmptyObject(i.callstack))var c=e('<span title="Call Stack" />').text("Stack").addClass(t("eye")).css("cursor","pointer").on("click",(function(){d&&d.is(":visible")?(d.hide(),c.addClass(t("eye")),c.removeClass(t("eye-dash"))):(!function(){if(d)d.show();else{var a,l,o,r,p;for(a in d=e('<table><tr><th colspan="3">Call Stack</th></tr></table>').addClass(t("callstack")).appendTo(n),i.callstack)o=(l=i.callstack[a])[3]?l[3].replace(s.root_path,"")+":"+l[4]:"",r=l[2].replace(s.root_path,""),p=l[1]?"caller":"",o&&s.xdebug_link&&(o='<a href="'+s.xdebug_link.replace("%f",l[3]).replace("%l",l[4])+'">'+o+"</a>"),d.append('<tr class="'+p+'"><th>'+l[0]+"</th><td>"+r+"</td><td>"+o+"</td></tr>");d.show()}}(),c.addClass(t("eye-dash")),c.removeClass(t("eye")))})).appendTo(n);if(void 0!==i.caller&&i.caller){var u=i.caller.replace(s.root_path,"");if(s.xdebug_link){var h=i.caller.split(":");e("<a />").text(u).addClass(t("editor-link")).attr("href",s.xdebug_link.replace("%f",h[0]).replace("%l",h[1])).appendTo(n)}else e('<span title="Caller" />').text(u).addClass(t("stmt-id")).appendTo(n)}e('<span title="Copy to clipboard" />').text("Copy").addClass(t("copy-clipboard")).css("cursor","pointer").on("click",(function(e){s.onCopyToClipboard(this),e.stopPropagation()})).appendTo(n),n.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 n={},i=0,l=0,o=0;o<a.statements.length;o++){var d=a.statements[o].sql;a.statements[o].params&&!e.isEmptyObject(a.statements[o].params)&&(d+=" {"+e.param(a.statements[o].params,!1)+"}"),n[d]=n[d]||{keys:[]},n[d].keys.push(o)}var r=0;for(var d in n)if(n[d].keys.length>1){l+=n[d].keys.length,r++;for(o=0;o<n[d].keys.length;o++)this.$list.$el.find("."+t("list-item")).eq(n[d].keys[o]).addClass(t("sql-duplicate")).attr("dupeindex","dupe-"+r)}else i++;if(l){for(o=0;o<=r;o++)e("<a />").addClass(t("filter")).text(o?"Duplicates "+o:"Uniques").attr("rel","dupe-"+o).on("click",(function(){s.onFilterDupesClick(this)})).appendTo(s.$toolbar);s.$toolbar.show(),s.$list.$el.css("margin-bottom","20px")}var p=e("<span />").text(a.nb_statements+" statements were executed").appendTo(this.$status);a.nb_failed_statements&&p.append(", "+a.nb_failed_statements+" of which failed"),l&&(p.append(", "+l+" of which were duplicates"),p.append(", "+i+" unique")),a.accumulated_duration_str&&this.$status.append(e('<span title="Accumulated duration" />').addClass(t("duration")).text(a.accumulated_duration_str)),a.memory_usage_str&&this.$status.append(e('<span title="Memory usage" />').addClass(t("memory")).text(a.memory_usage_str))}))}})}(PhpDebugBar.$);


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer