--- a/wp/wp-content/plugins/portfolio/bws_menu/js/shortcode-button.js Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-content/plugins/portfolio/bws_menu/js/shortcode-button.js Tue Dec 15 13:49:49 2020 +0100
@@ -12,117 +12,72 @@
* @param {string} url Absolute URL to where the plugin is located.
*/
init : function( ed, url ) {
- if ( bws_shortcode_button.wp_version < '3.9' ) {
- ed.addButton( 'add_bws_shortcode', {
- title : bws_shortcode_button.title,
- classes: 'bws_shortcode_button widget btn',
- image : bws_shortcode_button.icon_url,
- onclick: function() {
- /* triggers the thickbox */
- var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
- W = W - 80;
- H = H - 84;
- tb_show( bws_shortcode_button.title, '#TB_inline?width=' + W + '&height=' + H + '&inlineId=bws_shortcode_popup' );
-
- var current_object = '#TB_ajaxContent';
-
- var select_count = $( current_object + ' select#bws_shortcode_select option').length;
- if ( 1 == select_count ) {
- $( current_object + ' #bws_shortcode_select_plugin' ).hide();
- }
+ ed.addButton( 'add_bws_shortcode', {
+ title : bws_shortcode_button.title,
+ classes: 'bws_shortcode_button widget btn',
+ icon: 'icon bwsicons bwsicons-shortcode',
+ text: bws_shortcode_button.label,
+ onclick: function() {
+ win = ed.windowManager.open( {
+ width: 400,
+ height: 400,
+ inline: true,
+ title: bws_shortcode_button.title,
+ body: {
+ id : 'bws-shortcode-content',
+ type: 'container',
+ classes: 'bws-shortcode',
+ html: $( '#bws_shortcode_popup' ).html()
+ },
+ buttons: [{
+ text: 'Insert',
+ classes: 'button-primary primary bws_shortcode_insert',
+ onclick: function( e ) {
+ var shortcode = $( '.mce-container-body #bws_shortcode_display' ).text();
+ if ( '' != shortcode ) {
+ /* insert shortcode to tinymce */
+ ed.insertContent( shortcode );
+ }
+ ed.windowManager.close();
+ },
+ },
+ {
+ text: 'Cancel',
+ onclick: 'close'
+ }],
+
+ });
+ var current_object = '.mce-container-body';
+ var select_count = $( current_object + ' select#bws_shortcode_select option').length;
+ if ( 1 == select_count ) {
+ $( current_object + ' #bws_shortcode_select_plugin' ).hide();
+ }
+
+ var plugin = $( current_object + ' #bws_shortcode_select option:selected' ).val();
+ $( current_object + ' #bws_shortcode_content > div' ).hide();
+ $( current_object + ' #bws_shortcode_content > #' + plugin ).show();
+
+ if ( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).length > 0 ) {
+ $( current_object + ' #bws_shortcode_display' ).text( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).val() );
+ }
+
+ $( current_object + ' #bws_shortcode_select' ).on( 'change',function() {
var plugin = $( current_object + ' #bws_shortcode_select option:selected' ).val();
$( current_object + ' #bws_shortcode_content > div' ).hide();
$( current_object + ' #bws_shortcode_content > #' + plugin ).show();
-
if ( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).length > 0 ) {
$( current_object + ' #bws_shortcode_display' ).text( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).val() );
+ } else {
+ $( current_object + ' #bws_shortcode_display' ).text( '' );
}
-
- $( current_object + ' #bws_shortcode_select' ).on( 'change',function() {
- var plugin = $( current_object + ' #bws_shortcode_select option:selected' ).val();
- $( current_object + ' #bws_shortcode_content > div' ).hide();
- $( current_object + ' #bws_shortcode_content > #' + plugin ).show();
- if ( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).length > 0 ) {
- $( current_object + ' #bws_shortcode_display' ).text( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).val() );
- } else {
- $( current_object + ' #bws_shortcode_display' ).text( '' );
- }
- });
-
- $.each( bws_shortcode_button.function_name, function( index, value ) {
- eval( value + '();' );
- });
- }
- });
- } else {
- ed.addButton( 'add_bws_shortcode', {
- title : bws_shortcode_button.title,
- classes: 'bws_shortcode_button widget btn',
- icon: 'icon bwsicons bwsicons-shortcode',
- text: bws_shortcode_button.label,
- onclick: function() {
+ });
- win = ed.windowManager.open( {
- width: 400,
- height: 400,
- inline: true,
- title: bws_shortcode_button.title,
- body: {
- id : 'bws-shortcode-content',
- type: 'container',
- classes: 'bws-shortcode',
- html: $( '#bws_shortcode_popup' ).html()
- },
- buttons: [{
- text: 'Insert',
- classes: 'button-primary primary bws_shortcode_insert',
- onclick: function( e ) {
- var shortcode = $( '.mce-container-body #bws_shortcode_display' ).text();
- if ( '' != shortcode ) {
- /* insert shortcode to tinymce */
- ed.insertContent( shortcode );
- }
- ed.windowManager.close();
- },
- },
- {
- text: 'Cancel',
- onclick: 'close'
- }],
-
- });
- var current_object = '.mce-container-body';
- var select_count = $( current_object + ' select#bws_shortcode_select option').length;
- if ( 1 == select_count ) {
- $( current_object + ' #bws_shortcode_select_plugin' ).hide();
- }
-
- var plugin = $( current_object + ' #bws_shortcode_select option:selected' ).val();
- $( current_object + ' #bws_shortcode_content > div' ).hide();
- $( current_object + ' #bws_shortcode_content > #' + plugin ).show();
-
- if ( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).length > 0 ) {
- $( current_object + ' #bws_shortcode_display' ).text( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).val() );
- }
-
- $( current_object + ' #bws_shortcode_select' ).on( 'change',function() {
- var plugin = $( current_object + ' #bws_shortcode_select option:selected' ).val();
- $( current_object + ' #bws_shortcode_content > div' ).hide();
- $( current_object + ' #bws_shortcode_content > #' + plugin ).show();
- if ( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).length > 0 ) {
- $( current_object + ' #bws_shortcode_display' ).text( $( current_object + ' #bws_shortcode_content > #' + plugin + ' .bws_default_shortcode' ).val() );
- } else {
- $( current_object + ' #bws_shortcode_display' ).text( '' );
- }
- });
-
- $.each( bws_shortcode_button.function_name, function( index, value ) {
- eval( value + '();' );
- });
- }
- });
- }
+ $.each( bws_shortcode_button.function_name, function( index, value ) {
+ eval( value + '();' );
+ });
+ }
+ });
},
/**