← Back
Editing: jetpack-modules.views.min.js
window.jetpackModules=window.jetpackModules||{},window.jetpackModules.views=function(t,e,a,l){"use strict";var i={};return i.List_Table=a.View.extend({template:l.template("Jetpack_Modules_List_Table_Template"),updateUrl:function(){if(t.history.replaceState){var a=t.location.href.split("?")[0]+"?page=jetpack_modules",l=e(".subsubsub .current"),i=e(".purpose-filter .current"),o=e(".button-group.availability-filter .active"),n=e("#srch-term-search-input").val();"1"===new URLSearchParams(t.location.search).get("modules_fallback")&&(a+="&modules_fallback=1"),n.length&&(a+="&s="+encodeURIComponent(n)),"all"===o.data("availability")&&(a+="&offline_available=all"),l.hasClass("all")||(a+="&module_tag="+encodeURIComponent(l.find("a").data("title"))),i.length&&!i.hasClass("all")&&(a+="&product_group="+encodeURIComponent(i.find("a").data("group"))),e(".button-group.module-filter .active").each(function(){var t=e(this).data("filter-by"),l=e(this).data("filter-value");t&&(a+="&"+encodeURIComponent(t)+"="+encodeURIComponent(l))}),t.history.replaceState({},"",a)}},updateFacetCounts:function(t,a,l){e(t+" > li").each(function(){var t=e(this),i=t.hasClass("all"),o=t.children("a").data(l),n=i?a.__all__:a[o]||0;t.find(".count").text("("+n+")"),i||t.toggleClass("is-empty",0===n)})},updateCounts:function(){this.updateFacetCounts(".subsubsub",this.model.tag_counts(),"title"),this.updateFacetCounts(".purpose-filter",this.model.purpose_counts(),"group")},render:function(){return this.model.filter_and_sort(),this.$el.html(this.template(this.model.attributes)),this.updateCounts(),this.updateUrl(),this},initialize:function(){this.listenTo(this.model,"change",this.render)}}),i}(window,jQuery,Backbone,wp);
Save File
Cancel