HamroKhanpin/hamrokhaanpaan/wp-content/plugins/top-10/includes/admin/js/admin-scripts.min.js

1 line
3.2 KiB
JavaScript
Raw Normal View History

2024-04-29 07:27:44 +00:00
function clearCache(){jQuery.post(ajaxurl,{action:"tptn_clear_cache"},(function(response,textStatus,jqXHR){alert(response.message)}),"json")}jQuery(document).ready((function($){function confirmFormChange(){formmodified=1}function confirmExit(){if(1==formmodified)return!0}function formNotModified(){formmodified=0}formmodified=0,$("form *").change(confirmFormChange),window.onbeforeunload=confirmExit,$("input[name='submit']").click(formNotModified),$("input[id='search-submit']").click(formNotModified),$("input[id='doaction']").click(formNotModified),$("input[id='doaction2']").click(formNotModified),$("input[name='filter_action']").click(formNotModified),$((function(){$("#post-body-content").tabs({create:function(event,ui){$(ui.tab.find("a")).addClass("nav-tab-active")},activate:function(event,ui){$(ui.oldTab.find("a")).removeClass("nav-tab-active"),$(ui.newTab.find("a")).addClass("nav-tab-active")}})})),$((function(){var dateFormat="dd M yy",from=$("#datepicker-from").datepicker({changeMonth:!0,maxDate:0,dateFormat:"dd M yy"}).on("change",(function(){to.datepicker("option","minDate",getDate(this))})),to=$("#datepicker-to").datepicker({changeMonth:!0,maxDate:0,dateFormat:"dd M yy"}).on("change",(function(){from.datepicker("option","maxDate",getDate(this))}));function getDate(element){var date;try{date=$.datepicker.parseDate("dd M yy",element.value)}catch(error){date=null}return date}})),$(".codemirror_html").each((function(index,element){if($(element).length&&"object"==typeof wp.codeEditor){var editorSettings=wp.codeEditor.defaultSettings?_.clone(wp.codeEditor.defaultSettings):{},editor;editorSettings.codemirror=_.extend({},editorSettings.codemirror,{}),wp.codeEditor.initialize($(element),editorSettings).codemirror.on("change",confirmFormChange)}})),$(".codemirror_js").each((function(index,element){if($(element).length&&"object"==typeof wp.codeEditor){var editorSettings=wp.codeEditor.defaultSettings?_.clone(wp.codeEditor.defaultSettings):{},editor;editorSettings.codemirror=_.extend({},editorSettings.codemirror,{mode:"javascript"}),wp.codeEditor.initialize($(element),editorSettings).codemirror.on("change",confirmFormChange)}})),$(".codemirror_css").each((function(index,element){if($(element).length&&"object"==typeof wp.codeEditor){var editorSettings=wp.codeEditor.defaultSettings?_.clone(wp.codeEditor.defaultSettings):{},editor;editorSettings.codemirror=_.extend({},editorSettings.codemirror,{mode:"css"}),wp.codeEditor.initialize($(element),editorSettings).codemirror.on("change",confirmFormChange)}})),$(".live_edit").click((function(){$(this).addClass("live_edit_mode"),$(this).removeClass("live_edit_mode_success"),$(this).removeClass("live_edit_mode_error")})),$(".live_edit").on("focusout keypress",(function(e){if("focusout"===e.type||13===e.which){var $element=$(this),post_id=$element.attr("data-wp-post-id"),count=$element.attr("data-wp-count"),value=$element.text();$element.removeClass("live_edit_mode"),$.ajax({type:"POST",dataType:"json",url:ajaxurl,data:{action:"tptn_edit_count_ajax",post_id:post_id,total_count:value,total_count_original:count},success:function(response){!1===response?($element.addClass("live_edit_mode_error"),$element.html(count)):response>0&&$element.addClass("live_edit_mode_success")}})}}))}));