1 line
2.2 KiB
JavaScript
1 line
2.2 KiB
JavaScript
var tb_position;jQuery(document).ready(function(o){var e,n,i,a,l,r,d=o(".upload-view-toggle"),t=o(".wrap"),s=o(document.body);function c(){var t;a=o(":tabbable",i),l=e.find("#TB_closeWindowButton"),r=a.last(),(t=l.add(r)).off("keydown.wp-plugin-details"),t.on("keydown.wp-plugin-details",function(t){9===(t=t).which&&(r[0]!==t.target||t.shiftKey?l[0]===t.target&&t.shiftKey&&(t.preventDefault(),r.focus()):(t.preventDefault(),l.focus()))})}tb_position=function(){var t=o(window).width(),i=o(window).height()-(792<t?60:20),n=792<t?772:t-20;return(e=o("#TB_window")).length&&(e.width(n).height(i),o("#TB_iframeContent").width(n).height(i),e.css({"margin-left":"-"+parseInt(n/2,10)+"px"}),void 0!==document.body.style.maxWidth&&e.css({top:"30px","margin-top":"0"})),o("a.thickbox").each(function(){var t=o(this).attr("href");t&&(t=(t=t.replace(/&width=[0-9]+/g,"")).replace(/&height=[0-9]+/g,""),o(this).attr("href",t+"&width="+n+"&height="+i))})},o(window).resize(function(){tb_position()}),s.on("thickbox:iframe:loaded",e,function(){var t;t=e.find("#TB_iframeContent"),i=t.contents().find("body"),c(),l.focus(),o("#plugin-information-tabs a",i).on("click",function(){c()}),i.on("keydown",function(t){27===t.which&&tb_remove()})}).on("thickbox:removed",function(){n.focus()}),o(".thickbox.open-plugin-details-modal").on("click",function(t){var i=o(this).data("title")?plugininstallL10n.plugin_information+" "+o(this).data("title"):plugininstallL10n.plugin_modal_label;t.preventDefault(),t.stopPropagation(),n=o(this),tb_click.call(this),e.attr({role:"dialog","aria-label":plugininstallL10n.plugin_modal_label}),e.find("#TB_iframeContent").attr("title",i)}),o("#plugin-information-tabs a").click(function(t){var i=o(this).attr("name");t.preventDefault(),o("#plugin-information-tabs a.current").removeClass("current"),o(this).addClass("current"),"description"!==i&&o(window).width()<772?o("#plugin-information-content").find(".fyi").hide():o("#plugin-information-content").find(".fyi").show(),o("#section-holder div.section").hide(),o("#section-"+i).show()}),t.hasClass("plugin-install-tab-upload")||d.attr({role:"button","aria-expanded":"false"}).on("click",function(t){t.preventDefault(),s.toggleClass("show-upload-view"),d.attr("aria-expanded",s.hasClass("show-upload-view"))})}); |