first
This commit is contained in:
58
wp-content/plugins/slider-bws/bws_menu/js/bws_menu.js
Normal file
58
wp-content/plugins/slider-bws/bws_menu/js/bws_menu.js
Normal file
@ -0,0 +1,58 @@
|
||||
(function($) {
|
||||
"use strict";
|
||||
$( document ).ready(
|
||||
function() {
|
||||
var product = $( '.bws_product_box' ),
|
||||
max = 0;
|
||||
$( product ).each(
|
||||
function () {
|
||||
if ( $( this ).height() > max ) {
|
||||
max = $( this ).height();
|
||||
}
|
||||
}
|
||||
);
|
||||
$( '.bws_product_box' ).css( 'height', max + 'px' );
|
||||
|
||||
if ( $( '.bws-filter' ).length ) {
|
||||
var prvPos = $( '.bws-filter' ).offset().top;
|
||||
var maxPos = prvPos + $( '.bws-products' ).outerHeight() - $( '.bws-filter' ).outerHeight();
|
||||
|
||||
$( window ).scroll(
|
||||
function() {
|
||||
if ( $( window ).width() > 580 ) {
|
||||
var scrPos = Number( $( document ).scrollTop() ) + 40;
|
||||
if ( scrPos > maxPos ) {
|
||||
$( '.bws-filter' ).removeClass( 'bws_fixed' );
|
||||
} else if ( scrPos > prvPos ) {
|
||||
$( '.bws-filter' ).addClass( 'bws_fixed' );
|
||||
} else {
|
||||
$( '.bws-filter' ).removeClass( 'bws_fixed' );
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
$( '.bws-menu-item-icon' ).click(
|
||||
function() {
|
||||
if ( $( this ).hasClass( 'bws-active' ) ) {
|
||||
$( this ).removeClass( 'bws-active' );
|
||||
$( '.bws-nav-tab-wrapper, .bws-help-links-wrapper' ).hide();
|
||||
} else {
|
||||
$( this ).addClass( 'bws-active' );
|
||||
$( '.bws-nav-tab-wrapper, .bws-help-links-wrapper' ).css( 'display', 'inline-block' );
|
||||
}
|
||||
}
|
||||
);
|
||||
$( '.bws-filter-top h2' ).click(
|
||||
function() {
|
||||
if ( $( '.bws-filter-top' ).hasClass( 'bws-opened' ) ) {
|
||||
$( '.bws-filter-top' ).removeClass( 'bws-opened' );
|
||||
} else {
|
||||
$( '.bws-filter-top' ).addClass( 'bws-opened' );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
);
|
||||
})( jQuery );
|
110
wp-content/plugins/slider-bws/bws_menu/js/bws_tooltip.js
Normal file
110
wp-content/plugins/slider-bws/bws_menu/js/bws_tooltip.js
Normal file
@ -0,0 +1,110 @@
|
||||
/**
|
||||
* BWS tooltip function
|
||||
*/
|
||||
(function($) {
|
||||
"use strict";
|
||||
$( document ).ready(
|
||||
function() {
|
||||
jQuery.bwsTooltip = function( pointer_options ) {
|
||||
var pointer_buttons = pointer_options['buttons'];
|
||||
/* extend pointer options - add close button */
|
||||
pointer_options = $.extend(
|
||||
pointer_options,
|
||||
{
|
||||
buttons: function(event, t) {
|
||||
var button = '';
|
||||
/* check and add dismiss-type buttons */
|
||||
for ( var but in pointer_buttons ) {
|
||||
if ( typeof pointer_buttons[ but ]['type'] != 'undefined' && pointer_buttons[ but ]['type'] == 'dismiss' && typeof pointer_buttons[ but ]['text'] != 'undefined' && pointer_buttons[ but ]['text'] != '' ) {
|
||||
button += '<a style="margin:0px 5px 2px;" class="button-secondary">' + pointer_buttons[ but ]['text'] + '</a>';
|
||||
}
|
||||
}
|
||||
button = jQuery( button );
|
||||
button.on(
|
||||
'click.pointer',
|
||||
function () {
|
||||
t.element.pointer( 'close' );
|
||||
}
|
||||
);
|
||||
return button;
|
||||
},
|
||||
/* add ajax dismiss functionality */
|
||||
close : $.proxy(
|
||||
function () {
|
||||
if ( pointer_options['actions']['onload'] == true ) {
|
||||
$.post( ajaxurl, this );
|
||||
}
|
||||
},
|
||||
{
|
||||
pointer: pointer_options['tooltip_id'],
|
||||
action: 'dismiss-wp-pointer'
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
/* function to display pointer */
|
||||
function displayPointer( cssSelector ) {
|
||||
cssSelector.pointer( pointer_options ).pointer(
|
||||
{
|
||||
pointerClass: 'wp-pointer ' + pointer_options["tooltip_id"],
|
||||
content: pointer_options['content'],
|
||||
position: {
|
||||
edge: pointer_options['position']['edge'],
|
||||
align: pointer_options['position']['align'],
|
||||
},
|
||||
}
|
||||
).pointer( 'open' );
|
||||
/* display buttons that are not type of dismiss */
|
||||
for ( var but in pointer_buttons ) {
|
||||
if ( typeof pointer_buttons[ but ]['type'] != 'undefined' && pointer_buttons[ but ]['type'] != 'dismiss' && typeof pointer_buttons[ but ]['text'] != 'undefined' && pointer_buttons[ but ]['text'] != '' ) {
|
||||
$( '.' + pointer_options['tooltip_id'] + ' .button-secondary' ).first().before(
|
||||
'<a class="button-primary" style="margin-right: 5px;" ' +
|
||||
( ( pointer_buttons[ but ]['type'] == 'link' && typeof pointer_buttons[ but ]['link'] != 'undefined' && pointer_buttons[ but ]['link'] != '') ? 'target="_blank" href="' + pointer_buttons[ but ]['link'] + '"' : '' )
|
||||
+ '>' + pointer_buttons[ but ]['text'] + '</a>'
|
||||
);
|
||||
};
|
||||
}
|
||||
/* adjust position of pointer */
|
||||
var topPos,
|
||||
leftPos,
|
||||
pointerZindex;
|
||||
topPos = parseInt( $( "." + pointer_options["tooltip_id"] ).css( "top" ) ) + parseInt( pointer_options['position']['pos-top'] );
|
||||
leftPos = parseInt( $( "." + pointer_options["tooltip_id"] ).css( "left" ) ) + parseInt( pointer_options['position']['pos-left'] );
|
||||
if ( pointer_options['position']['align'] == 'left' ) {
|
||||
leftPos += cssSelector.outerWidth() / 2;
|
||||
};
|
||||
$( "." + pointer_options["tooltip_id"] ).css( { "top": topPos + "px", "left": leftPos + "px" } );
|
||||
/* adjust z-index if need */
|
||||
pointerZindex = parseInt( $( "." + pointer_options["tooltip_id"] ).css( "z-index" ) );
|
||||
if ( pointerZindex != pointer_options['position']['zindex'] ) {
|
||||
$( "." + pointer_options["tooltip_id"] ).css( { "z-index": pointer_options['position']['zindex'] } );
|
||||
}
|
||||
}
|
||||
|
||||
/* display pointer for the first time */
|
||||
if ( pointer_options['actions']['onload'] ) {
|
||||
if ( pointer_options['set_timeout'] > 0 ) {
|
||||
var settime = parseInt( pointer_options['set_timeout'] );
|
||||
setTimeout(
|
||||
function() {
|
||||
displayPointer( $( pointer_options['css_selector'] ) );
|
||||
},
|
||||
settime
|
||||
);
|
||||
} else {
|
||||
displayPointer( $( pointer_options['css_selector'] ) );
|
||||
}
|
||||
}
|
||||
|
||||
/* display pointer when clicked on selector */
|
||||
if ( pointer_options['actions']['click'] ) {
|
||||
$( pointer_options['css_selector'] ).click(
|
||||
function () {
|
||||
displayPointer( $( this ) );
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
)
|
||||
})( jQuery );
|
96
wp-content/plugins/slider-bws/bws_menu/js/c_o_o_k_i_e.js
Normal file
96
wp-content/plugins/slider-bws/bws_menu/js/c_o_o_k_i_e.js
Normal file
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Cookie plugin
|
||||
*
|
||||
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a cookie with the given name and value and other optional parameters.
|
||||
*
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Set the value of a cookie.
|
||||
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
||||
* @desc Create a cookie with all available options.
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Create a session cookie.
|
||||
* @example $.cookie('the_cookie', null);
|
||||
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
|
||||
* used when the cookie was set.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @param String value The value of the cookie.
|
||||
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
||||
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
||||
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
||||
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
||||
* when the the browser exits.
|
||||
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
||||
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
||||
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
||||
* require a secure protocol (like HTTPS).
|
||||
* @type undefined
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the value of a cookie with the given name.
|
||||
*
|
||||
* @example $.cookie('the_cookie');
|
||||
* @desc Get the value of a cookie.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @return The value of the cookie.
|
||||
* @type String
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
jQuery.cookie = function(name, value, options) {
|
||||
if (typeof value != 'undefined') { /* name and value given, set cookie */
|
||||
options = options || {};
|
||||
if (value === null) {
|
||||
value = '';
|
||||
options.expires = -1;
|
||||
}
|
||||
var expires = '';
|
||||
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
||||
var date;
|
||||
if (typeof options.expires == 'number') {
|
||||
date = new Date();
|
||||
date.setTime( date.getTime() + (options.expires * 24 * 60 * 60 * 1000) );
|
||||
} else {
|
||||
date = options.expires;
|
||||
}
|
||||
expires = '; expires=' + date.toUTCString(); /* use expires attribute, max-age is not supported by IE */
|
||||
}
|
||||
/** CAUTION: Needed to parenthesize options.path and options.domain
|
||||
* in the following expressions, otherwise they evaluate to undefined
|
||||
* in the packed version for some reason...
|
||||
*/
|
||||
var path = options.path ? '; path=' + (options.path) : '';
|
||||
var domain = options.domain ? '; domain=' + (options.domain) : '';
|
||||
var secure = options.secure ? '; secure' : '';
|
||||
document.cookie = [name, '=', encodeURIComponent( value ), expires, path, domain, secure].join( '' );
|
||||
} else { /* only name given, get cookie */
|
||||
var cookieValue = null;
|
||||
if (document.cookie && document.cookie != '') {
|
||||
var cookies = document.cookie.split( ';' );
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
var cookie = jQuery.trim( cookies[i] );
|
||||
/* Does this cookie string begin with the name we want? */
|
||||
if (cookie.substring( 0, name.length + 1 ) == (name + '=')) {
|
||||
cookieValue = decodeURIComponent( cookie.substring( name.length + 1 ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cookieValue;
|
||||
}
|
||||
};
|
5
wp-content/plugins/slider-bws/bws_menu/js/codemirror.js
Normal file
5
wp-content/plugins/slider-bws/bws_menu/js/codemirror.js
Normal file
File diff suppressed because one or more lines are too long
231
wp-content/plugins/slider-bws/bws_menu/js/general_script.js
Normal file
231
wp-content/plugins/slider-bws/bws_menu/js/general_script.js
Normal file
@ -0,0 +1,231 @@
|
||||
function bws_show_settings_notice() {
|
||||
"use strict";
|
||||
(function($) {
|
||||
$( '.updated.fade:not(.bws_visible), .error:not(.bws_visible)' ).css( 'display', 'none' );
|
||||
$( '#bws_save_settings_notice' ).css( 'display', 'block' );
|
||||
})( jQuery );
|
||||
}
|
||||
|
||||
(function($) {
|
||||
"use strict";
|
||||
$( document ).ready(
|
||||
function() {
|
||||
/**
|
||||
* add notice about changing on the settings page
|
||||
*/
|
||||
$( '.bws_form input, .bws_form textarea, .bws_form select' ).on(
|
||||
"change paste select",
|
||||
function() {
|
||||
if ( $( this ).attr( 'type' ) != 'submit' && ! $( this ).hasClass( 'bws_no_bind_notice' ) ) {
|
||||
bws_show_settings_notice();
|
||||
};
|
||||
}
|
||||
);
|
||||
$( '.bws_save_anchor' ).on(
|
||||
"click",
|
||||
function( event ) {
|
||||
event.preventDefault();
|
||||
$( '.bws_form #bws-submit-button' ).click();
|
||||
}
|
||||
);
|
||||
|
||||
/* custom code */
|
||||
|
||||
if ( 'function' == typeof wp.CodeMirror || 'function' == typeof CodeMirror ) {
|
||||
var CodeMirrorFunc = ( typeof wp.CodeMirror != 'undefined' ) ? wp.CodeMirror : CodeMirror;
|
||||
if ( $( '#bws_newcontent_css' ).length > 0 ) {
|
||||
var editor = CodeMirrorFunc.fromTextArea(
|
||||
document.getElementById( 'bws_newcontent_css' ),
|
||||
{
|
||||
mode: "css",
|
||||
theme: "default",
|
||||
styleActiveLine: true,
|
||||
matchBrackets: true,
|
||||
lineNumbers: true,
|
||||
addModeClass: 'bws_newcontent_css',
|
||||
readOnly: 'nocursor'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if ( $( '#bws_newcontent_php' ).length > 0 ) {
|
||||
var editor = CodeMirrorFunc.fromTextArea(
|
||||
document.getElementById( "bws_newcontent_php" ),
|
||||
{
|
||||
mode: 'text/x-php',
|
||||
styleActiveLine: true,
|
||||
matchBrackets: true,
|
||||
lineNumbers: true,
|
||||
readOnly: 'nocursor'
|
||||
}
|
||||
);
|
||||
/* disable lines */
|
||||
editor.markText( {ch:0,line:0}, {ch:0,line:5}, { readOnly: true, className: 'bws-readonly' } );
|
||||
}
|
||||
|
||||
if ( $( '#bws_newcontent_js' ).length > 0 ) {
|
||||
var editor = CodeMirrorFunc.fromTextArea(
|
||||
document.getElementById( "bws_newcontent_js" ),
|
||||
{
|
||||
mode: 'javascript',
|
||||
styleActiveLine: true,
|
||||
matchBrackets: true,
|
||||
lineNumbers: true,
|
||||
readOnly: 'nocursor'
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/* banner to settings */
|
||||
$( '.bws_banner_to_settings_joint .bws-details' ).addClass( 'hidden' ).removeClass( 'hide-if-js' );
|
||||
$( '.bws_banner_to_settings_joint .bws-more-links' ).on(
|
||||
"click",
|
||||
function( event ) {
|
||||
event.preventDefault();
|
||||
if ( $( '.bws_banner_to_settings_joint .bws-less' ).hasClass( 'hidden' ) ) {
|
||||
$( '.bws_banner_to_settings_joint .bws-less, .bws_banner_to_settings_joint .bws-details' ).removeClass( 'hidden' );
|
||||
$( '.bws_banner_to_settings_joint .bws-more' ).addClass( 'hidden' );
|
||||
} else {
|
||||
$( '.bws_banner_to_settings_joint .bws-less, .bws_banner_to_settings_joint .bws-details' ).addClass( 'hidden' );
|
||||
$( '.bws_banner_to_settings_joint .bws-more' ).removeClass( 'hidden' );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/* help tooltips */
|
||||
if ( $( '.bws_help_box' ).length > 0 ) {
|
||||
if ( $( 'body' ).hasClass( 'rtl' ) ) {
|
||||
var current_position = { my: "right top+15", at: "right bottom" };
|
||||
} else {
|
||||
var current_position = { my: "left top+15", at: "left bottom" };
|
||||
}
|
||||
$( document ).tooltip(
|
||||
{
|
||||
items: $( '.bws_help_box' ),
|
||||
content: function() {
|
||||
return $( this ).find( '.bws_hidden_help_text' ).html()
|
||||
},
|
||||
show: null, /* show immediately */
|
||||
tooltipClass: "bws-tooltip-content",
|
||||
position: current_position,
|
||||
open: function( event, ui ) {
|
||||
if ( typeof( event.originalEvent ) === 'undefined' ) {
|
||||
return false;
|
||||
}
|
||||
if ( $( event.originalEvent.target ).hasClass( 'bws-auto-width' ) ) {
|
||||
ui.tooltip.css( "max-width", "inherit" );
|
||||
}
|
||||
var $id = $( ui.tooltip ).attr( 'id' );
|
||||
/* close any lingering tooltips */
|
||||
$( 'div.ui-tooltip' ).not( '#' + $id ).remove();
|
||||
},
|
||||
close: function( event, ui ) {
|
||||
ui.tooltip.hover(
|
||||
function() {
|
||||
$( this ).stop( true ).fadeTo( 200, 1 );
|
||||
},
|
||||
function() {
|
||||
$( this ).fadeOut(
|
||||
'200',
|
||||
function() {
|
||||
$( this ).remove();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the styling of the "Settings" tab on the plugin settings page
|
||||
*/
|
||||
var tabs = $( '#bws_settings_tabs_wrapper' );
|
||||
if ( tabs.length ) {
|
||||
var current_tab_field = $( 'input[name="bws_active_tab"]' ),
|
||||
prevent_tabs_change = false,
|
||||
active_tab = current_tab_field.val();
|
||||
if ( '' == active_tab ) {
|
||||
var active_tab_index = 0;
|
||||
} else {
|
||||
var active_tab_index = $( '#bws_settings_tabs li[data-slug=' + active_tab + ']' ).index();
|
||||
}
|
||||
|
||||
$( '.bws_tab' ).css( 'min-height', $( '#bws_settings_tabs' ).css( 'height' ) );
|
||||
|
||||
/* jQuery tabs initialization */
|
||||
tabs.tabs(
|
||||
{
|
||||
active: active_tab_index
|
||||
}
|
||||
).on(
|
||||
"tabsactivate",
|
||||
function( event, ui ) {
|
||||
if ( ! prevent_tabs_change ) {
|
||||
active_tab = ui.newTab.data( 'slug' );
|
||||
current_tab_field.val( active_tab );
|
||||
}
|
||||
prevent_tabs_change = false;
|
||||
}
|
||||
);
|
||||
$( '.bws_trigger_tab_click' ).on(
|
||||
'click',
|
||||
function () {
|
||||
$( '#bws_settings_tabs a[href="' + $( this ).attr( 'href' ) + '"]' ).click();
|
||||
}
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Hide content for options on the plugin settings page
|
||||
*/
|
||||
var options = $( '.bws_option_affect' );
|
||||
if ( options.length ) {
|
||||
options.each(
|
||||
function() {
|
||||
var element = $( this );
|
||||
if ( element.is( ':selected' ) || element.is( ':checked' ) ) {
|
||||
$( element.data( 'affect-show' ) ).show();
|
||||
$( element.data( 'affect-hide' ) ).hide();
|
||||
} else {
|
||||
$( element.data( 'affect-show' ) ).hide();
|
||||
$( element.data( 'affect-hide' ) ).show();
|
||||
}
|
||||
if ( element.is( 'option' ) ) {
|
||||
element.parent().on(
|
||||
'change',
|
||||
function() {
|
||||
var affect_hide = element.data( 'affect-hide' ),
|
||||
affect_show = element.data( 'affect-show' );
|
||||
if ( element.is( ':selected' ) ) {
|
||||
$( affect_show ).show();
|
||||
$( affect_hide ).hide();
|
||||
} else {
|
||||
$( affect_show ).hide();
|
||||
$( affect_hide ).show();
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
element.on(
|
||||
'change',
|
||||
function() {
|
||||
var affect_hide = element.data( 'affect-hide' ),
|
||||
affect_show = element.data( 'affect-show' );
|
||||
if ( element.is( ':selected' ) || element.is( ':checked' ) ) {
|
||||
$( affect_show ).show();
|
||||
$( affect_hide ).hide();
|
||||
} else {
|
||||
$( affect_show ).hide();
|
||||
$( affect_hide ).show();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
})( jQuery );
|
132
wp-content/plugins/slider-bws/bws_menu/js/shortcode-button.js
Normal file
132
wp-content/plugins/slider-bws/bws_menu/js/shortcode-button.js
Normal file
@ -0,0 +1,132 @@
|
||||
(function($) {
|
||||
"use strict";
|
||||
if ( typeof bws_shortcode_button != 'undefined' ) {
|
||||
var win;
|
||||
|
||||
tinymce.create(
|
||||
'tinymce.plugins.BWSButton',
|
||||
{
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function( ed, url ) {
|
||||
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 + '();' );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates control instances based in the incomming name. This method is normally not
|
||||
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
|
||||
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
|
||||
* method can be used to create those.
|
||||
*
|
||||
* @param {String} n Name of the control to create.
|
||||
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
|
||||
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
||||
*/
|
||||
createControl : function(n, cm) {
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'BWS Shortcode Buttons',
|
||||
author : 'BWS',
|
||||
authorurl : 'https://bestwebsoft.com',
|
||||
infourl : '',
|
||||
version : "0.1"
|
||||
};
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
/* Register plugin */
|
||||
tinymce.PluginManager.add( 'add_bws_shortcode', tinymce.plugins.BWSButton );
|
||||
}
|
||||
})( jQuery );
|
Reference in New Issue
Block a user