woocommerce/assets/js/admin/woocommerce_admin.min.js

13 lines
13 KiB
JavaScript

/*!
jQuery blockUI plugin
Version 2.37 (29-JAN-2011)
@requires jQuery v1.2.3 or later
Examples at: http://malsup.com/jquery/block/
Copyright (c) 2007-2010 M. Alsup
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
Thanks to Amir-Hossein Sobhi for some excellent contributions!
*/(function(e){function u(n,u){var f=n==window,c=u&&u.message!==undefined?u.message:undefined;u=e.extend({},e.blockUI.defaults,u||{});u.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,u.overlayCSS||{});var v=e.extend({},e.blockUI.defaults.css,u.css||{}),m=e.extend({},e.blockUI.defaults.themedCSS,u.themedCSS||{});c=c===undefined?u.message:c;f&&s&&a(window,{fadeOut:0});if(c&&typeof c!="string"&&(c.parentNode||c.jquery)){var g=c.jquery?c[0]:c,y={};e(n).data("blockUI.history",y);y.el=g;y.parent=g.parentNode;y.display=g.style.display;y.position=g.style.position;y.parent&&y.parent.removeChild(g)}var b=u.baseZ,w=e.browser.msie||u.forceIframe?e('<iframe class="blockUI" style="z-index:'+b++ +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+u.iframeSrc+'"></iframe>'):e('<div class="blockUI" style="display:none"></div>'),E=e('<div class="blockUI blockOverlay" style="z-index:'+b++ +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'),S,x;u.theme&&f?x='<div class="blockUI '+u.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+b+';display:none;position:fixed">'+'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(u.title||"&nbsp;")+"</div>"+'<div class="ui-widget-content ui-dialog-content"></div>'+"</div>":u.theme?x='<div class="blockUI '+u.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+b+';display:none;position:absolute">'+'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(u.title||"&nbsp;")+"</div>"+'<div class="ui-widget-content ui-dialog-content"></div>'+"</div>":f?x='<div class="blockUI '+u.blockMsgClass+' blockPage" style="z-index:'+b+';display:none;position:fixed"></div>':x='<div class="blockUI '+u.blockMsgClass+' blockElement" style="z-index:'+b+';display:none;position:absolute"></div>';S=e(x);if(c)if(u.theme){S.css(m);S.addClass("ui-widget-content")}else S.css(v);(!u.applyPlatformOpacityRules||!e.browser.mozilla||!/Linux/.test(navigator.platform))&&E.css(u.overlayCSS);E.css("position",f?"fixed":"absolute");(e.browser.msie||u.forceIframe)&&w.css("opacity",0);var T=[w,E,S],N=f?e("body"):e(n);e.each(T,function(){this.appendTo(N)});u.theme&&u.draggable&&e.fn.draggable&&S.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var C=r&&(!e.boxModel||e("object,embed",f?null:n).length>0);if(i||C){f&&u.allowBodyStretch&&e.boxModel&&e("html,body").css("height","100%");if((i||!e.boxModel)&&!f)var k=d(n,"borderTopWidth"),L=d(n,"borderLeftWidth"),A=k?"(0 - "+k+")":0,O=L?"(0 - "+L+")":0;e.each([w,E,S],function(e,t){var n=t[0].style;n.position="absolute";if(e<2){f?n.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+u.quirksmodeOffsetHack+') + "px"'):n.setExpression("height",'this.parentNode.offsetHeight + "px"');f?n.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):n.setExpression("width",'this.parentNode.offsetWidth + "px"');O&&n.setExpression("left",O);A&&n.setExpression("top",A)}else if(u.centerY){f&&n.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');n.marginTop=0}else if(!u.centerY&&f){var r=u.css&&u.css.top?parseInt(u.css.top):0,i="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+r+') + "px"';n.setExpression("top",i)}})}if(c){u.theme?S.find(".ui-widget-content").append(c):S.append(c);(c.jquery||c.nodeType)&&e(c).show()}(e.browser.msie||u.forceIframe)&&u.showOverlay&&w.show();if(u.fadeIn){var M=u.onBlock?u.onBlock:t,_=u.showOverlay&&!c?M:t,D=c?M:t;u.showOverlay&&E._fadeIn(u.fadeIn,_);c&&S._fadeIn(u.fadeIn,D)}else{u.showOverlay&&E.show();c&&S.show();u.onBlock&&u.onBlock()}l(1,n,u);if(f){s=S[0];o=e(":input:enabled:visible",s);u.focusInput&&setTimeout(h,20)}else p(S[0],u.centerX,u.centerY);if(u.timeout){var P=setTimeout(function(){f?e.unblockUI(u):e(n).unblock(u)},u.timeout);e(n).data("blockUI.timeout",P)}}function a(t,n){var r=t==window,i=e(t),u=i.data("blockUI.history"),a=i.data("blockUI.timeout");if(a){clearTimeout(a);i.removeData("blockUI.timeout")}n=e.extend({},e.blockUI.defaults,n||{});l(0,t,n);var c;r?c=e("body").children().filter(".blockUI").add("body > .blockUI"):c=e(".blockUI",t);r&&(s=o=null);if(n.fadeOut){c.fadeOut(n.fadeOut);setTimeout(function(){f(c,u,n,t)},n.fadeOut)}else f(c,u,n,t)}function f(t,n,r,i){t.each(function(e,t){this.parentNode&&this.parentNode.removeChild(this)});if(n&&n.el){n.el.style.display=n.display;n.el.style.position=n.position;n.parent&&n.parent.appendChild(n.el);e(i).removeData("blockUI.history")}typeof r.onUnblock=="function"&&r.onUnblock(i,r)}function l(t,n,r){var i=n==window,o=e(n);if(!t&&(i&&!s||!i&&!o.data("blockUI.isBlocked")))return;i||o.data("blockUI.isBlocked",t);if(!r.bindEvents||t&&!r.showOverlay)return;var u="mousedown mouseup keydown keypress";t?e(document).bind(u,r,c):e(document).unbind(u,c)}function c(t){if(t.keyCode&&t.keyCode==9&&s&&t.data.constrainTabKey){var n=o,r=!t.shiftKey&&t.target===n[n.length-1],i=t.shiftKey&&t.target===n[0];if(r||i){setTimeout(function(){h(i)},10);return!1}}var u=t.data;return e(t.target).parents("div."+u.blockMsgClass).length>0?!0:e(t.target).parents().children().filter("div.blockUI").length==0}function h(e){if(!o)return;var t=o[e===!0?o.length-1:0];t&&t.focus()}function p(e,t,n){var r=e.parentNode,i=e.style,s=(r.offsetWidth-e.offsetWidth)/2-d(r,"borderLeftWidth"),o=(r.offsetHeight-e.offsetHeight)/2-d(r,"borderTopWidth");t&&(i.left=s>0?s+"px":"0");n&&(i.top=o>0?o+"px":"0")}function d(t,n){return parseInt(e.css(t,n))||0}if(/1\.(0|1|2)\.(0|1|2)/.test(e.fn.jquery)||/^1.1/.test(e.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later! You are using v"+e.fn.jquery);return}e.fn._fadeIn=e.fn.fadeIn;var t=function(){},n=document.documentMode||0,r=e.browser.msie&&(e.browser.version<8&&!n||n<8),i=e.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!n;e.blockUI=function(e){u(window,e)};e.unblockUI=function(e){a(window,e)};e.growlUI=function(t,n,r,i){var s=e('<div class="growlUI"></div>');t&&s.append("<h1>"+t+"</h1>");n&&s.append("<h2>"+n+"</h2>");r==undefined&&(r=3e3);e.blockUI({message:s,fadeIn:700,fadeOut:1e3,centerY:!1,timeout:r,showOverlay:!1,onUnblock:i,css:e.blockUI.defaults.growlCSS})};e.fn.block=function(t){return this.unblock({fadeOut:0}).each(function(){e.css(this,"position")=="static"&&(this.style.position="relative");e.browser.msie&&(this.style.zoom=1);u(this,t)})};e.fn.unblock=function(e){return this.each(function(){a(this,e)})};e.blockUI.version=2.37;e.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,applyPlatformOpacityRules:!0,onBlock:null,onUnblock:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg"};var s=null,o=[]})(jQuery);(function(e){e.fn.tipTip=function(t){var n={activation:"hover",keepAlive:!1,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:!1,enter:function(){},exit:function(){}},r=e.extend(n,t);if(e("#tiptip_holder").length<=0){var i=e('<div id="tiptip_holder" style="max-width:'+r.maxWidth+';"></div>'),s=e('<div id="tiptip_content"></div>'),o=e('<div id="tiptip_arrow"></div>');e("body").append(i.html(s).prepend(o.html('<div id="tiptip_arrow_inner"></div>')))}else var i=e("#tiptip_holder"),s=e("#tiptip_content"),o=e("#tiptip_arrow");return this.each(function(){var t=e(this);if(r.content)var n=r.content;else var n=t.attr(r.attribute);if(n!=""){r.content||t.removeAttr(r.attribute);var u=!1;if(r.activation=="hover"){t.hover(function(){a()},function(){r.keepAlive||f()});r.keepAlive&&i.hover(function(){},function(){f()})}else if(r.activation=="focus")t.focus(function(){a()}).blur(function(){f()});else if(r.activation=="click"){t.click(function(){a();return!1}).hover(function(){},function(){r.keepAlive||f()});r.keepAlive&&i.hover(function(){},function(){f()})}function a(){r.enter.call(this);s.html(n);i.hide().removeAttr("class").css("margin","0");o.removeAttr("style");var a=parseInt(t.offset().top),f=parseInt(t.offset().left),l=parseInt(t.outerWidth()),c=parseInt(t.outerHeight()),h=i.outerWidth(),p=i.outerHeight(),d=Math.round((l-h)/2),v=Math.round((c-p)/2),m=Math.round(f+d),g=Math.round(a+c+r.edgeOffset),y="",b="",w=Math.round(h-12)/2;r.defaultPosition=="bottom"?y="_bottom":r.defaultPosition=="top"?y="_top":r.defaultPosition=="left"?y="_left":r.defaultPosition=="right"&&(y="_right");var E=d+f<parseInt(e(window).scrollLeft()),S=h+f>parseInt(e(window).width());if(E&&d<0||y=="_right"&&!S||y=="_left"&&f<h+r.edgeOffset+5){y="_right";b=Math.round(p-13)/2;w=-12;m=Math.round(f+l+r.edgeOffset);g=Math.round(a+v)}else if(S&&d<0||y=="_left"&&!E){y="_left";b=Math.round(p-13)/2;w=Math.round(h);m=Math.round(f-(h+r.edgeOffset+5));g=Math.round(a+v)}var x=a+c+r.edgeOffset+p+8>parseInt(e(window).height()+e(window).scrollTop()),T=a+c-(r.edgeOffset+p+8)<0;if(x||y=="_bottom"&&x||y=="_top"&&!T){y=="_top"||y=="_bottom"?y="_top":y+="_top";b=p;g=Math.round(a-(p+5+r.edgeOffset))}else if(T|(y=="_top"&&T)||y=="_bottom"&&!x){y=="_top"||y=="_bottom"?y="_bottom":y+="_bottom";b=-12;g=Math.round(a+c+r.edgeOffset)}if(y=="_right_top"||y=="_left_top")g+=5;else if(y=="_right_bottom"||y=="_left_bottom")g-=5;if(y=="_left_top"||y=="_left_bottom")m+=5;o.css({"margin-left":w+"px","margin-top":b+"px"});i.css({"margin-left":m+"px","margin-top":g+"px"}).attr("class","tip"+y);u&&clearTimeout(u);u=setTimeout(function(){i.stop(!0,!0).fadeIn(r.fadeIn)},r.delay)}function f(){r.exit.call(this);u&&clearTimeout(u);i.fadeOut(r.fadeOut)}}})}})(jQuery);(function(e){function t(e){var t=e.attr("placeholder");e.val()===""&&e.val(t);e.bind({focus:function(n){e.val()===t&&e.val("")},blur:function(n){e.val()===""&&e.val(t)}})}function n(t){t.find(":input[placeholder]").each(function(){var t=e(this);t.val()===t.attr("placeholder")&&t.val("")})}if("placeholder"in document.createElement("input"))return;e(document).ready(function(){e(":input[placeholder]").each(function(){t(e(this))});e("form").submit(function(t){n(e(this))})})})(jQuery);jQuery(function(){jQuery("body").on("keyup",".wc_input_price",function(){var e=jQuery(this),t=jQuery(this).val();t!==""&&!jQuery.isNumeric(t)?e.addClass("wc-error"):e.removeClass("wc-error")}).keyup();jQuery(".tips, .help_tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200});jQuery("select.availability").change(function(){jQuery(this).val()=="specific"?jQuery(this).closest("tr").next("tr").show():jQuery(this).closest("tr").next("tr").hide()}).change();jQuery(".hide_options_if_checked").each(function(){jQuery(this).find("input:eq(0)").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide():jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show()}).change()});jQuery(".show_options_if_checked").each(function(){jQuery(this).find("input:eq(0)").change(function(){jQuery(this).is(":checked")?jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").show():jQuery(this).closest("fieldset, tr").nextUntil(".hide_options_if_checked, .show_options_if_checked",".hidden_option").hide()}).change()});jQuery("input#woocommerce_demo_store").change(function(){jQuery(this).is(":checked")?jQuery("#woocommerce_demo_store_notice").closest("tr").show():jQuery("#woocommerce_demo_store_notice").closest("tr").hide()}).change()});