1
|
|
|
(function( $ ) { |
|
|
|
|
2
|
|
|
'use strict'; |
3
|
|
|
|
4
|
|
|
jQuery(document).ready(function(){ |
5
|
|
|
|
6
|
|
|
jQuery("span.shorten_string").click(function(){ |
7
|
|
|
jQuery(this).toggleClass("full"); |
8
|
|
|
doShortText(jQuery(this)); |
9
|
|
|
}) |
10
|
|
|
|
11
|
|
|
jQuery("span.shorten_string").each(function(){ |
12
|
|
|
doShortText(jQuery(this)); |
13
|
|
|
}) |
14
|
|
|
|
15
|
|
|
jQuery("#xcloner_regex_exclude").on("focus", function(){ |
16
|
|
|
jQuery("ul.xcloner_regex_exclude_limit li").fadeIn(); |
17
|
|
|
}) |
18
|
|
|
|
19
|
|
|
jQuery(".regex_pattern").click(function(){ |
20
|
|
|
jQuery(this).select(); |
21
|
|
|
}) |
22
|
|
|
|
23
|
|
|
jQuery(".btn.system_info_toggle").click(function(){ |
24
|
|
|
jQuery(".additional_system_info").toggle(); |
25
|
|
|
}) |
26
|
|
|
|
27
|
|
|
jQuery(".nav-tab-wrapper.content li").click(function(e){ |
28
|
|
|
jQuery(".nav-tab-wrapper li a").removeClass("nav-tab-active"); |
29
|
|
|
jQuery(this).find('a').addClass("nav-tab-active"); |
30
|
|
|
jQuery(".nav-tab-wrapper-content .tab-content").removeClass('active'); |
31
|
|
|
jQuery(".nav-tab-wrapper-content "+jQuery(this).find('a').attr('href')).addClass('active'); |
32
|
|
|
|
33
|
|
|
e.preventDefault(); |
34
|
|
|
|
35
|
|
|
location.hash = jQuery(this).find('a').attr('href')+"_hash"; |
36
|
|
|
|
37
|
|
|
}) |
38
|
|
|
|
39
|
|
|
var hash = window.location.hash; |
40
|
|
|
if(hash){ |
41
|
|
|
next_tab(hash.replace("_hash","")); |
42
|
|
|
} |
43
|
|
|
}) |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* All of the code for your admin-facing JavaScript source |
47
|
|
|
* should reside in this file. |
48
|
|
|
* |
49
|
|
|
* Note: It has been assumed you will write jQuery code here, so the |
50
|
|
|
* $ function reference has been prepared for usage within the scope |
51
|
|
|
* of this function. |
52
|
|
|
* |
53
|
|
|
* This enables you to define handlers, for when the DOM is ready: |
54
|
|
|
* |
55
|
|
|
* $(function() { |
56
|
|
|
* |
57
|
|
|
* }); |
58
|
|
|
* |
59
|
|
|
* When the window is loaded: |
60
|
|
|
* |
61
|
|
|
* $( window ).load(function() { |
62
|
|
|
* |
63
|
|
|
* }); |
64
|
|
|
* |
65
|
|
|
* ...and/or other possibilities. |
66
|
|
|
* |
67
|
|
|
* Ideally, it is not considered best practise to attach more than a |
68
|
|
|
* single DOM-ready or window-load handler for a particular page. |
69
|
|
|
* Although scripts in the WordPress core, Plugins and Themes may be |
70
|
|
|
* practising this, we should strive to set a better example in our own work. |
71
|
|
|
*/ |
72
|
|
|
|
73
|
|
|
})( jQuery ); |
74
|
|
|
|
75
|
|
|
|
76
|
|
|
|
77
|
|
|
|
78
|
|
|
jQuery( document ).ajaxError(function(err, request) { |
|
|
|
|
79
|
|
|
//show_ajax_error("dd", "dd12", request) |
80
|
|
|
}); |
81
|
|
|
|
82
|
|
|
function next_tab(hash){ |
83
|
|
|
jQuery(".nav-tab-wrapper").find("li a[href='"+hash+"']").trigger('click'); |
84
|
|
|
location.hash = hash; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
function doShortText(elem) |
88
|
|
|
{ |
89
|
|
|
if(elem.hasClass("full")){ |
90
|
|
|
elem.text(elem.attr("data-text")); |
91
|
|
|
return; |
92
|
|
|
} |
93
|
|
|
var text = elem.text() |
94
|
|
|
var text_lenght = text.length; |
95
|
|
|
var first = text.substr(0, 10); |
96
|
|
|
var last = text.substr(text_lenght-20, text_lenght); |
97
|
|
|
|
98
|
|
|
elem.attr("data-text", text).text(first+"..."+last); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** global: xcloner_backup */ |
102
|
|
|
function show_ajax_error(title, msg, json){ |
103
|
|
|
|
104
|
|
|
//var json = jQuery.parseJSON( body ) |
105
|
|
|
|
106
|
|
|
if(typeof xcloner_backup !== 'undefined') |
107
|
|
|
{ |
108
|
|
|
xcloner_backup.cancel_backup(); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
if(json.responseText) |
112
|
|
|
{ |
113
|
|
|
msg = msg+": "+json.responseText; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
jQuery("#error_modal .title").text(title); |
117
|
|
|
jQuery("#error_modal .msg").text(msg); |
118
|
|
|
|
119
|
|
|
if(json.status) |
120
|
|
|
{ |
121
|
|
|
jQuery("#error_modal .status").text(json.status+" "+json.statusText); |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
jQuery("#error_modal .body").text(JSON.stringify(json)); |
125
|
|
|
var error_modal = jQuery("#error_modal").modal(); |
126
|
|
|
error_modal.modal('open'); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
var ID = function () { |
130
|
|
|
// Math.random should be unique because of its seeding algorithm. |
131
|
|
|
// Convert it to base 36 (numbers + letters), and grab the first 9 characters |
132
|
|
|
// after the decimal. |
133
|
|
|
return '_' + Math.random().toString(36).substr(2, 9); |
134
|
|
|
}; |
135
|
|
|
|
136
|
|
|
|
137
|
|
|
|
138
|
|
|
|
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.