PluginProbe ʕ •ᴥ•ʔ
Shortcoder — Create Shortcodes for Anything / 4.0.2
Shortcoder — Create Shortcodes for Anything v4.0.2
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-insert.js
shortcoder / admin / js Last commit date
tinymce 9 years ago script-insert.js 9 years ago script.js 9 years ago
script-insert.js
67 lines
1 (function($){
2
3 $(document).ready(function(){
4
5 var send_editor = function( content = '' ){
6 if( typeof parent.send_to_editor === 'function' ){
7 parent.send_to_editor( content );
8 }else{
9 alert( 'Editor does not exist. Cannot insert content !' );
10 }
11 }
12
13 var close_window = function(){
14 if( typeof parent.tb_remove === 'function' ){
15 parent.tb_remove();
16 }
17 }
18
19 $('.sc_shortcode_name').append('<span class="sc_toggle"></span>');
20
21 $( document ).on( 'click', '.sc_insert', function(){
22
23 var params = '';
24 var scname = $(this).closest( '.sc_shortcode' ).attr( 'data-name' );
25 var sc = '';
26
27 $(this).parent().children().find('input[type="text"]').each(function(){
28 if($(this).val() != ''){
29 attr = $(this).attr('data-param');
30 val = $(this).val().replace( /\"/g, '' );
31 params += attr + '="' + val + '" ';
32 }
33 });
34
35 sc = '[sc name="' + scname + '" ' + params + ']';
36 send_editor( sc );
37 close_window();
38
39 });
40
41 $( document ).on( 'click', '.sc_quick_insert', function(){
42
43 var scname = $(this).closest( '.sc_shortcode' ).attr( 'data-name' );
44 var sc = '[sc name="' + scname + '"]';
45
46 send_editor( sc );
47 close_window();
48
49 });
50
51 $( document ).on( 'click', '.sc_shortcode_name', function(e){
52 $('.sc_params').slideUp();
53 if($(this).next('.sc_params').is(':visible')){
54 $(this).next('.sc_params').slideUp();
55 }else{
56 $(this).next('.sc_params').slideDown();
57 }
58 });
59
60 $( document ).on( 'change', '.coffee_amt', function(){
61 var btn = $( '.buy_coffee_btn' );
62 btn.attr( 'href', btn.data( 'link' ) + $(this).val() );
63 });
64
65 });
66
67 })( jQuery );