PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.7.9
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.7.9
2.7.9 2.7.8 2.7.7 2.7.6 2.7.5 2.7.4 trunk 1.3 2.0.4 2.0.6 2.1.91 2.2.4 2.2.7 2.2.9 2.3.1 2.3.10 2.4.10 2.4.2 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.6.0 All 30 releases
insert-php / admin / assets / js / snippet-library.js

snippet-library.js in Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts 2.7.9, at admin/assets/js/snippet-library.js

74 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready( function($) {
2 // Show premium upsell modal for locked snippets
3 $(document).on('click', '.wbcr-inp-premium-snippet-button', function() {
4 $('#winp-premium-snippet-modal').show();
5 });
6
7 // Импортировать выбранный сниппет из списка
8 $( '.wbcr-inp-enable-snippet-button' ).click( function() {
9 if ( confirm(winp_snippet_library.is_import) ) {
10 if ($(this).hasClass('disabled')) return;
11
12 $(this).addClass('disabled');
13
14 $.post(
15 ajaxurl,
16 {
17 action: 'winp_snippet_create',
18 winp_ajax_custom_list_nonce: $('#winp_ajax_custom_list_nonce').val(),
19 snippet_id: $(this).data('snippet'),
20 common: $(this).data('common')
21 },
22 function(data) {
23 if (data) {
24 window.location = 'post.php?post=' + data + '&action=edit';
25 } else {
26 $( '.wbcr-inp-enable-snippet-button' ).removeClass('disabled');
27 alert(winp_snippet_library.import_failed);
28 }
29 }
30 );
31 }
32 });
33
34 // Close premium modal
35 $(document).on('click', '#winp-modal-close', function(e) {
36 e.preventDefault();
37 e.stopPropagation();
38 $('#winp-premium-snippet-modal').hide();
39 });
40
41 $(document).on('click', '#winp-premium-snippet-modal', function(e) {
42 if (e.target === this) {
43 e.preventDefault();
44 $('#winp-premium-snippet-modal').hide();
45 }
46 });
47
48 // Удалить выбранный сниппет из списка
49 $( '.wbcr-inp-delete-snippet-button' ).click( function() {
50 if ( confirm(winp_snippet_library.is_delete) ) {
51 if ($(this).hasClass('disabled')) return;
52
53 $(this).addClass('disabled');
54 var snippet_id = $(this).data('snippet');
55
56 $.post(
57 ajaxurl,
58 {
59 action: 'winp_snippet_delete',
60 winp_ajax_snippet_delete_nonce: $('#winp_ajax_snippet_delete_' + snippet_id).val(),
61 snippet_id: snippet_id
62 },
63 function(data) {
64 if (data) {
65 window.location.reload();
66 } else {
67 $( '.wbcr-inp-enable-snippet-button' ).removeClass('disabled');
68 alert(winp_snippet_library.delete_failed);
69 }
70 }
71 );
72 }
73 });
74 });