PluginProbe
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts / 2.7.8
Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts v2.7.8
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
← All changes | admin/assets/js/snippet-library.js +73 -54 2.2.4 → 2.7.8 View file →
@@ -1,55 +1,74 @@
1 -jQuery(document).ready( function($) {
2 - // Импортировать выбранный сниппет из списка
3 - $( '.wbcr-inp-enable-snippet-button' ).click( function() {
4 - if ( confirm(winp_snippet_library.is_import) ) {
5 - if ($(this).hasClass('disabled')) return;
6 -
7 - $(this).addClass('disabled');
8 -
9 - $.post(
10 - ajaxurl,
11 - {
12 - action: 'winp_snippet_create',
13 - winp_ajax_custom_list_nonce: $('#winp_ajax_custom_list_nonce').val(),
14 - snippet_id: $(this).data('snippet'),
15 - common: $(this).data('common')
16 - },
17 - function(data) {
18 - if (data) {
19 - window.location = 'post.php?post=' + data + '&action=edit';
20 - } else {
21 - $( '.wbcr-inp-enable-snippet-button' ).removeClass('disabled');
22 - alert(winp_snippet_library.import_failed);
23 - }
24 - }
25 - );
26 - }
27 - });
28 -
29 - // Удалить выбранный сниппет из списка
30 - $( '.wbcr-inp-delete-snippet-button' ).click( function() {
31 - if ( confirm(winp_snippet_library.is_delete) ) {
32 - if ($(this).hasClass('disabled')) return;
33 -
34 - $(this).addClass('disabled');
35 - var snippet_id = $(this).data('snippet');
36 -
37 - $.post(
38 - ajaxurl,
39 - {
40 - action: 'winp_snippet_delete',
41 - winp_ajax_snippet_delete_nonce: $('#winp_ajax_snippet_delete_' + snippet_id).val(),
42 - snippet_id: snippet_id
43 - },
44 - function(data) {
45 - if (data) {
46 - window.location.reload();
47 - } else {
48 - $( '.wbcr-inp-enable-snippet-button' ).removeClass('disabled');
49 - alert(winp_snippet_library.delete_failed);
50 - }
51 - }
52 - );
53 - }
54 - });
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 + });
55 74 });