var javascript_version = "2.8.15"; var ignore_key = true; var start = 1; var end = 16; var active_tab = 1; var active_tab_0 = 0; var active_tab_0_general = 0; var tabs_to_configure = new Array(); var debug = false; var debug_title = false; var save_enabled = true; var current_tab = 0; var next_tab = 0; var syntax_highlighting = false; var settings_page = ""; var dateFormat = "yy-mm-dd"; var timeFormat = "H:i:s"; var list_search_reload = false; var website_list_search_reload = false; //var ai_ctrl_pressed = false; //var ai_editor_disabled = false; var AI_DISABLED = 0; var AI_BEFORE_POST = 1; var AI_AFTER_POST = 2; var AI_BEFORE_CONTENT = 3; var AI_AFTER_CONTENT = 4; var AI_BEFORE_PARAGRAPH = 5; var AI_AFTER_PARAGRAPH = 6; var AI_BEFORE_EXCERPT = 7; var AI_AFTER_EXCERPT = 8; var AI_BETWEEN_POSTS = 9; var AI_BEFORE_COMMENTS = 10; var AI_BETWEEN_COMMENTS = 11; var AI_AFTER_COMMENTS = 12; var AI_FOOTER = 13; var AI_ABOVE_HEADER = 14; var AI_BEFORE_HTML_ELEMENT = 15; var AI_AFTER_HTML_ELEMENT = 16; var AI_INSIDE_HTML_ELEMENT = 17; var AI_BEFORE_IMAGE = 18; var AI_AFTER_IMAGE = 19; var AI_ALIGNMENT_DEFAULT = 0; var AI_ALIGNMENT_LEFT = 1; var AI_ALIGNMENT_RIGHT = 2; var AI_ALIGNMENT_CENTER = 3; var AI_ALIGNMENT_FLOAT_LEFT = 4; var AI_ALIGNMENT_FLOAT_RIGHT = 5; var AI_ALIGNMENT_NO_WRAPPING = 6; var AI_ALIGNMENT_CUSTOM_CSS = 7; var AI_ALIGNMENT_STICKY_LEFT = 8; var AI_ALIGNMENT_STICKY_RIGHT = 9; var AI_ALIGNMENT_STICKY_TOP = 10; var AI_ALIGNMENT_STICKY_BOTTOM = 11; var AI_ALIGNMENT_STICKY = 12; var AI_ADB_ACTION_NONE = 0; var AI_ADB_ACTION_MESSAGE = 1; var AI_ADB_ACTION_REDIRECTION = 2; var AI_ADB_BLOCK_ACTION_DO_NOTHING = 0; var AI_ADB_BLOCK_ACTION_REPLACE = 1; var AI_ADB_BLOCK_ACTION_SHOW = 2; var AI_ADB_BLOCK_ACTION_HIDE = 3; var AI_CODE_UNKNOWN = 100; var AI_CODE_BANNER = 0; var AI_CODE_ADSENSE = 1; var AI_CODE_AMAZON = 2; var AI_ADSENSE_STANDARD = 0; var AI_ADSENSE_LINK = 1; var AI_ADSENSE_IN_ARTICLE = 2; var AI_ADSENSE_IN_FEED = 3; var AI_ADSENSE_MATCHED_CONTENT = 4; var AI_ADSENSE_SIZE_FIXED = 0; var AI_ADSENSE_SIZE_RESPONSIVE = 1; var AI_ADSENSE_SIZE_FIXED_BY_VIEWPORT = 2; var AI_HTML_INSERTION_CLIENT_SIDE = 0; //var AI_HTML_INSERTION_CLIENT_SIDE_DOM_READY = 1; var AI_HTML_INSERTION_SEREVR_SIDE = 2; var AI_STICK_TO_THE_LEFT = 0; var AI_STICK_TO_THE_CONTENT_LEFT = 1; var AI_STICK_HORIZONTAL_CENTER = 2; var AI_STICK_TO_THE_CONTENT_RIGHT = 3; var AI_STICK_TO_THE_RIGHT = 4; var AI_STICK_TO_THE_TOP = 0; var AI_STICK_VERTICAL_CENTER = 1; var AI_SCROLL_WITH_THE_CONTENT = 2; var AI_STICK_TO_THE_BOTTOM = 3; var AI_ANIMATION_NONE = 0; var AI_BACKGROUND_REPEAT_DEFAULT = 0; var AI_BACKGROUND_REPEAT_NO = 1; var AI_BACKGROUND_REPEAT_YES = 2; var AI_BACKGROUND_REPEAT_HORIZONTALY = 3; var AI_BACKGROUND_REPEAT_VERTICALLY = 4; var AI_BACKGROUND_REPEAT_SPACE = 5; var AI_BACKGROUND_REPEAT_ROUND = 6; var AI_BACKGROUND_SIZE_DEFAULT = 0; var AI_BACKGROUND_SIZE_COVER = 1; var AI_BACKGROUND_SIZE_CONTAIN = 2; var AI_BACKGROUND_SIZE_FILL = 3; var before_update_selection_from_list = null; /* * jQuery Tooltip plugin 1.3 * * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ * http://docs.jquery.com/Plugins/Tooltip * * Copyright (c) 2006 - 2008 Jörn Zaefferer * * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $ * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ (function($) { // the tooltip element var helper = {}, // the current tooltipped element current, // the title of the current element, used for restoring title, // timeout id for delayed tooltips tID, // IE 5.5 or 6 // IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent), IE = false, // flag for mouse tracking track = false; $.tooltip = { blocked: false, defaults: { delay: 200, fade: false, showURL: true, extraClass: "", top: 15, left: 15, id: "ai-tooltip" }, block: function() { $.tooltip.blocked = !$.tooltip.blocked; } }; $.fn.extend({ tooltip: function(settings) { settings = $.extend({}, $.tooltip.defaults, settings); createHelper(settings); return this.each(function() { $.data(this, "tooltip", settings); this.tOpacity = helper.parent.css("opacity"); // copy tooltip into its own expando and remove the title this.tooltipText = this.title; $(this).removeAttr("title"); // also remove alt attribute to prevent default tooltip in IE this.alt = ""; }) // .mouseover(save) .on ("mouseover", save) // .mouseout(hide) .on ("mouseout", hide) // .click(hide); .on ("click", hide); }, fixPNG: IE ? function() { return this.each(function() { var image = $(this).css('backgroundImage'); if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) { image = RegExp.$1; $(this).css({ 'backgroundImage': 'none', 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')" }).each(function() { var position = $(this).css('position'); if (position != 'absolute' && position != 'relative') $(this).css('position', 'relative'); }); } }); } : function() { return this; }, unfixPNG: IE ? function() { return this.each(function() { $(this).css({ 'filter': '', backgroundImage: '' }); }); } : function() { return this; }, hideWhenEmpty: function() { return this.each(function() { $(this)[$(this).html() ? "show" : "hide"](); }); }, url: function() { return this.attr('href') || this.attr('src'); } }); function createHelper(settings) { // there can be only one tooltip helper if (helper.parent) return; // create the helper, h3 for title, div for url helper.parent = $('

') // add to document .appendTo(document.body) // hide it at first .hide(); // apply bgiframe if available if ($.fn.bgiframe) helper.parent.bgiframe(); // save references to title and url elements helper.title = $('h3', helper.parent); helper.body = $('div.body', helper.parent); helper.url = $('div.url', helper.parent); } function settings(element) { return $.data(element, "tooltip"); } // main event handler to start showing tooltips function handle(event) { // show helper, either with timeout or on instant if (settings(this).delay) tID = setTimeout(show, settings(this).delay); else show(); // if selected, update the helper position when the mouse moves track = !!settings(this).track; // $(document.body).bind('mousemove', update); $(document.body).on ('mousemove', update); // update at least once update(event); } // save elements title before the tooltip is displayed function save() { // if this is the current source, or it has no title (occurs with click event), stop if ($.tooltip.blocked || this == current || (!this.tooltipText && !settings(this).bodyHandler)) return; // save current current = this; title = this.tooltipText; title = title.replace (/\[\[(.+?)\]\]/g, '$1'); title = title.replace (/\[BR\]/g, '
'); title = title.replace (/\[HR\]/g, '
'); title = title.replace (/(\[ADINSERTER.+\])/g, '$1'); title = title.replace (/(\%N)/g, '$1'); title = title.replace (/(\[\*\])/g, ''); title = title.replace (/(http[^ ]+)/g, '$1'); title = title.replace (/(pub-[0-9]+)/g, '$1'); if (settings(this).bodyHandler) { helper.title.hide(); var bodyContent = settings(this).bodyHandler.call(this); if (bodyContent.nodeType || bodyContent.jquery) { helper.body.empty().append(bodyContent) } else { helper.body.html(bodyContent); } helper.body.show(); } else if (settings(this).showBody) { var parts = title.split(settings(this).showBody); if (parts.length == 2) { helper.title.html(parts.shift()).show(); } else { helper.title.hide(); } helper.body.empty(); for (var i = 0, part; (part = parts[i]); i++) { if (i > 0) helper.body.append("
"); helper.body.append(part); } helper.body.hideWhenEmpty(); } else { helper.title.html(title).show(); helper.body.hide(); } // if element has href or src, add and show it, otherwise hide it if (settings(this).showURL && $(this).url()) helper.url.html($(this).url().replace('http://', '')).show(); else helper.url.hide(); // add an optional class for this tip helper.parent.addClass(settings(this).extraClass); // fix PNG background for IE if (settings(this).fixPNG) helper.parent.fixPNG(); handle.apply(this, arguments); } // delete timeout and show helper function show() { tID = null; if ((!IE || !$.fn.bgiframe) && settings(current).fade) { if (helper.parent.is(":animated")) helper.parent.stop().show().fadeTo(settings(current).fade, current.tOpacity); else helper.parent.is(':visible') ? helper.parent.fadeTo(settings(current).fade, current.tOpacity) : helper.parent.fadeIn(settings(current).fade); } else { helper.parent.show(); } update(); } /** * callback for mousemove * updates the helper position * removes itself when no current element */ function update(event) { if ($.tooltip.blocked) return; if (event && event.target.tagName == "OPTION") { return; } // stop updating when tracking is disabled and the tooltip is visible if (!track && helper.parent.is(":visible")) { // $(document.body).unbind('mousemove', update) $(document.body).off ('mousemove', update) } // if no current element is available, remove this listener if (current == null) { // $(document.body).unbind('mousemove', update); $(document.body).off ('mousemove', update); return; } // remove position helper classes helper.parent.removeClass("viewport-right").removeClass("viewport-bottom"); var left = helper.parent[0].offsetLeft; var top = helper.parent[0].offsetTop; if (event) { // position the helper 15 pixel to bottom right, starting from mouse position left = event.pageX + settings(current).left; top = event.pageY + settings(current).top; var right = 'auto'; if (settings(current).positionLeft) { right = $(window).width() - left; left = 'auto'; } helper.parent.css({ left: left, right: right, top: top }); } var v = viewport(), h = helper.parent[0]; // check horizontal position if (v.x + v.cx < h.offsetLeft + h.offsetWidth) { left -= h.offsetWidth + 20 + settings(current).left; helper.parent.css({ left: left + 'px' }).addClass("viewport-right"); } // check vertical position if (v.y + v.cy < h.offsetTop + h.offsetHeight) { top -= h.offsetHeight + 20 + settings(current).top; helper.parent.css({ top: top + 'px' }).addClass("viewport-bottom"); } } function viewport() { return { x: $(window).scrollLeft(), y: $(window).scrollTop(), cx: $(window).width(), cy: $(window).height() }; } // hide helper and restore added classes and the title function hide(event) { if ($.tooltip.blocked) return; // clear timeout if possible if (tID) clearTimeout(tID); // no more current element current = null; var tsettings = settings(this); function complete() { helper.parent.removeClass(tsettings.extraClass).hide().css("opacity", ""); } if ((!IE || !$.fn.bgiframe) && tsettings.fade) { if (helper.parent.is(':animated')) helper.parent.stop().fadeTo(tsettings.fade, 0, complete); else helper.parent.stop().fadeOut(tsettings.fade, complete); } else complete(); if (settings(this).fixPNG) helper.parent.unfixPNG(); } })(jQuery); function b64e (str) { // first we use encodeURIComponent to get percent-encoded UTF-8, // then we convert the percent encodings into raw bytes which // can be fed into btoa. return btoa (encodeURIComponent (str).replace (/%([0-9A-F]{2})/g, function toSolidBytes (match, p1) { return String.fromCharCode ('0x' + p1); })); } function b64d (str) { // Going backwards: from bytestream, to percent-encoding, to original string. return decodeURIComponent (atob (str).split ('').map (function(c) { return '%' + ('00' + c.charCodeAt (0).toString (16)).slice (-2); }).join ('')); } // http://www.myersdaily.org/joseph/javascript/md5.js function md5cycle (x, k) { var a = x[0], b = x[1], c = x[2], d = x[3]; a = ff(a, b, c, d, k[0], 7, -680876936); d = ff(d, a, b, c, k[1], 12, -389564586); c = ff(c, d, a, b, k[2], 17, 606105819); b = ff(b, c, d, a, k[3], 22, -1044525330); a = ff(a, b, c, d, k[4], 7, -176418897); d = ff(d, a, b, c, k[5], 12, 1200080426); c = ff(c, d, a, b, k[6], 17, -1473231341); b = ff(b, c, d, a, k[7], 22, -45705983); a = ff(a, b, c, d, k[8], 7, 1770035416); d = ff(d, a, b, c, k[9], 12, -1958414417); c = ff(c, d, a, b, k[10], 17, -42063); b = ff(b, c, d, a, k[11], 22, -1990404162); a = ff(a, b, c, d, k[12], 7, 1804603682); d = ff(d, a, b, c, k[13], 12, -40341101); c = ff(c, d, a, b, k[14], 17, -1502002290); b = ff(b, c, d, a, k[15], 22, 1236535329); a = gg(a, b, c, d, k[1], 5, -165796510); d = gg(d, a, b, c, k[6], 9, -1069501632); c = gg(c, d, a, b, k[11], 14, 643717713); b = gg(b, c, d, a, k[0], 20, -373897302); a = gg(a, b, c, d, k[5], 5, -701558691); d = gg(d, a, b, c, k[10], 9, 38016083); c = gg(c, d, a, b, k[15], 14, -660478335); b = gg(b, c, d, a, k[4], 20, -405537848); a = gg(a, b, c, d, k[9], 5, 568446438); d = gg(d, a, b, c, k[14], 9, -1019803690); c = gg(c, d, a, b, k[3], 14, -187363961); b = gg(b, c, d, a, k[8], 20, 1163531501); a = gg(a, b, c, d, k[13], 5, -1444681467); d = gg(d, a, b, c, k[2], 9, -51403784); c = gg(c, d, a, b, k[7], 14, 1735328473); b = gg(b, c, d, a, k[12], 20, -1926607734); a = hh(a, b, c, d, k[5], 4, -378558); d = hh(d, a, b, c, k[8], 11, -2022574463); c = hh(c, d, a, b, k[11], 16, 1839030562); b = hh(b, c, d, a, k[14], 23, -35309556); a = hh(a, b, c, d, k[1], 4, -1530992060); d = hh(d, a, b, c, k[4], 11, 1272893353); c = hh(c, d, a, b, k[7], 16, -155497632); b = hh(b, c, d, a, k[10], 23, -1094730640); a = hh(a, b, c, d, k[13], 4, 681279174); d = hh(d, a, b, c, k[0], 11, -358537222); c = hh(c, d, a, b, k[3], 16, -722521979); b = hh(b, c, d, a, k[6], 23, 76029189); a = hh(a, b, c, d, k[9], 4, -640364487); d = hh(d, a, b, c, k[12], 11, -421815835); c = hh(c, d, a, b, k[15], 16, 530742520); b = hh(b, c, d, a, k[2], 23, -995338651); a = ii(a, b, c, d, k[0], 6, -198630844); d = ii(d, a, b, c, k[7], 10, 1126891415); c = ii(c, d, a, b, k[14], 15, -1416354905); b = ii(b, c, d, a, k[5], 21, -57434055); a = ii(a, b, c, d, k[12], 6, 1700485571); d = ii(d, a, b, c, k[3], 10, -1894986606); c = ii(c, d, a, b, k[10], 15, -1051523); b = ii(b, c, d, a, k[1], 21, -2054922799); a = ii(a, b, c, d, k[8], 6, 1873313359); d = ii(d, a, b, c, k[15], 10, -30611744); c = ii(c, d, a, b, k[6], 15, -1560198380); b = ii(b, c, d, a, k[13], 21, 1309151649); a = ii(a, b, c, d, k[4], 6, -145523070); d = ii(d, a, b, c, k[11], 10, -1120210379); c = ii(c, d, a, b, k[2], 15, 718787259); b = ii(b, c, d, a, k[9], 21, -343485551); x[0] = add32(a, x[0]); x[1] = add32(b, x[1]); x[2] = add32(c, x[2]); x[3] = add32(d, x[3]); } function cmn(q, a, b, x, s, t) { a = add32(add32(a, q), add32(x, t)); return add32((a << s) | (a >>> (32 - s)), b); } function ff(a, b, c, d, x, s, t) { return cmn((b & c) | ((~b) & d), a, b, x, s, t); } function gg(a, b, c, d, x, s, t) { return cmn((b & d) | (c & (~d)), a, b, x, s, t); } function hh(a, b, c, d, x, s, t) { return cmn(b ^ c ^ d, a, b, x, s, t); } function ii(a, b, c, d, x, s, t) { return cmn(c ^ (b | (~d)), a, b, x, s, t); } function md51(s) { txt = ''; var n = s.length, state = [1732584193, -271733879, -1732584194, 271733878], i; for (i = 64; i <= s.length; i += 64) { md5cycle(state, md5blk(s.substring(i - 64, i))); } s = s.substring(i - 64); var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; for (i = 0; i < s.length; i++) tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3); tail[i >> 2] |= 0x80 << ((i % 4) << 3); if (i > 55) { md5cycle(state, tail); for (i = 0; i < 16; i++) tail[i] = 0; } tail[14] = n * 8; md5cycle(state, tail); return state; } /* there needs to be support for Unicode here, * unless we pretend that we can redefine the MD-5 * algorithm for multi-byte characters (perhaps * by adding every four 16-bit characters and * shortening the sum to 32 bits). Otherwise * I suggest performing MD-5 as if every character * was two bytes--e.g., 0040 0025 = @%--but then * how will an ordinary MD-5 sum be matched? * There is no way to standardize text to something * like UTF-8 before transformation; speed cost is * utterly prohibitive. The JavaScript standard * itself needs to look at this: it should start * providing access to strings as preformed UTF-8 * 8-bit unsigned value arrays. */ function md5blk(s) { /* I figured global was faster. */ var md5blks = [], i; /* Andy King said do it this way. */ for (i = 0; i < 64; i += 4) { md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); } return md5blks; } var hex_chr = '0123456789abcdef'.split(''); function rhex(n) { var s = '', j = 0; for (; j < 4; j++) s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F]; return s; } function hex(x) { for (var i = 0; i < x.length; i++) x[i] = rhex(x[i]); return x.join(''); } function md5(s) { return hex(md51(s)); } /* this function is much faster, so if possible we use it. Some IEs are the only ones I know of that need the idiotic second function, generated by an if clause. */ function add32(a, b) { return (a + b) & 0xFFFFFFFF; } if (md5('hello') != '5d41402abc4b2a76b9719d911017c592') { function add32(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF), msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } } String.prototype.tabIndex = function () { return this.replace (/^\D+/g, '') }; String.prototype.replaceAll = function(search, replacement) { var target = this; return target.split(search).join(replacement); }; var ai_nonce = b64d (jQuery ("#ai-form").attr ('ai-value')); var ai_settings = b64d (jQuery ("#ai-form").attr ('ai-settings')); var ai_read_only = jQuery ("#ai-form").hasClass ('ai-read-only'); var shSettings = { "tab_size":"4", "use_soft_tabs":"1", "word_wrap":"1", "highlight_curr_line":"0", "key_bindings":"default", "full_line_selection":"1", "show_line_numbers":"0"}; function encode_code (block) { // copy code back to textarea and encode block code if (!save_enabled) return false; var textarea = jQuery ('#block-' + block); var textarea_name = textarea.attr ('name'); if (typeof textarea_name !== typeof undefined && textarea_name !== false) { var editor_element = jQuery ("#editor-" + block); // Copy code from editor only if it exists (tab has been configured) if (editor_element.length != 0 && typeof editor_element !== typeof undefined && editor_element !== false) { var editor = ace.edit ("editor-" + block); var session = editor.getSession(); var editor_disabled = true; if (typeof ace != 'undefined') { editor_disabled = jQuery("#simple-editor-" + block).is(":checked"); } if (!editor_disabled) { textarea.val (session.getValue()); } } var default_value = textarea.attr ("default"); var current_value = textarea.val (); var name = textarea.attr ("name"); if (typeof name != 'undefined') { if (typeof default_value != 'undefined') { // console.log (textarea.attr ("name"), ": default_value: ", default_value, ", current_value: ", current_value); if (current_value == default_value) { textarea.removeAttr ("name"); // console.log ("REMOVED: ", name); } } // else console.log ("NO DEFAULT VALUE: ", textarea.attr ("name")); } var copy_id = textarea.attr ('id') + '-copy'; jQuery ('#' + copy_id).remove (); var org_name = textarea.attr ('org-name'); if (typeof org_name !== typeof undefined && org_name !== false) { textarea.attr ("name", org_name); } else textarea.attr ("org-name", textarea_name); var textarea_copy = textarea.clone ().attr ('id', copy_id).hide (); textarea.removeAttr ("name"); textarea_copy.val (':AI:' + b64e (textarea.val ())); textarea.after (textarea_copy); // console.log (':AI:', block); } jQuery("#ai-active-tab").attr ("value", '[' + active_tab + ',' + active_tab_0 + ',' + active_tab_0_general + ']'); var named_parameters = jQuery("#tab-" + block + ' [name]'); var block_parameters = new Array(); named_parameters.each (function() { block_parameters.push (jQuery (this).attr ('name')); }); jQuery("#block-parameters-" + block).attr ('name', 'block-parameters-' + block).attr ('value', b64e (JSON.stringify (block_parameters))); }; function SyntaxHighlight (id, block, settings) { var textarea, editor, form, session, editDiv; settings ['tab_size'] = 2; this.textarea = textarea = jQuery(id); this.settings = settings || {}; if (textarea.length === 0 ) { // Element does not exist this.valid = false; return; } this.valid = true; editDiv = jQuery('
', { position: 'absolute', 'class': textarea.attr('class'), 'id': 'editor-' + block }).insertBefore (textarea); textarea.css('display', 'none'); this.editor = editor = ace.edit(editDiv[0]); this.form = form = textarea.closest('form'); this.session = session = editor.getSession(); editor.$blockScrolling = Infinity; session.setValue(textarea.val()); session.setMode ("ace/mode/ai-html"); this.applySettings(); } SyntaxHighlight.prototype.applySettings = function () { var editor = this.editor, session = this.session, settings = this.settings; editor.renderer.setShowGutter(settings['show_line_numbers'] == 1); editor.setHighlightActiveLine(settings['highlight_curr_line'] == 1); editor.setSelectionStyle(settings['full_line_selection'] == 1 ? "line" : "text"); editor.setTheme("ace/theme/" + settings['theme']); session.setUseWrapMode(settings['word_wrap'] == 1); session.setTabSize(settings['tab_size']); session.setUseSoftTabs(settings['use_soft_tabs'] == 1); }; function is_sticky (custom_css) { custom_css = custom_css.replace (/\s+/g, ''); if (custom_css.indexOf ("position:fixed") != - 1 && custom_css.indexOf ("z-index:") != - 1) return true; return false; } function is_background (custom_css) { custom_css = custom_css.replace (/\s+/g, ''); if (custom_css.indexOf ("top:0px;left:0px;width:100%;height:100%;") != - 1) return true; return false; } function change_block_alignment (block) { // jQuery ("select#block-alignment-" + block).change (); jQuery ("select#block-alignment-" + block).trigger ("change"); // jQuery ("select#horizontal-position-" + block).change (); jQuery ("select#horizontal-position-" + block).trigger ("change"); // jQuery ("select#vertical-position-" + block).change (); jQuery ("select#vertical-position-" + block).trigger ("change"); // jQuery ("input#background-" + block).change (); jQuery ("input#background-" + block).trigger ("change"); // jQuery ("input#bkg-color-" + block).colorpicker ('setValue', jQuery ("input#bkg-color-" + block).attr ('value')); jQuery ("input#bkg-color-" + block).colorpicker ('setValue', jQuery ("input#bkg-color-" + block).val ()); // jQuery ("select#bkg-repeat-" + block).change (); jQuery ("select#bkg-repeat-" + block).trigger ("change"); // jQuery ("select#bkg-size-" + block).change (); jQuery ("select#bkg-size-" + block).trigger ("change"); } function change_banner_image (block) { jQuery ("input#banner-image-url-" + block).trigger ("input"); } function ai_css_value_px (css, property) { var found = false; styles = css.split (';'); styles.forEach (function (style, index) { style = style.trim (); if (style.indexOf (property) == 0) { style_parts = style.split (':'); if (style_parts.length == 2) { style_property = style_parts [0].trim (); style_value = style_parts [1].trim (); if (style_property == property && style_value.endsWith ('px')) found = true; } } }); return found; } function ai_change_css (css, property, value) { var replaced = false; styles = css.split (';'); styles.forEach (function (style, index) { org_style = style; style = style.trim (); if (style.indexOf (property) == 0) { style_parts = style.split (':'); if (style_parts.length == 2) { style_property = style_parts [0].trim (); style_value = style_parts [1].trim (); if (style_property == property && style_value.endsWith ('px')) { var org_style_parts = org_style.split (':'); styles [index] = org_style_parts [0] + ': ' + value + 'px'; replaced = true; } } } }); var new_style = styles.join (';'); if (!replaced) { new_style = new_style.trim (); if (new_style.length != 0 && new_style.slice (-1) == ';') new_style = new_style.substring (0, new_style.length - 1); return new_style + '; ' + property + ': ' + value + ';'; } return new_style; } function update_sticky_margins (style, horizontal_margin, vertical_margin) { if (vertical_margin !== '') { if (ai_css_value_px (style, 'top')) style = ai_change_css (style, 'top', vertical_margin); else if (ai_css_value_px (style, 'bottom')) style = ai_change_css (style, 'bottom', vertical_margin); } if (horizontal_margin !== '') { if (ai_css_value_px (style, 'left')) style = ai_change_css (style, 'left', horizontal_margin); else if (ai_css_value_px (style, 'right')) style = ai_change_css (style, 'right', horizontal_margin); else if (ai_css_value_px (style, 'margin-left')) style = ai_change_css (style, 'margin-left', horizontal_margin); else if (ai_css_value_px (style, 'margin-right')) style = ai_change_css (style, 'margin-right', horizontal_margin); } return style; } (function ($) { $.widget("toggle.checkboxButton", { _create : function() { this._on(this.element, { "change" : function(event) { this.element.next ("label").find ('.checkbox-icon').toggleClass("on"); } }); } }); }(jQuery)); serialize_object = function (obj) { var str = []; for(var p in obj) if (obj.hasOwnProperty (p)) { str.push(encodeURIComponent (p) + "=" + encodeURIComponent (obj[p])); } return str.join ("&"); } Number.isInteger = Number.isInteger || function (value) { return typeof value === "number" && isFinite (value) && Math.floor (value) === value; }; function get_editor_text (block) { var editor_disabled = true; var editor_element = jQuery ("#editor-" + block); if (typeof ace != 'undefined' && editor_element.length != 0 && typeof editor_element !== typeof undefined && editor_element !== false) { var editor = ace.edit ("editor-" + block); editor_disabled = jQuery("#simple-editor-" + block).is(":checked"); } if (!editor_disabled) return editor.getSession ().getValue(); return jQuery ("#block-" + block).val (); } function set_editor_text (block, text) { var editor_disabled = true; var editor_element = jQuery ("#editor-" + block); if (typeof ace != 'undefined' && editor_element.length != 0 && typeof editor_element !== typeof undefined && editor_element !== false) { var editor = ace.edit ("editor-" + block); editor_disabled = jQuery("#simple-editor-" + block).is(":checked"); } if (!editor_disabled) editor.getSession ().setValue(text); else jQuery ("#block-" + block).val (text); } function open_popup_window_post (url, windowoption, name, params) { var form = document.createElement("form"); form.setAttribute("method", "post"); form.setAttribute("action", url); form.setAttribute("target", name); for (var i in params) { if (params.hasOwnProperty(i)) { var input = document.createElement('input'); input.type = 'hidden'; input.name = i; input.value = encodeURI (params[i]); form.appendChild(input); } } document.body.appendChild(form); //note I am using a post.htm page since I did not want to make double request to the page //it might have some Page_Load call which might screw things up. // window.open ("post.htm", name, windowoption); window.open ("admin-ajax.php", name, windowoption); form.submit(); document.body.removeChild(form); } function open_window_post (url, name, params) { var form = document.createElement("form"); form.setAttribute("method", "post"); form.setAttribute("action", url); form.setAttribute("target", name); for (var i in params) { if (params.hasOwnProperty(i)) { var input = document.createElement('input'); input.type = 'hidden'; input.name = i; input.value = encodeURI (params[i]); form.appendChild(input); } } document.body.appendChild(form); form.submit(); document.body.removeChild(form); } function check_managing_slave () { if (jQuery(".ai-managing.ai-managing-slave").length) { jQuery.get (ajaxurl + '?action=ai_ajax_backend&managed=&ai_check=' + ai_nonce, function (data) { if (data != '') { setTimeout (function () { check_managing_slave (); }, 30 * 1000); } else jQuery(".ai-managing.ai-managing-slave").hide (); }); } } function aiCopyToClipboard (text) { // Modern API if (navigator.clipboard && window.isSecureContext) { return navigator.clipboard.writeText (text); } // Fallback return new Promise ((resolve, reject) => { const $temp = $("