diff options
Diffstat (limited to 'plugins/wordpress-mobile-pack/admin/js/UI.Modules/Theming/WMP_EDIT_COVER.min.js')
-rw-r--r--[-rwxr-xr-x] | plugins/wordpress-mobile-pack/admin/js/UI.Modules/Theming/WMP_EDIT_COVER.min.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/wordpress-mobile-pack/admin/js/UI.Modules/Theming/WMP_EDIT_COVER.min.js b/plugins/wordpress-mobile-pack/admin/js/UI.Modules/Theming/WMP_EDIT_COVER.min.js index 84ed5b1d..d29dfbe0 100755..100644 --- a/plugins/wordpress-mobile-pack/admin/js/UI.Modules/Theming/WMP_EDIT_COVER.min.js +++ b/plugins/wordpress-mobile-pack/admin/js/UI.Modules/Theming/WMP_EDIT_COVER.min.js @@ -1 +1 @@ -function WMP_EDIT_COVER(){var JSObject=this;this.type="wmp_editcover",this.form,this.DOMDoc,this.send_btn,this.deletingCover=!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_editcover_cover:{accept:"png|jpg|jpeg|gif"}},messages:{wmp_editcover_cover:{accept:"Please add a png, gif or jpeg image."}},errorPlacement:function(e,t){var r=t[0].id.split("_"),o=r.length>1?r[r.length-1]:r[0],c=jQuery("#error_"+o+"_container",JSObject.DOMDoc);e.appendTo(c)},errorElement:"span"});var $Cover=jQuery("#"+this.type+"_cover",this.DOMDoc),$RemoveCoverLink=jQuery("#"+this.type+"_cover_removenew",this.DOMDoc);$Cover.bind("change",function(){$Cover.focus(),$Cover.blur(),this.files[0]&&jQuery("#fakefilecover").val(this.files[0].name),$RemoveCoverLink.css("display","block")}),$RemoveCoverLink.bind("click",function(){jQuery("#fakefilecover").val(""),$Cover.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_cover"),$RemoveCoverLink.css("display","none")});var $EditCoverLink=jQuery("."+this.type+"_changecover",this.DOMDoc);$EditCoverLink.length>0&&$EditCoverLink.click(function(){"none"==jQuery("."+JSObject.type+"_uploadcover",JSObject.DOMDoc).css("display")&&($Cover.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_cover"),jQuery("#fakefilecover").val(""),$RemoveCoverLink.css("display","none"),jQuery("."+JSObject.type+"_uploadcover",JSObject.DOMDoc).show(),"none"!=jQuery("#"+JSObject.type+"_currentcover",JSObject.DOMDoc).css("background-image")&&jQuery("."+JSObject.type+"_changecover_cancel",JSObject.DOMDoc).show(),"block"==jQuery("."+JSObject.type+"_covercontainer",JSObject.DOMDoc).css("display")&&jQuery("."+JSObject.type+"_covercontainer",JSObject.DOMDoc).hide())});var $CancelEditCoverLink=jQuery("."+this.type+"_changecover_cancel a",this.DOMDoc);$CancelEditCoverLink.length>0&&$CancelEditCoverLink.click(function(){"block"==jQuery("."+JSObject.type+"_uploadcover",JSObject.DOMDoc).css("display")&&($Cover.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_cover"),jQuery("#fakefilecover").val(""),jQuery("."+JSObject.type+"_uploadcover",JSObject.DOMDoc).hide(),jQuery(this).parent().hide(),"none"==jQuery("."+JSObject.type+"_covercontainer",JSObject.DOMDoc).css("display")&&"none"!=jQuery("#"+JSObject.type+"_currentcover",JSObject.DOMDoc).css("background-image")&&jQuery("."+JSObject.type+"_covercontainer",JSObject.DOMDoc).show())});var $DeleteCoverLink=jQuery("."+this.type+"_deletecover",this.DOMDoc);if($DeleteCoverLink.length>0){var href=$DeleteCoverLink.get(0).href;$DeleteCoverLink.get(0).href="javascript:void(0);",$DeleteCoverLink.click(function(){var isConfirmed=confirm("Are you sure you want to remove the app cover?");isConfirmed&&jQuery.get(ajaxurl,{action:"wmp_theme_editimages",type:"delete",source:"cover"},function(responseJSON){var JSON=eval("("+responseJSON+")"),response=Boolean(Number(String(JSON.status)));if(JSObject.deletingCover=!1,1==response){jQuery("#"+JSObject.type+"_currentcover",JSObject.DOMDoc).css("background-image","none"),$EditCoverLink.trigger("click");var message="The app cover 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+"_cover",JSObject.DOMDoc).val(""),jQuery("#fakefilecover").val(""),jQuery("."+JSObject.type+"_uploadcover",JSObject.DOMDoc).hide(),jQuery("."+JSObject.type+"_changecover_cancel",JSObject.DOMDoc).hide(),jQuery("#"+JSObject.type+"_currentcover",JSObject.DOMDoc).css("background-image","url("+t+")"),jQuery("."+JSObject.type+"_covercontainer",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),r=parseInt(jQuery("html,body").scrollTop())||parseInt(jQuery("body").scrollTop()),o=t.get(0).clientHeight;parseInt(t.offset().top);r>e?jQuery(t).animate({scrollTop:e-20},1e3):e>r+o&&jQuery(t).animate({scrollTop:r+o},1e3)},this.validate=function(){jQuery(this.form).validate().form();var e=[];for(var t in this.validator.invalid){var r=jQuery(this.form[t]);e.push(r.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_cover&&JSObject.displayImage("cover",JSON.uploaded_cover),1==response&&0==JSON.messages.length){var message="Your app 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(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_EDIT_COVER(){var JSObject=this;this.type="wmp_editcover",this.form,this.DOMDoc,this.send_btn,this.deletingCover=!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_editcover_cover:{accept:"png|jpg|jpeg|gif"}},messages:{wmp_editcover_cover:{accept:"Please add a png, gif or jpeg image."}},errorPlacement:function(e,t){var r=t[0].id.split("_"),o=r.length>1?r[r.length-1]:r[0],c=jQuery("#error_"+o+"_container",JSObject.DOMDoc);e.appendTo(c)},errorElement:"span"});var $Cover=jQuery("#"+this.type+"_cover",this.DOMDoc),$RemoveCoverLink=jQuery("#"+this.type+"_cover_removenew",this.DOMDoc);$Cover.bind("change",function(){$Cover.focus(),$Cover.blur(),this.files[0]&&jQuery("#fakefilecover").val(this.files[0].name),$RemoveCoverLink.css("display","block")}),$RemoveCoverLink.bind("click",function(){jQuery("#fakefilecover").val(""),$Cover.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_cover"),$RemoveCoverLink.css("display","none")});var $EditCoverLink=jQuery("."+this.type+"_changecover",this.DOMDoc);$EditCoverLink.length>0&&$EditCoverLink.click(function(){"none"==jQuery("."+JSObject.type+"_uploadcover",JSObject.DOMDoc).css("display")&&($Cover.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_cover"),jQuery("#fakefilecover").val(""),$RemoveCoverLink.css("display","none"),jQuery("."+JSObject.type+"_uploadcover",JSObject.DOMDoc).show(),"none"!=jQuery("#"+JSObject.type+"_currentcover",JSObject.DOMDoc).css("background-image")&&jQuery("."+JSObject.type+"_changecover_cancel",JSObject.DOMDoc).show(),"block"==jQuery("."+JSObject.type+"_covercontainer",JSObject.DOMDoc).css("display")&&jQuery("."+JSObject.type+"_covercontainer",JSObject.DOMDoc).hide())});var $CancelEditCoverLink=jQuery("."+this.type+"_changecover_cancel a",this.DOMDoc);$CancelEditCoverLink.length>0&&$CancelEditCoverLink.click(function(){"block"==jQuery("."+JSObject.type+"_uploadcover",JSObject.DOMDoc).css("display")&&($Cover.val(""),jQuery(JSObject.form).validate().element("#"+JSObject.type+"_cover"),jQuery("#fakefilecover").val(""),jQuery("."+JSObject.type+"_uploadcover",JSObject.DOMDoc).hide(),jQuery(this).parent().hide(),"none"==jQuery("."+JSObject.type+"_covercontainer",JSObject.DOMDoc).css("display")&&"none"!=jQuery("#"+JSObject.type+"_currentcover",JSObject.DOMDoc).css("background-image")&&jQuery("."+JSObject.type+"_covercontainer",JSObject.DOMDoc).show())});var $DeleteCoverLink=jQuery("."+this.type+"_deletecover",this.DOMDoc);if($DeleteCoverLink.length>0){var href=$DeleteCoverLink.get(0).href;$DeleteCoverLink.get(0).href="javascript:void(0);",$DeleteCoverLink.click(function(){var isConfirmed=confirm("Are you sure you want to remove the app cover?");isConfirmed&&jQuery.get(ajaxurl,{action:"wmp_theme_editimages",type:"delete",source:"cover"},function(responseJSON){var JSON=eval("("+responseJSON+")"),response=Boolean(Number(String(JSON.status)));if(JSObject.deletingCover=!1,1==response){jQuery("#"+JSObject.type+"_currentcover",JSObject.DOMDoc).css("background-image","none"),$EditCoverLink.trigger("click");var message="The app cover 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+"_cover",JSObject.DOMDoc).val(""),jQuery("#fakefilecover").val(""),jQuery("."+JSObject.type+"_uploadcover",JSObject.DOMDoc).hide(),jQuery("."+JSObject.type+"_changecover_cancel",JSObject.DOMDoc).hide(),jQuery("#"+JSObject.type+"_currentcover",JSObject.DOMDoc).css("background-image","url("+t+")"),jQuery("."+JSObject.type+"_covercontainer",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),r=parseInt(jQuery("html,body").scrollTop())||parseInt(jQuery("body").scrollTop()),o=t.get(0).clientHeight;parseInt(t.offset().top);e<r?jQuery(t).animate({scrollTop:e-20},1e3):e>r+o&&jQuery(t).animate({scrollTop:r+o},1e3)},this.validate=function(){jQuery(this.form).validate().form();var e=[];for(var t in this.validator.invalid){var r=jQuery(this.form[t]);e.push(r.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_cover&&JSObject.displayImage("cover",JSON.uploaded_cover),1==response&&0==JSON.messages.length){var message="Your app 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(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 |