PluginProbe ʕ •ᴥ•ʔ
Shortcoder — Create Shortcodes for Anything / 4.0.1
Shortcoder — Create Shortcodes for Anything v4.0.1
trunk 3.0 3.0.1 3.1 3.2 3.3 3.4 3.4.1 4.0 4.0.1 4.0.2 4.0.3 4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2 4.3 4.4 4.5 4.6 5.0 5.0.1 5.0.2 5.0.3 5.0.4 5.1 5.2 5.2.1 5.3 5.3.1 5.3.2 5.3.3 5.3.4 5.4 5.5 5.6 5.7 5.8 6.0 6.1 6.2 6.3 6.3.1 6.3.2 6.4 6.5 6.5.1 6.5.2 6.5.3
shortcoder / admin / js / script.js
shortcoder / admin / js Last commit date
tinymce 9 years ago script-insert.js 9 years ago script.js 9 years ago
script.js
132 lines
1 (function($){
2 $(document).ready(function(){
3
4 var delete_ctext = 'Are you sure want to delete this shortcode ?';
5
6 $( document ).on( 'click', '.sc_delete', function(e){
7
8 e.preventDefault();
9
10 var del_btn = $(this);
11 var href = del_btn.attr( 'href' );
12 var confirm_user = confirm( delete_ctext );
13
14 if( confirm_user ){
15
16 var ajax = $.get( href );
17 del_btn.addClass( 'spin' );
18
19 ajax.done(function( data ){
20 if( data.search( 'DELETED' ) != -1 ){
21 del_btn.closest( 'li' ).fadeOut( 'slow', function(){
22 $(this).remove();
23 });
24 }else{
25 alert( 'Delete failed ! - ' + data );
26 }
27 });
28
29 ajax.fail(function(){
30 alert( 'Auth failed !' );
31 });
32
33 }
34
35 });
36
37 $( document ).on( 'click', '.sc_delete_ep', function(e){
38
39 e.preventDefault();
40
41 var $delete_btn = $(this);
42 var href = $delete_btn.attr( 'href' );
43 var confirm_user = confirm( delete_ctext );
44
45 if( confirm_user ){
46
47 var ajax = $.get( href );
48 $delete_btn.addClass( 'spin' );
49
50 ajax.done(function( data ){
51 if( data.search( 'DELETED' ) != -1 ){
52 var back_href = $( '.sc_back_btn' ).attr( 'href' );
53 window.location = back_href + '&msg=3';
54 }else{
55 alert( 'Delete failed ! - ' + data );
56 }
57 });
58
59 ajax.fail(function(){
60 alert( 'Auth failed !' );
61 });
62
63 $delete_btn.removeClass( 'spin' );
64
65 }
66
67 });
68
69 $( document ).on( 'click', '.sc_copy', function(e){
70
71 e.preventDefault();
72
73 var btn = $(this);
74 var box = btn.closest( 'li' ).find( '.sc_copy_box' );
75
76 $( '.sc_copy_box' ).not( box ).hide();
77
78 box.fadeToggle();
79 box.select();
80
81 });
82
83 $(window).load(function(){
84 $( '.wp-media-buttons' ).append(function(){
85 return '<button class="button button-primary sc_insert_params"><span class="dashicons dashicons-plus"></span> Insert shortcode paramerters <span class="dashicons dashicons-arrow-down"></span></button>';
86 });
87 $( '.params_wrap' ).appendTo( 'body' );
88 });
89
90 $( document ).on( 'click', '.sc_insert_params', function(e){
91
92 e.preventDefault();
93
94 var offset = $(this).offset();
95 var mtop = offset.top + $(this).outerHeight();
96
97 $( '.params_wrap' ).css({
98 top: mtop,
99 left: offset.left
100 }).toggle();
101 });
102
103 $( document ).on( 'click', '.cp_btn', function(){
104
105 var $cp_box = $( '.cp_box' );
106 var $cp_info = $( '.cp_info' );
107 var param_val = $cp_box.val().trim();
108
109 if( param_val != '' && $cp_box[0].checkValidity() ){
110 send_to_editor( '%%' + param_val + '%%' );
111 $cp_info.removeClass( 'red' );
112 $( '.params_wrap' ).hide();
113 }else{
114 $cp_info.addClass( 'red' );
115 }
116
117 });
118
119 $( document ).on( 'click', '.wp_params li', function(){
120
121 send_to_editor( '$$' + $(this).data( 'id' ) + '$$' );
122 $( '.params_wrap' ).hide();
123
124 });
125
126 $( document ).on( 'change', '.coffee_amt', function(){
127 var btn = $( '.buy_coffee_btn' );
128 btn.attr( 'href', btn.data( 'link' ) + $(this).val() );
129 });
130
131 });
132 })( jQuery );