PluginProbe ʕ •ᴥ•ʔ
External Links – nofollow, noopener & new window / 2.66
External Links – nofollow, noopener & new window v2.66
2.66 0.31 0.32 0.33 0.34 0.35 1.01 1.02 1.03 1.10 1.20 1.21 1.30 1.31 1.40 1.41 1.50 1.51 1.52 1.53 1.54 1.55 1.56 1.60 1.61 1.62 1.70 1.80 1.81 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.0 2.1.1 2.1.2 2.1.3 2.2.0 2.3 2.32 2.35 2.40 2.42 2.43 2.45 2.46 2.47 2.48 2.50 2.51 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.65 trunk 0.10 0.11 0.12 0.20 0.21 0.30
wp-external-links / public / js / wpel-admin.js
wp-external-links / public / js Last commit date
wpel-admin.js 1 day ago wpel-pointers.js 3 years ago
wpel-admin.js
359 lines
1 /**
2 * WP External Links Plugin
3 * Admin
4 */
5
6 /*global jQuery, window*/
7 jQuery(function ($) {
8 // add custom jQuery show/hide function
9 $.extend($.fn, {
10 wpelShow: function () {
11 var self = this;
12 this.stop({ clearQueue: true, jumpToEnd: true });
13 this.fadeIn({
14 duration: 500,
15 queue: false,
16 complete: function () {
17 self.removeClass('wpel-hidden');
18 },
19 });
20 },
21 wpelHide: function () {
22 var self = this;
23 this.stop({ clearQueue: true, jumpToEnd: true });
24 this.fadeOut({
25 duration: 500,
26 queue: false,
27 complete: function () {
28 self.addClass('wpel-hidden');
29 },
30 });
31 },
32 });
33
34 var $wrapper = $('.wpel-settings-page');
35
36 /**
37 * Apply Sections Settings
38 */
39 $wrapper.on('change', '.js-wpel-apply input', function () {
40 var applyAll = $(this).is(':checked');
41 var $items = $wrapper.find('.js-wpel-apply-child');
42
43 if (applyAll) {
44 $items.wpelHide();
45 } else {
46 $items.wpelShow();
47 }
48 });
49
50 // trigger immediatly
51 $wrapper.find('.js-wpel-apply input[type="checkbox"]').change();
52
53 /**
54 * Link Settings
55 */
56 $wrapper.on('change', '.js-icon-type select', function () {
57 var iconType = $(this).val();
58 var $itemsChild = $wrapper.find('.js-icon-type-child');
59 var $itemsDepend = $wrapper.find('.js-icon-type-depend');
60
61 $itemsChild.hide();
62
63 if (iconType === 'image') {
64 $itemsDepend.wpelShow();
65 $itemsChild.filter('.js-icon-type-image').wpelShow();
66 } else if (iconType === 'dashicon') {
67 $itemsDepend.wpelShow();
68 $itemsChild.filter('.js-icon-type-dashicon').wpelShow();
69 } else if (iconType === 'fontawesome') {
70 $itemsDepend.wpelShow();
71 $itemsChild.filter('.js-icon-type-fontawesome').wpelShow();
72 } else {
73 $itemsDepend.wpelHide();
74 }
75 });
76
77 $wrapper.on('change', '.js-apply-settings input[type="checkbox"]', function () {
78 var $items = $wrapper.find('.form-table tr').not('.js-apply-settings');
79
80 if ($(this).prop('checked')) {
81 $items.wpelShow();
82 $wrapper.find('.js-icon-type select').change();
83 } else {
84 $items.wpelHide();
85 }
86 });
87
88 // trigger immediatly
89 $wrapper.find('.js-apply-settings input[type="checkbox"]').change();
90
91 /**
92 * Support
93 * Copy to clipboard
94 */
95 $wrapper.on('click', '.js-wpel-copy', function (e) {
96 e.preventDefault();
97
98 var node = $wrapper.find('.js-wpel-copy-target').get(0);
99 node.select();
100
101 var range = document.createRange();
102 range.selectNode(node);
103 window.getSelection().addRange(range);
104
105 try {
106 document.execCommand('copy');
107 } catch (err) {}
108 });
109
110 /**
111 * Help documentation links/buttons
112 */
113 $wrapper.on('click', '[data-wpel-help]', function () {
114 var helpKey = $(this).data('wpel-help');
115
116 if (helpKey) {
117 // activate given tab
118 $('#tab-link-' + helpKey + ' a').click();
119 } else {
120 // activate first tab
121 $('.contextual-help-tabs li a').first().click();
122 }
123
124 $('#contextual-help-link[aria-expanded="false"]').click();
125 });
126
127 // show current tab
128 $wrapper.find('form').wpelShow();
129 // for network pages
130 $('.wpel-network-page').find('form').wpelShow();
131
132 // pro dialog
133 $('a.nav-tab-pro').on('click', function (e) {
134 e.preventDefault();
135
136 open_upsell('tab');
137
138 return false;
139 });
140
141 $('#wpwrap').on('click', '.open-pro-dialog', function (e) {
142 e.preventDefault();
143 $(this).blur();
144
145 pro_feature = $(this).data('pro-feature');
146 if (!pro_feature) {
147 pro_feature = $(this).parent('label').attr('for');
148 }
149 open_upsell(pro_feature);
150
151 return false;
152 });
153
154 $('#wpel-pro-dialog').dialog({
155 dialogClass: 'wp-dialog wpel-pro-dialog',
156 modal: true,
157 resizable: false,
158 width: 850,
159 height: 'auto',
160 show: 'fade',
161 hide: 'fade',
162 close: function (event, ui) {},
163 open: function (event, ui) {
164 $(this).siblings().find('span.ui-dialog-title').html('WP Links PRO is here!');
165 wpel_fix_dialog_close(event, ui);
166 },
167 autoOpen: false,
168 closeOnEscape: true,
169 });
170
171 function clean_feature(feature) {
172 feature = feature || 'free-plugin-unknown';
173 feature = feature.toLowerCase();
174 feature = feature.replace(' ', '-');
175
176 return feature;
177 }
178
179 function open_upsell(feature) {
180 feature = clean_feature(feature);
181
182 $('#wpel-pro-dialog').dialog('open');
183
184 $('#wpel-pro-dialog .button-buy').each(function (ind, el) {
185 tmp = $(el).data('href-org');
186 tmp = tmp.replace('pricing-table', feature);
187 $(el).attr('href', tmp);
188 });
189 } // open_upsell
190
191 // show upsell popup every 3 months
192 if (window.localStorage.getItem('wpel_upsell_timestamp') === null ||
193 (new Date().getTime() / 1000 - window.localStorage.getItem('wpel_upsell_timestamp')) > (86400 * 90)) {
194 window.localStorage.setItem('wpel_upsell_timestamp', Math.round(new Date().getTime() / 1000));
195
196 open_upsell('welcome');
197 }
198
199 if (window.location.hash == '#open-pro-dialog') {
200 open_upsell('url-hash');
201 window.location.hash = '';
202 }
203
204 $('a.show-link-rules').click(function () {
205 $('#link-rules-new').dialog({
206 height: 'auto',
207 width: 'auto',
208 closeOnEscape: true,
209 dialogClass: 'wp-dialog',
210 modal: true,
211 open: function (event, ui) {
212 wpel_fix_dialog_close(event, ui);
213 },
214 });
215 });
216
217 jQuery(document).ready(function ($) {
218 $('.wpel-colorpicker').wpColorPicker();
219 });
220
221 $('.wpel-exit-confirmation').on('click', function (event) {
222 event.stopPropagation();
223 refresh_exit_confirmaiton_preview();
224 });
225
226 function refresh_exit_confirmaiton_preview() {
227 wp_external_links = {};
228 wp_external_links.background = $('#wpel-exit-confirmation-settings-background').val();
229 wp_external_links.title = $('#wpel-exit-confirmation-settings-title').val();
230 wp_external_links.title_color = $('#wpel-exit-confirmation-settings-title_color').val();
231 wp_external_links.title_background = $('#wpel-exit-confirmation-settings-title_background').val();
232 wp_external_links.title_size = $('#wpel-exit-confirmation-settings-title_size').val();
233 wp_external_links.text = $('#wpel-exit-confirmation-settings-text').val().replace('{siteurl}', wpel.home_url);
234 wp_external_links.text_color = $('#wpel-exit-confirmation-settings-text_color').val();
235 wp_external_links.text_size = $('#wpel-exit-confirmation-settings-text_size').val();
236 wp_external_links.popup_width = $('#wpel-exit-confirmation-settings-popup_width').val();
237 wp_external_links.popup_height = $('#wpel-exit-confirmation-settings-popup_height').val();
238 wp_external_links.overlay = $('#wpel-exit-confirmation-settings-overlay').val();
239 wp_external_links.overlay_color = $('#wpel-exit-confirmation-settings-overlay_color').val();
240 wp_external_links.button_text = $('#wpel-exit-confirmation-settings-button_text').val();
241 wp_external_links.button_size = $('#wpel-exit-confirmation-settings-button_size').val();
242 wp_external_links.button_color = $('#wpel-exit-confirmation-settings-button_color').val();
243 wp_external_links.button_background = $('#wpel-exit-confirmation-settings-button_background').val();
244 wp_external_links.title = $('#wpel-exit-confirmation-settings-title').val();
245
246 wp_external_links.href = 'https://www.google.com';
247
248 exit_confirmation_html = '';
249 if (wp_external_links.overlay == '1') {
250 exit_confirmation_html += '<div id="wpel_exit_confirmation_overlay"></div>';
251 }
252 exit_confirmation_html += '<div id="wpel_exit_confirmation">';
253 if (wp_external_links.title.length > 0) {
254 exit_confirmation_html += '<div id="wpel_exit_confirmation_title">' + wp_external_links.title + '</div>';
255 }
256 exit_confirmation_html +=
257 '<div id="wpel_exit_confirmation_link">' +
258 wp_external_links.text +
259 '<br /><a target="' +
260 wp_external_links.href +
261 '" href="' +
262 wp_external_links.href +
263 '">' +
264 wp_external_links.href +
265 '</a></div>';
266 exit_confirmation_html += '<div id="wpel_exit_confirmation_button_wrapper">';
267 exit_confirmation_html +=
268 '<div id="wpel_exit_confirmation_cancel" onMouseOver="this.style.opacity=\'0.8\'" onMouseOut="this.style.opacity=\'1\'">' +
269 wp_external_links.button_text +
270 '</a></div>';
271 exit_confirmation_html += '</div>';
272 exit_confirmation_html += '</div>';
273
274 exit_confirmation_html += '<style>';
275 exit_confirmation_html +=
276 '#wpel_exit_confirmation_overlay{width:100%;height:100%;position:fixed;top:0px;left:0px;opacity:0.2;z-index:100000;background:' +
277 wp_external_links.overlay_color +
278 ';}';
279 exit_confirmation_html +=
280 '#wpel_exit_confirmation{z-index:100001;border-radius:4px;padding-bottom:40px;position:fixed;top:0px;left:0px;top:50%;left:50%;margin-top:-' +
281 wp_external_links.popup_height / 2 +
282 'px;margin-left:-' +
283 wp_external_links.popup_width / 2 +
284 'px;width:' +
285 wp_external_links.popup_width +
286 'px;height:' +
287 wp_external_links.popup_height +
288 'px;background:' +
289 wp_external_links.background +
290 ';}';
291 exit_confirmation_html +=
292 '#wpel_exit_confirmation_title{width:100%;padding:6px 10px; text-align:center; box-sizing: border-box; background:' +
293 wp_external_links.title_background +
294 ';font-size:' +
295 wp_external_links.title_size +
296 'px; color:' +
297 wp_external_links.title_color +
298 ';}';
299 exit_confirmation_html +=
300 '#wpel_exit_confirmation_link{width:100%;padding:10px 20px; line-height: 1.5; box-sizing: border-box;font-size:' +
301 wp_external_links.text_size +
302 'px; color:' +
303 wp_external_links.text_color +
304 ';}';
305 exit_confirmation_html +=
306 '#wpel_exit_confirmation_button_wrapper{width:100%; text-align:center; position:absolute; bottom:10px;}';
307 exit_confirmation_html +=
308 '#wpel_exit_confirmation_cancel{cursor:pointer;border-radius:4px;padding:10px 15px;display:inline-block;font-size:' +
309 wp_external_links.button_size +
310 'px;color:' +
311 wp_external_links.button_color +
312 '; background:' +
313 wp_external_links.button_background +
314 ';}';
315
316 exit_confirmation_html += '@media only screen and (max-width: 900px) {';
317 exit_confirmation_html +=
318 '#wpel_exit_confirmation{ width: 90%; margin: 0 auto; padding-bottom: 40px; top: 20%; position: fixed; left: auto; height: auto; height:' +
319 wp_external_links.popup_height +
320 'px; display: block; margin-left: 5%;}';
321 exit_confirmation_html += '}';
322 exit_confirmation_html += '</style>';
323
324 $('#exit-confirmation-preview').html(exit_confirmation_html);
325 }
326
327 $('body').on('click', '#wpel_exit_confirmation_cancel', function (e) {
328 $('#wpel_exit_confirmation_overlay').remove();
329 $('#wpel_exit_confirmation').remove();
330 });
331
332 $('body').click(function () {
333 $('#wpel_exit_confirmation_overlay').remove();
334 $('#wpel_exit_confirmation').remove();
335 });
336
337 $('#wpel_exit_confirmation').click(function (event) {
338 event.stopPropagation();
339 });
340
341 $('.install-wpcaptcha').on('click',function(e){
342 if (!confirm('The free WP Advanced Google ReCaptcha plugin will be installed & activated from the official WordPress repository.')) {
343 return false;
344 }
345
346 jQuery('body').append('<div style="width:550px;height:450px; position:fixed;top:10%;left:50%;margin-left:-275px; color:#444; background-color: #fbfbfb;border:1px solid #DDD; border-radius:4px;box-shadow: 0px 0px 0px 4000px rgba(0, 0, 0, 0.85);z-index: 9999999;"><iframe src="' + wpel.wpcaptcha_install_url + '" style="width:100%;height:100%;border:none;" /></div>');
347 jQuery('#wpwrap').css('pointer-events', 'none');
348
349 e.preventDefault();
350 return false;
351 });
352 });
353
354 function wpel_fix_dialog_close(event, ui) {
355 jQuery('.ui-widget-overlay').bind('click', function () {
356 jQuery('#' + event.target.id).dialog('close');
357 });
358 } // wpel_fix_dialog_close
359