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

13 lines
12 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(a){function h(c,h){var j=c==window,l=h&&h.message!==undefined?h.message:undefined;h=a.extend({},a.blockUI.defaults,h||{});h.overlayCSS=a.extend({},a.blockUI.defaults.overlayCSS,h.overlayCSS||{});var p=a.extend({},a.blockUI.defaults.css,h.css||{}),q=a.extend({},a.blockUI.defaults.themedCSS,h.themedCSS||{});l=l===undefined?h.message:l;j&&f&&i(window,{fadeOut:0});if(l&&typeof l!="string"&&(l.parentNode||l.jquery)){var r=l.jquery?l[0]:l,s={};a(c).data("blockUI.history",s);s.el=r;s.parent=r.parentNode;s.display=r.style.display;s.position=r.style.position;s.parent&&s.parent.removeChild(r)}var t=h.baseZ,u=a.browser.msie||h.forceIframe?a('<iframe class="blockUI" style="z-index:'+t++ +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+h.iframeSrc+'"></iframe>'):a('<div class="blockUI" style="display:none"></div>'),v=a('<div class="blockUI blockOverlay" style="z-index:'+t++ +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'),w,x;h.theme&&j?x='<div class="blockUI '+h.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+t+';display:none;position:fixed">'+'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(h.title||"&nbsp;")+"</div>"+'<div class="ui-widget-content ui-dialog-content"></div>'+"</div>":h.theme?x='<div class="blockUI '+h.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+t+';display:none;position:absolute">'+'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(h.title||"&nbsp;")+"</div>"+'<div class="ui-widget-content ui-dialog-content"></div>'+"</div>":j?x='<div class="blockUI '+h.blockMsgClass+' blockPage" style="z-index:'+t+';display:none;position:fixed"></div>':x='<div class="blockUI '+h.blockMsgClass+' blockElement" style="z-index:'+t+';display:none;position:absolute"></div>';w=a(x);if(l)if(h.theme){w.css(q);w.addClass("ui-widget-content")}else w.css(p);(!h.applyPlatformOpacityRules||!a.browser.mozilla||!/Linux/.test(navigator.platform))&&v.css(h.overlayCSS);v.css("position",j?"fixed":"absolute");(a.browser.msie||h.forceIframe)&&u.css("opacity",0);var y=[u,v,w],z=j?a("body"):a(c);a.each(y,function(){this.appendTo(z)});h.theme&&h.draggable&&a.fn.draggable&&w.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var A=d&&(!a.boxModel||a("object,embed",j?null:c).length>0);if(e||A){j&&h.allowBodyStretch&&a.boxModel&&a("html,body").css("height","100%");if((e||!a.boxModel)&&!j)var B=o(c,"borderTopWidth"),C=o(c,"borderLeftWidth"),D=B?"(0 - "+B+")":0,E=C?"(0 - "+C+")":0;a.each([u,v,w],function(a,b){var c=b[0].style;c.position="absolute";if(a<2){j?c.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+h.quirksmodeOffsetHack+') + "px"'):c.setExpression("height",'this.parentNode.offsetHeight + "px"');j?c.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):c.setExpression("width",'this.parentNode.offsetWidth + "px"');E&&c.setExpression("left",E);D&&c.setExpression("top",D)}else if(h.centerY){j&&c.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');c.marginTop=0}else if(!h.centerY&&j){var d=h.css&&h.css.top?parseInt(h.css.top):0,e="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+d+') + "px"';c.setExpression("top",e)}})}if(l){h.theme?w.find(".ui-widget-content").append(l):w.append(l);(l.jquery||l.nodeType)&&a(l).show()}(a.browser.msie||h.forceIframe)&&h.showOverlay&&u.show();if(h.fadeIn){var F=h.onBlock?h.onBlock:b,G=h.showOverlay&&!l?F:b,H=l?F:b;h.showOverlay&&v._fadeIn(h.fadeIn,G);l&&w._fadeIn(h.fadeIn,H)}else{h.showOverlay&&v.show();l&&w.show();h.onBlock&&h.onBlock()}k(1,c,h);if(j){f=w[0];g=a(":input:enabled:visible",f);h.focusInput&&setTimeout(m,20)}else n(w[0],h.centerX,h.centerY);if(h.timeout){var I=setTimeout(function(){j?a.unblockUI(h):a(c).unblock(h)},h.timeout);a(c).data("blockUI.timeout",I)}}function i(b,c){var d=b==window,e=a(b),h=e.data("blockUI.history"),i=e.data("blockUI.timeout");if(i){clearTimeout(i);e.removeData("blockUI.timeout")}c=a.extend({},a.blockUI.defaults,c||{});k(0,b,c);var l;d?l=a("body").children().filter(".blockUI").add("body > .blockUI"):l=a(".blockUI",b);d&&(f=g=null);if(c.fadeOut){l.fadeOut(c.fadeOut);setTimeout(function(){j(l,h,c,b)},c.fadeOut)}else j(l,h,c,b)}function j(b,c,d,e){b.each(function(a,b){this.parentNode&&this.parentNode.removeChild(this)});if(c&&c.el){c.el.style.display=c.display;c.el.style.position=c.position;c.parent&&c.parent.appendChild(c.el);a(e).removeData("blockUI.history")}typeof d.onUnblock=="function"&&d.onUnblock(e,d)}function k(b,c,d){var e=c==window,g=a(c);if(!b&&(e&&!f||!e&&!g.data("blockUI.isBlocked")))return;e||g.data("blockUI.isBlocked",b);if(!d.bindEvents||b&&!d.showOverlay)return;var h="mousedown mouseup keydown keypress";b?a(document).bind(h,d,l):a(document).unbind(h,l)}function l(b){if(b.keyCode&&b.keyCode==9&&f&&b.data.constrainTabKey){var c=g,d=!b.shiftKey&&b.target===c[c.length-1],e=b.shiftKey&&b.target===c[0];if(d||e){setTimeout(function(){m(e)},10);return!1}}var h=b.data;return a(b.target).parents("div."+h.blockMsgClass).length>0?!0:a(b.target).parents().children().filter("div.blockUI").length==0}function m(a){if(!g)return;var b=g[a===!0?g.length-1:0];b&&b.focus()}function n(a,b,c){var d=a.parentNode,e=a.style,f=(d.offsetWidth-a.offsetWidth)/2-o(d,"borderLeftWidth"),g=(d.offsetHeight-a.offsetHeight)/2-o(d,"borderTopWidth");b&&(e.left=f>0?f+"px":"0");c&&(e.top=g>0?g+"px":"0")}function o(b,c){return parseInt(a.css(b,c))||0}if(/1\.(0|1|2)\.(0|1|2)/.test(a.fn.jquery)||/^1.1/.test(a.fn.jquery)){alert("blockUI requires jQuery v1.2.3 or later! You are using v"+a.fn.jquery);return}a.fn._fadeIn=a.fn.fadeIn;var b=function(){},c=document.documentMode||0,d=a.browser.msie&&(a.browser.version<8&&!c||c<8),e=a.browser.msie&&/MSIE 6.0/.test(navigator.userAgent)&&!c;a.blockUI=function(a){h(window,a)};a.unblockUI=function(a){i(window,a)};a.growlUI=function(b,c,d,e){var f=a('<div class="growlUI"></div>');b&&f.append("<h1>"+b+"</h1>");c&&f.append("<h2>"+c+"</h2>");d==undefined&&(d=3e3);a.blockUI({message:f,fadeIn:700,fadeOut:1e3,centerY:!1,timeout:d,showOverlay:!1,onUnblock:e,css:a.blockUI.defaults.growlCSS})};a.fn.block=function(b){return this.unblock({fadeOut:0}).each(function(){a.css(this,"position")=="static"&&(this.style.position="relative");a.browser.msie&&(this.style.zoom=1);h(this,b)})};a.fn.unblock=function(a){return this.each(function(){i(this,a)})};a.blockUI.version=2.37;a.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 f=null,g=[]})(jQuery);(function(a){a.fn.tipTip=function(b){var c={activation:"hover",keepAlive:!1,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:!1,enter:function(){},exit:function(){}},d=a.extend(c,b);if(a("#tiptip_holder").length<=0){var e=a('<div id="tiptip_holder" style="max-width:'+d.maxWidth+';"></div>'),f=a('<div id="tiptip_content"></div>'),g=a('<div id="tiptip_arrow"></div>');a("body").append(e.html(f).prepend(g.html('<div id="tiptip_arrow_inner"></div>')))}else var e=a("#tiptip_holder"),f=a("#tiptip_content"),g=a("#tiptip_arrow");return this.each(function(){var b=a(this);if(d.content)var c=d.content;else var c=b.attr(d.attribute);if(c!=""){d.content||b.removeAttr(d.attribute);var h=!1;if(d.activation=="hover"){b.hover(function(){i()},function(){d.keepAlive||j()});d.keepAlive&&e.hover(function(){},function(){j()})}else if(d.activation=="focus")b.focus(function(){i()}).blur(function(){j()});else if(d.activation=="click"){b.click(function(){i();return!1}).hover(function(){},function(){d.keepAlive||j()});d.keepAlive&&e.hover(function(){},function(){j()})}function i(){d.enter.call(this);f.html(c);e.hide().removeAttr("class").css("margin","0");g.removeAttr("style");var i=parseInt(b.offset().top),j=parseInt(b.offset().left),k=parseInt(b.outerWidth()),l=parseInt(b.outerHeight()),m=e.outerWidth(),n=e.outerHeight(),o=Math.round((k-m)/2),p=Math.round((l-n)/2),q=Math.round(j+o),r=Math.round(i+l+d.edgeOffset),s="",t="",u=Math.round(m-12)/2;d.defaultPosition=="bottom"?s="_bottom":d.defaultPosition=="top"?s="_top":d.defaultPosition=="left"?s="_left":d.defaultPosition=="right"&&(s="_right");var v=o+j<parseInt(a(window).scrollLeft()),w=m+j>parseInt(a(window).width());if(v&&o<0||s=="_right"&&!w||s=="_left"&&j<m+d.edgeOffset+5){s="_right";t=Math.round(n-13)/2;u=-12;q=Math.round(j+k+d.edgeOffset);r=Math.round(i+p)}else if(w&&o<0||s=="_left"&&!v){s="_left";t=Math.round(n-13)/2;u=Math.round(m);q=Math.round(j-(m+d.edgeOffset+5));r=Math.round(i+p)}var x=i+l+d.edgeOffset+n+8>parseInt(a(window).height()+a(window).scrollTop()),y=i+l-(d.edgeOffset+n+8)<0;if(x||s=="_bottom"&&x||s=="_top"&&!y){s=="_top"||s=="_bottom"?s="_top":s+="_top";t=n;r=Math.round(i-(n+5+d.edgeOffset))}else if(y|(s=="_top"&&y)||s=="_bottom"&&!x){s=="_top"||s=="_bottom"?s="_bottom":s+="_bottom";t=-12;r=Math.round(i+l+d.edgeOffset)}if(s=="_right_top"||s=="_left_top")r+=5;else if(s=="_right_bottom"||s=="_left_bottom")r-=5;if(s=="_left_top"||s=="_left_bottom")q+=5;g.css({"margin-left":u+"px","margin-top":t+"px"});e.css({"margin-left":q+"px","margin-top":r+"px"}).attr("class","tip"+s);h&&clearTimeout(h);h=setTimeout(function(){e.stop(!0,!0).fadeIn(d.fadeIn)},d.delay)}function j(){d.exit.call(this);h&&clearTimeout(h);e.fadeOut(d.fadeOut)}}})}})(jQuery);(function(a){function b(a){var b=a.attr("placeholder");a.val()===""&&a.val(b);a.bind({focus:function(c){a.val()===b&&a.val("")},blur:function(c){a.val()===""&&a.val(b)}})}function c(b){b.find(":input[placeholder]").each(function(){var b=a(this);b.val()===b.attr("placeholder")&&b.val("")})}if("placeholder"in document.createElement("input"))return;a(document).ready(function(){a(":input[placeholder]").each(function(){b(a(this))});a("form").submit(function(b){c(a(this))})})})(jQuery);jQuery(function(){jQuery("body").on("keyup",".wc_input_price",function(){var a=jQuery(this),b=jQuery(this).val();b!==""&&!jQuery.isNumeric(b)?a.addClass("wc-error"):a.removeClass("wc-error")}).keyup();jQuery(".tips, .help_tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50});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()})});