This commit is contained in:
apuc committed 2024-05-20 15:37:46 +03:00
commit 00b7dbd0b7
10404 files changed
+3285853

No files matched your search

@@ -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 );
@@ -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 );
@@ -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;
}
};
@@ -0,0 +1,5 @@
!function(a){if("object"==typeof exports&&"object"==typeof module)module.exports=a();else{if("function"==typeof define&&define.amd)return define([],a);this.CodeMirror=a()}}(function(){"use strict";function z(a,c){if(!(this instanceof z))return new z(a,c);this.options=c=c||{},Fg($d,c,!1),N(c);var d=c.value;"string"==typeof d&&(d=new zf(d,c.mode)),this.doc=d;var e=this.display=new A(a,d);e.wrapper.CodeMirror=this,J(this),H(this),c.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),c.autofocus&&!r&&Rc(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new vg},b&&setTimeout(Gg(Qc,this,!0),20),Uc(this);var f=this;Ac(this,function(){f.curOp.forceUpdate=!0,Df(f,d),c.autofocus&&!r||Rg()==e.input?setTimeout(Gg(vd,f),20):wd(f);for(var a in _d)_d.hasOwnProperty(a)&&_d[a](f,c[a],be);for(var b=0;b<fe.length;++b)fe[b](f)})}function A(a,b){var d=this,e=d.input=Mg("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");h?e.style.width="1000px":e.setAttribute("wrap","off"),q&&(e.style.border="1px solid black"),e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck","false"),d.inputDiv=Mg("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),d.scrollbarH=Mg("div",[Mg("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),d.scrollbarV=Mg("div",[Mg("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),d.scrollbarFiller=Mg("div",null,"CodeMirror-scrollbar-filler"),d.gutterFiller=Mg("div",null,"CodeMirror-gutter-filler"),d.lineDiv=Mg("div",null,"CodeMirror-code"),d.selectionDiv=Mg("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=Mg("div",null,"CodeMirror-cursors"),d.measure=Mg("div",null,"CodeMirror-measure"),d.lineMeasure=Mg("div",null,"CodeMirror-measure"),d.lineSpace=Mg("div",[d.measure,d.lineMeasure,d.selectionDiv,d.cursorDiv,d.lineDiv],null,"position: relative; outline: none"),d.mover=Mg("div",[Mg("div",[d.lineSpace],"CodeMirror-lines")],null,"position: relative"),d.sizer=Mg("div",[d.mover],"CodeMirror-sizer"),d.heightForcer=Mg("div",null,null,"position: absolute; height: "+qg+"px; width: 1px;"),d.gutters=Mg("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=Mg("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=Mg("div",[d.inputDiv,d.scrollbarH,d.scrollbarV,d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),c&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),q&&(e.style.width="0px"),h||(d.scroller.draggable=!0),m&&(d.inputDiv.style.height="1px",d.inputDiv.style.position="absolute"),c&&(d.scrollbarH.style.minHeight=d.scrollbarV.style.minWidth="18px"),a.appendChild?a.appendChild(d.wrapper):a(d.wrapper),d.viewFrom=d.viewTo=b.first,d.view=[],d.externalMeasured=null,d.viewOffset=0,d.lastSizeC=0,d.updateLineNumbers=null,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.prevInput="",d.alignWidgets=!1,d.pollingFast=!1,d.poll=new vg,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.inaccurateSelection=!1,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1}function B(a){a.doc.mode=z.getMode(a.options,a.doc.modeOption),C(a)}function C(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null)}),a.doc.frontier=a.doc.first,Tb(a,100),a.state.modeGen++,a.curOp&&Gc(a)}function D(a){a.options.lineWrapping?(Ug(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth=""):(Tg(a.display.wrapper,"CodeMirror-wrap"),M(a)),F(a),Gc(a),jc(a),setTimeout(function(){P(a)},100)}function E(a){var b=vc(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/wc(a.display)-3);return function(e){if(Ve(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return c?f+(Math.ceil(e.text.length/d)||1)*b:f+b}}function F(a){var b=a.doc,c=E(a);b.iter(function(a){var b=c(a);b!=a.height&&Hf(a,b)})}function G(a){var b=ke[a.options.keyMap],c=b.style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(c?" cm-keymap-"+c:"")}function H(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-"),jc(a)}function I(a){J(a),Gc(a),setTimeout(function(){R(a)},20)}function J(a){var b=a.display.gutters,c=a.options.gutters;Og(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(Mg("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none",K(a)}function K(a){var b=a.display.gutters.offsetWidth;a.display.sizer.style.marginLeft=b+"px",a.display.scrollbarH.style.left=a.options.fixedGutter?b+"px":0}function LLine truncated
}function Fc(a,b,c){for(var e,d=[],f=b;c>f;f=e){var g=new Ec(a.doc,Ef(a.doc,f),f);e=f+g.size,d.push(g)}return d}function Gc(a,b,c,d){null==b&&(b=a.doc.first),null==c&&(c=a.doc.first+a.doc.size),d||(d=0);var e=a.display;if(d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b),a.curOp.viewChanged=!0,b>=e.viewTo)y&&Te(a.doc,b)<e.viewTo&&Ic(a);else if(c<=e.viewFrom)y&&Ue(a.doc,c+d)>e.viewFrom?Ic(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Ic(a);else if(b<=e.viewFrom){var f=Kc(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Ic(a)}else if(c>=e.viewTo){var f=Kc(a,b,b,-1);f?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Ic(a)}else{var g=Kc(a,b,b,-1),h=Kc(a,c,c+d,1);g&&h?(e.view=e.view.slice(0,g.index).concat(Fc(a,g.lineN,h.lineN)).concat(e.view.slice(h.index)),e.viewTo+=d):Ic(a)}var i=e.externalMeasured;i&&(c<i.lineN?i.lineN+=d:b<i.lineN+i.size&&(e.externalMeasured=null))}function Hc(a,b,c){a.curOp.viewChanged=!0;var d=a.display,e=a.display.externalMeasured;if(e&&b>=e.lineN&&b<e.lineN+e.size&&(d.externalMeasured=null),!(b<d.viewFrom||b>=d.viewTo)){var f=d.view[Jc(a,b)];if(null!=f.node){var g=f.changes||(f.changes=[]);-1==Cg(g,c)&&g.push(c)}}}function Ic(a){a.display.viewFrom=a.display.viewTo=a.doc.first,a.display.view=[],a.display.viewOffset=0}function Jc(a,b){if(b>=a.display.viewTo)return null;if(b-=a.display.viewFrom,0>b)return null;for(var c=a.display.view,d=0;d<c.length;d++)if(b-=c[d].size,0>b)return d}function Kc(a,b,c,d){var f,e=Jc(a,b),g=a.display.view;if(!y)return{index:e,lineN:c};for(var h=0,i=a.display.viewFrom;e>h;h++)i+=g[h].size;if(i!=b){if(d>0){if(e==g.length-1)return null;f=i+g[e].size-b,e++}else f=i-b;b+=f,c+=f}for(;Te(a.doc,c)!=c;){if(e==(0>d?0:g.length-1))return null;c+=d*g[e-(0>d?1:0)].size,e+=d}return{index:e,lineN:c}}function Lc(a,b,c){var d=a.display,e=d.view;0==e.length||b>=d.viewTo||c<=d.viewFrom?(d.view=Fc(a,b,c),d.viewFrom=b):(d.viewFrom>b?d.view=Fc(a,b,d.viewFrom).concat(d.view):d.viewFrom<b&&(d.view=d.view.slice(Jc(a,b))),d.viewFrom=b,d.viewTo<c?d.view=d.view.concat(Fc(a,d.viewTo,c)):d.viewTo>c&&(d.view=d.view.slice(0,Jc(a,c)))),d.viewTo=c}function Mc(a){for(var b=a.display.view,c=0,d=0;d<b.length;d++){var e=b[d];e.hidden||e.node&&!e.changes||++c}return c}function Nc(a){a.display.pollingFast||a.display.poll.set(a.options.pollInterval,function(){Pc(a),a.state.focused&&Nc(a)})}function Oc(a){function c(){var d=Pc(a);d||b?(a.display.pollingFast=!1,Nc(a)):(b=!0,a.display.poll.set(60,c))}var b=!1;a.display.pollingFast=!0,a.display.poll.set(20,c)}function Pc(a){var b=a.display.input,c=a.display.prevInput,e=a.doc;if(!a.state.focused||ch(b)&&!c||Tc(a)||a.options.disableInput)return!1;a.state.pasteIncoming&&a.state.fakedLastChar&&(b.value=b.value.substring(0,b.value.length-1),a.state.fakedLastChar=!1);var f=b.value;if(f==c&&!a.somethingSelected())return!1;if(g&&!d&&a.display.inputHasSelection===f)return Qc(a),!1;var h=!a.curOp;h&&yc(a),a.display.shift=!1;for(var i=0,j=Math.min(c.length,f.length);j>i&&c.charCodeAt(i)==f.charCodeAt(i);)++i;for(var k=f.slice(i),l=bh(k),m=a.state.pasteIncoming&&l.length>1&&e.sel.ranges.length==l.length,n=e.sel.ranges.length-1;n>=0;n--){var o=e.sel.ranges[n],p=o.from(),q=o.to();i<c.length?p=ob(p.line,p.ch-(c.length-i)):a.state.overwrite&&o.empty()&&!a.state.pasteIncoming&&(q=ob(q.line,Math.min(Ef(e,q.line).text.length,q.ch+Ag(l).length)));var r=a.curOp.updateInput,s={from:p,to:q,text:m?[l[n]]:l,origin:a.state.pasteIncoming?"paste":a.state.cutIncoming?"cut":"+input"};if(Gd(a.doc,s),kg(a,"inputRead",a,s),k&&!a.state.pasteIncoming&&a.options.electricChars&&a.options.smartIndent&&o.head.ch<100&&(!n||e.sel.ranges[n-1].head.line!=o.head.line)){var t=a.getModeAt(o.head);if(t.electricChars){for(var u=0;u<t.electricChars.length;u++)if(k.indexOf(t.electricChars.charAt(u))>-1){Ud(a,o.head.line,"smart");break}}else if(t.electricInput){var v=Ad(s);t.electricInput.test(Ef(e,v.line).text.slice(0,v.ch))&&Ud(a,o.head.line,"smart")}}}return Sd(a),a.curOp.updateInput=r,a.curOp.typing=!0,f.length>1e3||f.indexOf("\n")>-1?b.value=a.display.prevInput="":a.display.prevInput=f,h&&zc(a),a.state.pasteIncoming=a.state.cutIncoming=!1,!0}function Qc(a,b){var c,e,f=a.doc;if(a.somethingSelected()){a.display.prevInput="";var h=f.sel.primary();c=dh&&(h.to().line-h.from().line>100||(e=a.getSelection()).length>1e3);var i=c?"-":e||a.getSelection();a.display.input.value=i,a.state.focused&&Bg(a.display.input),g&&!d&&(a.display.inputHasSelection=i)}else b||(a.display.prevInput=a.display.input.value="",g&&!d&&(a.display.inputHasSelection=null));a.display.inaccurateSelection=c}function Rc(a){"nocursor"==a.options.readOnly||r&&Rg()==a.display.input||a.display.input.focus()}function Sc(a){a.state.focused||(Rc(a),vd(a))}function Tc(a){return a.options.readOnly||a.doc.cantEdit}function Uc(a){function e(){a.state.focused&&setTimeout(Gg(Rc,a),0)}function i(){null==f&&(f=setTimeout(function(){f=null,c.cachedCharWidth=c.cachedTeLine truncated
if(!(pb(j.to,h.from)<0||pb(j.from,h.to)>0)){var k=[i,1],l=pb(j.from,h.from),m=pb(j.to,h.to);(0>l||!g.inclusiveLeft&&!l)&&k.push({from:j.from,to:h.from}),(m>0||!g.inclusiveRight&&!m)&&k.push({from:h.to,to:j.to}),e.splice.apply(e,k),i+=k.length-1}}return e}function Ie(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Je(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function Ke(a){return a.inclusiveLeft?-1:0}function Le(a){return a.inclusiveRight?1:0}function Me(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;var d=a.find(),e=b.find(),f=pb(d.from,e.from)||Ke(a)-Ke(b);if(f)return-f;var g=pb(d.to,e.to)||Le(a)-Le(b);return g?g:b.id-a.id}function Ne(a,b){var d,c=y&&a.markedSpans;if(c)for(var e,f=0;f<c.length;++f)e=c[f],e.marker.collapsed&&null==(b?e.from:e.to)&&(!d||Me(d,e.marker)<0)&&(d=e.marker);return d}function Oe(a){return Ne(a,!0)}function Pe(a){return Ne(a,!1)}function Qe(a,b,c,d,e){var f=Ef(a,b),g=y&&f.markedSpans;if(g)for(var h=0;h<g.length;++h){var i=g[h];if(i.marker.collapsed){var j=i.marker.find(0),k=pb(j.from,c)||Ke(i.marker)-Ke(e),l=pb(j.to,d)||Le(i.marker)-Le(e);if(!(k>=0&&0>=l||0>=k&&l>=0)&&(0>=k&&(pb(j.to,c)||Le(i.marker)-Ke(e))>0||k>=0&&(pb(j.from,d)||Ke(i.marker)-Le(e))<0))return!0}}}function Re(a){for(var b;b=Oe(a);)a=b.find(-1,!0).line;return a}function Se(a){for(var b,c;b=Pe(a);)a=b.find(1,!0).line,(c||(c=[])).push(a);return c}function Te(a,b){var c=Ef(a,b),d=Re(c);return c==d?b:If(d)}function Ue(a,b){if(b>a.lastLine())return b;var d,c=Ef(a,b);if(!Ve(a,c))return b;for(;d=Pe(c);)c=d.find(1,!0).line;return If(c)+1}function Ve(a,b){var c=y&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed){if(null==d.from)return!0;if(!d.marker.widgetNode&&0==d.from&&d.marker.inclusiveLeft&&We(a,b,d))return!0}}function We(a,b,c){if(null==c.to){var d=c.marker.find(1,!0);return We(a,d.line,ze(d.line.markedSpans,c.marker))}if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var e,f=0;f<b.markedSpans.length;++f)if(e=b.markedSpans[f],e.marker.collapsed&&!e.marker.widgetNode&&e.from==c.to&&(null==e.to||e.to!=c.from)&&(e.marker.inclusiveLeft||c.marker.inclusiveRight)&&We(a,b,e))return!0}function Ye(a,b,c){Kf(b)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Rd(a,null,c)}function Ze(a){return null!=a.height?a.height:(Qg(document.body,a.node)||Pg(a.cm.display.measure,Mg("div",[a.node],null,"position: relative")),a.height=a.node.offsetHeight)}function $e(a,b,c,d){var e=new Xe(a,c,d);return e.noHScroll&&(a.display.alignWidgets=!0),Vd(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);if(null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e),e.line=b,!Ve(a.doc,b)){var d=Kf(b)<a.doc.scrollTop;Hf(b,b.height+Ze(e)),d&&Rd(a,null,e.height),a.curOp.forceUpdate=!0}return!0}),e}function af(a,b,c,d){a.text=b,a.stateAfter&&(a.stateAfter=null),a.styles&&(a.styles=null),null!=a.order&&(a.order=null),Ie(a),Je(a,c);var e=d?d(a):1;e!=a.height&&Hf(a,e)}function bf(a){a.parent=null,Ie(a)}function cf(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:new RegExp("(?:^|s)"+c[2]+"(?:$|s)").test(b[d])||(b[d]+=" "+c[2])}return a}function df(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode){var c=z.innerMode(a,b);return c.mode.blankLine?c.mode.blankLine(c.state):void 0}}function ef(a,b,c){var d=a.token(b,c);if(b.pos<=b.start)throw new Error("Mode "+a.name+" failed to advance stream.");return d}function ff(a,b,c,d,e,f,g){var h=c.flattenSpans;null==h&&(h=a.options.flattenSpans);var l,i=0,j=null,k=new pe(b,a.options.tabSize);for(""==b&&cf(df(c,d),f);!k.eol();){if(k.pos>a.options.maxHighlightLength?(h=!1,g&&jf(a,b,d,k.pos),k.pos=b.length,l=null):l=cf(ef(c,k,d),f),a.options.addModeClass){var m=z.innerMode(c,d).mode.name;m&&(l="m-"+(l?m+" "+l:m))}h&&j==l||(i<k.start&&e(k.start,j),i=k.start,j=l),k.start=k.pos}for(;i<k.pos;){var n=Math.min(k.pos,i+5e4);e(n,j),i=n}}function gf(a,b,c,d){var e=[a.state.modeGen],f={};ff(a,b.text,a.doc.mode,c,function(a,b){e.push(a,b)},f,d);for(var g=0;g<a.state.overlays.length;++g){var h=a.state.overlays[g],i=1,j=0;ff(a,b.text,h.mode,!0,function(a,b){for(var c=i;a>j;){var d=e[i];d>a&&e.splice(i,1,a,e[i+1],d),i+=2,j=Math.min(a,d)}if(b)if(h.opaque)e.splice(c,i-c,a,"cm-overlay "+b),i=c+2;else for(;i>c;c+=2){var f=e[c+1];e[c+1]=(f?f+" ":"")+"cm-overlay "+b}},f)}return{styles:e,classes:f.bgClass||f.textClass?f:null}}function hf(a,b){if(!b.styles||b.styles[0]!=a.state.modeGen){var c=gf(a,b,b.stateAfter=Wb(a,If(b)));b.styles=c.styles,c.classes?b.styleClasses=c.classes:b.styleClasses&&(b.styleClasses=null)}return b.styles}function jf(a,b,c,d){var e=a.doc.mode,f=new pe(b,a.options.tabSize);for(f.start=f.pos=d||0,""==b&&df(e,c);!f.eol()&&f.pos<=a.options.maxHighlightLength;)ef(e,f,c),f.start=f.pos}function mf(a,b){if(!a|Line truncated
},!0),ae("coverGutterNextToScrollbar",!1,P,!0),ae("lineNumbers",!1,function(a){N(a.options),I(a)},!0),ae("firstLineNumber",1,I,!0),ae("lineNumberFormatter",function(a){return a},I,!0),ae("showCursorWhenSelecting",!1,Pb,!0),ae("resetSelectionOnContextMenu",!0),ae("readOnly",!1,function(a,b){"nocursor"==b?(wd(a),a.display.input.blur(),a.display.disabled=!0):(a.display.disabled=!1,b||Qc(a))}),ae("disableInput",!1,function(a,b){b||Qc(a)},!0),ae("dragDrop",!0),ae("cursorBlinkRate",530),ae("cursorScrollMargin",0),ae("cursorHeight",1),ae("workTime",100),ae("workDelay",100),ae("flattenSpans",!0,C,!0),ae("addModeClass",!1,C,!0),ae("pollInterval",100),ae("undoDepth",200,function(a,b){a.doc.history.undoDepth=b}),ae("historyEventDelay",1250),ae("viewportMargin",10,function(a){a.refresh()},!0),ae("maxHighlightLength",1e4,C,!0),ae("moveInputWithCursor",!0,function(a,b){b||(a.display.inputDiv.style.top=a.display.inputDiv.style.left=0)}),ae("tabindex",null,function(a,b){a.display.input.tabIndex=b||""}),ae("autofocus",null);var ce=z.modes={},de=z.mimeModes={};z.defineMode=function(a,b){if(z.defaults.mode||"null"==a||(z.defaults.mode=a),arguments.length>2){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}ce[a]=b},z.defineMIME=function(a,b){de[a]=b},z.resolveMode=function(a){if("string"==typeof a&&de.hasOwnProperty(a))a=de[a];else if(a&&"string"==typeof a.name&&de.hasOwnProperty(a.name)){var b=de[a.name];"string"==typeof b&&(b={name:b}),a=Eg(b,a),a.name=b.name}else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return z.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}},z.getMode=function(a,b){var b=z.resolveMode(b),c=ce[b.name];if(!c)return z.getMode(a,"text/plain");var d=c(a,b);if(ee.hasOwnProperty(b.name)){var e=ee[b.name];for(var f in e)e.hasOwnProperty(f)&&(d.hasOwnProperty(f)&&(d["_"+f]=d[f]),d[f]=e[f])}if(d.name=b.name,b.helperType&&(d.helperType=b.helperType),b.modeProps)for(var f in b.modeProps)d[f]=b.modeProps[f];return d},z.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),z.defineMIME("text/plain","null");var ee=z.modeExtensions={};z.extendMode=function(a,b){var c=ee.hasOwnProperty(a)?ee[a]:ee[a]={};Fg(b,c)},z.defineExtension=function(a,b){z.prototype[a]=b},z.defineDocExtension=function(a,b){zf.prototype[a]=b},z.defineOption=ae;var fe=[];z.defineInitHook=function(a){fe.push(a)};var ge=z.helpers={};z.registerHelper=function(a,b,c){ge.hasOwnProperty(a)||(ge[a]=z[a]={_global:[]}),ge[a][b]=c},z.registerGlobalHelper=function(a,b,c,d){z.registerHelper(a,b,d),ge[a]._global.push({pred:c,val:d})};var he=z.copyState=function(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c},ie=z.startState=function(a,b,c){return a.startState?a.startState(b,c):!0};z.innerMode=function(a,b){for(;a.innerMode;){var c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state,a=c.mode}return c||{mode:a,state:b}};var je=z.commands={selectAll:function(a){a.setSelection(ob(a.firstLine(),0),ob(a.lastLine()),sg)},singleSelection:function(a){a.setSelection(a.getCursor("anchor"),a.getCursor("head"),sg)},killLine:function(a){Wd(a,function(b){if(b.empty()){var c=Ef(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:ob(b.head.line+1,0)}:{from:b.head,to:ob(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){Wd(a,function(b){return{from:ob(b.from().line,0),to:yb(a.doc,ob(b.to().line+1,0))}})},delLineLeft:function(a){Wd(a,function(a){return{from:ob(a.from().line,0),to:a.from()}})},undo:function(a){a.undo()},redo:function(a){a.redo()},undoSelection:function(a){a.undoSelection()},redoSelection:function(a){a.redoSelection()},goDocStart:function(a){a.extendSelection(ob(a.firstLine(),0))},goDocEnd:function(a){a.extendSelection(ob(a.lastLine()))},goLineStart:function(a){a.extendSelectionsBy(function(b){return kh(a,b.head.line)},ug)},goLineStartSmart:function(a){a.extendSelectionsBy(function(b){var c=kh(a,b.head.line),d=a.getLineHandle(c.line),e=Lf(d);if(!e||0==e[0].level){var f=Math.max(0,d.text.search(/\S/)),g=b.head.line==c.line&&b.head.ch<=f&&b.head.ch;return ob(c.line,g?0:f)}return c},ug)},goLineEnd:function(a){a.extendSelectionsBy(function(b){return lh(a,b.head.line)},ug)},goLineRight:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div")},ug)},goLineLeft:function(a){a.extendSelectionsBy(function(b){var c=a.charCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:c},"div")},ug)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.Line truncated
break}c="*"==d}return["comment","comment"]}function r(a,b){return a.skipTo("-->")?(a.match("-->"),b.tokenize=null):a.skipToEnd(),["comment","comment"]}a.defineMode("css",function(b,c){function p(a,b){return n=b,a}function q(a,b){var c=a.next();if(e[c]){var d=e[c](a,b);if(d!==!1)return d}return"@"==c?(a.eatWhile(/[\w\\\-]/),p("def",a.current())):"="==c||("~"==c||"|"==c)&&a.eat("=")?p(null,"compare"):'"'==c||"'"==c?(b.tokenize=r(c),b.tokenize(a,b)):"#"==c?(a.eatWhile(/[\w\\\-]/),p("atom","hash")):"!"==c?(a.match(/^\s*\w*/),p("keyword","important")):/\d/.test(c)||"."==c&&a.eat(/\d/)?(a.eatWhile(/[\w.%]/),p("number","unit")):"-"!==c?/[,+>*\/]/.test(c)?p(null,"select-op"):"."==c&&a.match(/^-?[_a-z][_a-z0-9-]*/i)?p("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(c)?p(null,c):"u"==c&&a.match("rl(")?(a.backUp(1),b.tokenize=s,p("property","word")):/[\w\\\-]/.test(c)?(a.eatWhile(/[\w\\\-]/),p("property","word")):p(null,null):/[\d.]/.test(a.peek())?(a.eatWhile(/[\w.%]/),p("number","unit")):a.match(/^[^-]+-/)?p("meta","meta"):void 0}function r(a){return function(b,c){for(var e,d=!1;null!=(e=b.next());){if(e==a&&!d){")"==a&&b.backUp(1);break}d=!d&&"\\"==e}return(e==a||!d&&")"!=a)&&(c.tokenize=null),p("string","string")}}function s(a,b){return a.next(),b.tokenize=a.match(/\s*[\"\')]/,!1)?null:r(")"),p(null,"(")}function t(a,b,c){this.type=a,this.indent=b,this.prev=c}function u(a,b,c){return a.context=new t(c,b.indentation()+d,a.context),c}function v(a){return a.context=a.context.prev,a.context.type}function w(a,b,c){return z[c.context.type](a,b,c)}function x(a,b,c,d){for(var e=d||1;e>0;e--)c.context=c.context.prev;return w(a,b,c)}function y(a){var b=a.current().toLowerCase();o=k.hasOwnProperty(b)?"atom":j.hasOwnProperty(b)?"keyword":"variable"}c.propertyKeywords||(c=a.resolveMode("text/css"));var n,o,d=b.indentUnit,e=c.tokenHooks,f=c.mediaTypes||{},g=c.mediaFeatures||{},h=c.propertyKeywords||{},i=c.nonStandardPropertyKeywords||{},j=c.colorKeywords||{},k=c.valueKeywords||{},l=c.fontProperties||{},m=c.allowNested,z={};return z.top=function(a,b,c){if("{"==a)return u(c,b,"block");if("}"==a&&c.context.prev)return v(c);if("@media"==a)return u(c,b,"media");if("@font-face"==a)return"font_face_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(a))return"keyframes";if(a&&"@"==a.charAt(0))return u(c,b,"at");if("hash"==a)o="builtin";else if("word"==a)o="tag";else{if("variable-definition"==a)return"maybeprop";if("interpolation"==a)return u(c,b,"interpolation");if(":"==a)return"pseudo";if(m&&"("==a)return u(c,b,"params")}return c.context.type},z.block=function(a,b,c){if("word"==a){var d=b.current().toLowerCase();return h.hasOwnProperty(d)?(o="property","maybeprop"):i.hasOwnProperty(d)?(o="string-2","maybeprop"):m?(o=b.match(/^\s*:/,!1)?"property":"tag","block"):(o+=" error","maybeprop")}return"meta"==a?"block":m||"hash"!=a&&"qualifier"!=a?z.top(a,b,c):(o="error","block")},z.maybeprop=function(a,b,c){return":"==a?u(c,b,"prop"):w(a,b,c)},z.prop=function(a,b,c){if(";"==a)return v(c);if("{"==a&&m)return u(c,b,"propBlock");if("}"==a||"{"==a)return x(a,b,c);if("("==a)return u(c,b,"parens");if("hash"!=a||/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(b.current())){if("word"==a)y(b);else if("interpolation"==a)return u(c,b,"interpolation")}else o+=" error";return"prop"},z.propBlock=function(a,b,c){return"}"==a?v(c):"word"==a?(o="property","maybeprop"):c.context.type},z.parens=function(a,b,c){return"{"==a||"}"==a?x(a,b,c):")"==a?v(c):"parens"},z.pseudo=function(a,b,c){return"word"==a?(o="variable-3",c.context.type):w(a,b,c)},z.media=function(a,b,c){if("("==a)return u(c,b,"media_parens");if("}"==a)return x(a,b,c);if("{"==a)return v(c)&&u(c,b,m?"block":"top");if("word"==a){var d=b.current().toLowerCase();o="only"==d||"not"==d||"and"==d?"keyword":f.hasOwnProperty(d)?"attribute":g.hasOwnProperty(d)?"property":"error"}return c.context.type},z.media_parens=function(a,b,c){return")"==a?v(c):"{"==a||"}"==a?x(a,b,c,2):z.media(a,b,c)},z.font_face_before=function(a,b,c){return"{"==a?u(c,b,"font_face"):w(a,b,c)},z.font_face=function(a,b,c){return"}"==a?v(c):"word"==a?(o=l.hasOwnProperty(b.current().toLowerCase())?"property":"error","maybeprop"):"font_face"},z.keyframes=function(a,b,c){return"word"==a?(o="variable","keyframes"):"{"==a?u(c,b,"top"):w(a,b,c)},z.at=function(a,b,c){return";"==a?v(c):"{"==a||"}"==a?x(a,b,c):("word"==a?o="tag":"hash"==a&&(o="builtin"),"at")},z.interpolation=function(a,b,c){return"}"==a?v(c):"{"==a||";"==a?x(a,b,c):("variable"!=a&&(o="error"),"interpolation")},z.params=function(a,b,c){return")"==a?v(c):"{"==a||"}"==a?x(a,b,c):("word"==a&&y(b),"params")},{startState:function(a){return{tokenize:null,state:"top",context:new t("top",a||0,null)}},token:function(a,b){if(!b.tokenize&&a.eatSpace())return null;var c=(b.tokenize||q)(a,b);return c&&"object"==typeof c&&(n=c[1],c=c[0]),o=c,b.state=z[b.state](n,a,b),o},indent:function(a,b){var c=a.context,e=b&&b.charAt(0),f=c.indent;return"prop"==c.type&&"}"==e&&(c=c.prev),!c.prev||("}"!=e||"blockLine truncated
@@ -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 );
@@ -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 );