// source --> https://wxf2088.xyz/wp-content/plugins/urvanov-syntax-highlighter/js/min/urvanov_syntax_highlighter.min.js?ver=2.8.14 // To avoid duplicates conflicting var jQueryUrvanovSyntaxHighlighter = jQuery; (function ($) { UrvanovSyntaxHighlighterUtil = new function () { var base = this; var settings = null; base.init = function () { settings = UrvanovSyntaxHighlighterSyntaxSettings; base.initGET(); }; base.addPrefixToID = function (id) { return id.replace(/^([#.])?(.*)$/, '$1' + settings.prefix + '$2'); }; base.removePrefixFromID = function (id) { var re = new RegExp('^[#.]?' + settings.prefix, 'i'); return id.replace(re, ''); }; base.cssElem = function (id) { return $(base.addPrefixToID(id)); }; base.setDefault = function (v, d) { return (typeof v == 'undefined') ? d : v; }; base.setMax = function (v, max) { return v <= max ? v : max; }; base.setMin = function (v, min) { return v >= min ? v : min; }; base.setRange = function (v, min, max) { return base.setMax(base.setMin(v, min), max); }; base.getExt = function (str) { if (str.indexOf('.') == -1) { return undefined; } var ext = str.split('.'); if (ext.length) { ext = ext[ext.length - 1]; } else { ext = ''; } return ext; }; base.initGET = function () { // URLs window.currentURL = window.location.protocol + '//' + window.location.host + window.location.pathname; window.currentDir = window.currentURL.substring(0, window.currentURL.lastIndexOf('/')); // http://stackoverflow.com/questions/439463 function getQueryParams(qs) { qs = qs.split("+").join(" "); var params = {}, tokens, re = /[?&]?([^=]+)=([^&]*)/g; while (tokens = re.exec(qs)) { params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); } return params; } window.GET = getQueryParams(document.location.search); }; base.getAJAX = function (args, callback) { args.version = settings.version; $.get(settings.ajaxurl, args, callback); }; /** * @param {String} HTML representing any number of sibling elements * @return {NodeList} */ base.htmlToElements = function (html) { return $.parseHTML(html, document, true); } base.postAJAX = function (args, callback) { args.version = settings.version; $.post(settings.ajaxurl, args, callback); }; base.reload = function () { var get = '?'; for (var i in window.GET) { get += i + '=' + window.GET[i] + '&'; } window.location = window.currentURL + get; }; base.escape = function (string) { if (typeof encodeURIComponent == 'function') { return encodeURIComponent(string); } else if (typeof escape != 'function') { return escape(string); } else { return string; } }; base.log = function (string) { if (typeof console != 'undefined' && settings.debug) { console.log(string); } }; base.decode_html = function (str) { return String(str).replace(/</g, '<').replace( />/g, '>').replace(/&/g, '&'); }; base.encode_html = function (str) { return String(str).replace(/&/g, '&').replace(//g, '>'); }; /** * Returns either black or white to ensure this color is distinguishable with the given RGB hex. * This function can be used to create a readable foreground color given a background color, or vice versa. * It forms a radius around white where black is returned. Outside this radius, white is returned. * * @param hex An RGB hex (e.g. "#FFFFFF") * @requires jQuery and TinyColor * @param args The argument object. Properties: * amount: a value in the range [0,1]. If the distance of the given hex from white exceeds this value, * white is returned. Otherwise, black is returned. * xMulti: a multiplier to the distance in the x-axis. * yMulti: a multiplier to the distance in the y-axis. * normalizeHue: either falsey or an [x,y] array range. If hex is a colour with hue in this range, * then normalizeHueXMulti and normalizeHueYMulti are applied. * normalizeHueXMulti: a multiplier to the distance in the x-axis if hue is normalized. * normalizeHueYMulti: a multiplier to the distance in the y-axis if hue is normalized. * @return the RGB hex string of black or white. */ base.getReadableColor = function (hex, args) { args = $.extend({ amount: 0.5, xMulti: 1, // We want to achieve white a bit sooner in the y axis yMulti: 1.5, normalizeHue: [20, 180], // For colors that appear lighter (yellow, green, light blue) we reduce the distance in the x direction, // stretching the radius in the x axis allowing more black than before. normalizeHueXMulti: 1 / 2.5, normalizeHueYMulti: 1 }, args); var color = tinycolor(hex); var hsv = color.toHsv(); // Origin is white var coord = {x: hsv.s, y: 1 - hsv.v}; // Multipliers coord.x *= args.xMulti; coord.y *= args.yMulti; if (args.normalizeHue && hsv.h > args.normalizeHue[0] && hsv.h < args.normalizeHue[1]) { coord.x *= args.normalizeHueXMulti; coord.y *= args.normalizeHueYMulti; } var dist = Math.sqrt(Math.pow(coord.x, 2) + Math.pow(coord.y, 2)); if (dist < args.amount) { hsv.v = 0; // black } else { hsv.v = 1; // white } hsv.s = 0; return tinycolor(hsv).toHexString(); }; base.removeChars = function (chars, str) { var re = new RegExp('[' + chars + ']', 'gmi'); return str.replace(re, ''); } }; $(document).ready(function () { UrvanovSyntaxHighlighterUtil.init(); }); // http://stackoverflow.com/questions/2360655/jquery-event-handlers-always-execute-in-order-they-were-bound-any-way-around-t // [name] is the name of the event "click", "mouseover", .. // same as you'd pass it to bind() // [fn] is the handler function $.fn.bindFirst = function (name, fn) { // bind as you normally would // don't want to miss out on any jQuery magic this.bind(name, fn); // Thanks to a comment by @Martin, adding support for // namespaced events too. var handlers = this.data('events')[name.split('.')[0]]; // take out the handler we just inserted from the end var handler = handlers.pop(); // move it at the beginning handlers.splice(0, 0, handler); }; // http://stackoverflow.com/questions/4079274/how-to-get-an-objects-properties-in-javascript-jquery $.keys = function (obj) { var keys = []; for (var key in obj) { keys.push(key); } return keys; } // Prototype modifications RegExp.prototype.execAll = function (string) { var matches = []; var match = null; while ((match = this.exec(string)) != null) { var matchArray = []; for (var i in match) { if (parseInt(i) == i) { matchArray.push(match[i]); } } matches.push(matchArray); } return matches; }; // Escape regex chars with \ RegExp.prototype.escape = function (text) { return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); }; String.prototype.sliceReplace = function (start, end, repl) { return this.substring(0, start) + repl + this.substring(end); }; String.prototype.escape = function () { var tagsToReplace = { '&': '&', '<': '<', '>': '>' }; return this.replace(/[&<>]/g, function (tag) { return tagsToReplace[tag] || tag; }); }; String.prototype.linkify = function (target) { target = typeof target != 'undefined' ? target : ''; return this.replace(/(http(s)?:\/\/(\S)+)/gmi, '$1'); }; String.prototype.toTitleCase = function () { var parts = this.split(/\s+/); var title = ''; $.each(parts, function (i, part) { if (part != '') { title += part.slice(0, 1).toUpperCase() + part.slice(1, part.length); if (i != parts.length - 1 && parts[i + 1] != '') { title += ' '; } } }); return title; }; })(jQueryUrvanovSyntaxHighlighter); // Default Settings jqueryPopup = Object(); jqueryPopup.defaultSettings = { centerBrowser:0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left centerScreen:0, // center window over entire screen? {1 (YES) or 0 (NO)}. overrides top and left height:500, // sets the height in pixels of the window. left:0, // left position when the window appears. location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}. menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}. resizable:0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable. scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}. status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}. width:500, // sets the width in pixels of the window. windowName:null, // name of window set from the name attribute of the element that invokes the click windowURL:null, // url used for the popup top:0, // top position when the window appears. toolbar:0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}. data:null, event:'click' }; (function ($) { popupWindow = function (object, instanceSettings, beforeCallback, afterCallback) { beforeCallback = typeof beforeCallback !== 'undefined' ? beforeCallback : null; afterCallback = typeof afterCallback !== 'undefined' ? afterCallback : null; if (typeof object == 'string') { object = jQuery(object); } if (!(object instanceof jQuery)) { return false; } var settings = jQuery.extend({}, jqueryPopup.defaultSettings, instanceSettings || {}); object.handler = jQuery(object).bind(settings.event, function() { if (beforeCallback) { beforeCallback(); } var windowFeatures = 'height=' + settings.height + ',width=' + settings.width + ',toolbar=' + settings.toolbar + ',scrollbars=' + settings.scrollbars + ',status=' + settings.status + ',resizable=' + settings.resizable + ',location=' + settings.location + ',menuBar=' + settings.menubar; settings.windowName = settings.windowName || jQuery(this).attr('name'); var href = jQuery(this).attr('href'); if (!settings.windowURL && !(href == '#') && !(href == '')) { settings.windowURL = jQuery(this).attr('href'); } var centeredY,centeredX; var win = null; if (settings.centerBrowser) { if (typeof window.screenY == 'undefined') {// not defined for old IE versions centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120)/2) - (settings.height/2))); centeredX = window.screenLeft + ((((document.body.offsetWidth + 20)/2) - (settings.width/2))); } else { centeredY = window.screenY + (((window.outerHeight/2) - (settings.height/2))); centeredX = window.screenX + (((window.outerWidth/2) - (settings.width/2))); } win = window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY); } else if (settings.centerScreen) { centeredY = (screen.height - settings.height)/2; centeredX = (screen.width - settings.width)/2; win = window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY); } else { win = window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + settings.left +',top=' + settings.top); } if (win != null) { win.focus(); if (settings.data) { win.document.write(settings.data); } } if (afterCallback) { afterCallback(); } }); return settings; }; popdownWindow = function(object, event) { if (typeof event == 'undefined') { event = 'click'; } object = jQuery(object); if (!(object instanceof jQuery)) { return false; } object.unbind(event, object.handler); }; })(jQueryUrvanovSyntaxHighlighter); // Urvanov Syntax Highlighter JavaScript (function ($) { // BEGIN AUXILIARY FUNCTIONS $.fn.exists = function () { return this.length !== 0; }; $.fn.style = function (styleName, value, priority) { // DOM node var node = this.get(0); // Ensure we have a DOM node if (typeof node == 'undefined') { return; } // CSSStyleDeclaration var style = node.style; // Getter/Setter if (typeof styleName != 'undefined') { if (typeof value != 'undefined') { // Set style property priority = typeof priority != 'undefined' ? priority : ''; if (typeof style.setProperty != 'undefined') { style.setProperty(styleName, value, priority); } else { // XXX Using priority breaks on IE 7 & 8 // if (priority) { // value = value + ' !' + priority; // } style[styleName] = value; } } else { // Get style property return style[styleName]; } } else { // Get CSSStyleDeclaration return style; } }; // END AUXILIARY FUNCTIONS var PRESSED = 'crayon-pressed'; var UNPRESSED = ''; var URVANOV_SYNTAX_HIGHLIGHTER_SYNTAX = 'div.urvanov-syntax-highlighter-syntax'; var URVANOV_SYNTAX_HIGHLIGHTER_TOOLBAR = '.crayon-toolbar'; var URVANOV_SYNTAX_HIGHLIGHTER_INFO = '.crayon-info'; var URVANOV_SYNTAX_HIGHLIGHTER_PLAIN = '.urvanov-syntax-highlighter-plain'; var URVANOV_SYNTAX_HIGHLIGHTER_MAIN = '.urvanov-syntax-highlighter-main'; var URVANOV_SYNTAX_HIGHLIGHTER_TABLE = '.crayon-table'; var URVANOV_SYNTAX_HIGHLIGHTER_LOADING = '.urvanov-syntax-highlighter-loading'; var URVANOV_SYNTAX_HIGHLIGHTER_CODE = '.urvanov-syntax-highlighter-code'; var URVANOV_SYNTAX_HIGHLIGHTER_TITLE = '.crayon-title'; var URVANOV_SYNTAX_HIGHLIGHTER_TOOLS = '.crayon-tools'; var URVANOV_SYNTAX_HIGHLIGHTER_NUMS = '.crayon-nums'; var URVANOV_SYNTAX_HIGHLIGHTER_NUM = '.crayon-num'; var URVANOV_SYNTAX_HIGHLIGHTER_LINE = '.crayon-line'; var URVANOV_SYNTAX_HIGHLIGHTER_WRAPPED = 'urvanov-syntax-highlighter-wrapped'; var URVANOV_SYNTAX_HIGHLIGHTER_NUMS_CONTENT = '.urvanov-syntax-highlighter-nums-content'; var URVANOV_SYNTAX_HIGHLIGHTER_NUMS_BUTTON = '.urvanov-syntax-highlighter-nums-button'; var URVANOV_SYNTAX_HIGHLIGHTER_WRAP_BUTTON = '.urvanov-syntax-highlighter-wrap-button'; var URVANOV_SYNTAX_HIGHLIGHTER_EXPAND_BUTTON = '.urvanov-syntax-highlighter-expand-button'; var URVANOV_SYNTAX_HIGHLIGHTER_EXPANDED = 'urvanov-syntax-highlighter-expanded urvanov-syntax-highlighter-toolbar-visible'; var URVANOV_SYNTAX_HIGHLIGHTER_PLACEHOLDER = 'urvanov-syntax-highlighter-placeholder'; var URVANOV_SYNTAX_HIGHLIGHTER_POPUP_BUTTON = '.urvanov-syntax-highlighter-popup-button'; var URVANOV_SYNTAX_HIGHLIGHTER_COPY_BUTTON = '.urvanov-syntax-highlighter-copy-button'; var URVANOV_SYNTAX_HIGHLIGHTER_PLAIN_BUTTON = '.urvanov-syntax-highlighter-plain-button'; UrvanovSyntaxHighlighterSyntax = new function () { var base = this; var urvanov_syntax_highlighters = new Object(); var settings; var strings; var currUID = 0; var touchscreen; base.init = function () { if (typeof urvanov_syntax_highlighters == 'undefined') { urvanov_syntax_highlighters = new Object(); } settings = UrvanovSyntaxHighlighterSyntaxSettings; strings = UrvanovSyntaxHighlighterSyntaxStrings; $(URVANOV_SYNTAX_HIGHLIGHTER_SYNTAX).each(function () { base.process(this); }); }; base.process = function (c, replace) { c = $(c); var uid = c.attr('id'); if (uid == 'urvanov-syntax-highlighter-') { // No ID, generate one uid += getUID(); } c.attr('id', uid); UrvanovSyntaxHighlighterUtil.log(uid); if (typeof replace == 'undefined') { replace = false; } if (!replace && !makeUID(uid)) { // Already a UrvanovSyntaxHighlighter return; } var toolbar = c.find(URVANOV_SYNTAX_HIGHLIGHTER_TOOLBAR); var info = c.find(URVANOV_SYNTAX_HIGHLIGHTER_INFO); var plain = c.find(URVANOV_SYNTAX_HIGHLIGHTER_PLAIN); var main = c.find(URVANOV_SYNTAX_HIGHLIGHTER_MAIN); var table = c.find(URVANOV_SYNTAX_HIGHLIGHTER_TABLE); var code = c.find(URVANOV_SYNTAX_HIGHLIGHTER_CODE); var title = c.find(URVANOV_SYNTAX_HIGHLIGHTER_TITLE); var tools = c.find(URVANOV_SYNTAX_HIGHLIGHTER_TOOLS); var nums = c.find(URVANOV_SYNTAX_HIGHLIGHTER_NUMS); var numsContent = c.find(URVANOV_SYNTAX_HIGHLIGHTER_NUMS_CONTENT); var numsButton = c.find(URVANOV_SYNTAX_HIGHLIGHTER_NUMS_BUTTON); var wrapButton = c.find(URVANOV_SYNTAX_HIGHLIGHTER_WRAP_BUTTON); var expandButton = c.find(URVANOV_SYNTAX_HIGHLIGHTER_EXPAND_BUTTON); var popupButton = c.find(URVANOV_SYNTAX_HIGHLIGHTER_POPUP_BUTTON); var copyButton = c.find(URVANOV_SYNTAX_HIGHLIGHTER_COPY_BUTTON); var plainButton = c.find(URVANOV_SYNTAX_HIGHLIGHTER_PLAIN_BUTTON); urvanov_syntax_highlighters[uid] = c; urvanov_syntax_highlighters[uid].toolbar = toolbar; urvanov_syntax_highlighters[uid].plain = plain; urvanov_syntax_highlighters[uid].info = info; urvanov_syntax_highlighters[uid].main = main; urvanov_syntax_highlighters[uid].table = table; urvanov_syntax_highlighters[uid].code = code; urvanov_syntax_highlighters[uid].title = title; urvanov_syntax_highlighters[uid].tools = tools; urvanov_syntax_highlighters[uid].nums = nums; urvanov_syntax_highlighters[uid].nums_content = numsContent; urvanov_syntax_highlighters[uid].numsButton = numsButton; urvanov_syntax_highlighters[uid].wrapButton = wrapButton; urvanov_syntax_highlighters[uid].expandButton = expandButton; urvanov_syntax_highlighters[uid].popup_button = popupButton; urvanov_syntax_highlighters[uid].copy_button = copyButton; urvanov_syntax_highlighters[uid].plainButton = plainButton; urvanov_syntax_highlighters[uid].numsVisible = true; urvanov_syntax_highlighters[uid].wrapped = false; urvanov_syntax_highlighters[uid].plainVisible = false; urvanov_syntax_highlighters[uid].toolbar_delay = 0; urvanov_syntax_highlighters[uid].time = 1; // Set plain $(URVANOV_SYNTAX_HIGHLIGHTER_PLAIN).css('z-index', 0); // XXX Remember CSS dimensions var mainStyle = main.style(); urvanov_syntax_highlighters[uid].mainStyle = { 'height': mainStyle && mainStyle.height || '', 'max-height': mainStyle && mainStyle.maxHeight || '', 'min-height': mainStyle && mainStyle.minHeight || '', 'width': mainStyle && mainStyle.width || '', 'max-width': mainStyle && mainStyle.maxWidth || '', 'min-width': mainStyle && mainStyle.minWidth || '' }; urvanov_syntax_highlighters[uid].mainHeightAuto = urvanov_syntax_highlighters[uid].mainStyle.height == '' && urvanov_syntax_highlighters[uid].mainStyle['max-height'] == ''; var load_timer; var i = 0; urvanov_syntax_highlighters[uid].loading = true; urvanov_syntax_highlighters[uid].scrollBlockFix = false; // Register click events numsButton.click(function () { UrvanovSyntaxHighlighterSyntax.toggleNums(uid); }); wrapButton.click(function () { UrvanovSyntaxHighlighterSyntax.toggleWrap(uid); }); expandButton.click(function () { UrvanovSyntaxHighlighterSyntax.toggleExpand(uid); }); plainButton.click(function () { UrvanovSyntaxHighlighterSyntax.togglePlain(uid); }); copyButton.click(function () { UrvanovSyntaxHighlighterSyntax.copyPlain(uid); }); // Enable retina if supported retina(uid); var load_func = function () { // If nums hidden by default if (nums.filter('[data-settings~="hide"]').length != 0) { numsContent.ready(function () { UrvanovSyntaxHighlighterUtil.log('function' + uid); UrvanovSyntaxHighlighterSyntax.toggleNums(uid, true, true); }); } else { updateNumsButton(uid); } if (typeof urvanov_syntax_highlighters[uid].expanded == 'undefined') { // Determine if we should enable code expanding toggling if (Math.abs(urvanov_syntax_highlighters[uid].main.outerWidth() - urvanov_syntax_highlighters[uid].table.outerWidth()) < 10) { urvanov_syntax_highlighters[uid].expandButton.hide(); } else { urvanov_syntax_highlighters[uid].expandButton.show(); } } // TODO If width has changed or timeout, stop timer if (/*last_num_width != nums.outerWidth() ||*/ i == 5) { clearInterval(load_timer); //urvanov_syntax_highlighters[uid].removeClass(URVANOV_SYNTAX_HIGHLIGHTER_LOADING); urvanov_syntax_highlighters[uid].loading = false; } i++; }; load_timer = setInterval(load_func, 300); fixScrollBlank(uid); // Add ref to num for each line $(URVANOV_SYNTAX_HIGHLIGHTER_NUM, urvanov_syntax_highlighters[uid]).each(function () { var lineID = $(this).attr('data-line'); var line = $('#' + lineID); var height = line.style('height'); if (height) { line.attr('data-height', height); } }); // Used for toggling main.css('position', 'relative'); main.css('z-index', 1); // Disable certain features for touchscreen devices touchscreen = (c.filter('[data-settings~="touchscreen"]').length != 0); // Used to hide info if (!touchscreen) { main.click(function () { urvanovSyntaxHighlighterInfo(uid, '', false); }); plain.click(function () { urvanovSyntaxHighlighterInfo(uid, '', false); }); info.click(function () { urvanovSyntaxHighlighterInfo(uid, '', false); }); } // Used for code popup if (c.filter('[data-settings~="no-popup"]').length == 0) { urvanov_syntax_highlighters[uid].popup_settings = popupWindow(popupButton, { height: screen.height - 200, width: screen.width - 100, top: 75, left: 50, scrollbars: 1, windowURL: '', data: '' // Data overrides URL }, function () { codePopup(uid); }, function () { //UrvanovSyntaxHighlighterUtil.log('after'); }); } plain.css('opacity', 0); urvanov_syntax_highlighters[uid].toolbarVisible = true; urvanov_syntax_highlighters[uid].hasOneLine = table.outerHeight() < toolbar.outerHeight() * 2; urvanov_syntax_highlighters[uid].toolbarMouseover = false; // If a toolbar with mouseover was found if (toolbar.filter('[data-settings~="mouseover"]').length != 0 && !touchscreen) { urvanov_syntax_highlighters[uid].toolbarMouseover = true; urvanov_syntax_highlighters[uid].toolbarVisible = false; toolbar.css('margin-top', '-' + toolbar.outerHeight() + 'px'); toolbar.hide(); // Overlay the toolbar if needed, only if doing so will not hide the // whole code! if (toolbar.filter('[data-settings~="overlay"]').length != 0 && !urvanov_syntax_highlighters[uid].hasOneLine) { toolbar.css('position', 'absolute'); toolbar.css('z-index', 2); // Hide on single click when overlayed if (toolbar.filter('[data-settings~="hide"]').length != 0) { main.click(function () { toggleToolbar(uid, undefined, undefined, 0); }); plain.click(function () { toggleToolbar(uid, false, undefined, 0); }); } } else { toolbar.css('z-index', 4); } // Enable delay on mouseout if (toolbar.filter('[data-settings~="delay"]').length != 0) { urvanov_syntax_highlighters[uid].toolbar_delay = 500; } // Use .hover() for chrome, but in firefox mouseover/mouseout worked best c.mouseenter(function () { toggleToolbar(uid, true); }) .mouseleave(function () { toggleToolbar(uid, false); }); } else if (touchscreen) { toolbar.show(); } // Minimize if (c.filter('[data-settings~="minimize"]').length == 0) { base.minimize(uid); } // Plain show events if (plain.length != 0 && !touchscreen) { if (plain.filter('[data-settings~="dblclick"]').length != 0) { main.dblclick(function () { UrvanovSyntaxHighlighterSyntax.togglePlain(uid); }); } else if (plain.filter('[data-settings~="click"]').length != 0) { main.click(function () { UrvanovSyntaxHighlighterSyntax.togglePlain(uid); }); } else if (plain.filter('[data-settings~="mouseover"]').length != 0) { c.mouseenter(function () { UrvanovSyntaxHighlighterSyntax.togglePlain(uid, true); }) .mouseleave(function () { UrvanovSyntaxHighlighterSyntax.togglePlain(uid, false); }); numsButton.hide(); } if (plain.filter('[data-settings~="show-plain-default"]').length != 0) { // XXX UrvanovSyntaxHighlighterSyntax.togglePlain(uid, true); } } // Scrollbar show events var expand = c.filter('[data-settings~="expand"]').length != 0; // urvanov_syntax_highlighters[uid].mouse_expand = expand; if (!touchscreen && c.filter('[data-settings~="scroll-mouseover"]').length != 0) { // Disable on touchscreen devices and when set to mouseover main.css('overflow', 'hidden'); plain.css('overflow', 'hidden'); c.mouseenter(function () { toggle_scroll(uid, true, expand); }) .mouseleave(function () { toggle_scroll(uid, false, expand); }); } if (expand) { c.mouseenter(function () { toggleExpand(uid, true); }) .mouseleave(function () { toggleExpand(uid, false); }); } // Disable animations if (c.filter('[data-settings~="disable-anim"]').length != 0) { urvanov_syntax_highlighters[uid].time = 0; } // Wrap if (c.filter('[data-settings~="wrap"]').length != 0) { urvanov_syntax_highlighters[uid].wrapped = true; } // Determine if Mac urvanov_syntax_highlighters[uid].mac = c.hasClass('urvanov-syntax-highlighter-os-mac'); // Update clickable buttons updateNumsButton(uid); updatePlainButton(uid); updateWrap(uid); }; var makeUID = function (uid) { UrvanovSyntaxHighlighterUtil.log(urvanov_syntax_highlighters); if (typeof urvanov_syntax_highlighters[uid] == 'undefined') { urvanov_syntax_highlighters[uid] = $('#' + uid); UrvanovSyntaxHighlighterUtil.log('make ' + uid); return true; } UrvanovSyntaxHighlighterUtil.log('no make ' + uid); return false; }; var getUID = function () { return currUID++; }; var codePopup = function (uid) { if (typeof urvanov_syntax_highlighters[uid] == 'undefined') { return makeUID(uid); } var settings = urvanov_syntax_highlighters[uid].popup_settings; if (settings && settings.data) { // Already done return; } var clone = urvanov_syntax_highlighters[uid].clone(true); clone.removeClass('urvanov-syntax-highlighter-wrapped'); // Unwrap if (urvanov_syntax_highlighters[uid].wrapped) { $(URVANOV_SYNTAX_HIGHLIGHTER_NUM, clone).each(function () { var line_id = $(this).attr('data-line'); var line = $('#' + line_id); var height = line.attr('data-height'); height = height ? height : ''; if (typeof height != 'undefined') { line.css('height', height); $(this).css('height', height); } }); } clone.find(URVANOV_SYNTAX_HIGHLIGHTER_MAIN).css('height', ''); var code = ''; if (urvanov_syntax_highlighters[uid].plainVisible) { code = clone.find(URVANOV_SYNTAX_HIGHLIGHTER_PLAIN); } else { code = clone.find(URVANOV_SYNTAX_HIGHLIGHTER_MAIN); } settings.data = base.getAllCSS() + '