mirror of
https://github.com/WordPress/WordPress.git
synced 2024-08-24 14:54:08 +02:00
Props yoavf, TobiasBg. Fixes #26073. Built from https://develop.svn.wordpress.org/trunk@27053 git-svn-id: http://core.svn.wordpress.org/trunk@26927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
3.3 KiB
JavaScript
1 line
3.3 KiB
JavaScript
var theme_viewer;jQuery(function(a){a("#availablethemes").on("click",".theme-detail",function(b){var c=a(this).closest(".available-theme"),d=c.find(".themedetaildiv");d.length||(d=c.find(".install-theme-info .theme-details"),d=d.clone().addClass("themedetaildiv").appendTo(c).hide()),d.toggle(),b.preventDefault()})}),jQuery(function(a){if(window.postMessage){var b=a("#theme-installer"),c=b.find(".wp-full-overlay-header"),d=b.find(".install-theme-info"),e=b.find(".wp-full-overlay-main"),f=a(document.body);b.on("click",".close-full-overlay",function(a){b.fadeOut(200,function(){e.empty(),f.removeClass("theme-installer-active full-overlay-active")}),a.preventDefault()}),b.on("click",".collapse-sidebar",function(a){b.toggleClass("collapsed").toggleClass("expanded"),a.preventDefault()}),a("#availablethemes").on("click",".install-theme-preview",function(g){var h;d.html(a(this).closest(".installable-theme").find(".install-theme-info").html()),c.find(".theme-install").replaceWith(d.find(".theme-install")),h=d.find(".theme-preview-url").val(),e.html('<iframe src="'+h+'" />'),b.fadeIn(200,function(){f.addClass("theme-installer-active full-overlay-active")}),g.preventDefault()})}});var ThemeViewer;!function(a){ThemeViewer=function(){function b(){a("#filter-click, #mini-filter-click").unbind("click").click(function(){return a("#filter-click").toggleClass("current"),a("#filter-box").slideToggle(),a("#current-theme").slideToggle(300),!1}),a("#filter-box :checkbox").unbind("click").click(function(){var b=a("#filter-box :checked").length,c=a("#filter-click").text();-1!==c.indexOf("(")&&(c=c.substr(0,c.indexOf("("))),a("#filter-click").text(0===b?c:c+" ("+b+")")})}var c={init:b};return c}}(jQuery),jQuery(document).ready(function(){theme_viewer=new ThemeViewer,theme_viewer.init()});var ThemeScroller;!function(a){ThemeScroller={querying:!1,scrollPollingDelay:500,failedRetryDelay:4e3,outListBottomThreshold:300,init:function(){var b=this;return"undefined"==typeof ajaxurl||"undefined"==typeof list_args||"undefined"==typeof theme_list_args?void a(".pagination-links").show():(this.nonce=a("#_ajax_fetch_list_nonce").val(),this.nextPage=theme_list_args.paged+1,this.$outList=a("#availablethemes"),this.$spinner=a("div.tablenav.bottom").children(".spinner"),this.$window=a(window),this.$document=a(document),void(theme_list_args.total_pages>=this.nextPage&&(this.pollInterval=setInterval(function(){return b.poll()},this.scrollPollingDelay))))},poll:function(){var a=this.$document.scrollTop()+this.$window.innerHeight();this.querying||a<this.$outList.height()-this.outListBottomThreshold||this.ajax()},process:function(a){return void 0===a?void clearInterval(this.pollInterval):(this.nextPage>theme_list_args.total_pages&&clearInterval(this.pollInterval),void(this.nextPage<=theme_list_args.total_pages+1&&this.$outList.append(a.rows)))},ajax:function(){var b=this,c={action:"fetch-list",paged:this.nextPage,s:theme_list_args.search,tab:theme_list_args.tab,type:theme_list_args.type,_ajax_fetch_list_nonce:this.nonce,"features[]":theme_list_args.features,list_args:list_args};this.querying=!0,this.$spinner.show(),a.getJSON(ajaxurl,c).done(function(a){b.nextPage++,b.process(a),b.$spinner.hide(),b.querying=!1}).fail(function(){b.$spinner.hide(),b.querying=!1,setTimeout(function(){b.ajax()},b.failedRetryDelay)})}},a(document).ready(function(){ThemeScroller.init()})}(jQuery); |