[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  !function(t){var e=PhpDebugBar.utils.makecsscls("phpdebugbar-widgets-");PhpDebugBar.Widgets.SQLQueriesWidget=PhpDebugBar.Widget.extend({className:e("sqlqueries"),onFilterClick:function(s){t(s).toggleClass(e("excluded"));var a=[];this.$toolbar.find(e(".filter")+e(".excluded")).each((function(){a.push(this.rel)})),this.$list.$el.find("li[connection="+t(s).attr("rel")+"]").toggle(),this.set("exclude",a)},onCopyToClipboard:function(e){var s=t(e).parent("li").find("code").get(0);!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()}(s)},render:function(){this.$status=t("<div />").addClass(e("status")).appendTo(this.$el),this.$toolbar=t("<div></div>").addClass(e("toolbar")).appendTo(this.$el);var s=[],a=this;this.$list=new PhpDebugBar.Widgets.ListWidget({itemRenderer:function(n,o){if(t("<code />").addClass(e("sql")).html(PhpDebugBar.Widgets.highlight(o.sql,"sql")).appendTo(n),o.duration_str&&t('<span title="Duration" />').addClass(e("duration")).text(o.duration_str).appendTo(n),o.memory_str&&t('<span title="Memory usage" />').addClass(e("memory")).text(o.memory_str).appendTo(n),void 0!==o.row_count&&t('<span title="Row count" />').addClass(e("row-count")).text(o.row_count).appendTo(n),void 0!==o.stmt_id&&o.stmt_id&&t('<span title="Prepared statement ID" />').addClass(e("stmt-id")).text(o.stmt_id).appendTo(n),o.connection&&(t('<span title="Connection" />').addClass(e("database")).text(o.connection).appendTo(n),n.attr("connection",o.connection),-1==t.inArray(o.connection,s)&&(s.push(o.connection),t("<a />").addClass(e("filter")).text(o.connection).attr("rel",o.connection).on("click",(function(){a.onFilterClick(this)})).appendTo(a.$toolbar),s.length>1&&(a.$toolbar.show(),a.$list.$el.css("margin-bottom","20px")))),void 0===o.is_success||o.is_success||(n.addClass(e("error")),n.append(t("<span />").addClass(e("error")).text("["+o.error_code+"] "+o.error_message))),t('<span title="Copy to clipboard" />').addClass(e("copy-clipboard")).css("cursor","pointer").on("click",(function(t){a.onCopyToClipboard(this),t.stopPropagation()})).appendTo(n),o.params&&!t.isEmptyObject(o.params)){var i=t('<table><tr><th colspan="2">Params</th></tr></table>').addClass(e("params")).appendTo(n);for(var d in o.params)"function"!=typeof o.params[d]&&i.append('<tr><td class="'+e("name")+'">'+d+'</td><td class="'+e("value")+'">'+o.params[d]+"</td></tr>");n.css("cursor","pointer").click((function(){i.is(":visible")?i.hide():i.show()}))}}}),this.$list.$el.appendTo(this.$el),this.bindAttr("data",(function(s){if(s.length<=0)return!1;this.$list.set("data",s.statements),this.$status.empty();for(var a={},n=0,o=0,i=0;i<s.statements.length;i++){var d=s.statements[i].sql;s.statements[i].params&&!t.isEmptyObject(s.statements[i].params)&&(d+=" {"+t.param(s.statements[i].params,!1)+"}"),a[d]=a[d]||{keys:[]},a[d].keys.push(i)}for(var d in a)if(a[d].keys.length>1){o+=a[d].keys.length;for(i=0;i<a[d].keys.length;i++)this.$list.$el.find("."+e("list-item")).eq(a[d].keys[i]).addClass(e("sql-duplicate"))}else n++;var r=t("<span />").text(s.nb_statements+" statements were executed").appendTo(this.$status);s.nb_failed_statements&&r.append(", "+s.nb_failed_statements+" of which failed"),o&&(r.append(", "+o+" of which were duplicates"),r.append(", "+n+" unique")),s.accumulated_duration_str&&this.$status.append(t('<span title="Accumulated duration" />').addClass(e("duration")).text(s.accumulated_duration_str)),s.memory_usage_str&&this.$status.append(t('<span title="Memory usage" />').addClass(e("memory")).text(s.memory_usage_str))}))}})}(PhpDebugBar.$);


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