| 1 |
"use strict"; |
| 2 |
|
| 3 |
var powerkit_basic_shortcodes; |
| 4 |
var powerkit_basic_shortcodes_content; |
| 5 |
|
| 6 |
( function() { |
| 7 |
tinymce.create( 'tinymce.plugins.powerkit_basic_shortcodes', { |
| 8 |
init: function( ed, url ) { |
| 9 |
ed.addButton( 'powerkit_basic_shortcodes_button', { |
| 10 |
title: 'Basic Shortcodes', |
| 11 |
image: url.substring( 0, url.length - 3 ) + '/images/icon.png', |
| 12 |
onclick: function() { |
| 13 |
|
| 14 |
powerkit_basic_shortcodes = ed.selection; |
| 15 |
powerkit_basic_shortcodes_content = ed.selection.getContent(); |
| 16 |
|
| 17 |
var width = jQuery( window ).width(), |
| 18 |
H = jQuery( window ).height(), |
| 19 |
W = ( 720 < width ) ? 720 : width; |
| 20 |
W = W - 80; |
| 21 |
H = H - 84; |
| 22 |
|
| 23 |
|
| 24 |
var shortcodes_loaded = jQuery( '#powerkit_basic_shortcodes_holder' ).length; |
| 25 |
|
| 26 |
if ( shortcodes_loaded ) { |
| 27 |
|
| 28 |
tb_show( 'Basic Shortcodes', '#TB_inline?width=' + W + '&height=' + H + '&inlineId=powerkit_basic_shortcodes' ); |
| 29 |
jQuery( '#TB_window' ).addClass( 'powerkit_basic_shortcodes_window' ); |
| 30 |
|
| 31 |
} else { |
| 32 |
|
| 33 |
jQuery( "body" ).append( '<div id="powerkit_basic_shortcodes_holder" style="display: none;"><div id="powerkit_basic_shortcodes"></div></div>' ); |
| 34 |
|
| 35 |
jQuery.get( 'admin-ajax.php?action=powerkit_basic_shortcodes_sections', function( data ) { |
| 36 |
jQuery( '#powerkit_basic_shortcodes' ).html( data ); |
| 37 |
tb_show( 'Basic Shortcodes', '#TB_inline?width=' + W + '&height=' + H + '&inlineId=powerkit_basic_shortcodes' ); |
| 38 |
jQuery( '#TB_window' ).addClass( 'powerkit_basic_shortcodes_window' ); |
| 39 |
} ); |
| 40 |
} |
| 41 |
} |
| 42 |
} ); |
| 43 |
}, |
| 44 |
createControl: function( n, cm ) { |
| 45 |
return null; |
| 46 |
}, |
| 47 |
} ); |
| 48 |
tinymce.PluginManager.add( 'powerkit_basic_shortcodes', tinymce.plugins.powerkit_basic_shortcodes ); |
| 49 |
} )(); |