diff options
Diffstat (limited to 'plugins/wordpress-mobile-pack/admin/js/UI.Modules/Content/WMP_CATEGORY_DETAILS.min.js')
-rwxr-xr-x | plugins/wordpress-mobile-pack/admin/js/UI.Modules/Content/WMP_CATEGORY_DETAILS.min.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/wordpress-mobile-pack/admin/js/UI.Modules/Content/WMP_CATEGORY_DETAILS.min.js b/plugins/wordpress-mobile-pack/admin/js/UI.Modules/Content/WMP_CATEGORY_DETAILS.min.js index 1b03a0d4..a08f42f9 100755 --- a/plugins/wordpress-mobile-pack/admin/js/UI.Modules/Content/WMP_CATEGORY_DETAILS.min.js +++ b/plugins/wordpress-mobile-pack/admin/js/UI.Modules/Content/WMP_CATEGORY_DETAILS.min.js @@ -1 +1 @@ -function WMP_CATEGORY_DETAILS(){var JSObject=this;this.type="wmp_categoryedit",this.form,this.DOMDoc,this.send_btn,this.deletingIcon=!1,this.init=function(){WMPJSInterface=window.parent.WMPJSInterface,this.send_btn=jQuery("#"+this.type+"_send_btn",this.DOMDoc).get(0),this.form=this.DOMDoc.getElementById(this.type+"_form"),this.addButtonsActions(),null!=this.form&&this.initValidation()},this.initValidation=function(){this.validator=jQuery("#"+this.form.id,this.DOMDoc).validate({rules:{wmp_categoryedit_icon:{accept:"png|jpg|jpeg|gif"}},messages:{wmp_categoryedit_icon:{accept:"Please add a png, gif or jpeg image."}},errorPlacement:function(e,t){var n=t[0].id.split("_"),i=n.length>1?n[n.length-1]:n[0],c=jQuery("#error_"+i+"_container",JSObject.DOMDoc);e.appendTo(c)},errorElement:"span"});var $Icon=jQuery("#"+this.type+"_icon",this.DOMDoc),$RemoveIconLink=jQuery("#"+this.type+"_icon_removenew",this.DOMDoc);$Icon.bind("change",function(){$Icon.focus(),$Icon.blur(),this.files[0]&&jQuery("#fakefileicon").val(this.files[0].name),$RemoveIconLink.css("display","block")}),$RemoveIconLink.bind("click",function(){jQuery("#fakefileicon").val(""),$Icon.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_icon"),$RemoveIconLink.css("display","none")});var $EditIconLink=jQuery("."+this.type+"_changeicon",this.DOMDoc);$EditIconLink.length>0&&$EditIconLink.click(function(){"none"==jQuery("."+JSObject.type+"_uploadicon",JSObject.DOMDoc).css("display")&&($Icon.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_icon"),jQuery("#fakefileicon").val(""),$RemoveIconLink.css("display","none"),jQuery("."+JSObject.type+"_uploadicon",JSObject.DOMDoc).show(),""!=jQuery("#"+JSObject.type+"_currenticon",JSObject.DOMDoc).attr("src")&&jQuery("."+JSObject.type+"_changeicon_cancel",JSObject.DOMDoc).show(),"block"==jQuery("."+JSObject.type+"_iconcontainer",JSObject.DOMDoc).css("display")&&jQuery("."+JSObject.type+"_iconcontainer",JSObject.DOMDoc).hide())});var $CancelEditIconLink=jQuery("."+this.type+"_changeicon_cancel a",this.DOMDoc);$CancelEditIconLink.length>0&&$CancelEditIconLink.click(function(){"block"==jQuery("."+JSObject.type+"_uploadicon",JSObject.DOMDoc).css("display")&&($Icon.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_icon"),jQuery("#fakefileicon").val(""),jQuery("."+JSObject.type+"_uploadicon",JSObject.DOMDoc).hide(),jQuery(this).parent().hide(),"none"==jQuery("."+JSObject.type+"_iconcontainer",JSObject.DOMDoc).css("display")&&""!=jQuery("#"+JSObject.type+"_currenticon",JSObject.DOMDoc).attr("src")&&jQuery("."+JSObject.type+"_iconcontainer",JSObject.DOMDoc).show())});var $DeleteIconLink=jQuery("."+this.type+"_deleteicon",this.DOMDoc);if($DeleteIconLink.length>0){var href=$DeleteIconLink.get(0).href;$DeleteIconLink.get(0).href="javascript:void(0);",$DeleteIconLink.click(function(){if(!JSObject.deletingIcon){JSObject.deletingIcon=!0;var isConfirmed=confirm("Are you sure you want to remove this image?");isConfirmed&&jQuery.get(ajaxurl,{action:"wmp_theme_editimages",type:"delete",source:"category_icon",category_id:jQuery("#"+JSObject.type+"_id",JSObject.DOMDoc).val()},function(responseJSON){var JSON=eval("("+responseJSON+")"),response=Boolean(Number(String(JSON.status)));if(JSObject.deletingIcon=!1,1==response){jQuery("#"+JSObject.type+"_currenticon",JSObject.DOMDoc).attr("src",""),$EditIconLink.trigger("click");var message="The image has been removed.";WMPJSInterface.Loader.display({message:message})}else{var message="There was an error. Please try again in few seconds.";WMPJSInterface.Loader.display({message:message})}})}})}},this.displayImage=function(e,t){jQuery("#"+JSObject.type+"_icon",JSObject.DOMDoc).val(""),jQuery("#fakefileicon").val(""),jQuery("."+JSObject.type+"_uploadicon",JSObject.DOMDoc).hide(),jQuery("."+JSObject.type+"_changeicon_cancel",JSObject.DOMDoc).hide(),jQuery("#"+JSObject.type+"_currenticon",JSObject.DOMDoc).attr("src",t),jQuery("."+JSObject.type+"_iconcontainer",JSObject.DOMDoc).css("display","block")},this.addButtonsActions=function(){jQuery(this.send_btn).unbind("click"),jQuery(this.send_btn).bind("click",function(){JSObject.disableButton(this),JSObject.validate()}),JSObject.enableButton(this.send_btn)},this.enableButton=function(e){jQuery(e).css("cursor","pointer"),jQuery(e).animate({opacity:1},100)},this.disableButton=function(e){jQuery(e).unbind("click"),jQuery(e).animate({opacity:.4},100),jQuery(e).css("cursor","default")},this.scrollToError=function(e){var t=jQuery("html,body",JSObject.DOMDoc),n=parseInt(jQuery("html,body").scrollTop())||parseInt(jQuery("body").scrollTop()),i=t.get(0).clientHeight;parseInt(t.offset().top);n>e?jQuery(t).animate({scrollTop:e-20},1e3):e>n+i&&jQuery(t).animate({scrollTop:n+i},1e3)},this.validate=function(){jQuery(this.form).validate().form();var e=[];for(var t in this.validator.invalid){var n=jQuery(this.form[t]);e.push(n.offset().top)}0==e.length?this.sendData():(e.sort(function(e,t){return e-t}),JSObject.scrollToError(e[0]),JSObject.addButtonsActions())},this.submitForm=function(){return WMPJSInterface.AjaxUpload.dosubmit(JSObject.form,{onStart:JSObject.startUploadingData,onComplete:JSObject.completeUploadingData})},this.sendData=function(){jQuery("#"+this.form.id,this.DOMDoc).unbind("submit"),jQuery("#"+this.form.id,this.DOMDoc).bind("submit",function(){JSObject.submitForm()}),jQuery("#"+this.form.id,this.DOMDoc).submit(),JSObject.disableButton(JSObject.send_btn)},this.startUploadingData=function(){return WMPJSInterface.Preloader.start(),setTimeout(function(){var e=JSObject.form.elements;for(nElems=e.length,j=0;j<nElems;j++)e[j].disabled=!0},300),!0},this.completeUploadingData=function(responseJSON){jQuery("#"+JSObject.form.id,JSObject.DOMDoc).unbind("submit"),jQuery("#"+JSObject.form.id,JSObject.DOMDoc).bind("submit",function(){return!1}),WMPJSInterface.Preloader.remove(100);var JSON=eval("("+responseJSON+")"),response=Boolean(Number(String(JSON.status)));if(void 0!=JSON.uploaded_category_icon&&JSObject.displayImage("icon",JSON.uploaded_category_icon),1==response&&0==JSON.messages.length){var message="Your category image has been successfully modified!";WMPJSInterface.Loader.display({message:message})}else if(0==JSON.messages.length){var message="There was an error. Please reload the page and try again.";WMPJSInterface.Loader.display({message:message})}else for(var i=0;i<JSON.messages.length;i++)WMPJSInterface.Loader.display({message:JSON.messages[i]});setTimeout(function(){var e=JSObject.form.elements;for(nElems=e.length,j=0;j<nElems;j++)e[j].disabled=!1},300),JSObject.addButtonsActions()}}
\ No newline at end of file +function WMP_CATEGORY_DETAILS(){var JSObject=this;this.type="wmp_categoryedit",this.form,this.DOMDoc,this.send_btn,this.deletingIcon=!1,this.init=function(){WMPJSInterface=window.parent.WMPJSInterface,this.send_btn=jQuery("#"+this.type+"_send_btn",this.DOMDoc).get(0),this.form=this.DOMDoc.getElementById(this.type+"_form"),this.addButtonsActions(),null!=this.form&&this.initValidation()},this.initValidation=function(){this.validator=jQuery("#"+this.form.id,this.DOMDoc).validate({rules:{wmp_categoryedit_icon:{accept:"png|jpg|jpeg|gif"}},messages:{wmp_categoryedit_icon:{accept:"Please add a png, gif or jpeg image."}},errorPlacement:function(e,t){var n=t[0].id.split("_"),i=n.length>1?n[n.length-1]:n[0],c=jQuery("#error_"+i+"_container",JSObject.DOMDoc);e.appendTo(c)},errorElement:"span"});var $Icon=jQuery("#"+this.type+"_icon",this.DOMDoc),$RemoveIconLink=jQuery("#"+this.type+"_icon_removenew",this.DOMDoc);$Icon.bind("change",function(){$Icon.focus(),$Icon.blur(),this.files[0]&&jQuery("#fakefileicon").val(this.files[0].name),$RemoveIconLink.css("display","block")}),$RemoveIconLink.bind("click",function(){jQuery("#fakefileicon").val(""),$Icon.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_icon"),$RemoveIconLink.css("display","none")});var $EditIconLink=jQuery("."+this.type+"_changeicon",this.DOMDoc);$EditIconLink.length>0&&$EditIconLink.click(function(){"none"==jQuery("."+JSObject.type+"_uploadicon",JSObject.DOMDoc).css("display")&&($Icon.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_icon"),jQuery("#fakefileicon").val(""),$RemoveIconLink.css("display","none"),jQuery("."+JSObject.type+"_uploadicon",JSObject.DOMDoc).show(),""!=jQuery("#"+JSObject.type+"_currenticon",JSObject.DOMDoc).attr("src")&&jQuery("."+JSObject.type+"_changeicon_cancel",JSObject.DOMDoc).show(),"block"==jQuery("."+JSObject.type+"_iconcontainer",JSObject.DOMDoc).css("display")&&jQuery("."+JSObject.type+"_iconcontainer",JSObject.DOMDoc).hide())});var $CancelEditIconLink=jQuery("."+this.type+"_changeicon_cancel a",this.DOMDoc);$CancelEditIconLink.length>0&&$CancelEditIconLink.click(function(){"block"==jQuery("."+JSObject.type+"_uploadicon",JSObject.DOMDoc).css("display")&&($Icon.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_icon"),jQuery("#fakefileicon").val(""),jQuery("."+JSObject.type+"_uploadicon",JSObject.DOMDoc).hide(),jQuery(this).parent().hide(),"none"==jQuery("."+JSObject.type+"_iconcontainer",JSObject.DOMDoc).css("display")&&""!=jQuery("#"+JSObject.type+"_currenticon",JSObject.DOMDoc).attr("src")&&jQuery("."+JSObject.type+"_iconcontainer",JSObject.DOMDoc).show())});var $DeleteIconLink=jQuery("."+this.type+"_deleteicon",this.DOMDoc);if($DeleteIconLink.length>0){var href=$DeleteIconLink.get(0).href;$DeleteIconLink.get(0).href="javascript:void(0);",$DeleteIconLink.click(function(){if(!JSObject.deletingIcon){JSObject.deletingIcon=!0;var isConfirmed=confirm("Are you sure you want to remove this image?");isConfirmed&&jQuery.get(ajaxurl,{action:"wmp_theme_editimages",type:"delete",source:"category_icon",category_id:jQuery("#"+JSObject.type+"_id",JSObject.DOMDoc).val()},function(responseJSON){var JSON=eval("("+responseJSON+")"),response=Boolean(Number(String(JSON.status)));if(JSObject.deletingIcon=!1,1==response){jQuery("#"+JSObject.type+"_currenticon",JSObject.DOMDoc).attr("src",""),$EditIconLink.trigger("click");var message="The image has been removed.";WMPJSInterface.Loader.display({message:message})}else{var message="There was an error. Please try again in few seconds.";WMPJSInterface.Loader.display({message:message})}})}})}},this.displayImage=function(e,t){jQuery("#"+JSObject.type+"_icon",JSObject.DOMDoc).val(""),jQuery("#fakefileicon").val(""),jQuery("."+JSObject.type+"_uploadicon",JSObject.DOMDoc).hide(),jQuery("."+JSObject.type+"_changeicon_cancel",JSObject.DOMDoc).hide(),jQuery("#"+JSObject.type+"_currenticon",JSObject.DOMDoc).attr("src",t),jQuery("."+JSObject.type+"_iconcontainer",JSObject.DOMDoc).css("display","block")},this.addButtonsActions=function(){jQuery(this.send_btn).unbind("click"),jQuery(this.send_btn).bind("click",function(){JSObject.disableButton(this),JSObject.validate()}),JSObject.enableButton(this.send_btn)},this.enableButton=function(e){jQuery(e).css("cursor","pointer"),jQuery(e).animate({opacity:1},100)},this.disableButton=function(e){jQuery(e).unbind("click"),jQuery(e).animate({opacity:.4},100),jQuery(e).css("cursor","default")},this.scrollToError=function(e){var t=jQuery("html,body",JSObject.DOMDoc),n=parseInt(jQuery("html,body").scrollTop())||parseInt(jQuery("body").scrollTop()),i=t.get(0).clientHeight;parseInt(t.offset().top);e<n?jQuery(t).animate({scrollTop:e-20},1e3):e>n+i&&jQuery(t).animate({scrollTop:n+i},1e3)},this.validate=function(){jQuery(this.form).validate().form();var e=[];for(var t in this.validator.invalid){var n=jQuery(this.form[t]);e.push(n.offset().top)}0==e.length?this.sendData():(e.sort(function(e,t){return e-t}),JSObject.scrollToError(e[0]),JSObject.addButtonsActions())},this.submitForm=function(){return WMPJSInterface.AjaxUpload.dosubmit(JSObject.form,{onStart:JSObject.startUploadingData,onComplete:JSObject.completeUploadingData})},this.sendData=function(){jQuery("#"+this.form.id,this.DOMDoc).unbind("submit"),jQuery("#"+this.form.id,this.DOMDoc).bind("submit",function(){JSObject.submitForm()}),jQuery("#"+this.form.id,this.DOMDoc).submit(),JSObject.disableButton(JSObject.send_btn)},this.startUploadingData=function(){return WMPJSInterface.Preloader.start(),setTimeout(function(){var e=JSObject.form.elements;for(nElems=e.length,j=0;j<nElems;j++)e[j].disabled=!0},300),!0},this.completeUploadingData=function(responseJSON){jQuery("#"+JSObject.form.id,JSObject.DOMDoc).unbind("submit"),jQuery("#"+JSObject.form.id,JSObject.DOMDoc).bind("submit",function(){return!1}),WMPJSInterface.Preloader.remove(100);var JSON=eval("("+responseJSON+")"),response=Boolean(Number(String(JSON.status)));if(null!=JSON.uploaded_category_icon&&JSObject.displayImage("icon",JSON.uploaded_category_icon),1==response&&0==JSON.messages.length){var message="Your category image has been successfully modified!";WMPJSInterface.Loader.display({message:message})}else if(0==JSON.messages.length){var message="There was an error. Please reload the page and try again.";WMPJSInterface.Loader.display({message:message})}else for(var i=0;i<JSON.messages.length;i++)WMPJSInterface.Loader.display({message:JSON.messages[i]});setTimeout(function(){var e=JSObject.form.elements;for(nElems=e.length,j=0;j<nElems;j++)e[j].disabled=!1},300),JSObject.addButtonsActions()}}
\ No newline at end of file |