vendor/assets/javascripts/redactor.js in biola_wcms_components-0.15.3 vs vendor/assets/javascripts/redactor.js in biola_wcms_components-0.16.0
- old
+ new
@@ -1,8768 +1,12 @@
/*
- Redactor v10.1.1
- Updated: April 28, 2015
+ Redactor 10.2.3
+ Updated: August 15, 2015
http://imperavi.com/redactor/
Copyright (c) 2009-2015, Imperavi LLC.
License: http://imperavi.com/redactor/license/
Usage: $('#content').redactor();
*/
-
-(function($)
-{
- 'use strict';
-
- if (!Function.prototype.bind)
- {
- Function.prototype.bind = function(scope)
- {
- var fn = this;
- return function()
- {
- return fn.apply(scope);
- };
- };
- }
-
- var uuid = 0;
-
- // Plugin
- $.fn.redactor = function(options)
- {
- var val = [];
- var args = Array.prototype.slice.call(arguments, 1);
-
- if (typeof options === 'string')
- {
- this.each(function()
- {
- var instance = $.data(this, 'redactor');
- var func;
-
- if (options.search(/\./) != '-1')
- {
- func = options.split('.');
- if (typeof instance[func[0]] != 'undefined')
- {
- func = instance[func[0]][func[1]];
- }
- }
- else
- {
- func = instance[options];
- }
-
- if (typeof instance !== 'undefined' && $.isFunction(func))
- {
- var methodVal = func.apply(instance, args);
- if (methodVal !== undefined && methodVal !== instance)
- {
- val.push(methodVal);
- }
- }
- else
- {
- $.error('No such method "' + options + '" for Redactor');
- }
- });
- }
- else
- {
- this.each(function()
- {
- $.data(this, 'redactor', {});
- $.data(this, 'redactor', Redactor(this, options));
- });
- }
-
- if (val.length === 0) return this;
- else if (val.length === 1) return val[0];
- else return val;
-
- };
-
- // Initialization
- function Redactor(el, options)
- {
- return new Redactor.prototype.init(el, options);
- }
-
- // Functionality
- $.Redactor = Redactor;
- $.Redactor.VERSION = '10.1.1';
- $.Redactor.modules = ['alignment', 'autosave', 'block', 'buffer', 'build', 'button',
- 'caret', 'clean', 'code', 'core', 'dropdown', 'file', 'focus',
- 'image', 'indent', 'inline', 'insert', 'keydown', 'keyup',
- 'lang', 'line', 'link', 'list', 'modal', 'observe', 'paragraphize',
- 'paste', 'placeholder', 'progress', 'selection', 'shortcuts',
- 'tabifier', 'tidy', 'toolbar', 'upload', 'utils', 'linkify'];
-
- $.Redactor.opts = {
-
- // settings
- lang: 'en',
- direction: 'ltr', // ltr or rtl
-
- plugins: false, // array
-
- focus: false,
- focusEnd: false,
-
- placeholder: false,
-
- visual: true,
- tabindex: false,
-
- minHeight: false,
- maxHeight: false,
-
- linebreaks: false,
- replaceDivs: true,
- paragraphize: true,
- cleanStyleOnEnter: false,
- enterKey: true,
-
- cleanOnPaste: true,
- cleanSpaces: true,
- pastePlainText: false,
-
- autosave: false, // false or url
- autosaveName: false,
- autosaveInterval: 60, // seconds
- autosaveOnChange: false,
- autosaveFields: false,
-
- linkTooltip: true,
- linkProtocol: 'http',
- linkNofollow: false,
- linkSize: 50,
-
- imageEditable: true,
- imageLink: true,
- imagePosition: true,
- imageFloatMargin: '10px',
- imageResizable: true,
-
- imageUpload: null,
- imageUploadParam: 'file',
-
- uploadImageField: false,
-
- dragImageUpload: true,
-
- fileUpload: null,
- fileUploadParam: 'file',
-
- dragFileUpload: true,
-
- s3: false,
-
- convertLinks: true,
- convertUrlLinks: true,
- convertImageLinks: true,
- convertVideoLinks: true,
-
- preSpaces: 4, // or false
- tabAsSpaces: false, // true or number of spaces
- tabKey: true,
-
- scrollTarget: false,
-
- toolbar: true,
- toolbarFixed: true,
- toolbarFixedTarget: document,
- toolbarFixedTopOffset: 0, // pixels
- toolbarExternal: false, // ID selector
- toolbarOverflow: false,
-
- source: true,
- buttons: ['html', 'formatting', 'bold', 'italic', 'deleted', 'unorderedlist', 'orderedlist',
- 'outdent', 'indent', 'image', 'file', 'link', 'alignment', 'horizontalrule'], // + 'underline'
-
- buttonsHide: [],
- buttonsHideOnMobile: [],
-
- formatting: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
- formattingAdd: false,
-
- tabifier: true,
-
- deniedTags: ['script', 'style'],
- allowedTags: false, // or array
-
- paragraphizeBlocks: ['table', 'div', 'pre', 'form', 'ul', 'ol', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'dl', 'blockquote', 'figcaption',
- 'address', 'section', 'header', 'footer', 'aside', 'article', 'object', 'style', 'script', 'iframe', 'select', 'input', 'textarea',
- 'button', 'option', 'map', 'area', 'math', 'hr', 'fieldset', 'legend', 'hgroup', 'nav', 'figure', 'details', 'menu', 'summary', 'p'],
-
- removeComments: false,
- replaceTags: [
- ['strike', 'del']
- ],
- replaceStyles: [
- ['font-weight:\\s?bold', "strong"],
- ['font-style:\\s?italic', "em"],
- ['text-decoration:\\s?underline', "u"],
- ['text-decoration:\\s?line-through', 'del']
- ],
- removeDataAttr: false,
-
- removeAttr: false, // or multi array
- allowedAttr: false, // or multi array
-
- removeWithoutAttr: ['span'], // or false
- removeEmpty: ['p'], // or false;
-
- activeButtons: ['deleted', 'italic', 'bold', 'underline', 'unorderedlist', 'orderedlist',
- 'alignleft', 'aligncenter', 'alignright', 'justify'],
- activeButtonsStates: {
- b: 'bold',
- strong: 'bold',
- i: 'italic',
- em: 'italic',
- del: 'deleted',
- strike: 'deleted',
- ul: 'unorderedlist',
- ol: 'orderedlist',
- u: 'underline'
- },
-
- shortcuts: {
- 'ctrl+shift+m, meta+shift+m': { func: 'inline.removeFormat' },
- 'ctrl+b, meta+b': { func: 'inline.format', params: ['bold'] },
- 'ctrl+i, meta+i': { func: 'inline.format', params: ['italic'] },
- 'ctrl+h, meta+h': { func: 'inline.format', params: ['superscript'] },
- 'ctrl+l, meta+l': { func: 'inline.format', params: ['subscript'] },
- 'ctrl+k, meta+k': { func: 'link.show' },
- 'ctrl+shift+7': { func: 'list.toggle', params: ['orderedlist'] },
- 'ctrl+shift+8': { func: 'list.toggle', params: ['unorderedlist'] }
- },
- shortcutsAdd: false,
-
- // private
- buffer: [],
- rebuffer: [],
- emptyHtml: '<p>​</p>',
- invisibleSpace: '​',
- imageTypes: ['image/png', 'image/jpeg', 'image/gif'],
- indentValue: 20,
- verifiedTags: ['a', 'img', 'b', 'strong', 'sub', 'sup', 'i', 'em', 'u', 'small', 'strike', 'del', 'cite', 'ul', 'ol', 'li'], // and for span tag special rule
- inlineTags: ['strong', 'b', 'u', 'em', 'i', 'code', 'del', 'ins', 'samp', 'kbd', 'sup', 'sub', 'mark', 'var', 'cite', 'small'],
- alignmentTags: ['P', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'DL', 'DT', 'DD', 'DIV', 'TD', 'BLOCKQUOTE', 'OUTPUT', 'FIGCAPTION', 'ADDRESS', 'SECTION', 'HEADER', 'FOOTER', 'ASIDE', 'ARTICLE'],
- blockLevelElements: ['PRE', 'UL', 'OL', 'LI'],
-
-
- // lang
- langs: {
- en: {
- html: 'HTML',
- video: 'Insert Video',
- image: 'Insert Image',
- table: 'Table',
- link: 'Link',
- link_insert: 'Insert link',
- link_edit: 'Edit link',
- unlink: 'Unlink',
- formatting: 'Formatting',
- paragraph: 'Normal text',
- quote: 'Quote',
- code: 'Code',
- header1: 'Header 1',
- header2: 'Header 2',
- header3: 'Header 3',
- header4: 'Header 4',
- header5: 'Header 5',
- bold: 'Bold',
- italic: 'Italic',
- fontcolor: 'Font Color',
- backcolor: 'Back Color',
- unorderedlist: 'Unordered List',
- orderedlist: 'Ordered List',
- outdent: 'Outdent',
- indent: 'Indent',
- cancel: 'Cancel',
- insert: 'Insert',
- save: 'Save',
- _delete: 'Delete',
- insert_table: 'Insert Table',
- insert_row_above: 'Add Row Above',
- insert_row_below: 'Add Row Below',
- insert_column_left: 'Add Column Left',
- insert_column_right: 'Add Column Right',
- delete_column: 'Delete Column',
- delete_row: 'Delete Row',
- delete_table: 'Delete Table',
- rows: 'Rows',
- columns: 'Columns',
- add_head: 'Add Head',
- delete_head: 'Delete Head',
- title: 'Title',
- image_position: 'Position',
- none: 'None',
- left: 'Left',
- right: 'Right',
- center: 'Center',
- image_web_link: 'Image Web Link',
- text: 'Text',
- mailto: 'Email',
- web: 'URL',
- video_html_code: 'Video Embed Code or Youtube/Vimeo Link',
- file: 'Insert File',
- upload: 'Upload',
- download: 'Download',
- choose: 'Choose',
- or_choose: 'Or choose',
- drop_file_here: 'Drop file here',
- align_left: 'Align text to the left',
- align_center: 'Center text',
- align_right: 'Align text to the right',
- align_justify: 'Justify text',
- horizontalrule: 'Insert Horizontal Rule',
- deleted: 'Deleted',
- anchor: 'Anchor',
- link_new_tab: 'Open link in new tab',
- underline: 'Underline',
- alignment: 'Alignment',
- filename: 'Name (optional)',
- edit: 'Edit',
- upload_label: 'Drop file here or '
-
- }
- },
-
- linkify: {
- regexps: {
- youtube: /https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com\S*[^\w\-\s])([\w\-]{11})(?=[^\w\-]|$)(?![?=&+%\w.\-]*(?:['"][^<>]*>|<\/a>))[?=&+%\w.-]*/ig,
- vimeo: /https?:\/\/(www\.)?vimeo.com\/(\d+)($|\/)/,
- image: /((https?|www)[^\s]+\.)(jpe?g|png|gif)(\?[^\s-]+)?/ig,
- url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/ig,
- }
- },
-
- codemirror: false
- };
-
- // Functionality
- Redactor.fn = $.Redactor.prototype = {
-
- keyCode: {
- BACKSPACE: 8,
- DELETE: 46,
- DOWN: 40,
- ENTER: 13,
- SPACE: 32,
- ESC: 27,
- TAB: 9,
- CTRL: 17,
- META: 91,
- SHIFT: 16,
- ALT: 18,
- RIGHT: 39,
- LEFT: 37,
- LEFT_WIN: 91
- },
-
- // Initialization
- init: function(el, options)
- {
- this.$element = $(el);
- this.uuid = uuid++;
-
- // if paste event detected = true
- this.rtePaste = false;
- this.$pasteBox = false;
-
- this.loadOptions(options);
- this.loadModules();
-
- // formatting storage
- this.formatting = {};
-
- // block level tags
- $.merge(this.opts.blockLevelElements, this.opts.alignmentTags);
- this.reIsBlock = new RegExp('^(' + this.opts.blockLevelElements.join('|' ) + ')$', 'i');
-
- // setup allowed and denied tags
- this.tidy.setupAllowed();
-
- // setup denied tags
- if (this.opts.deniedTags !== false)
- {
- var tags = ['html', 'head', 'link', 'body', 'meta', 'applet'];
- for (var i = 0; i < tags.length; i++)
- {
- this.opts.deniedTags.push(tags[i]);
- }
- }
-
- // load lang
- this.lang.load();
-
- // extend shortcuts
- $.extend(this.opts.shortcuts, this.opts.shortcutsAdd);
-
- // start callback
- this.core.setCallback('start');
-
- // build
- this.start = true;
- this.build.run();
- },
-
- loadOptions: function(options)
- {
- this.opts = $.extend(
- {},
- $.extend(true, {}, $.Redactor.opts),
- this.$element.data(),
- options
- );
- },
- getModuleMethods: function(object)
- {
- return Object.getOwnPropertyNames(object).filter(function(property)
- {
- return typeof object[property] == 'function';
- });
- },
- loadModules: function()
- {
- var len = $.Redactor.modules.length;
- for (var i = 0; i < len; i++)
- {
- this.bindModuleMethods($.Redactor.modules[i]);
- }
- },
- bindModuleMethods: function(module)
- {
- if (typeof this[module] == 'undefined') return;
-
- // init module
- this[module] = this[module]();
-
- var methods = this.getModuleMethods(this[module]);
- var len = methods.length;
-
- // bind methods
- for (var z = 0; z < len; z++)
- {
- this[module][methods[z]] = this[module][methods[z]].bind(this);
- }
- },
-
- alignment: function()
- {
- return {
- left: function()
- {
- this.alignment.set('');
- },
- right: function()
- {
- this.alignment.set('right');
- },
- center: function()
- {
- this.alignment.set('center');
- },
- justify: function()
- {
- this.alignment.set('justify');
- },
- set: function(type)
- {
- // focus
- if (!this.utils.browser('msie')) this.$editor.focus();
-
- this.buffer.set();
- this.selection.save();
-
- // get blocks
- this.alignment.blocks = this.selection.getBlocks();
- this.alignment.type = type;
-
- // set alignment
- if (this.alignment.isLinebreaksOrNoBlocks())
- {
- this.alignment.setText();
- }
- else
- {
- this.alignment.setBlocks();
- }
-
- // sync
- this.selection.restore();
- this.code.sync();
- },
- setText: function()
- {
- var wrapper = this.selection.wrap('div');
- $(wrapper).attr('data-tagblock', 'redactor').css('text-align', this.alignment.type);
- },
- setBlocks: function()
- {
- $.each(this.alignment.blocks, $.proxy(function(i, el)
- {
- var $el = this.utils.getAlignmentElement(el);
- if (!$el) return;
-
- if (this.alignment.isNeedReplaceElement($el))
- {
- this.alignment.replaceElement($el);
- }
- else
- {
- this.alignment.alignElement($el);
- }
-
- }, this));
- },
- isLinebreaksOrNoBlocks: function()
- {
- return (this.opts.linebreaks && this.alignment.blocks[0] === false);
- },
- isNeedReplaceElement: function($el)
- {
- return (this.alignment.type === '' && typeof($el.data('tagblock')) !== 'undefined');
- },
- replaceElement: function($el)
- {
- $el.replaceWith($el.html());
- },
- alignElement: function($el)
- {
- $el.css('text-align', this.alignment.type);
- this.utils.removeEmptyAttr($el, 'style');
- }
- };
- },
- autosave: function()
- {
- return {
- html: false,
- enable: function()
- {
- if (!this.opts.autosave) return;
-
- this.autosave.name = (this.opts.autosaveName) ? this.opts.autosaveName : this.$textarea.attr('name');
-
- if (this.opts.autosaveOnChange) return;
- this.autosaveInterval = setInterval(this.autosave.load, this.opts.autosaveInterval * 1000);
- },
- onChange: function()
- {
- if (!this.opts.autosaveOnChange) return;
- this.autosave.load();
- },
- load: function()
- {
- this.autosave.source = this.code.get();
-
- if (this.autosave.html === this.autosave.source) return;
- //if (this.utils.isEmpty(this.autosave.source)) return;
-
- // data
- var data = {};
- data['name'] = this.autosave.name;
- data[this.autosave.name] = this.autosave.source;
- data = this.autosave.getHiddenFields(data);
-
- // ajax
- var jsxhr = $.ajax({
- url: this.opts.autosave,
- type: 'post',
- data: data
- });
-
- jsxhr.done(this.autosave.success);
- },
- getHiddenFields: function(data)
- {
- if (this.opts.autosaveFields === false || typeof this.opts.autosaveFields !== 'object')
- {
- return data;
- }
-
- $.each(this.opts.autosaveFields, $.proxy(function(k, v)
- {
- if (v !== null && v.toString().indexOf('#') === 0) v = $(v).val();
- data[k] = v;
-
- }, this));
-
- return data;
-
- },
- success: function(data)
- {
- var json;
- try
- {
- json = $.parseJSON(data);
- }
- catch(e)
- {
- //data has already been parsed
- json = data;
- }
-
- var callbackName = (typeof json.error == 'undefined') ? 'autosave' : 'autosaveError';
-
- this.core.setCallback(callbackName, this.autosave.name, json);
- this.autosave.html = this.autosave.source;
- },
- disable: function()
- {
- clearInterval(this.autosaveInterval);
- }
- };
- },
- block: function()
- {
- return {
- formatting: function(name)
- {
- this.block.clearStyle = false;
- var type, value;
-
- if (typeof this.formatting[name].data != 'undefined') type = 'data';
- else if (typeof this.formatting[name].attr != 'undefined') type = 'attr';
- else if (typeof this.formatting[name]['class'] != 'undefined') type = 'class';
-
- if (typeof this.formatting[name].clear != 'undefined')
- {
- this.block.clearStyle = true;
- }
-
- if (type) value = this.formatting[name][type];
-
- this.block.format(this.formatting[name].tag, type, value);
-
- },
- format: function(tag, type, value)
- {
- if (tag == 'quote') tag = 'blockquote';
-
- var formatTags = ['p', 'pre', 'blockquote', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
- if ($.inArray(tag, formatTags) == -1) return;
-
- this.block.isRemoveInline = (tag == 'pre' || tag.search(/h[1-6]/i) != -1);
-
- // focus
- if (!this.utils.browser('msie')) this.$editor.focus();
-
- this.block.blocks = this.selection.getBlocks();
-
- this.block.blocksSize = this.block.blocks.length;
- this.block.type = type;
- this.block.value = value;
-
- this.buffer.set();
- this.selection.save();
-
- this.block.set(tag);
-
- this.selection.restore();
- this.code.sync();
-
- },
- set: function(tag)
- {
- this.selection.get();
- this.block.containerTag = this.range.commonAncestorContainer.tagName;
-
- if (this.range.collapsed)
- {
- this.block.setCollapsed(tag);
- }
- else
- {
- this.block.setMultiple(tag);
- }
- },
- setCollapsed: function(tag)
- {
- var block = this.block.blocks[0];
- if (block === false) return;
-
- if (block.tagName == 'LI')
- {
- if (tag != 'blockquote') return;
-
- this.block.formatListToBlockquote();
- return;
- }
-
- var isContainerTable = (this.block.containerTag == 'TD' || this.block.containerTag == 'TH');
- if (isContainerTable && !this.opts.linebreaks)
- {
-
- document.execCommand('formatblock', false, '<' + tag + '>');
-
- block = this.selection.getBlock();
- this.block.toggle($(block));
-
- }
- else if (block.tagName.toLowerCase() != tag)
- {
- if (this.opts.linebreaks && tag == 'p')
- {
- $(block).prepend('<br>').append('<br>');
- this.utils.replaceWithContents(block);
- }
- else
- {
- var $formatted = this.utils.replaceToTag(block, tag);
-
- this.block.toggle($formatted);
-
- if (tag != 'p' && tag != 'blockquote') $formatted.find('img').remove();
- if (this.block.isRemoveInline) this.utils.removeInlineTags($formatted);
- if (tag == 'p' || this.block.headTag) $formatted.find('p').contents().unwrap();
-
- this.block.formatTableWrapping($formatted);
- }
- }
- else if (tag == 'blockquote' && block.tagName.toLowerCase() == tag)
- {
- // blockquote off
- if (this.opts.linebreaks)
- {
- $(block).prepend('<br>').append('<br>');
- this.utils.replaceWithContents(block);
- }
- else
- {
- var $el = this.utils.replaceToTag(block, 'p');
- this.block.toggle($el);
- }
- }
- else if (block.tagName.toLowerCase() == tag)
- {
- this.block.toggle($(block));
- }
-
- if (typeof this.block.type == 'undefined' && typeof this.block.value == 'undefined')
- {
- $(block).removeAttr('class').removeAttr('style');
- }
-
- },
- setMultiple: function(tag)
- {
- var block = this.block.blocks[0];
- var isContainerTable = (this.block.containerTag == 'TD' || this.block.containerTag == 'TH');
-
- if (block !== false && this.block.blocksSize === 1)
- {
- if (block.tagName.toLowerCase() == tag && tag == 'blockquote')
- {
- // blockquote off
- if (this.opts.linebreaks)
- {
- $(block).prepend('<br>').append('<br>');
- this.utils.replaceWithContents(block);
- }
- else
- {
- var $el = this.utils.replaceToTag(block, 'p');
- this.block.toggle($el);
- }
- }
- else if (block.tagName == 'LI')
- {
- if (tag != 'blockquote') return;
-
- this.block.formatListToBlockquote();
- }
- else if (this.block.containerTag == 'BLOCKQUOTE')
- {
- this.block.formatBlockquote(tag);
- }
- else if (this.opts.linebreaks && ((isContainerTable) || (this.range.commonAncestorContainer != block)))
- {
- this.block.formatWrap(tag);
- }
- else
- {
- if (this.opts.linebreaks && tag == 'p')
- {
- $(block).prepend('<br>').append('<br>');
- this.utils.replaceWithContents(block);
- }
- else if (block.tagName === 'TD')
- {
- this.block.formatWrap(tag);
- }
- else
- {
- var $formatted = this.utils.replaceToTag(block, tag);
-
- this.block.toggle($formatted);
-
- if (this.block.isRemoveInline) this.utils.removeInlineTags($formatted);
- if (tag == 'p' || this.block.headTag) $formatted.find('p').contents().unwrap();
- }
- }
- }
- else
- {
-
- if (this.opts.linebreaks || tag != 'p')
- {
- if (tag == 'blockquote')
- {
- var count = 0;
- for (var i = 0; i < this.block.blocksSize; i++)
- {
- if (this.block.blocks[i].tagName == 'BLOCKQUOTE') count++;
- }
-
- // only blockquote selected
- if (count == this.block.blocksSize)
- {
- $.each(this.block.blocks, $.proxy(function(i,s)
- {
- var $formatted = false;
- if (this.opts.linebreaks)
- {
- $(s).prepend('<br>').append('<br>');
- $formatted = this.utils.replaceWithContents(s);
- }
- else
- {
- $formatted = this.utils.replaceToTag(s, 'p');
- }
-
- if ($formatted && typeof this.block.type == 'undefined' && typeof this.block.value == 'undefined')
- {
- $formatted.removeAttr('class').removeAttr('style');
- }
-
- }, this));
-
- return;
- }
-
- }
-
-
- this.block.formatWrap(tag);
- }
- else
- {
- var classSize = 0;
- var toggleType = false;
- if (this.block.type == 'class')
- {
- toggleType = 'toggle';
- classSize = $(this.block.blocks).filter('.' + this.block.value).length;
-
- if (this.block.blocksSize == classSize) toggleType = 'toggle';
- else if (this.block.blocksSize > classSize) toggleType = 'set';
- else if (classSize === 0) toggleType = 'set';
-
- }
-
- var exceptTags = ['ul', 'ol', 'li', 'td', 'th', 'dl', 'dt', 'dd'];
- $.each(this.block.blocks, $.proxy(function(i,s)
- {
- if ($.inArray(s.tagName.toLowerCase(), exceptTags) != -1) return;
-
- var $formatted = this.utils.replaceToTag(s, tag);
-
- if (toggleType)
- {
- if (toggleType == 'toggle') this.block.toggle($formatted);
- else if (toggleType == 'remove') this.block.remove($formatted);
- else if (toggleType == 'set') this.block.setForce($formatted);
- }
- else this.block.toggle($formatted);
-
- if (tag != 'p' && tag != 'blockquote') $formatted.find('img').remove();
- if (this.block.isRemoveInline) this.utils.removeInlineTags($formatted);
- if (tag == 'p' || this.block.headTag) $formatted.find('p').contents().unwrap();
-
- if (typeof this.block.type == 'undefined' && typeof this.block.value == 'undefined')
- {
- $formatted.removeAttr('class').removeAttr('style');
- }
-
-
- }, this));
- }
- }
- },
- setForce: function($el)
- {
- // remove style and class if the specified setting
- if (this.block.clearStyle)
- {
- $el.removeAttr('class').removeAttr('style');
- }
-
- if (this.block.type == 'class')
- {
- $el.addClass(this.block.value);
- return;
- }
- else if (this.block.type == 'attr' || this.block.type == 'data')
- {
- $el.attr(this.block.value.name, this.block.value.value);
- return;
- }
- },
- toggle: function($el)
- {
- // remove style and class if the specified setting
- if (this.block.clearStyle)
- {
- $el.removeAttr('class').removeAttr('style');
- }
-
- if (this.block.type == 'class')
- {
- $el.toggleClass(this.block.value);
- return;
- }
- else if (this.block.type == 'attr' || this.block.type == 'data')
- {
- if ($el.attr(this.block.value.name) == this.block.value.value)
- {
- $el.removeAttr(this.block.value.name);
- }
- else
- {
- $el.attr(this.block.value.name, this.block.value.value);
- }
-
- return;
- }
- else
- {
- $el.removeAttr('style class');
- return;
- }
- },
- remove: function($el)
- {
- $el.removeClass(this.block.value);
- },
- formatListToBlockquote: function()
- {
- var block = $(this.block.blocks[0]).closest('ul, ol', this.$editor[0]);
-
- $(block).find('ul, ol').contents().unwrap();
- $(block).find('li').append($('<br>')).contents().unwrap();
-
- var $el = this.utils.replaceToTag(block, 'blockquote');
- this.block.toggle($el);
- },
- formatBlockquote: function(tag)
- {
- document.execCommand('outdent');
- document.execCommand('formatblock', false, tag);
-
- this.clean.clearUnverified();
- this.$editor.find('p:empty').remove();
-
- var formatted = this.selection.getBlock();
-
- if (tag != 'p')
- {
- $(formatted).find('img').remove();
- }
-
- if (!this.opts.linebreaks)
- {
- this.block.toggle($(formatted));
- }
-
- this.$editor.find('ul, ol, tr, blockquote, p').each($.proxy(this.utils.removeEmpty, this));
-
- if (this.opts.linebreaks && tag == 'p')
- {
- this.utils.replaceWithContents(formatted);
- }
-
- },
- formatWrap: function(tag)
- {
- if (this.block.containerTag == 'UL' || this.block.containerTag == 'OL')
- {
- if (tag == 'blockquote')
- {
- this.block.formatListToBlockquote();
- }
- else
- {
- return;
- }
- }
-
- var formatted = this.selection.wrap(tag);
- if (formatted === false) return;
-
- var $formatted = $(formatted);
-
- this.block.formatTableWrapping($formatted);
-
- var $elements = $formatted.find(this.opts.blockLevelElements.join(',') + ', td, table, thead, tbody, tfoot, th, tr');
-
- if ((this.opts.linebreaks && tag == 'p') || tag == 'pre' || tag == 'blockquote')
- {
- $elements.append('<br />');
- }
-
- $elements.contents().unwrap();
-
- if (tag != 'p' && tag != 'blockquote') $formatted.find('img').remove();
-
- $.each(this.block.blocks, $.proxy(this.utils.removeEmpty, this));
-
- $formatted.append(this.selection.getMarker(2));
-
- if (!this.opts.linebreaks)
- {
- this.block.toggle($formatted);
- }
-
- this.$editor.find('ul, ol, tr, blockquote, p').each($.proxy(this.utils.removeEmpty, this));
- $formatted.find('blockquote:empty').remove();
-
- if (this.block.isRemoveInline)
- {
- this.utils.removeInlineTags($formatted);
- }
-
- if (this.opts.linebreaks && tag == 'p')
- {
- this.utils.replaceWithContents($formatted);
- }
-
- },
- formatTableWrapping: function($formatted)
- {
- if ($formatted.closest('table', this.$editor[0]).length === 0) return;
-
- if ($formatted.closest('tr', this.$editor[0]).length === 0) $formatted.wrap('<tr>');
- if ($formatted.closest('td', this.$editor[0]).length === 0 && $formatted.closest('th').length === 0)
- {
- $formatted.wrap('<td>');
- }
- },
- removeData: function(name, value)
- {
- var blocks = this.selection.getBlocks();
- $(blocks).removeAttr('data-' + name);
-
- this.code.sync();
- },
- setData: function(name, value)
- {
- var blocks = this.selection.getBlocks();
- $(blocks).attr('data-' + name, value);
-
- this.code.sync();
- },
- toggleData: function(name, value)
- {
- var blocks = this.selection.getBlocks();
- $.each(blocks, function()
- {
- if ($(this).attr('data-' + name))
- {
- $(this).removeAttr('data-' + name);
- }
- else
- {
- $(this).attr('data-' + name, value);
- }
- });
- },
- removeAttr: function(attr, value)
- {
- var blocks = this.selection.getBlocks();
- $(blocks).removeAttr(attr);
-
- this.code.sync();
- },
- setAttr: function(attr, value)
- {
- var blocks = this.selection.getBlocks();
- $(blocks).attr(attr, value);
-
- this.code.sync();
- },
- toggleAttr: function(attr, value)
- {
- var blocks = this.selection.getBlocks();
- $.each(blocks, function()
- {
- if ($(this).attr(name))
- {
- $(this).removeAttr(name);
- }
- else
- {
- $(this).attr(name, value);
- }
- });
- },
- removeClass: function(className)
- {
- var blocks = this.selection.getBlocks();
- $(blocks).removeClass(className);
-
- this.utils.removeEmptyAttr(blocks, 'class');
-
- this.code.sync();
- },
- setClass: function(className)
- {
- var blocks = this.selection.getBlocks();
- $(blocks).addClass(className);
-
- this.code.sync();
- },
- toggleClass: function(className)
- {
- var blocks = this.selection.getBlocks();
- $(blocks).toggleClass(className);
-
- this.code.sync();
- }
- };
- },
- buffer: function()
- {
- return {
- set: function(type)
- {
- if (typeof type == 'undefined' || type == 'undo')
- {
- this.buffer.setUndo();
- }
- else
- {
- this.buffer.setRedo();
- }
- },
- setUndo: function()
- {
- this.selection.save();
- this.opts.buffer.push(this.$editor.html());
- this.selection.restore();
- },
- setRedo: function()
- {
- this.selection.save();
- this.opts.rebuffer.push(this.$editor.html());
- this.selection.restore();
- },
- getUndo: function()
- {
- this.$editor.html(this.opts.buffer.pop());
- },
- getRedo: function()
- {
- this.$editor.html(this.opts.rebuffer.pop());
- },
- add: function()
- {
- this.opts.buffer.push(this.$editor.html());
- },
- undo: function()
- {
- if (this.opts.buffer.length === 0) return;
-
- this.buffer.set('redo');
- this.buffer.getUndo();
-
- this.selection.restore();
-
- setTimeout($.proxy(this.observe.load, this), 50);
- },
- redo: function()
- {
- if (this.opts.rebuffer.length === 0) return;
-
- this.buffer.set('undo');
- this.buffer.getRedo();
-
- this.selection.restore();
-
- setTimeout($.proxy(this.observe.load, this), 50);
- }
- };
- },
- build: function()
- {
- return {
- run: function()
- {
- this.build.createContainerBox();
- this.build.loadContent();
- this.build.loadEditor();
- this.build.enableEditor();
- this.build.setCodeAndCall();
- },
- isTextarea: function()
- {
- return (this.$element[0].tagName === 'TEXTAREA');
- },
- createContainerBox: function()
- {
- this.$box = $('<div class="redactor-box" />');
- },
- createTextarea: function()
- {
- this.$textarea = $('<textarea />').attr('name', this.build.getTextareaName());
- },
- getTextareaName: function()
- {
- return ((typeof(name) == 'undefined')) ? 'content-' + this.uuid : this.$element.attr('id');
- },
- loadContent: function()
- {
- var func = (this.build.isTextarea()) ? 'val' : 'html';
- this.content = $.trim(this.$element[func]());
- },
- enableEditor: function()
- {
- this.$editor.attr({ 'contenteditable': true, 'dir': this.opts.direction });
- },
- loadEditor: function()
- {
- var func = (this.build.isTextarea()) ? 'fromTextarea' : 'fromElement';
- this.build[func]();
- },
- fromTextarea: function()
- {
- this.$editor = $('<div />');
- this.$textarea = this.$element;
- this.$box.insertAfter(this.$element).append(this.$editor).append(this.$element);
- this.$editor.addClass('redactor-editor');
-
- this.$element.hide();
- },
- fromElement: function()
- {
- this.$editor = this.$element;
- this.build.createTextarea();
- this.$box.insertAfter(this.$editor).append(this.$editor).append(this.$textarea);
- this.$editor.addClass('redactor-editor');
-
- this.$textarea.hide();
- },
- setCodeAndCall: function()
- {
- // set code
- this.code.set(this.content);
-
- this.build.setOptions();
- this.build.callEditor();
-
- // code mode
- if (this.opts.visual) return;
- setTimeout($.proxy(this.code.showCode, this), 200);
- },
- callEditor: function()
- {
- this.build.disableMozillaEditing();
- this.build.setEvents();
- this.build.setHelpers();
-
- // load toolbar
- if (this.opts.toolbar)
- {
- this.opts.toolbar = this.toolbar.init();
- this.toolbar.build();
- }
-
- // modal templates init
- this.modal.loadTemplates();
-
- // plugins
- this.build.plugins();
-
- // observers
- setTimeout($.proxy(this.observe.load, this), 4);
-
- // init callback
- this.core.setCallback('init');
- },
- setOptions: function()
- {
- // textarea direction
- $(this.$textarea).attr('dir', this.opts.direction);
-
- if (this.opts.linebreaks) this.$editor.addClass('redactor-linebreaks');
-
- if (this.opts.tabindex) this.$editor.attr('tabindex', this.opts.tabindex);
-
- if (this.opts.minHeight) this.$editor.css('minHeight', this.opts.minHeight);
- if (this.opts.maxHeight) this.$editor.css('maxHeight', this.opts.maxHeight);
-
- },
- setEventDropUpload: function(e)
- {
- e.preventDefault();
-
- if (!this.opts.dragImageUpload || !this.opts.dragFileUpload) return;
-
- var files = e.dataTransfer.files;
- this.upload.directUpload(files[0], e);
- },
- setEventDrop: function(e)
- {
- this.code.sync();
- setTimeout(this.clean.clearUnverified, 1);
- this.core.setCallback('drop', e);
- },
- setEvents: function()
- {
- // drop
- this.$editor.on('drop.redactor', $.proxy(function(e)
- {
- e = e.originalEvent || e;
-
- if (window.FormData === undefined || !e.dataTransfer) return true;
-
- if (e.dataTransfer.files.length === 0)
- {
- return this.build.setEventDrop(e);
- }
- else
- {
- this.build.setEventDropUpload(e);
- }
-
- setTimeout(this.clean.clearUnverified, 1);
- this.core.setCallback('drop', e);
-
- }, this));
-
-
- // click
- this.$editor.on('click.redactor', $.proxy(function(e)
- {
- var event = this.core.getEvent();
- var type = (event == 'click' || event == 'arrow') ? false : 'click';
-
- this.core.addEvent(type);
- this.utils.disableSelectAll();
- this.core.setCallback('click', e);
-
- }, this));
-
- // paste
- this.$editor.on('paste.redactor', $.proxy(this.paste.init, this));
-
- // cut
- this.$editor.on('cut.redactor', $.proxy(this.code.sync, this));
-
- // keydown
- this.$editor.on('keydown.redactor', $.proxy(this.keydown.init, this));
-
- // keyup
- this.$editor.on('keyup.redactor', $.proxy(this.keyup.init, this));
-
- // textarea keydown
- if ($.isFunction(this.opts.codeKeydownCallback))
- {
- this.$textarea.on('keydown.redactor-textarea', $.proxy(this.opts.codeKeydownCallback, this));
- }
-
- // textarea keyup
- if ($.isFunction(this.opts.codeKeyupCallback))
- {
- this.$textarea.on('keyup.redactor-textarea', $.proxy(this.opts.codeKeyupCallback, this));
- }
-
- // focus
- if ($.isFunction(this.opts.focusCallback))
- {
- this.$editor.on('focus.redactor', $.proxy(this.opts.focusCallback, this));
- }
-
- var clickedElement;
- $(document).on('mousedown', function(e) { clickedElement = e.target; });
-
- // blur
- this.$editor.on('blur.redactor', $.proxy(function(e)
- {
- if (this.rtePaste) return;
- if (!this.build.isBlured(clickedElement)) return;
-
- this.utils.disableSelectAll();
- if ($.isFunction(this.opts.blurCallback)) this.core.setCallback('blur', e);
-
- }, this));
- },
- isBlured: function(clickedElement)
- {
- var $el = $(clickedElement);
-
- return (!$el.hasClass('redactor-toolbar, redactor-dropdown') && !$el.is('#redactor-modal') && $el.parents('.redactor-toolbar, .redactor-dropdown, #redactor-modal').length === 0);
- },
- setHelpers: function()
- {
- // linkify
- if (this.linkify.isEnabled())
- {
- this.linkify.format();
- }
-
- // placeholder
- this.placeholder.enable();
-
- // focus
- if (this.opts.focus) setTimeout(this.focus.setStart, 100);
- if (this.opts.focusEnd) setTimeout(this.focus.setEnd, 100);
-
- },
- plugins: function()
- {
- if (!this.opts.plugins) return;
- if (!RedactorPlugins) return;
-
- $.each(this.opts.plugins, $.proxy(function(i, s)
- {
- if (typeof RedactorPlugins[s] === 'undefined') return;
-
- if ($.inArray(s, $.Redactor.modules) !== -1)
- {
- $.error('Plugin name "' + s + '" matches the name of the Redactor\'s module.');
- return;
- }
-
- if (!$.isFunction(RedactorPlugins[s])) return;
-
- this[s] = RedactorPlugins[s]();
-
- // get methods
- var methods = this.getModuleMethods(this[s]);
- var len = methods.length;
-
- // bind methods
- for (var z = 0; z < len; z++)
- {
- this[s][methods[z]] = this[s][methods[z]].bind(this);
- }
-
- if ($.isFunction(this[s].init)) this[s].init();
-
-
- }, this));
-
- },
- disableMozillaEditing: function()
- {
- if (!this.utils.browser('mozilla')) return;
-
- // FF fix
- try {
- document.execCommand('enableObjectResizing', false, false);
- document.execCommand('enableInlineTableEditing', false, false);
- } catch (e) {}
- }
- };
- },
- button: function()
- {
- return {
- build: function(btnName, btnObject)
- {
- var $button = $('<a href="#" class="re-icon re-' + btnName + '" rel="' + btnName + '" />').attr('tabindex', '-1');
-
- // click
- if (btnObject.func || btnObject.command || btnObject.dropdown)
- {
- this.button.setEvent($button, btnName, btnObject);
- }
-
- // dropdown
- if (btnObject.dropdown)
- {
- var $dropdown = $('<div class="redactor-dropdown redactor-dropdown-' + this.uuid + ' redactor-dropdown-box-' + btnName + '" style="display: none;">');
- $button.data('dropdown', $dropdown);
- this.dropdown.build(btnName, $dropdown, btnObject.dropdown);
- }
-
- // tooltip
- if (this.utils.isDesktop())
- {
- this.button.createTooltip($button, btnName, btnObject.title);
- }
-
- return $button;
- },
- setEvent: function($button, btnName, btnObject)
- {
- $button.on('touchstart click', $.proxy(function(e)
- {
- if ($button.hasClass('redactor-button-disabled')) return false;
-
- var type = 'func';
- var callback = btnObject.func;
-
- if (btnObject.command)
- {
- type = 'command';
- callback = btnObject.command;
- }
- else if (btnObject.dropdown)
- {
- type = 'dropdown';
- callback = false;
- }
-
- this.button.onClick(e, btnName, type, callback);
-
- }, this));
- },
- createTooltip: function($button, name, title)
- {
- var $tooltip = $('<span>').addClass('redactor-toolbar-tooltip redactor-toolbar-tooltip-' + name).hide().html(title);
- $tooltip.appendTo('body');
-
- $button.on('mouseover', function()
- {
- if ($(this).hasClass('redactor-button-disabled')) return;
-
- var pos = $button.offset();
-
- $tooltip.show();
- $tooltip.css({
- top: (pos.top + $button.innerHeight()) + 'px',
- left: (pos.left + $button.innerWidth()/2 - $tooltip.innerWidth()/2) + 'px'
- });
- });
-
- $button.on('mouseout', function()
- {
- $tooltip.hide();
- });
-
- },
- onClick: function(e, btnName, type, callback)
- {
- this.button.caretOffset = this.caret.getOffset();
-
- e.preventDefault();
-
- if (this.utils.browser('msie')) e.returnValue = false;
-
- if (type == 'command') this.inline.format(callback);
- else if (type == 'dropdown') this.dropdown.show(e, btnName);
- else this.button.onClickCallback(e, callback, btnName);
- },
- onClickCallback: function(e, callback, btnName)
- {
- var func;
-
- if ($.isFunction(callback)) callback.call(this, btnName);
- else if (callback.search(/\./) != '-1')
- {
- func = callback.split('.');
- if (typeof this[func[0]] == 'undefined') return;
-
- this[func[0]][func[1]](btnName);
- }
- else this[callback](btnName);
-
- this.observe.buttons(e, btnName);
- },
- get: function(key)
- {
- return this.$toolbar.find('a.re-' + key);
- },
- setActive: function(key)
- {
- this.button.get(key).addClass('redactor-act');
- },
- setInactive: function(key)
- {
- this.button.get(key).removeClass('redactor-act');
- },
- setInactiveAll: function(key)
- {
- if (typeof key === 'undefined')
- {
- this.$toolbar.find('a.re-icon').removeClass('redactor-act');
- }
- else
- {
- this.$toolbar.find('a.re-icon').not('.re-' + key).removeClass('redactor-act');
- }
- },
- setActiveInVisual: function()
- {
- this.$toolbar.find('a.re-icon').not('a.re-html').removeClass('redactor-button-disabled');
- },
- setInactiveInCode: function()
- {
- this.$toolbar.find('a.re-icon').not('a.re-html').addClass('redactor-button-disabled');
- },
- changeIcon: function(key, classname)
- {
- this.button.get(key).addClass('re-' + classname);
- },
- removeIcon: function(key, classname)
- {
- this.button.get(key).removeClass('re-' + classname);
- },
- setAwesome: function(key, name)
- {
- var $button = this.button.get(key);
- $button.removeClass('redactor-btn-image').addClass('fa-redactor-btn');
- $button.html('<i class="fa ' + name + '"></i>');
- },
- addCallback: function($btn, callback)
- {
- var type = (callback == 'dropdown') ? 'dropdown' : 'func';
- var key = $btn.attr('rel');
- $btn.on('touchstart click', $.proxy(function(e)
- {
- if ($btn.hasClass('redactor-button-disabled')) return false;
- this.button.onClick(e, key, type, callback);
-
- }, this));
- },
- addDropdown: function($btn, dropdown)
- {
- var key = $btn.attr('rel');
- this.button.addCallback($btn, 'dropdown');
-
- var $dropdown = $('<div class="redactor-dropdown redactor-dropdown-' + this.uuid + ' redactor-dropdown-box-' + key + '" style="display: none;">');
- $btn.data('dropdown', $dropdown);
-
- // build dropdown
- if (dropdown) this.dropdown.build(key, $dropdown, dropdown);
-
- return $dropdown;
- },
- add: function(key, title)
- {
- if (!this.opts.toolbar) return;
-
- var btn = this.button.build(key, { title: title });
- btn.addClass('redactor-btn-image');
-
- this.$toolbar.append($('<li>').append(btn));
-
- return btn;
- },
- addFirst: function(key, title)
- {
- if (!this.opts.toolbar) return;
-
- var btn = this.button.build(key, { title: title });
- btn.addClass('redactor-btn-image');
- this.$toolbar.prepend($('<li>').append(btn));
-
- return btn;
- },
- addAfter: function(afterkey, key, title)
- {
- if (!this.opts.toolbar) return;
-
- var btn = this.button.build(key, { title: title });
- btn.addClass('redactor-btn-image');
- var $btn = this.button.get(afterkey);
-
- if ($btn.length !== 0) $btn.parent().after($('<li>').append(btn));
- else this.$toolbar.append($('<li>').append(btn));
-
- return btn;
- },
- addBefore: function(beforekey, key, title)
- {
- if (!this.opts.toolbar) return;
-
- var btn = this.button.build(key, { title: title });
- btn.addClass('redactor-btn-image');
- var $btn = this.button.get(beforekey);
-
- if ($btn.length !== 0) $btn.parent().before($('<li>').append(btn));
- else this.$toolbar.append($('<li>').append(btn));
-
- return btn;
- },
- remove: function(key)
- {
- this.button.get(key).remove();
- }
- };
- },
- caret: function()
- {
- return {
- setStart: function(node)
- {
- // inline tag
- if (!this.utils.isBlock(node))
- {
- var space = this.utils.createSpaceElement();
-
- $(node).prepend(space);
- this.caret.setEnd(space);
- }
- else
- {
- this.caret.set(node, 0, node, 0);
- }
- },
- setEnd: function(node)
- {
- this.caret.set(node, 1, node, 1);
- },
- set: function(orgn, orgo, focn, foco)
- {
- // focus
- // disabled in 10.0.7
- // if (!this.utils.browser('msie')) this.$editor.focus();
-
- orgn = orgn[0] || orgn;
- focn = focn[0] || focn;
-
- if (this.utils.isBlockTag(orgn.tagName) && orgn.innerHTML === '')
- {
- orgn.innerHTML = this.opts.invisibleSpace;
- }
-
- if (orgn.tagName == 'BR' && this.opts.linebreaks === false)
- {
- var parent = $(this.opts.emptyHtml)[0];
- $(orgn).replaceWith(parent);
- orgn = parent;
- focn = orgn;
- }
-
- this.selection.get();
-
- try
- {
- this.range.setStart(orgn, orgo);
- this.range.setEnd(focn, foco);
- }
- catch (e) {}
-
- this.selection.addRange();
- },
- setAfter: function(node)
- {
- try
- {
- var tag = $(node)[0].tagName;
-
- // inline tag
- if (tag != 'BR' && !this.utils.isBlock(node))
- {
- var space = this.utils.createSpaceElement();
-
- $(node).after(space);
- this.caret.setEnd(space);
- }
- else
- {
- if (tag != 'BR' && this.utils.browser('msie'))
- {
- this.caret.setStart($(node).next());
- }
- else
- {
- this.caret.setAfterOrBefore(node, 'after');
- }
- }
- }
- catch (e)
- {
- var space = this.utils.createSpaceElement();
- $(node).after(space);
- this.caret.setEnd(space);
- }
- },
- setBefore: function(node)
- {
- // block tag
- if (this.utils.isBlock(node))
- {
- this.caret.setEnd($(node).prev());
- }
- else
- {
- this.caret.setAfterOrBefore(node, 'before');
- }
- },
- setAfterOrBefore: function(node, type)
- {
- // focus
- if (!this.utils.browser('msie')) this.$editor.focus();
-
- node = node[0] || node;
-
- this.selection.get();
-
- if (type == 'after')
- {
- try {
-
- this.range.setStartAfter(node);
- this.range.setEndAfter(node);
- }
- catch (e) {}
- }
- else
- {
- try {
- this.range.setStartBefore(node);
- this.range.setEndBefore(node);
- }
- catch (e) {}
- }
-
-
- this.range.collapse(false);
- this.selection.addRange();
- },
- getOffsetOfElement: function(node)
- {
- node = node[0] || node;
-
- this.selection.get();
-
- var cloned = this.range.cloneRange();
- cloned.selectNodeContents(node);
- cloned.setEnd(this.range.endContainer, this.range.endOffset);
-
- return $.trim(cloned.toString()).length;
- },
- getOffset: function()
- {
- var offset = 0;
- var sel = window.getSelection();
-
- if (sel.rangeCount > 0)
- {
- var range = window.getSelection().getRangeAt(0);
- var caretRange = range.cloneRange();
- caretRange.selectNodeContents(this.$editor[0]);
- caretRange.setEnd(range.endContainer, range.endOffset);
- offset = caretRange.toString().length;
- }
-
- return offset;
- },
- setOffset: function(start, end)
- {
- if (typeof end == 'undefined') end = start;
- if (!this.focus.isFocused()) this.focus.setStart();
-
- var sel = this.selection.get();
- var node, offset = 0;
- var walker = document.createTreeWalker(this.$editor[0], NodeFilter.SHOW_TEXT, null, null);
-
- while (node = walker.nextNode())
- {
- offset += node.nodeValue.length;
- if (offset > start)
- {
- this.range.setStart(node, node.nodeValue.length + start - offset);
- start = Infinity;
- }
-
- if (offset >= end)
- {
- this.range.setEnd(node, node.nodeValue.length + end - offset);
- break;
- }
- }
-
- this.range.collapse(false);
- this.selection.addRange();
- },
- // deprecated
- setToPoint: function(start, end)
- {
- this.caret.setOffset(start, end);
- },
- getCoords: function()
- {
- return this.caret.getOffset();
- }
- };
- },
- clean: function()
- {
- return {
- onSet: function(html)
- {
- html = this.clean.savePreCode(html);
-
- // convert script tag
- html = html.replace(/<script(.*?[^>]?)>([\w\W]*?)<\/script>/gi, '<pre class="redactor-script-tag" style="display: none;" $1>$2</pre>');
-
- // replace dollar sign to entity
- html = html.replace(/\$/g, '$');
-
- // replace special characters in links
- html = html.replace(/<a href="(.*?[^>]?)®(.*?[^>]?)">/gi, '<a href="$1®$2">');
-
- if (this.opts.replaceDivs) html = this.clean.replaceDivs(html);
- if (this.opts.linebreaks) html = this.clean.replaceParagraphsToBr(html);
-
- // save form tag
- html = this.clean.saveFormTags(html);
-
- // convert font tag to span
- var $div = $('<div>');
- $div.html(html);
- var fonts = $div.find('font[style]');
- if (fonts.length !== 0)
- {
- fonts.replaceWith(function()
- {
- var $el = $(this);
- var $span = $('<span>').attr('style', $el.attr('style'));
- return $span.append($el.contents());
- });
-
- html = $div.html();
- }
- $div.remove();
-
- // remove font tag
- html = html.replace(/<font(.*?[^<])>/gi, '');
- html = html.replace(/<\/font>/gi, '');
-
- // tidy html
- html = this.tidy.load(html);
-
- // paragraphize
- if (this.opts.paragraphize) html = this.paragraphize.load(html);
-
- // verified
- html = this.clean.setVerified(html);
-
- // convert inline tags
- html = this.clean.convertInline(html);
-
- return html;
- },
- onSync: function(html)
- {
- // remove spaces
- html = html.replace(/[\u200B-\u200D\uFEFF]/g, '');
- html = html.replace(/​/gi, '');
-
- if (this.opts.cleanSpaces)
- {
- html = html.replace(/ /gi, ' ');
- }
-
- if (html.search(/^<p>(||\s||<br\s?\/?>|| )<\/p>$/i) != -1)
- {
- return '';
- }
-
- // reconvert script tag
- html = html.replace(/<pre class="redactor-script-tag" style="display: none;"(.*?[^>]?)>([\w\W]*?)<\/pre>/gi, '<script$1>$2</script>');
-
- // restore form tag
- html = this.clean.restoreFormTags(html);
-
- var chars = {
- '\u2122': '™',
- '\u00a9': '©',
- '\u2026': '…',
- '\u2014': '—',
- '\u2010': '‐'
- };
- // replace special characters
- $.each(chars, function(i,s)
- {
- html = html.replace(new RegExp(i, 'g'), s);
- });
-
- // remove br in the of li
- html = html.replace(new RegExp('<br\\s?/?></li>', 'gi'), '</li>');
- html = html.replace(new RegExp('</li><br\\s?/?>', 'gi'), '</li>');
- // remove verified
- html = html.replace(/<div(.*?[^>]) data-tagblock="redactor"(.*?[^>])>/gi, '<div$1$2>');
- html = html.replace(/<(.*?) data-verified="redactor"(.*?[^>])>/gi, '<$1$2>');
- html = html.replace(/<span(.*?[^>])\srel="(.*?[^>])"(.*?[^>])>/gi, '<span$1$3>');
- html = html.replace(/<img(.*?[^>])\srel="(.*?[^>])"(.*?[^>])>/gi, '<img$1$3>');
- html = html.replace(/<img(.*?[^>])\sstyle="" (.*?[^>])>'/gi, '<img$1 $2>');
- html = html.replace(/<img(.*?[^>])\sstyle (.*?[^>])>'/gi, '<img$1 $2>');
- html = html.replace(/<span class="redactor-invisible-space">(.*?)<\/span>/gi, '$1');
- html = html.replace(/ data-save-url="(.*?[^>])"/gi, '');
-
- // remove image resize
- html = html.replace(/<span(.*?)id="redactor-image-box"(.*?[^>])>([\w\W]*?)<img(.*?)><\/span>/gi, '$3<img$4>');
- html = html.replace(/<span(.*?)id="redactor-image-resizer"(.*?[^>])>(.*?)<\/span>/gi, '');
- html = html.replace(/<span(.*?)id="redactor-image-editter"(.*?[^>])>(.*?)<\/span>/gi, '');
-
- // remove font tag
- html = html.replace(/<font(.*?[^<])>/gi, '');
- html = html.replace(/<\/font>/gi, '');
-
- // tidy html
- html = this.tidy.load(html);
-
- // link nofollow
- if (this.opts.linkNofollow)
- {
- html = html.replace(/<a(.*?)rel="nofollow"(.*?[^>])>/gi, '<a$1$2>');
- html = html.replace(/<a(.*?[^>])>/gi, '<a$1 rel="nofollow">');
- }
-
- // reconvert inline
- html = html.replace(/\sdata-redactor-(tag|class|style)="(.*?[^>])"/gi, '');
- html = html.replace(new RegExp('<(.*?) data-verified="redactor"(.*?[^>])>', 'gi'), '<$1$2>');
- html = html.replace(new RegExp('<(.*?) data-verified="redactor">', 'gi'), '<$1>');
-
- return html;
- },
- onPaste: function(html, setMode)
- {
- html = $.trim(html);
-
- html = html.replace(/\$/g, '$');
-
- // convert dirty spaces
- html = html.replace(/<span class="s1">/gi, '<span>');
- html = html.replace(/<span class="Apple-converted-space"> <\/span>/gi, ' ');
- html = html.replace(/<span class="Apple-tab-span"[^>]*>\t<\/span>/gi, '\t');
- html = html.replace(/<span[^>]*>(\s| )<\/span>/gi, ' ');
-
- if (this.opts.pastePlainText)
- {
- return this.clean.getPlainText(html);
- }
-
- if (!this.utils.isSelectAll() && typeof setMode == 'undefined')
- {
- if (this.utils.isCurrentOrParent(['FIGCAPTION', 'A']))
- {
- return this.clean.getPlainText(html, false);
- }
-
- if (this.utils.isCurrentOrParent('PRE'))
- {
- html = html.replace(/”/g, '"');
- html = html.replace(/“/g, '"');
- html = html.replace(/‘/g, '\'');
- html = html.replace(/’/g, '\'');
-
- return this.clean.getPreCode(html);
- }
-
- if (this.utils.isCurrentOrParent(['BLOCKQUOTE', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6']))
- {
- html = this.clean.getOnlyImages(html);
-
- if (!this.utils.browser('msie'))
- {
- var block = this.selection.getBlock();
- if (block && block.tagName == 'P')
- {
- html = html.replace(/<img(.*?)>/gi, '<p><img$1></p>');
- }
- }
-
- return html;
- }
-
- if (this.utils.isCurrentOrParent(['TD']))
- {
- html = this.clean.onPasteTidy(html, 'td');
-
- if (this.opts.linebreaks) html = this.clean.replaceParagraphsToBr(html);
-
- html = this.clean.replaceDivsToBr(html);
-
- return html;
- }
-
-
- if (this.utils.isCurrentOrParent(['LI']))
- {
- return this.clean.onPasteTidy(html, 'li');
- }
- }
-
-
- html = this.clean.isSingleLine(html, setMode);
-
- if (!this.clean.singleLine)
- {
- if (this.opts.linebreaks) html = this.clean.replaceParagraphsToBr(html);
- if (this.opts.replaceDivs) html = this.clean.replaceDivs(html);
-
- html = this.clean.saveFormTags(html);
- }
-
-
- html = this.clean.onPasteWord(html);
- html = this.clean.onPasteExtra(html);
-
- html = this.clean.onPasteTidy(html, 'all');
-
-
- // paragraphize
- if (!this.clean.singleLine && this.opts.paragraphize)
- {
- html = this.paragraphize.load(html);
- }
-
- html = this.clean.removeDirtyStyles(html);
- html = this.clean.onPasteRemoveSpans(html);
- html = this.clean.onPasteRemoveEmpty(html);
-
-
- html = this.clean.convertInline(html);
-
- return html;
- },
- onPasteWord: function(html)
- {
- // comments
- html = html.replace(/<!--[\s\S]*?-->/gi, '');
-
- // style
- html = html.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '');
-
- if (/(class=\"?Mso|style=\"[^\"]*\bmso\-|w:WordDocument)/.test(html))
- {
- html = this.clean.onPasteIeFixLinks(html);
-
- // shapes
- html = html.replace(/<img(.*?)v:shapes=(.*?)>/gi, '');
- html = html.replace(/src="file\:\/\/(.*?)"/, 'src=""');
-
- // list
- html = html.replace(/<p(.*?)class="MsoListParagraphCxSpFirst"([\w\W]*?)<\/p>/gi, '<ul><li$2</li>');
- html = html.replace(/<p(.*?)class="MsoListParagraphCxSpMiddle"([\w\W]*?)<\/p>/gi, '<li$2</li>');
- html = html.replace(/<p(.*?)class="MsoListParagraphCxSpLast"([\w\W]*?)<\/p>/gi, '<li$2</li></ul>');
- // one line
- html = html.replace(/<p(.*?)class="MsoListParagraph"([\w\W]*?)<\/p>/gi, '<ul><li$2</li></ul>');
- // remove ms word's bullet
- html = html.replace(/·/g, '');
- html = html.replace(/<p class="Mso(.*?)"/gi, '<p');
-
- // classes
- html = html.replace(/ class=\"(mso[^\"]*)\"/gi, "");
- html = html.replace(/ class=(mso\w+)/gi, "");
-
- // remove ms word tags
- html = html.replace(/<o:p(.*?)>([\w\W]*?)<\/o:p>/gi, '$2');
-
- // ms word break lines
- html = html.replace(/\n/g, ' ');
-
- // ms word lists break lines
- html = html.replace(/<p>\n?<li>/gi, '<li>');
- }
-
- // remove nbsp
- if (this.opts.cleanSpaces)
- {
- html = html.replace(/(\s| )+/g, ' ');
- }
-
- return html;
- },
- onPasteExtra: function(html)
- {
- // remove google docs markers
- html = html.replace(/<b\sid="internal-source-marker(.*?)">([\w\W]*?)<\/b>/gi, "$2");
- html = html.replace(/<b(.*?)id="docs-internal-guid(.*?)">([\w\W]*?)<\/b>/gi, "$3");
-
- // google docs styles
- html = html.replace(/<span[^>]*(font-style: italic; font-weight: bold|font-weight: bold; font-style: italic)[^>]*>/gi, '<span style="font-weight: bold;"><span style="font-style: italic;">');
- html = html.replace(/<span[^>]*font-style: italic[^>]*>/gi, '<span style="font-style: italic;">');
- html = html.replace(/<span[^>]*font-weight: bold[^>]*>/gi, '<span style="font-weight: bold;">');
- html = html.replace(/<span[^>]*text-decoration: underline[^>]*>/gi, '<span style="text-decoration: underline;">');
-
- html = html.replace(/<img>/gi, '');
- html = html.replace(/\n{3,}/gi, '\n');
- html = html.replace(/<font(.*?)>([\w\W]*?)<\/font>/gi, '$2');
-
- // remove dirty p
- html = html.replace(/<p><p>/gi, '<p>');
- html = html.replace(/<\/p><\/p>/gi, '</p>');
- html = html.replace(/<li>(\s*|\t*|\n*)<p>/gi, '<li>');
- html = html.replace(/<\/p>(\s*|\t*|\n*)<\/li>/gi, '</li>');
-
- // remove space between paragraphs
- html = html.replace(/<\/p>\s<p/gi, '<\/p><p');
-
- // remove safari local images
- html = html.replace(/<img src="webkit-fake-url\:\/\/(.*?)"(.*?)>/gi, '');
-
- // bullets
- html = html.replace(/<p>•([\w\W]*?)<\/p>/gi, '<li>$1</li>');
-
- // FF fix
- if (this.utils.browser('mozilla'))
- {
- html = html.replace(/<br\s?\/?>$/gi, '');
- }
-
- return html;
- },
- onPasteTidy: function(html, type)
- {
- // remove all tags except these
- var tags = ['span', 'a', 'pre', 'blockquote', 'small', 'em', 'strong', 'code', 'kbd', 'mark', 'address', 'cite', 'var', 'samp', 'dfn', 'sup', 'sub', 'b', 'i', 'u', 'del',
- 'ol', 'ul', 'li', 'dl', 'dt', 'dd', 'p', 'br', 'video', 'audio', 'iframe', 'embed', 'param', 'object', 'img', 'table',
- 'td', 'th', 'tr', 'tbody', 'tfoot', 'thead', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
- var tagsEmpty = false;
- var attrAllowed = [
- ['a', '*'],
- ['img', ['src', 'alt']],
- ['span', ['class', 'rel', 'data-verified']],
- ['iframe', '*'],
- ['video', '*'],
- ['audio', '*'],
- ['embed', '*'],
- ['object', '*'],
- ['param', '*'],
- ['source', '*']
- ];
-
- if (type == 'all')
- {
- tagsEmpty = ['p', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
- attrAllowed = [
- ['table', 'class'],
- ['td', ['colspan', 'rowspan']],
- ['a', '*'],
- ['img', ['src', 'alt', 'data-redactor-inserted-image']],
- ['span', ['class', 'rel', 'data-verified']],
- ['iframe', '*'],
- ['video', '*'],
- ['audio', '*'],
- ['embed', '*'],
- ['object', '*'],
- ['param', '*'],
- ['source', '*']
- ];
- }
- else if (type == 'td')
- {
- // remove all tags except these and remove all table tags: tr, td etc
- tags = ['ul', 'ol', 'li', 'span', 'a', 'small', 'em', 'strong', 'code', 'kbd', 'mark', 'cite', 'var', 'samp', 'dfn', 'sup', 'sub', 'b', 'i', 'u', 'del',
- 'ol', 'ul', 'li', 'dl', 'dt', 'dd', 'br', 'iframe', 'video', 'audio', 'embed', 'param', 'object', 'img', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
-
- }
- else if (type == 'li')
- {
- // only inline tags and ul, ol, li
- tags = ['ul', 'ol', 'li', 'span', 'a', 'small', 'em', 'strong', 'code', 'kbd', 'mark', 'cite', 'var', 'samp', 'dfn', 'sup', 'sub', 'b', 'i', 'u', 'del', 'br',
- 'iframe', 'video', 'audio', 'embed', 'param', 'object', 'img'];
- }
-
- var options = {
- deniedTags: (this.opts.deniedTags) ? this.opts.deniedTags : false,
- allowedTags: (this.opts.allowedTags) ? this.opts.allowedTags : tags,
- removeComments: true,
- removePhp: true,
- removeAttr: (this.opts.removeAttr) ? this.opts.removeAttr : false,
- allowedAttr: (this.opts.allowedAttr) ? this.opts.allowedAttr : attrAllowed,
- removeEmpty: tagsEmpty
- };
-
- return this.tidy.load(html, options);
- },
- onPasteRemoveEmpty: function(html)
- {
- html = html.replace(/<(p|h[1-6])>(|\s|\n|\t|<br\s?\/?>)<\/(p|h[1-6])>/gi, '');
-
- // remove br in the end
- if (!this.opts.linebreaks) html = html.replace(/<br>$/i, '');
-
- return html;
- },
- onPasteRemoveSpans: function(html)
- {
- html = html.replace(/<span>(.*?)<\/span>/gi, '$1');
- html = html.replace(/<span[^>]*>\s| <\/span>/gi, ' ');
-
- return html;
- },
- onPasteIeFixLinks: function(html)
- {
- if (!this.utils.browser('msie')) return html;
-
- var tmp = $.trim(html);
- if (tmp.search(/^<a(.*?)>(.*?)<\/a>$/i) === 0)
- {
- html = html.replace(/^<a(.*?)>(.*?)<\/a>$/i, "$2");
- }
-
- return html;
- },
- isSingleLine: function(html, setMode)
- {
- this.clean.singleLine = false;
-
- if (!this.utils.isSelectAll() && typeof setMode == 'undefined')
- {
- var blocks = this.opts.blockLevelElements.join('|').replace('P|', '').replace('DIV|', '');
-
- var matchBlocks = html.match(new RegExp('</(' + blocks + ')>', 'gi'));
- var matchContainers = html.match(/<\/(p|div)>/gi);
-
- if (!matchBlocks && (matchContainers === null || (matchContainers && matchContainers.length <= 1)))
- {
- var matchBR = html.match(/<br\s?\/?>/gi);
- var matchIMG = html.match(/<img(.*?[^>])>/gi);
- if (!matchBR && !matchIMG)
- {
- this.clean.singleLine = true;
- html = html.replace(/<\/?(p|div)(.*?)>/gi, '');
- }
- }
- }
-
- return html;
- },
- stripTags: function(input, allowed)
- {
- allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('');
- var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi;
-
- return input.replace(tags, function ($0, $1) {
- return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
- });
- },
- savePreCode: function(html)
- {
- html = this.clean.savePreFormatting(html);
- html = this.clean.saveCodeFormatting(html);
-
- return html;
- },
- savePreFormatting: function(html)
- {
- var pre = html.match(/<pre(.*?)>([\w\W]*?)<\/pre>/gi);
- if (pre !== null)
- {
- $.each(pre, $.proxy(function(i,s)
- {
- var arr = s.match(/<pre(.*?)>([\w\W]*?)<\/pre>/i);
-
- arr[2] = arr[2].replace(/<br\s?\/?>/g, '\n');
- arr[2] = arr[2].replace(/ /g, ' ');
-
- if (this.opts.preSpaces)
- {
- arr[2] = arr[2].replace(/\t/g, Array(this.opts.preSpaces + 1).join(' '));
- }
-
- arr[2] = this.clean.encodeEntities(arr[2]);
-
- // $ fix
- arr[2] = arr[2].replace(/\$/g, '$');
-
- html = html.replace(s, '<pre' + arr[1] + '>' + arr[2] + '</pre>');
-
- }, this));
- }
-
- return html;
- },
- saveCodeFormatting: function(html)
- {
- var code = html.match(/<code(.*?[^>])>(.*?)<\/code>/gi);
- if (code !== null)
- {
- $.each(code, $.proxy(function(i,s)
- {
- var arr = s.match(/<code(.*?[^>])>(.*?)<\/code>/i);
-
- arr[2] = arr[2].replace(/ /g, ' ');
- arr[2] = this.clean.encodeEntities(arr[2]);
-
- // $ fix
- arr[2] = arr[2].replace(/\$/g, '$');
-
- html = html.replace(s, '<code' + arr[1] + '>' + arr[2] + '</code>');
-
- }, this));
- }
-
- return html;
- },
- getTextFromHtml: function(html)
- {
- html = html.replace(/<br\s?\/?>|<\/H[1-6]>|<\/p>|<\/div>|<\/li>|<\/td>/gi, '\n');
-
- var tmp = document.createElement('div');
- tmp.innerHTML = html;
- html = tmp.textContent || tmp.innerText;
-
- return $.trim(html);
- },
- getPlainText: function(html, paragraphize)
- {
- html = this.clean.getTextFromHtml(html);
- html = html.replace(/\n/g, '<br />');
-
- if (this.opts.paragraphize && typeof paragraphize == 'undefined' && !this.utils.browser('mozilla'))
- {
- html = this.paragraphize.load(html);
- }
-
- return html;
- },
- getPreCode: function(html)
- {
- html = html.replace(/<img(.*?) style="(.*?)"(.*?[^>])>/gi, '<img$1$3>');
- html = html.replace(/<img(.*?)>/gi, '<img$1>');
- html = this.clean.getTextFromHtml(html);
-
- if (this.opts.preSpaces)
- {
- html = html.replace(/\t/g, Array(this.opts.preSpaces + 1).join(' '));
- }
-
- html = this.clean.encodeEntities(html);
-
- return html;
- },
- getOnlyImages: function(html)
- {
- html = html.replace(/<img(.*?)>/gi, '[img$1]');
-
- // remove all tags
- html = html.replace(/<([Ss]*?)>/gi, '');
-
- html = html.replace(/\[img(.*?)\]/gi, '<img$1>');
-
- return html;
- },
- getOnlyLinksAndImages: function(html)
- {
- html = html.replace(/<a(.*?)href="(.*?)"(.*?)>([\w\W]*?)<\/a>/gi, '[a href="$2"]$4[/a]');
- html = html.replace(/<img(.*?)>/gi, '[img$1]');
-
- // remove all tags
- html = html.replace(/<(.*?)>/gi, '');
-
- html = html.replace(/\[a href="(.*?)"\]([\w\W]*?)\[\/a\]/gi, '<a href="$1">$2</a>');
- html = html.replace(/\[img(.*?)\]/gi, '<img$1>');
-
- return html;
- },
- encodeEntities: function(str)
- {
- str = String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
- return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
- },
- removeDirtyStyles: function(html)
- {
- if (this.utils.browser('msie')) return html;
-
- var div = document.createElement('div');
- div.innerHTML = html;
-
- this.clean.clearUnverifiedRemove($(div));
-
- html = div.innerHTML;
- $(div).remove();
-
- return html;
- },
- clearUnverified: function()
- {
- if (this.utils.browser('msie')) return;
-
- this.clean.clearUnverifiedRemove(this.$editor);
-
- var headers = this.$editor.find('h1, h2, h3, h4, h5, h6');
- headers.find('span').removeAttr('style');
- headers.find(this.opts.verifiedTags.join(', ')).removeAttr('style');
-
- this.code.sync();
- },
- clearUnverifiedRemove: function($editor)
- {
- $editor.find(this.opts.verifiedTags.join(', ')).removeAttr('style');
- $editor.find('span').not('[data-verified="redactor"]').removeAttr('style');
-
- $editor.find('span[data-verified="redactor"], img[data-verified="redactor"]').each(function(i, s)
- {
- var $s = $(s);
- $s.attr('style', $s.attr('rel'));
- });
-
- },
- cleanEmptyParagraph: function()
- {
- var p = this.$editor.find("p").first();
-
- if (this.utils.isEmpty(p.html()))
- {
- p.remove();
- }
- },
- setVerified: function(html)
- {
- if (this.utils.browser('msie')) return html;
-
- html = html.replace(new RegExp('<img(.*?[^>])>', 'gi'), '<img$1 data-verified="redactor">');
- html = html.replace(new RegExp('<span(.*?[^>])>', 'gi'), '<span$1 data-verified="redactor">');
-
- var matches = html.match(new RegExp('<(span|img)(.*?)style="(.*?)"(.*?[^>])>', 'gi'));
-
- if (matches)
- {
- var len = matches.length;
- for (var i = 0; i < len; i++)
- {
- try {
-
- var newTag = matches[i].replace(/style="(.*?)"/i, 'style="$1" rel="$1"');
- html = html.replace(matches[i], newTag);
-
- }
- catch (e) {}
- }
- }
-
- return html;
- },
- convertInline: function(html)
- {
- var $div = $('<div />').html(html);
-
- var tags = this.opts.inlineTags;
- tags.push('span');
-
- $div.find(tags.join(',')).each(function()
- {
- var $el = $(this);
- var tag = this.tagName.toLowerCase();
- $el.attr('data-redactor-tag', tag);
-
- if (tag == 'span')
- {
- if ($el.attr('style')) $el.attr('data-redactor-style', $el.attr('style'));
- else if ($el.attr('class')) $el.attr('data-redactor-class', $el.attr('class'));
- }
-
- });
-
- html = $div.html();
- $div.remove();
-
- return html;
- },
- normalizeLists: function()
- {
- this.$editor.find('li').each(function(i,s)
- {
- var $next = $(s).next();
- if ($next.length !== 0 && ($next[0].tagName == 'UL' || $next[0].tagName == 'OL'))
- {
- $(s).append($next);
- }
-
- });
- },
- removeSpaces: function(html)
- {
- html = html.replace(/\n/g, '');
- html = html.replace(/[\t]*/g, '');
- html = html.replace(/\n\s*\n/g, "\n");
- html = html.replace(/^[\s\n]*/g, ' ');
- html = html.replace(/[\s\n]*$/g, ' ');
- html = html.replace( />\s{2,}</g, '> <'); // between inline tags can be only one space
- html = html.replace(/\n\n/g, "\n");
- html = html.replace(/[\u200B-\u200D\uFEFF]/g, '');
-
- return html;
- },
- replaceDivs: function(html)
- {
- if (this.opts.linebreaks)
- {
- html = html.replace(/<div><br\s?\/?><\/div>/gi, '<br />');
- html = html.replace(/<div(.*?)>([\w\W]*?)<\/div>/gi, '$2<br />');
- }
- else
- {
- html = html.replace(/<div(.*?)>([\w\W]*?)<\/div>/gi, '<p$1>$2</p>');
- }
-
- html = html.replace(/<div(.*?[^>])>/gi, '');
- html = html.replace(/<\/div>/gi, '');
-
- return html;
- },
- replaceDivsToBr: function(html)
- {
- html = html.replace(/<div\s(.*?)>/gi, '<p>');
- html = html.replace(/<div><br\s?\/?><\/div>/gi, '<br /><br />');
- html = html.replace(/<div>([\w\W]*?)<\/div>/gi, '$1<br /><br />');
-
- return html;
- },
- replaceParagraphsToBr: function(html)
- {
- html = html.replace(/<p\s(.*?)>/gi, '<p>');
- html = html.replace(/<p><br\s?\/?><\/p>/gi, '<br />');
- html = html.replace(/<p>([\w\W]*?)<\/p>/gi, '$1<br /><br />');
- html = html.replace(/(<br\s?\/?>){1,}\n?<\/blockquote>/gi, '</blockquote>');
-
- return html;
- },
- saveFormTags: function(html)
- {
- return html.replace(/<form(.*?)>([\w\W]*?)<\/form>/gi, '<section$1 rel="redactor-form-tag">$2</section>');
- },
- restoreFormTags: function(html)
- {
- return html.replace(/<section(.*?) rel="redactor-form-tag"(.*?)>([\w\W]*?)<\/section>/gi, '<form$1$2>$3</form>');
- }
- };
- },
- code: function()
- {
- return {
- set: function(html)
- {
- html = $.trim(html.toString());
-
- // clean
- html = this.clean.onSet(html);
-
- this.$editor.html(html);
- this.code.sync();
-
- if (html !== '') this.placeholder.remove();
-
- setTimeout($.proxy(this.buffer.add, this), 15);
- if (this.start === false) this.observe.load();
-
- },
- get: function()
- {
- var code = this.$textarea.val();
-
- // indent code
- code = this.tabifier.get(code);
-
- return code;
- },
- sync: function()
- {
- setTimeout($.proxy(this.code.startSync, this), 10);
- },
- startSync: function()
- {
- var html = this.$editor.html();
-
- // is there a need to synchronize
- if (this.code.syncCode && this.code.syncCode == html)
- {
- // do not sync
- return;
- }
-
- // save code
- this.code.syncCode = html;
-
- // before clean callback
- html = this.core.setCallback('syncBefore', html);
-
- // clean
- html = this.clean.onSync(html);
-
- // set code
- this.$textarea.val(html);
-
- // after sync callback
- this.core.setCallback('sync', html);
-
- if (this.start === false)
- {
- this.core.setCallback('change', html);
- }
-
- this.start = false;
-
- if (this.autosave.html == false)
- {
- this.autosave.html = this.code.get();
- }
-
- if (this.opts.codemirror)
- {
- this.$textarea.next('.CodeMirror').each(function(i, el)
- {
- el.CodeMirror.setValue(html);
- });
- }
-
- //autosave
- this.autosave.onChange();
- this.autosave.enable();
- },
- toggle: function()
- {
- if (this.opts.visual)
- {
- this.code.showCode();
- }
- else
- {
- this.code.showVisual();
- }
- },
- showCode: function()
- {
- this.code.offset = this.caret.getOffset();
- var scroll = $(window).scrollTop();
-
- var width = this.$editor.innerWidth(),
- height = this.$editor.innerHeight();
-
- this.$editor.hide();
-
- var html = this.$textarea.val();
- this.modified = this.clean.removeSpaces(html);
-
- // indent code
- html = this.tabifier.get(html);
-
- this.$textarea.val(html);
-
- if (this.opts.codemirror)
- {
- this.$textarea.next('.CodeMirror').each(function(i, el)
- {
- $(el).show();
- el.CodeMirror.setValue(html);
- el.CodeMirror.setSize(width, height);
- el.CodeMirror.refresh();
- el.CodeMirror.focus();
- });
- }
- else
- {
- this.$textarea.height(height).show().focus();
- this.$textarea.on('keydown.redactor-textarea-indenting', this.code.textareaIndenting);
-
- $(window).scrollTop(scroll);
-
- if (this.$textarea[0].setSelectionRange)
- {
- this.$textarea[0].setSelectionRange(0, 0);
- }
-
- this.$textarea[0].scrollTop = 0;
- }
-
- this.opts.visual = false;
-
- this.button.setInactiveInCode();
- this.button.setActive('html');
- this.core.setCallback('source', html);
- },
- showVisual: function()
- {
- var html;
-
- if (this.opts.visual) return;
-
- if (this.opts.codemirror)
- {
- this.$textarea.next('.CodeMirror').each(function(i, el)
- {
- html = el.CodeMirror.getValue();
- });
- }
- else
- {
- html = this.$textarea.hide().val();
- }
-
- if (this.modified !== this.clean.removeSpaces(html))
- {
- this.code.set(html);
- }
-
- if (this.opts.codemirror)
- {
- this.$textarea.next('.CodeMirror').hide();
- }
-
- this.$editor.show();
-
- if (!this.utils.isEmpty(html))
- {
- this.placeholder.remove();
- }
-
- this.caret.setOffset(this.code.offset);
-
- this.$textarea.off('keydown.redactor-textarea-indenting');
-
- this.button.setActiveInVisual();
- this.button.setInactive('html');
-
- this.observe.load();
- this.opts.visual = true;
- this.core.setCallback('visual', html);
- },
- textareaIndenting: function(e)
- {
- if (e.keyCode !== 9) return true;
-
- var $el = this.$textarea;
- var start = $el.get(0).selectionStart;
- $el.val($el.val().substring(0, start) + "\t" + $el.val().substring($el.get(0).selectionEnd));
- $el.get(0).selectionStart = $el.get(0).selectionEnd = start + 1;
-
- return false;
- }
- };
- },
- core: function()
- {
- return {
- getObject: function()
- {
- return $.extend({}, this);
- },
- getEditor: function()
- {
- return this.$editor;
- },
- getBox: function()
- {
- return this.$box;
- },
- getElement: function()
- {
- return this.$element;
- },
- getTextarea: function()
- {
- return this.$textarea;
- },
- getToolbar: function()
- {
- return (this.$toolbar) ? this.$toolbar : false;
- },
- addEvent: function(name)
- {
- this.core.event = name;
- },
- getEvent: function()
- {
- return this.core.event;
- },
- setCallback: function(type, e, data)
- {
- var callback = this.opts[type + 'Callback'];
- if ($.isFunction(callback))
- {
- return (typeof data == 'undefined') ? callback.call(this, e) : callback.call(this, e, data);
- }
- else
- {
- return (typeof data == 'undefined') ? e : data;
- }
- },
- destroy: function()
- {
- this.core.setCallback('destroy');
-
- // off events and remove data
- this.$element.off('.redactor').removeData('redactor');
- this.$editor.off('.redactor');
-
- $(document).off('click.redactor-image-delete.' + this.uuid);
- $(document).off('click.redactor-image-resize-hide.' + this.uuid);
- $(document).off('touchstart.redactor.' + this.uuid + ' click.redactor.' + this.uuid);
- $("body").off('scroll.redactor.' + this.uuid);
- $(this.opts.toolbarFixedTarget).off('scroll.redactor.' + this.uuid);
-
- // common
- this.$editor.removeClass('redactor-editor redactor-linebreaks redactor-placeholder');
- this.$editor.removeAttr('contenteditable');
-
- var html = this.code.get();
-
- // dropdowns off
- this.$toolbar.find('a').each(function()
- {
- var $el = $(this);
- if ($el.data('dropdown'))
- {
- $el.data('dropdown').remove();
- $el.data('dropdown', {});
- }
- });
-
-
- if (this.build.isTextarea())
- {
- this.$box.after(this.$element);
- this.$box.remove();
- this.$element.val(html).show();
- }
- else
- {
- this.$box.after(this.$editor);
- this.$box.remove();
- this.$element.html(html).show();
- }
-
- // paste box
- if (this.$pasteBox) this.$pasteBox.remove();
-
- // modal
- if (this.$modalBox) this.$modalBox.remove();
- if (this.$modalOverlay) this.$modalOverlay.remove();
-
- // buttons tooltip
- $('.redactor-toolbar-tooltip').remove();
-
- // autosave
- clearInterval(this.autosaveInterval);
-
- }
- };
- },
- dropdown: function()
- {
- return {
- build: function(name, $dropdown, dropdownObject)
- {
- if (name == 'formatting' && this.opts.formattingAdd)
- {
- $.each(this.opts.formattingAdd, $.proxy(function(i,s)
- {
- var name = s.tag,
- func;
-
- if (typeof s['class'] != 'undefined')
- {
- name = name + '-' + s['class'];
- }
-
- s.type = (this.utils.isBlockTag(s.tag)) ? 'block' : 'inline';
-
- if (typeof s.func !== "undefined")
- {
- func = s.func;
- }
- else
- {
- func = (s.type == 'inline') ? 'inline.formatting' : 'block.formatting';
- }
-
- if (this.opts.linebreaks && s.type == 'block' && s.tag == 'p') return;
-
- this.formatting[name] = {
- tag: s.tag,
- style: s.style,
- 'class': s['class'],
- attr: s.attr,
- data: s.data,
- clear: s.clear
- };
-
- dropdownObject[name] = {
- func: func,
- title: s.title
- };
-
- }, this));
-
- }
-
- $.each(dropdownObject, $.proxy(function(btnName, btnObject)
- {
- var $item = $('<a href="#" class="redactor-dropdown-' + btnName + '">' + btnObject.title + '</a>');
- if (name == 'formatting') $item.addClass('redactor-formatting-' + btnName);
-
- $item.on('click', $.proxy(function(e)
- {
- e.preventDefault();
-
- var type = 'func';
- var callback = btnObject.func;
- if (btnObject.command)
- {
- type = 'command';
- callback = btnObject.command;
- }
- else if (btnObject.dropdown)
- {
- type = 'dropdown';
- callback = btnObject.dropdown;
- }
-
- this.button.onClick(e, btnName, type, callback);
- this.dropdown.hideAll();
-
- }, this));
-
- $dropdown.append($item);
-
- }, this));
- },
- show: function(e, key)
- {
- if (!this.opts.visual)
- {
- e.preventDefault();
- return false;
- }
-
- var $button = this.button.get(key);
-
- // Always re-append it to the end of <body> so it always has the highest sub-z-index.
- var $dropdown = $button.data('dropdown').appendTo(document.body);
-
- // ios keyboard hide
- if (this.utils.isMobile() && !this.utils.browser('msie'))
- {
- document.activeElement.blur();
- }
-
- if ($button.hasClass('dropact'))
- {
- this.dropdown.hideAll();
- }
- else
- {
- this.dropdown.hideAll();
- this.core.setCallback('dropdownShow', { dropdown: $dropdown, key: key, button: $button });
-
- this.button.setActive(key);
-
- $button.addClass('dropact');
-
- var keyPosition = $button.offset();
-
- // fix right placement
- var dropdownWidth = $dropdown.width();
- if ((keyPosition.left + dropdownWidth) > $(document).width())
- {
- keyPosition.left = Math.max(0, keyPosition.left - dropdownWidth);
- }
-
- var left = keyPosition.left + 'px';
- if (this.$toolbar.hasClass('toolbar-fixed-box'))
- {
- var top = this.$toolbar.innerHeight() + this.opts.toolbarFixedTopOffset;
- var position = 'fixed';
- if (this.opts.toolbarFixedTarget !== document)
- {
- top = (this.$toolbar.innerHeight() + this.$toolbar.offset().top) + this.opts.toolbarFixedTopOffset;
- position = 'absolute';
- }
-
- $dropdown.css({ position: position, left: left, top: top + 'px' }).show();
- }
- else
- {
- var top = ($button.innerHeight() + keyPosition.top) + 'px';
-
- $dropdown.css({ position: 'absolute', left: left, top: top }).show();
- }
-
- this.core.setCallback('dropdownShown', { dropdown: $dropdown, key: key, button: $button });
- }
-
- $(document).one('click', $.proxy(this.dropdown.hide, this));
- this.$editor.one('click', $.proxy(this.dropdown.hide, this));
-
- // disable scroll whan dropdown scroll
- var $body = $(document.body);
- var width = $body.width();
-
- $dropdown.on('mouseover', function() {
-
- $body.addClass('body-redactor-hidden');
- $body.css('margin-right', ($body.width() - width) + 'px');
-
- });
-
- $dropdown.on('mouseout', function() {
-
- $body.removeClass('body-redactor-hidden').css('margin-right', 0);
-
- });
-
-
- e.stopPropagation();
- },
- hideAll: function()
- {
- this.$toolbar.find('a.dropact').removeClass('redactor-act').removeClass('dropact');
-
- $(document.body).removeClass('body-redactor-hidden').css('margin-right', 0);
- $('.redactor-dropdown-' + this.uuid).hide();
- this.core.setCallback('dropdownHide');
- },
- hide: function (e)
- {
- var $dropdown = $(e.target);
- if (!$dropdown.hasClass('dropact'))
- {
- $dropdown.removeClass('dropact');
- this.dropdown.hideAll();
- }
- }
- };
- },
- file: function()
- {
- return {
- show: function()
- {
- this.modal.load('file', this.lang.get('file'), 700);
- this.upload.init('#redactor-modal-file-upload', this.opts.fileUpload, this.file.insert);
-
- this.selection.save();
-
- this.selection.get();
- var text = this.sel.toString();
-
- $('#redactor-filename').val(text);
-
- this.modal.show();
- },
- insert: function(json, direct, e)
- {
- // error callback
- if (typeof json.error != 'undefined')
- {
- this.modal.close();
- this.selection.restore();
- this.core.setCallback('fileUploadError', json);
- return;
- }
-
- var link;
- if (typeof json == 'string')
- {
- link = json;
- }
- else
- {
- var text = $('#redactor-filename').val();
- if (typeof text == 'undefined' || text === '') text = json.filename;
-
- link = '<a href="' + json.filelink + '" id="filelink-marker">' + text + '</a>';
- }
-
- if (direct)
- {
- this.selection.removeMarkers();
- var marker = this.selection.getMarker();
- this.insert.nodeToCaretPositionFromPoint(e, marker);
- }
- else
- {
- this.modal.close();
- }
-
- this.selection.restore();
- this.buffer.set();
-
- this.insert.htmlWithoutClean(link);
-
- if (typeof json == 'string') return;
-
- var linkmarker = $(this.$editor.find('a#filelink-marker'));
- if (linkmarker.length !== 0)
- {
- linkmarker.removeAttr('id').removeAttr('style');
- }
- else linkmarker = false;
-
- this.core.setCallback('fileUpload', linkmarker, json);
-
- }
- };
- },
- focus: function()
- {
- return {
- setStart: function()
- {
- this.$editor.focus();
-
- var first = this.$editor.children().first();
-
- if (first.length === 0) return;
- if (first[0].length === 0 || first[0].tagName == 'BR' || first[0].nodeType == 3)
- {
- return;
- }
-
- if (first[0].tagName == 'UL' || first[0].tagName == 'OL')
- {
- var child = first.find('li').first();
- if (!this.utils.isBlock(child) && child.text() === '')
- {
- // empty inline tag in li
- this.caret.setStart(child);
- return;
- }
- }
-
- if (this.opts.linebreaks && !this.utils.isBlockTag(first[0].tagName))
- {
- this.selection.get();
- this.range.setStart(this.$editor[0], 0);
- this.range.setEnd(this.$editor[0], 0);
- this.selection.addRange();
-
- return;
- }
-
- // if node is tag
- this.caret.setStart(first);
- },
- setEnd: function()
- {
- if (this.utils.browser('mozilla') || this.utils.browser('msie'))
- {
- var last = this.$editor.children().last();
-
- this.$editor.focus();
- this.caret.setEnd(last);
- }
- else
- {
- this.selection.get();
-
- try {
- this.range.selectNodeContents(this.$editor[0]);
- this.range.collapse(false);
-
- this.selection.addRange();
- }
- catch (e) {}
- }
-
- },
- isFocused: function()
- {
- var focusNode = document.getSelection().focusNode;
- if (focusNode === null) return false;
-
- if (this.opts.linebreaks && $(focusNode.parentNode).hasClass('redactor-linebreaks')) return true;
- else if (!this.utils.isRedactorParent(focusNode.parentNode)) return false;
-
- return this.$editor.is(':focus');
- }
- };
- },
- image: function()
- {
- return {
- show: function()
- {
- this.modal.load('image', this.lang.get('image'), 700);
- this.upload.init('#redactor-modal-image-droparea', this.opts.imageUpload, this.image.insert);
-
- this.selection.save();
- this.modal.show();
-
- },
- showEdit: function($image)
- {
- var $link = $image.closest('a', this.$editor[0]);
-
- this.modal.load('imageEdit', this.lang.get('edit'), 705);
-
- this.modal.createCancelButton();
- this.image.buttonDelete = this.modal.createDeleteButton(this.lang.get('_delete'));
- this.image.buttonSave = this.modal.createActionButton(this.lang.get('save'));
-
- this.image.buttonDelete.on('click', $.proxy(function()
- {
- this.image.remove($image);
-
- }, this));
-
- this.image.buttonSave.on('click', $.proxy(function()
- {
- this.image.update($image);
-
- }, this));
-
- $('#redactor-image-title').val($image.attr('alt'));
-
- if (!this.opts.imageLink) $('.redactor-image-link-option').hide();
- else
- {
- var $redactorImageLink = $('#redactor-image-link');
-
- $redactorImageLink.attr('href', $image.attr('src'));
- if ($link.length !== 0)
- {
- $redactorImageLink.val($link.attr('href'));
- if ($link.attr('target') == '_blank') $('#redactor-image-link-blank').prop('checked', true);
- }
- }
-
- if (!this.opts.imagePosition) $('.redactor-image-position-option').hide();
- else
- {
- var floatValue = ($image.css('display') == 'block' && $image.css('float') == 'none') ? 'center' : $image.css('float');
- $('#redactor-image-align').val(floatValue);
- }
-
- this.modal.show();
-
- },
- setFloating: function($image)
- {
- var floating = $('#redactor-image-align').val();
-
- var imageFloat = '';
- var imageDisplay = '';
- var imageMargin = '';
-
- switch (floating)
- {
- case 'left':
- imageFloat = 'left';
- imageMargin = '0 ' + this.opts.imageFloatMargin + ' ' + this.opts.imageFloatMargin + ' 0';
- break;
- case 'right':
- imageFloat = 'right';
- imageMargin = '0 0 ' + this.opts.imageFloatMargin + ' ' + this.opts.imageFloatMargin;
- break;
- case 'center':
- imageDisplay = 'block';
- imageMargin = 'auto';
- break;
- }
-
- $image.css({ 'float': imageFloat, display: imageDisplay, margin: imageMargin });
- $image.attr('rel', $image.attr('style'));
- },
- update: function($image)
- {
- this.image.hideResize();
- this.buffer.set();
-
- var $link = $image.closest('a', this.$editor[0]);
-
- $image.attr('alt', $('#redactor-image-title').val());
-
- this.image.setFloating($image);
-
- // as link
- var link = $.trim($('#redactor-image-link').val());
- if (link !== '')
- {
- // test url (add protocol)
- var pattern = '((xn--)?[a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}';
- var re = new RegExp('^(http|ftp|https)://' + pattern, 'i');
- var re2 = new RegExp('^' + pattern, 'i');
-
- if (link.search(re) == -1 && link.search(re2) === 0 && this.opts.linkProtocol)
- {
- link = this.opts.linkProtocol + '://' + link;
- }
-
- var target = ($('#redactor-image-link-blank').prop('checked')) ? true : false;
-
- if ($link.length === 0)
- {
- var a = $('<a href="' + link + '">' + this.utils.getOuterHtml($image) + '</a>');
- if (target) a.attr('target', '_blank');
-
- $image.replaceWith(a);
- }
- else
- {
- $link.attr('href', link);
- if (target)
- {
- $link.attr('target', '_blank');
- }
- else
- {
- $link.removeAttr('target');
- }
- }
- }
- else if ($link.length !== 0)
- {
- $link.replaceWith(this.utils.getOuterHtml($image));
-
- }
-
- this.modal.close();
- this.observe.images();
- this.code.sync();
-
-
- },
- setEditable: function($image)
- {
- if (this.opts.imageEditable)
- {
- $image.on('dragstart', $.proxy(this.image.onDrag, this));
- }
-
- $image.on('mousedown', $.proxy(this.image.hideResize, this));
- $image.on('click.redactor touchstart', $.proxy(function(e)
- {
- this.observe.image = $image;
-
- if (this.$editor.find('#redactor-image-box').length !== 0) return false;
-
- this.image.resizer = this.image.loadEditableControls($image);
-
- $(document).on('click.redactor-image-resize-hide.' + this.uuid, $.proxy(this.image.hideResize, this));
- this.$editor.on('click.redactor-image-resize-hide.' + this.uuid, $.proxy(this.image.hideResize, this));
-
- // resize
- if (!this.opts.imageResizable) return;
-
- this.image.resizer.on('mousedown.redactor touchstart.redactor', $.proxy(function(e)
- {
- this.image.setResizable(e, $image);
- }, this));
-
-
- }, this));
- },
- setResizable: function(e, $image)
- {
- e.preventDefault();
-
- this.image.resizeHandle = {
- x : e.pageX,
- y : e.pageY,
- el : $image,
- ratio: $image.width() / $image.height(),
- h: $image.height()
- };
-
- e = e.originalEvent || e;
-
- if (e.targetTouches)
- {
- this.image.resizeHandle.x = e.targetTouches[0].pageX;
- this.image.resizeHandle.y = e.targetTouches[0].pageY;
- }
-
- this.image.startResize();
-
-
- },
- startResize: function()
- {
- $(document).on('mousemove.redactor-image-resize touchmove.redactor-image-resize', $.proxy(this.image.moveResize, this));
- $(document).on('mouseup.redactor-image-resize touchend.redactor-image-resize', $.proxy(this.image.stopResize, this));
- },
- moveResize: function(e)
- {
- e.preventDefault();
-
- e = e.originalEvent || e;
-
- var height = this.image.resizeHandle.h;
-
- if (e.targetTouches) height += (e.targetTouches[0].pageY - this.image.resizeHandle.y);
- else height += (e.pageY - this.image.resizeHandle.y);
-
- var width = Math.round(height * this.image.resizeHandle.ratio);
-
- if (height < 50 || width < 100) return;
-
- var height = Math.round(this.image.resizeHandle.el.width() / this.image.resizeHandle.ratio);
-
- this.image.resizeHandle.el.attr({width: width, height: height});
- this.image.resizeHandle.el.width(width);
- this.image.resizeHandle.el.height(height);
-
- this.code.sync();
- },
- stopResize: function()
- {
- this.handle = false;
- $(document).off('.redactor-image-resize');
-
- this.image.hideResize();
- },
- onDrag: function(e)
- {
- if (this.$editor.find('#redactor-image-box').length !== 0)
- {
- e.preventDefault();
- return false;
- }
-
- this.$editor.on('drop.redactor-image-inside-drop', $.proxy(function()
- {
- setTimeout($.proxy(this.image.onDrop, this), 1);
-
- }, this));
- },
- onDrop: function()
- {
- this.image.fixImageSourceAfterDrop();
- this.observe.images();
- this.$editor.off('drop.redactor-image-inside-drop');
- this.clean.clearUnverified();
- this.code.sync();
- },
- fixImageSourceAfterDrop: function()
- {
- this.$editor.find('img[data-save-url]').each(function()
- {
- var $el = $(this);
- $el.attr('src', $el.attr('data-save-url'));
- $el.removeAttr('data-save-url');
- });
- },
- hideResize: function(e)
- {
- if (e && $(e.target).closest('#redactor-image-box', this.$editor[0]).length !== 0) return;
- if (e && e.target.tagName == 'IMG')
- {
- var $image = $(e.target);
- $image.attr('data-save-url', $image.attr('src'));
- }
-
- var imageBox = this.$editor.find('#redactor-image-box');
- if (imageBox.length === 0) return;
-
- if (this.opts.imageEditable)
- {
- this.image.editter.remove();
- }
-
- $(this.image.resizer).remove();
-
- imageBox.find('img').css({
- marginTop: imageBox[0].style.marginTop,
- marginBottom: imageBox[0].style.marginBottom,
- marginLeft: imageBox[0].style.marginLeft,
- marginRight: imageBox[0].style.marginRight
- });
-
- imageBox.css('margin', '');
- imageBox.find('img').css('opacity', '');
- imageBox.replaceWith(function()
- {
- return $(this).contents();
- });
-
- $(document).off('click.redactor-image-resize-hide.' + this.uuid);
- this.$editor.off('click.redactor-image-resize-hide.' + this.uuid);
-
- if (typeof this.image.resizeHandle !== 'undefined')
- {
- this.image.resizeHandle.el.attr('rel', this.image.resizeHandle.el.attr('style'));
- }
-
- this.code.sync();
-
- },
- loadResizableControls: function($image, imageBox)
- {
- if (this.opts.imageResizable && !this.utils.isMobile())
- {
- var imageResizer = $('<span id="redactor-image-resizer" data-redactor="verified"></span>');
-
- if (!this.utils.isDesktop())
- {
- imageResizer.css({ width: '15px', height: '15px' });
- }
-
- imageResizer.attr('contenteditable', false);
- imageBox.append(imageResizer);
- imageBox.append($image);
-
- return imageResizer;
- }
- else
- {
- imageBox.append($image);
- return false;
- }
- },
- loadEditableControls: function($image)
- {
- var imageBox = $('<span id="redactor-image-box" data-redactor="verified">');
- imageBox.css('float', $image.css('float')).attr('contenteditable', false);
-
- if ($image[0].style.margin != 'auto')
- {
- imageBox.css({
- marginTop: $image[0].style.marginTop,
- marginBottom: $image[0].style.marginBottom,
- marginLeft: $image[0].style.marginLeft,
- marginRight: $image[0].style.marginRight
- });
-
- $image.css('margin', '');
- }
- else
- {
- imageBox.css({ 'display': 'block', 'margin': 'auto' });
- }
-
- $image.css('opacity', '.5').after(imageBox);
-
-
- if (this.opts.imageEditable)
- {
- // editter
- this.image.editter = $('<span id="redactor-image-editter" data-redactor="verified">' + this.lang.get('edit') + '</span>');
- this.image.editter.attr('contenteditable', false);
- this.image.editter.on('click', $.proxy(function()
- {
- this.image.showEdit($image);
- }, this));
-
- imageBox.append(this.image.editter);
-
- // position correction
- var editerWidth = this.image.editter.innerWidth();
- this.image.editter.css('margin-left', '-' + editerWidth/2 + 'px');
- }
-
- return this.image.loadResizableControls($image, imageBox);
-
- },
- remove: function(image)
- {
- var $image = $(image);
- var $link = $image.closest('a', this.$editor[0]);
- var $figure = $image.closest('figure', this.$editor[0]);
- var $parent = $image.parent();
- if ($('#redactor-image-box').length !== 0)
- {
- $parent = $('#redactor-image-box').parent();
- }
-
- var $next;
- if ($figure.length !== 0)
- {
- $next = $figure.next();
- $figure.remove();
- }
- else if ($link.length !== 0)
- {
- $parent = $link.parent();
- $link.remove();
- }
- else
- {
- $image.remove();
- }
-
- $('#redactor-image-box').remove();
-
- if ($figure.length !== 0)
- {
- this.caret.setStart($next);
- }
- else
- {
- this.caret.setStart($parent);
- }
-
- // delete callback
- this.core.setCallback('imageDelete', $image[0].src, $image);
-
- this.modal.close();
- this.code.sync();
- },
- insert: function(json, direct, e)
- {
- // error callback
- if (typeof json.error != 'undefined')
- {
- this.modal.close();
- this.selection.restore();
- this.core.setCallback('imageUploadError', json);
- return;
- }
-
- var $img;
- if (typeof json == 'string')
- {
- $img = $(json).attr('data-redactor-inserted-image', 'true');
- }
- else
- {
- $img = $('<img>');
- $img.attr('src', json.filelink).attr('data-redactor-inserted-image', 'true');
- }
-
-
- var node = $img;
- var isP = this.utils.isCurrentOrParent('P');
- if (isP)
- {
- // will replace
- node = $('<blockquote />').append($img);
- }
-
- if (direct)
- {
- this.selection.removeMarkers();
- var marker = this.selection.getMarker();
- this.insert.nodeToCaretPositionFromPoint(e, marker);
- }
- else
- {
- this.modal.close();
- }
-
- this.selection.restore();
- this.buffer.set();
-
- this.insert.html(this.utils.getOuterHtml(node), false);
-
- var $image = this.$editor.find('img[data-redactor-inserted-image=true]').removeAttr('data-redactor-inserted-image');
-
- if (isP)
- {
- $image.parent().contents().unwrap().wrap('<p />');
- }
- else if (this.opts.linebreaks)
- {
- $image.before('<br>').after('<br>');
- }
-
- if (typeof json == 'string') return;
-
- this.core.setCallback('imageUpload', $image, json);
-
- }
- };
- },
- indent: function()
- {
- return {
- increase: function()
- {
- // focus
- if (!this.utils.browser('msie')) this.$editor.focus();
-
- this.buffer.set();
- this.selection.save();
-
- var block = this.selection.getBlock();
-
- if (block && block.tagName == 'LI')
- {
- this.indent.increaseLists();
- }
- else if (block === false && this.opts.linebreaks)
- {
- this.indent.increaseText();
- }
- else
- {
- this.indent.increaseBlocks();
- }
-
- this.selection.restore();
- this.code.sync();
- },
- increaseLists: function()
- {
- document.execCommand('indent');
-
- this.indent.fixEmptyIndent();
- this.clean.normalizeLists();
- this.clean.clearUnverified();
- },
- increaseBlocks: function()
- {
- $.each(this.selection.getBlocks(), $.proxy(function(i, elem)
- {
- if (elem.tagName === 'TD' || elem.tagName === 'TH') return;
-
- var $el = this.utils.getAlignmentElement(elem);
-
- var left = this.utils.normalize($el.css('margin-left')) + this.opts.indentValue;
- $el.css('margin-left', left + 'px');
-
- }, this));
- },
- increaseText: function()
- {
- var wrapper = this.selection.wrap('div');
- $(wrapper).attr('data-tagblock', 'redactor');
- $(wrapper).css('margin-left', this.opts.indentValue + 'px');
- },
- decrease: function()
- {
- this.buffer.set();
- this.selection.save();
-
- var block = this.selection.getBlock();
- if (block && block.tagName == 'LI')
- {
- this.indent.decreaseLists();
- }
- else
- {
- this.indent.decreaseBlocks();
- }
-
- this.selection.restore();
- this.code.sync();
- },
- decreaseLists: function ()
- {
- document.execCommand('outdent');
-
- var current = this.selection.getCurrent();
-
- var $item = $(current).closest('li', this.$editor[0]);
- var $parent = $item.parent();
- if ($item.length !== 0 && $parent.length !== 0 && $parent[0].tagName == 'LI')
- {
- $parent.after($item);
- }
-
- this.indent.fixEmptyIndent();
-
- if (!this.opts.linebreaks && $item.length === 0)
- {
- document.execCommand('formatblock', false, 'p');
- this.$editor.find('ul, ol, blockquote, p').each($.proxy(this.utils.removeEmpty, this));
- }
-
- this.clean.clearUnverified();
- },
- decreaseBlocks: function()
- {
- $.each(this.selection.getBlocks(), $.proxy(function(i, elem)
- {
- var $el = this.utils.getAlignmentElement(elem);
- var left = this.utils.normalize($el.css('margin-left')) - this.opts.indentValue;
-
- if (left <= 0)
- {
- if (this.opts.linebreaks && typeof($el.data('tagblock')) !== 'undefined')
- {
- $el.replaceWith($el.html() + '<br />');
- }
- else
- {
- $el.css('margin-left', '');
- this.utils.removeEmptyAttr($el, 'style');
- }
- }
- else
- {
- $el.css('margin-left', left + 'px');
- }
-
- }, this));
- },
- fixEmptyIndent: function()
- {
- var block = this.selection.getBlock();
-
- if (this.range.collapsed && block && block.tagName == 'LI' && this.utils.isEmpty($(block).text()))
- {
- var $block = $(block);
- $block.find('span').not('.redactor-selection-marker').contents().unwrap();
- $block.append('<br>');
- }
- }
- };
- },
- inline: function()
- {
- return {
- formatting: function(name)
- {
- var type, value;
-
- if (typeof this.formatting[name].style != 'undefined') type = 'style';
- else if (typeof this.formatting[name]['class'] != 'undefined') type = 'class';
-
- if (type) value = this.formatting[name][type];
-
- this.inline.format(this.formatting[name].tag, type, value);
-
- },
- format: function(tag, type, value)
- {
- // Stop formatting pre and headers
- if (this.utils.isCurrentOrParent('PRE') || this.utils.isCurrentOrParentHeader()) return;
-
- var tags = ['b', 'bold', 'i', 'italic', 'underline', 'strikethrough', 'deleted', 'superscript', 'subscript'];
- var replaced = ['strong', 'strong', 'em', 'em', 'u', 'del', 'del', 'sup', 'sub'];
-
- for (var i = 0; i < tags.length; i++)
- {
- if (tag == tags[i]) tag = replaced[i];
- }
-
- if (this.opts.allowedTags)
- {
- if ($.inArray(tag, this.opts.allowedTags) == -1) return;
- }
- else
- {
- if ($.inArray(tag, this.opts.deniedTags) !== -1) return;
- }
-
- this.inline.type = type || false;
- this.inline.value = value || false;
-
- this.buffer.set();
-
- if (!this.utils.browser('msie'))
- {
- this.$editor.focus();
- }
-
- this.selection.get();
-
- if (this.range.collapsed)
- {
- this.inline.formatCollapsed(tag);
- }
- else
- {
- this.inline.formatMultiple(tag);
- }
- },
- formatCollapsed: function(tag)
- {
- var current = this.selection.getCurrent();
- var $parent = $(current).closest(tag + '[data-redactor-tag=' + tag + ']', this.$editor[0]);
-
- // inline there is
- if ($parent.length !== 0 && (this.inline.type != 'style' && $parent[0].tagName != 'SPAN'))
- {
- // remove empty
- if (this.utils.isEmpty($parent.text()))
- {
- this.caret.setAfter($parent[0]);
-
- $parent.remove();
- this.code.sync();
- }
- else if (this.utils.isEndOfElement($parent))
- {
- this.caret.setAfter($parent[0]);
- }
-
- return;
- }
-
- // create empty inline
- var node = $('<' + tag + '>').attr('data-verified', 'redactor').attr('data-redactor-tag', tag);
- node.html(this.opts.invisibleSpace);
-
- node = this.inline.setFormat(node);
-
- var node = this.insert.node(node);
- this.caret.setEnd(node);
-
- this.code.sync();
- },
- formatMultiple: function(tag)
- {
- this.inline.formatConvert(tag);
-
- this.selection.save();
- document.execCommand('strikethrough');
-
- this.$editor.find('strike').each($.proxy(function(i,s)
- {
- var $el = $(s);
-
- this.inline.formatRemoveSameChildren($el, tag);
-
- var $span;
- if (this.inline.type)
- {
- $span = $('<span>').attr('data-redactor-tag', tag).attr('data-verified', 'redactor');
- $span = this.inline.setFormat($span);
- }
- else
- {
- $span = $('<' + tag + '>').attr('data-redactor-tag', tag).attr('data-verified', 'redactor');
- }
-
- $el.replaceWith($span.html($el.contents()));
-
- if (tag == 'span')
- {
- var $parent = $span.parent();
- if ($parent && $parent[0].tagName == 'SPAN' && this.inline.type == 'style')
- {
- var arr = this.inline.value.split(';');
-
- for (var z = 0; z < arr.length; z++)
- {
- if (arr[z] === '') return;
- var style = arr[z].split(':');
- $parent.css(style[0], '');
-
- if (this.utils.removeEmptyAttr($parent, 'style'))
- {
- $parent.replaceWith($parent.contents());
- }
-
- }
-
- }
- }
-
- }, this));
-
- // clear text decoration
- if (tag != 'span')
- {
- this.$editor.find(this.opts.inlineTags.join(', ')).each($.proxy(function(i,s)
- {
- var $el = $(s);
- var property = $el.css('text-decoration');
- if (property == 'line-through')
- {
- $el.css('text-decoration', '');
- this.utils.removeEmptyAttr($el, 'style');
- }
- }, this));
- }
-
- if (tag != 'del')
- {
- var _this = this;
- this.$editor.find('inline').each(function(i,s)
- {
- _this.utils.replaceToTag(s, 'del');
- });
- }
-
- this.selection.restore();
- this.code.sync();
-
- },
- formatRemoveSameChildren: function($el, tag)
- {
- var self = this;
- $el.children(tag).each(function()
- {
- var $child = $(this);
-
- if (!$child.hasClass('redactor-selection-marker'))
- {
- if (self.inline.type == 'style')
- {
- var arr = self.inline.value.split(';');
-
- for (var z = 0; z < arr.length; z++)
- {
- if (arr[z] === '') return;
-
- var style = arr[z].split(':');
- $child.css(style[0], '');
-
- if (self.utils.removeEmptyAttr($child , 'style'))
- {
- $child.replaceWith($child.contents());
- }
-
- }
- }
- else
- {
- $child.contents().unwrap();
- }
- }
-
- });
- },
- formatConvert: function(tag)
- {
- this.selection.save();
-
- var find = '';
- if (this.inline.type == 'class') find = '[data-redactor-class=' + this.inline.value + ']';
- else if (this.inline.type == 'style')
- {
- find = '[data-redactor-style="' + this.inline.value + '"]';
- }
-
- var self = this;
- if (tag != 'del')
- {
- this.$editor.find('del').each(function(i,s)
- {
- self.utils.replaceToTag(s, 'inline');
- });
- }
-
- if (tag != 'span')
- {
- this.$editor.find(tag).each(function()
- {
- var $el = $(this);
- $el.replaceWith($('<strike />').html($el.contents()));
-
- });
- }
-
- this.$editor.find('[data-redactor-tag="' + tag + '"]' + find).each(function()
- {
- if (find === '' && tag == 'span' && this.tagName.toLowerCase() == tag) return;
-
- var $el = $(this);
- $el.replaceWith($('<strike />').html($el.contents()));
-
- });
-
- this.selection.restore();
- },
- setFormat: function(node)
- {
- switch (this.inline.type)
- {
- case 'class':
-
- if (node.hasClass(this.inline.value))
- {
- node.removeClass(this.inline.value);
- node.removeAttr('data-redactor-class');
- }
- else
- {
- node.addClass(this.inline.value);
- node.attr('data-redactor-class', this.inline.value);
- }
-
-
- break;
- case 'style':
-
- node[0].style.cssText = this.inline.value;
- node.attr('data-redactor-style', this.inline.value);
-
- break;
- }
-
- return node;
- },
- removeStyle: function()
- {
- this.buffer.set();
- var current = this.selection.getCurrent();
- var nodes = this.selection.getInlines();
-
- this.selection.save();
-
- if (current && current.tagName === 'SPAN')
- {
- var $s = $(current);
-
- $s.removeAttr('style');
- if ($s[0].attributes.length === 0)
- {
- $s.replaceWith($s.contents());
- }
- }
-
- $.each(nodes, $.proxy(function(i,s)
- {
- var $s = $(s);
- if ($.inArray(s.tagName.toLowerCase(), this.opts.inlineTags) != -1 && !$s.hasClass('redactor-selection-marker'))
- {
- $s.removeAttr('style');
- if ($s[0].attributes.length === 0)
- {
- $s.replaceWith($s.contents());
- }
- }
- }, this));
-
- this.selection.restore();
- this.code.sync();
-
- },
- removeStyleRule: function(name)
- {
- this.buffer.set();
- var parent = this.selection.getParent();
- var nodes = this.selection.getInlines();
-
- this.selection.save();
-
- if (parent && parent.tagName === 'SPAN')
- {
- var $s = $(parent);
-
- $s.css(name, '');
- this.utils.removeEmptyAttr($s, 'style');
- if ($s[0].attributes.length === 0)
- {
- $s.replaceWith($s.contents());
- }
- }
-
- $.each(nodes, $.proxy(function(i,s)
- {
- var $s = $(s);
- if ($.inArray(s.tagName.toLowerCase(), this.opts.inlineTags) != -1 && !$s.hasClass('redactor-selection-marker'))
- {
- $s.css(name, '');
- this.utils.removeEmptyAttr($s, 'style');
- if ($s[0].attributes.length === 0)
- {
- $s.replaceWith($s.contents());
- }
- }
- }, this));
-
- this.selection.restore();
- this.code.sync();
- },
- removeFormat: function()
- {
- this.buffer.set();
- var current = this.selection.getCurrent();
-
- this.selection.save();
-
- document.execCommand('removeFormat');
-
- if (current && current.tagName === 'SPAN')
- {
- $(current).replaceWith($(current).contents());
- }
-
-
- $.each(this.selection.getNodes(), $.proxy(function(i,s)
- {
- var $s = $(s);
- if ($.inArray(s.tagName.toLowerCase(), this.opts.inlineTags) != -1 && !$s.hasClass('redactor-selection-marker'))
- {
- $s.replaceWith($s.contents());
- }
- }, this));
-
- this.selection.restore();
- this.code.sync();
-
- },
- toggleClass: function(className)
- {
- this.inline.format('span', 'class', className);
- },
- toggleStyle: function(value)
- {
- this.inline.format('span', 'style', value);
- }
- };
- },
- insert: function()
- {
- return {
- set: function(html, clean)
- {
- this.placeholder.remove();
-
- html = this.clean.setVerified(html);
-
- if (typeof clean == 'undefined')
- {
- html = this.clean.onPaste(html, false);
- }
-
- this.$editor.html(html);
- this.selection.remove();
- this.focus.setEnd();
- this.clean.normalizeLists();
- this.code.sync();
- this.observe.load();
-
- if (typeof clean == 'undefined')
- {
- setTimeout($.proxy(this.clean.clearUnverified, this), 10);
- }
- },
- text: function(text)
- {
- this.placeholder.remove();
-
- text = text.toString();
- text = $.trim(text);
- text = this.clean.getPlainText(text, false);
-
- this.$editor.focus();
-
- if (this.utils.browser('msie'))
- {
- this.insert.htmlIe(text);
- }
- else
- {
- this.selection.get();
-
- this.range.deleteContents();
- var el = document.createElement("div");
- el.innerHTML = text;
- var frag = document.createDocumentFragment(), node, lastNode;
- while ((node = el.firstChild))
- {
- lastNode = frag.appendChild(node);
- }
-
- this.range.insertNode(frag);
-
- if (lastNode)
- {
- var range = this.range.cloneRange();
- range.setStartAfter(lastNode);
- range.collapse(true);
- this.sel.removeAllRanges();
- this.sel.addRange(range);
- }
- }
-
- this.code.sync();
- this.clean.clearUnverified();
- },
- htmlWithoutClean: function(html)
- {
- this.insert.html(html, false);
- },
- html: function(html, clean)
- {
- this.placeholder.remove();
-
- if (typeof clean == 'undefined') clean = true;
-
- this.$editor.focus();
-
- html = this.clean.setVerified(html);
-
- if (clean)
- {
- html = this.clean.onPaste(html);
- }
-
- if (this.utils.browser('msie'))
- {
- this.insert.htmlIe(html);
- }
- else
- {
- if (this.clean.singleLine) this.insert.execHtml(html);
- else document.execCommand('insertHTML', false, html);
-
- this.insert.htmlFixMozilla();
-
- }
-
- this.clean.normalizeLists();
-
- // remove empty paragraphs finaly
- if (!this.opts.linebreaks)
- {
- this.$editor.find('p').each($.proxy(this.utils.removeEmpty, this));
- }
-
- this.code.sync();
- this.observe.load();
-
- if (clean)
- {
- this.clean.clearUnverified();
- }
-
- },
- htmlFixMozilla: function()
- {
- // FF inserts empty p when content was selected dblclick
- if (!this.utils.browser('mozilla')) return;
-
- var $next = $(this.selection.getBlock()).next();
- if ($next.length > 0 && $next[0].tagName == 'P' && $next.html() === '')
- {
- $next.remove();
- }
-
- },
- htmlIe: function(html)
- {
- if (this.utils.isIe11())
- {
- var parent = this.utils.isCurrentOrParent('P');
- var $html = $('<div>').append(html);
- var blocksMatch = $html.contents().is('p, :header, dl, ul, ol, div, table, td, blockquote, pre, address, section, header, footer, aside, article');
-
- if (parent && blocksMatch) this.insert.ie11FixInserting(parent, html);
- else this.insert.ie11PasteFrag(html);
-
- return;
- }
-
- document.selection.createRange().pasteHTML(html);
-
- },
- execHtml: function(html)
- {
- html = this.clean.setVerified(html);
-
- this.selection.get();
-
- this.range.deleteContents();
-
- var el = document.createElement('div');
- el.innerHTML = html;
-
- var frag = document.createDocumentFragment(), node, lastNode;
- while ((node = el.firstChild))
- {
- lastNode = frag.appendChild(node);
- }
-
- this.range.insertNode(frag);
-
- this.range.collapse(true);
- this.caret.setAfter(lastNode);
-
- },
- node: function(node, deleteContents)
- {
- node = node[0] || node;
-
- var html = this.utils.getOuterHtml(node);
- html = this.clean.setVerified(html);
-
- if (html.match(/</g) !== null)
- {
- node = $(html)[0];
- }
-
- this.selection.get();
-
- if (deleteContents !== false)
- {
- this.range.deleteContents();
- }
-
- this.range.insertNode(node);
- this.range.collapse(false);
- this.selection.addRange();
-
- return node;
- },
- nodeToPoint: function(node, x, y)
- {
- node = node[0] || node;
-
- this.selection.get();
-
- var range;
- if (document.caretPositionFromPoint)
- {
- var pos = document.caretPositionFromPoint(x, y);
-
- this.range.setStart(pos.offsetNode, pos.offset);
- this.range.collapse(true);
- this.range.insertNode(node);
- }
- else if (document.caretRangeFromPoint)
- {
- range = document.caretRangeFromPoint(x, y);
- range.insertNode(node);
- }
- else if (typeof document.body.createTextRange != "undefined")
- {
- range = document.body.createTextRange();
- range.moveToPoint(x, y);
- var endRange = range.duplicate();
- endRange.moveToPoint(x, y);
- range.setEndPoint("EndToEnd", endRange);
- range.select();
- }
- },
- nodeToCaretPositionFromPoint: function(e, node)
- {
- node = node[0] || node;
-
- var range;
- var x = e.clientX, y = e.clientY;
- if (document.caretPositionFromPoint)
- {
- var pos = document.caretPositionFromPoint(x, y);
- var sel = document.getSelection();
- range = sel.getRangeAt(0);
- range.setStart(pos.offsetNode, pos.offset);
- range.collapse(true);
- range.insertNode(node);
- }
- else if (document.caretRangeFromPoint)
- {
- range = document.caretRangeFromPoint(x, y);
- range.insertNode(node);
- }
- else if (typeof document.body.createTextRange != "undefined")
- {
- range = document.body.createTextRange();
- range.moveToPoint(x, y);
- var endRange = range.duplicate();
- endRange.moveToPoint(x, y);
- range.setEndPoint("EndToEnd", endRange);
- range.select();
- }
-
- },
- ie11FixInserting: function(parent, html)
- {
- var node = document.createElement('span');
- node.className = 'redactor-ie-paste';
- this.insert.node(node);
-
- var parHtml = $(parent).html();
-
- parHtml = '<p>' + parHtml.replace(/<span class="redactor-ie-paste"><\/span>/gi, '</p>' + html + '<p>') + '</p>';
- $(parent).replaceWith(parHtml);
- },
- ie11PasteFrag: function(html)
- {
- this.selection.get();
- this.range.deleteContents();
-
- var el = document.createElement("div");
- el.innerHTML = html;
-
- var frag = document.createDocumentFragment(), node, lastNode;
- while ((node = el.firstChild))
- {
- lastNode = frag.appendChild(node);
- }
-
- this.range.insertNode(frag);
- this.range.collapse(false);
- this.selection.addRange();
- }
- };
- },
- keydown: function()
- {
- return {
- init: function(e)
- {
- if (this.rtePaste) return;
-
- var key = e.which;
- var arrow = (key >= 37 && key <= 40);
-
- this.keydown.ctrl = e.ctrlKey || e.metaKey;
- this.keydown.current = this.selection.getCurrent();
- this.keydown.parent = this.selection.getParent();
- this.keydown.block = this.selection.getBlock();
-
- // detect tags
- this.keydown.pre = this.utils.isTag(this.keydown.current, 'pre');
- this.keydown.blockquote = this.utils.isTag(this.keydown.current, 'blockquote');
- this.keydown.figcaption = this.utils.isTag(this.keydown.current, 'figcaption');
-
- // shortcuts setup
- this.shortcuts.init(e, key);
-
- this.keydown.checkEvents(arrow, key);
- this.keydown.setupBuffer(e, key);
- this.keydown.addArrowsEvent(arrow);
- this.keydown.setupSelectAll(e, key);
-
- // callback
- var keydownStop = this.core.setCallback('keydown', e);
- if (keydownStop === false)
- {
- e.preventDefault();
- return false;
- }
-
- // ie and ff exit from table
- if (this.opts.enterKey && (this.utils.browser('msie') || this.utils.browser('mozilla')) && (key === this.keyCode.DOWN || key === this.keyCode.RIGHT))
- {
- var isEndOfTable = false;
- var $table = false;
- if (this.keydown.block && this.keydown.block.tagName === 'TD')
- {
- $table = $(this.keydown.block).closest('table', this.$editor[0]);
- }
-
- if ($table && $table.find('td').last()[0] === this.keydown.block)
- {
- isEndOfTable = true;
- }
-
- if (this.utils.isEndOfElement() && isEndOfTable)
- {
- var node = $(this.opts.emptyHtml);
- $table.after(node);
- this.caret.setStart(node);
- }
- }
-
- // down
- if (this.opts.enterKey && key === this.keyCode.DOWN)
- {
- this.keydown.onArrowDown();
- }
-
- // turn off enter key
- if (!this.opts.enterKey && key === this.keyCode.ENTER)
- {
- e.preventDefault();
- // remove selected
- if (!this.range.collapsed) this.range.deleteContents();
- return;
- }
-
- // on enter
- if (key == this.keyCode.ENTER && !e.shiftKey && !e.ctrlKey && !e.metaKey)
- {
- var stop = this.core.setCallback('enter', e);
- if (stop === false)
- {
- e.preventDefault();
- return false;
- }
-
- if (this.keydown.blockquote && this.keydown.exitFromBlockquote(e) === true)
- {
- return false;
- }
-
- var current, $next;
- if (this.keydown.pre)
- {
- return this.keydown.insertNewLine(e);
- }
- else if (this.keydown.blockquote || this.keydown.figcaption)
- {
- current = this.selection.getCurrent();
- $next = $(current).next();
-
- if ($next.length !== 0 && $next[0].tagName == 'BR')
- {
- return this.keydown.insertBreakLine(e);
- }
- else if (this.utils.isEndOfElement() && (current && current != 'SPAN'))
- {
- return this.keydown.insertDblBreakLine(e);
- }
- else
- {
- return this.keydown.insertBreakLine(e);
- }
- }
- else if (this.opts.linebreaks && !this.keydown.block)
- {
- current = this.selection.getCurrent();
- $next = $(this.keydown.current).next();
-
- if ($next.length !== 0 && $next[0].tagName == 'BR')
- {
- return this.keydown.insertBreakLine(e);
- }
- else if (current !== false && $(current).hasClass('redactor-invisible-space'))
- {
- this.caret.setAfter(current);
- $(current).contents().unwrap();
-
- return this.keydown.insertDblBreakLine(e);
- }
- else
- {
- if (this.utils.isEndOfEditor())
- {
- return this.keydown.insertDblBreakLine(e);
- }
- else if ($next.length === 0 && current === false && typeof $next.context != 'undefined')
- {
- return this.keydown.insertBreakLine(e);
- }
-
- return this.keydown.insertBreakLine(e);
- }
- }
- else if (this.opts.linebreaks && this.keydown.block)
- {
- setTimeout($.proxy(this.keydown.replaceDivToBreakLine, this), 1);
- }
- // paragraphs
- else if (!this.opts.linebreaks && this.keydown.block)
- {
- if (this.keydown.block.tagName !== 'LI')
- {
- setTimeout($.proxy(this.keydown.replaceDivToParagraph, this), 1);
- }
- else
- {
- current = this.selection.getCurrent();
- var $parent = $(current).closest('li', this.$editor[0]);
- var $list = $parent.closest('ul,ol', this.$editor[0]);
-
- if ($parent.length !== 0 && this.utils.isEmpty($parent.html()) && $list.next().length === 0 && this.utils.isEmpty($list.find("li").last().html()))
- {
- $list.find("li").last().remove();
-
- var node = $(this.opts.emptyHtml);
- $list.after(node);
- this.caret.setStart(node);
-
- return false;
- }
- }
- }
- else if (!this.opts.linebreaks && !this.keydown.block)
- {
- return this.keydown.insertParagraph(e);
- }
- }
-
- // Shift+Enter or Ctrl+Enter
- if (key === this.keyCode.ENTER && (e.ctrlKey || e.shiftKey))
- {
- return this.keydown.onShiftEnter(e);
- }
-
-
- // tab or cmd + [
- if (key === this.keyCode.TAB || e.metaKey && key === 221 || e.metaKey && key === 219)
- {
- return this.keydown.onTab(e, key);
- }
-
- // image delete and backspace
- if (key === this.keyCode.BACKSPACE || key === this.keyCode.DELETE)
- {
- if (this.utils.browser('mozilla') && this.keydown.current && this.keydown.current.tagName === 'TD')
- {
- e.preventDefault();
- return false;
- }
-
- var nodes = this.selection.getNodes();
- if (nodes)
- {
- var len = nodes.length;
- var last;
- for (var i = 0; i < len; i++)
- {
- var children = $(nodes[i]).children('img');
- if (children.length !== 0)
- {
- var self = this;
- $.each(children, function(z,s)
- {
- var $s = $(s);
- if ($s.css('float') != 'none') return;
-
- // image delete callback
- self.core.setCallback('imageDelete', s.src, $s);
- last = s;
- });
- }
- else if (nodes[i].tagName == 'IMG')
- {
- if (last != nodes[i])
- {
- // image delete callback
- this.core.setCallback('imageDelete', nodes[i].src, $(nodes[i]));
- last = nodes[i];
- }
- }
- }
- }
- }
-
- // backspace
- if (key === this.keyCode.BACKSPACE)
- {
- this.keydown.removeInvisibleSpace();
- this.keydown.removeEmptyListInTable(e);
- }
-
- this.code.sync();
- },
- checkEvents: function(arrow, key)
- {
- if (!arrow && (this.core.getEvent() == 'click' || this.core.getEvent() == 'arrow'))
- {
- this.core.addEvent(false);
-
- if (this.keydown.checkKeyEvents(key))
- {
- this.buffer.set();
- }
- }
- },
- checkKeyEvents: function(key)
- {
- var k = this.keyCode;
- var keys = [k.BACKSPACE, k.DELETE, k.ENTER, k.SPACE, k.ESC, k.TAB, k.CTRL, k.META, k.ALT, k.SHIFT];
-
- return ($.inArray(key, keys) == -1) ? true : false;
-
- },
- addArrowsEvent: function(arrow)
- {
- if (!arrow) return;
-
- if ((this.core.getEvent() == 'click' || this.core.getEvent() == 'arrow'))
- {
- this.core.addEvent(false);
- return;
- }
-
- this.core.addEvent('arrow');
- },
- setupBuffer: function(e, key)
- {
- if (this.keydown.ctrl && key === 90 && !e.shiftKey && !e.altKey && this.opts.buffer.length) // z key
- {
- e.preventDefault();
- this.buffer.undo();
- return;
- }
- // undo
- else if (this.keydown.ctrl && key === 90 && e.shiftKey && !e.altKey && this.opts.rebuffer.length !== 0)
- {
- e.preventDefault();
- this.buffer.redo();
- return;
- }
- else if (!this.keydown.ctrl)
- {
- if (key == this.keyCode.BACKSPACE || key == this.keyCode.DELETE || (key == this.keyCode.ENTER && !e.ctrlKey && !e.shiftKey) || key == this.keyCode.SPACE)
- {
- this.buffer.set();
- }
- }
- },
- setupSelectAll: function(e, key)
- {
- if (this.keydown.ctrl && key === 65)
- {
- this.utils.enableSelectAll();
- }
- else if (key != this.keyCode.LEFT_WIN && !this.keydown.ctrl)
- {
- this.utils.disableSelectAll();
- }
- },
- onArrowDown: function()
- {
- var tags = [this.keydown.blockquote, this.keydown.pre, this.keydown.figcaption];
-
- for (var i = 0; i < tags.length; i++)
- {
- if (tags[i])
- {
- this.keydown.insertAfterLastElement(tags[i]);
- return false;
- }
- }
- },
- onShiftEnter: function(e)
- {
- this.buffer.set();
-
- if (this.utils.isEndOfElement())
- {
- return this.keydown.insertDblBreakLine(e);
- }
-
- return this.keydown.insertBreakLine(e);
- },
- onTab: function(e, key)
- {
- if (!this.opts.tabKey) return true;
- if (this.utils.isEmpty(this.code.get()) && this.opts.tabAsSpaces === false) return true;
-
- e.preventDefault();
-
- var node;
- if (this.keydown.pre && !e.shiftKey)
- {
- node = (this.opts.preSpaces) ? document.createTextNode(Array(this.opts.preSpaces + 1).join('\u00a0')) : document.createTextNode('\t');
- this.insert.node(node);
- this.code.sync();
- }
- else if (this.opts.tabAsSpaces !== false)
- {
- node = document.createTextNode(Array(this.opts.tabAsSpaces + 1).join('\u00a0'));
- this.insert.node(node);
- this.code.sync();
- }
- else
- {
- if (e.metaKey && key === 219) this.indent.decrease();
- else if (e.metaKey && key === 221) this.indent.increase();
- else if (!e.shiftKey) this.indent.increase();
- else this.indent.decrease();
- }
-
- return false;
- },
- replaceDivToBreakLine: function()
- {
- var blockElem = this.selection.getBlock();
- var blockHtml = blockElem.innerHTML.replace(/<br\s?\/?>/gi, '');
- if ((blockElem.tagName === 'DIV' || blockElem.tagName === 'P') && blockHtml === '' && !$(blockElem).hasClass('redactor-editor'))
- {
- var br = document.createElement('br');
-
- $(blockElem).replaceWith(br);
- this.caret.setBefore(br);
-
- this.code.sync();
-
- return false;
- }
- },
- replaceDivToParagraph: function()
- {
- var blockElem = this.selection.getBlock();
- var blockHtml = blockElem.innerHTML.replace(/<br\s?\/?>/gi, '');
- if (blockElem.tagName === 'DIV' && blockHtml === '' && !$(blockElem).hasClass('redactor-editor'))
- {
- var p = document.createElement('p');
- p.innerHTML = this.opts.invisibleSpace;
-
- $(blockElem).replaceWith(p);
- this.caret.setStart(p);
-
- this.code.sync();
-
- return false;
- }
- else if (this.opts.cleanStyleOnEnter && blockElem.tagName == 'P')
- {
- $(blockElem).removeAttr('class').removeAttr('style');
- }
- },
- insertParagraph: function(e)
- {
- e.preventDefault();
-
- this.selection.get();
-
- var p = document.createElement('p');
- p.innerHTML = this.opts.invisibleSpace;
-
- this.range.deleteContents();
- this.range.insertNode(p);
-
- this.caret.setStart(p);
-
- this.code.sync();
-
- return false;
- },
- exitFromBlockquote: function(e)
- {
- if (!this.utils.isEndOfElement()) return;
-
- var tmp = $.trim($(this.keydown.block).html());
- if (tmp.search(/(<br\s?\/?>){2}$/i) != -1)
- {
- e.preventDefault();
-
- if (this.opts.linebreaks)
- {
- var br = document.createElement('br');
- $(this.keydown.blockquote).after(br);
-
- this.caret.setBefore(br);
- $(this.keydown.block).html(tmp.replace(/<br\s?\/?>$/i, ''));
- }
- else
- {
- var node = $(this.opts.emptyHtml);
- $(this.keydown.blockquote).after(node);
- this.caret.setStart(node);
- }
-
- return true;
-
- }
-
- return;
-
- },
- insertAfterLastElement: function(element)
- {
- if (!this.utils.isEndOfElement()) return;
-
- this.buffer.set();
-
- if (this.opts.linebreaks)
- {
- var contents = $('<div>').append($.trim(this.$editor.html())).contents();
- var last = contents.last()[0];
- if (last.tagName == 'SPAN' && last.innerHTML === '')
- {
- last = contents.prev()[0];
- }
-
- if (this.utils.getOuterHtml(last) != this.utils.getOuterHtml(element)) return;
-
- var br = document.createElement('br');
- $(element).after(br);
- this.caret.setAfter(br);
-
- }
- else
- {
- if (this.$editor.contents().last()[0] !== element) return;
-
- var node = $(this.opts.emptyHtml);
- $(element).after(node);
- this.caret.setStart(node);
- }
- },
- insertNewLine: function(e)
- {
- e.preventDefault();
-
- var node = document.createTextNode('\n');
-
- this.selection.get();
-
- this.range.deleteContents();
- this.range.insertNode(node);
-
- this.caret.setAfter(node);
-
- this.code.sync();
-
- return false;
- },
- insertBreakLine: function(e)
- {
- return this.keydown.insertBreakLineProcessing(e);
- },
- insertDblBreakLine: function(e)
- {
- return this.keydown.insertBreakLineProcessing(e, true);
- },
- insertBreakLineProcessing: function(e, dbl)
- {
- e.stopPropagation();
-
- this.selection.get();
-
- var br1 = document.createElement('br');
-
- if (this.utils.browser('msie'))
- {
- this.range.collapse(false);
- this.range.setEnd(this.range.endContainer, this.range.endOffset);
- }
- else
- {
- this.range.deleteContents();
- }
-
- this.range.insertNode(br1);
-
- // move br outside A tag
- var $parentA = $(br1).parent("a");
-
- if ($parentA.length > 0)
- {
- $parentA.find(br1)
- .remove();
-
- $parentA.after(br1);
- }
-
- if (dbl === true)
- {
- var $next = $(br1).next();
- if ($next.length !== 0 && $next[0].tagName === 'BR' && this.utils.isEndOfEditor())
- {
- this.caret.setAfter(br1);
- this.code.sync();
- return false;
- }
-
- var br2 = document.createElement('br');
-
- this.range.insertNode(br2);
- this.caret.setAfter(br2);
- }
- else
- {
- this.keydown.insertBreakLineProcessingAfter(br1);
- }
-
- this.code.sync();
- return false;
- },
- insertBreakLineProcessingAfter: function(node)
- {
- var space = this.utils.createSpaceElement();
- $(node).after(space);
- this.selection.selectElement(space);
-
- $(space).replaceWith(function()
- {
- return $(this).contents();
- });
- },
- removeInvisibleSpace: function()
- {
- var $current = $(this.keydown.current);
- if ($current.text().search(/^\u200B$/g) === 0)
- {
- $current.remove();
- }
- },
- removeEmptyListInTable: function(e)
- {
- var $current = $(this.keydown.current);
- var $parent = $(this.keydown.parent);
- var td = $current.closest('td', this.$editor[0]);
-
- if (td.length !== 0 && $current.closest('li', this.$editor[0]) && $parent.children('li').length === 1)
- {
- if (!this.utils.isEmpty($current.text())) return;
-
- e.preventDefault();
-
- $current.remove();
- $parent.remove();
-
- this.caret.setStart(td);
- }
- }
- };
- },
- keyup: function()
- {
- return {
- init: function(e)
- {
- if (this.rtePaste) return;
-
- var key = e.which;
-
- this.keyup.current = this.selection.getCurrent();
- this.keyup.parent = this.selection.getParent();
- var $parent = this.utils.isRedactorParent($(this.keyup.parent).parent());
-
- // callback
- var keyupStop = this.core.setCallback('keyup', e);
- if (keyupStop === false)
- {
- e.preventDefault();
- return false;
- }
-
- // replace to p before / after the table or body
- if (!this.opts.linebreaks && this.keyup.current.nodeType == 3 && this.keyup.current.length <= 1 && (this.keyup.parent === false || this.keyup.parent.tagName == 'BODY'))
- {
- this.keyup.replaceToParagraph();
- }
-
- // replace div after lists
- if (!this.opts.linebreaks && this.utils.isRedactorParent(this.keyup.current) && this.keyup.current.tagName === 'DIV')
- {
- this.keyup.replaceToParagraph(false);
- }
-
-
- if (!this.opts.linebreaks && $(this.keyup.parent).hasClass('redactor-invisible-space') && ($parent === false || $parent[0].tagName == 'BODY'))
- {
- $(this.keyup.parent).contents().unwrap();
- this.keyup.replaceToParagraph();
- }
-
- // linkify
- if (this.linkify.isEnabled() && this.linkify.isKey(key))
- this.linkify.format();
-
- if (key === this.keyCode.DELETE || key === this.keyCode.BACKSPACE)
- {
- // clear unverified
- this.clean.clearUnverified();
-
- if (this.observe.image)
- {
- e.preventDefault();
-
- this.image.hideResize();
-
- this.buffer.set();
- this.image.remove(this.observe.image);
- this.observe.image = false;
-
- return false;
- }
-
- // remove empty paragraphs
- this.$editor.find('p').each($.proxy(function(i, s)
- {
- this.utils.removeEmpty(i, $(s).html());
- }, this));
-
- // remove invisible space
- if (this.opts.linebreaks && this.keyup.current && this.keyup.current.tagName == 'DIV' && this.utils.isEmpty(this.keyup.current.innerHTML))
- {
- $(this.keyup.current).after(this.selection.getMarkerAsHtml());
- this.selection.restore();
- $(this.keyup.current).remove();
- }
-
- // if empty
- return this.keyup.formatEmpty(e);
- }
- },
- replaceToParagraph: function(clone)
- {
- var $current = $(this.keyup.current);
-
- var node;
- if (clone === false)
- {
- node = $('<p>').append($current.html());
- }
- else
- {
- node = $('<p>').append($current.clone());
- }
-
- $current.replaceWith(node);
- var next = $(node).next();
- if (typeof(next[0]) !== 'undefined' && next[0].tagName == 'BR')
- {
- next.remove();
- }
-
- this.caret.setEnd(node);
- },
- formatEmpty: function(e)
- {
- var html = $.trim(this.$editor.html());
-
- if (!this.utils.isEmpty(html)) return;
-
- e.preventDefault();
-
- if (this.opts.linebreaks)
- {
- this.$editor.html(this.selection.getMarkerAsHtml());
- this.selection.restore();
- }
- else
- {
- html = '<p><br /></p>';
-
- this.$editor.html(html);
- this.focus.setStart();
- }
-
- this.code.sync();
-
- return false;
- }
- };
- },
- lang: function()
- {
- return {
- load: function()
- {
- this.opts.curLang = this.opts.langs[this.opts.lang];
- },
- get: function(name)
- {
- return (typeof this.opts.curLang[name] != 'undefined') ? this.opts.curLang[name] : '';
- }
- };
- },
- line: function()
- {
- return {
- insert: function()
- {
- this.buffer.set();
-
- var blocks = this.selection.getBlocks();
- if (blocks[0] !== false && this.line.isExceptLastOrFirst(blocks))
- {
- if (!this.utils.browser('msie')) this.$editor.focus();
- return;
- }
-
- if (this.utils.browser('msie'))
- {
- this.line.insertInIe();
- }
- else
- {
- this.line.insertInOthersBrowsers();
- }
- },
- isExceptLastOrFirst: function(blocks)
- {
- var exceptTags = ['li', 'td', 'th', 'blockquote', 'figcaption', 'pre', 'dl', 'dt', 'dd'];
-
- var first = blocks[0].tagName.toLowerCase();
- var last = this.selection.getLastBlock();
-
- last = (typeof last == 'undefined') ? first : last.tagName.toLowerCase();
-
- var firstFound = $.inArray(first, exceptTags) != -1;
- var lastFound = $.inArray(last, exceptTags) != -1;
-
- if ((firstFound && lastFound) || firstFound)
- {
- return true;
- }
- },
- insertInIe: function()
- {
- this.utils.saveScroll();
- this.buffer.set();
-
- this.insert.node(document.createElement('hr'));
-
- this.utils.restoreScroll();
- this.code.sync();
- },
- insertInOthersBrowsers: function()
- {
- this.buffer.set();
-
- var extra = '<p id="redactor-insert-line"><br /></p>';
- if (this.opts.linebreaks) extra = '<br id="redactor-insert-line">';
-
- document.execCommand('insertHTML', false, '<hr>' + extra);
-
- this.line.setFocus();
- this.code.sync();
- },
- setFocus: function()
- {
- var node = this.$editor.find('#redactor-insert-line');
- var next = $(node).next()[0];
-
- if (next)
- {
- this.caret.setAfter(node);
- node.remove();
- }
- else
- {
- node.removeAttr('id');
- }
- }
- };
- },
- link: function()
- {
- return {
- show: function(e)
- {
- if (typeof e != 'undefined' && e.preventDefault) e.preventDefault();
-
- this.modal.load('link', this.lang.get('link_insert'), 600);
-
- this.modal.createCancelButton();
- this.link.buttonInsert = this.modal.createActionButton(this.lang.get('insert'));
-
- this.selection.get();
-
- this.link.getData();
- this.link.cleanUrl();
-
- if (this.link.target == '_blank') $('#redactor-link-blank').prop('checked', true);
-
- this.link.$inputUrl = $('#redactor-link-url');
- this.link.$inputText = $('#redactor-link-url-text');
-
- this.link.$inputText.val(this.link.text);
- this.link.$inputUrl.val(this.link.url);
-
- this.link.buttonInsert.on('click', $.proxy(this.link.insert, this));
-
- // hide link's tooltip
- $('.redactor-link-tooltip').remove();
-
- // show modal
- this.selection.save();
- this.modal.show();
- this.link.$inputUrl.focus();
- },
- cleanUrl: function()
- {
- var thref = self.location.href.replace(/\/$/i, '');
-
- if (typeof this.link.url !== "undefined")
- {
- this.link.url = this.link.url.replace(thref, '');
- this.link.url = this.link.url.replace(/^\/#/, '#');
- this.link.url = this.link.url.replace('mailto:', '');
-
- // remove host from href
- if (!this.opts.linkProtocol)
- {
- var re = new RegExp('^(http|ftp|https)://' + self.location.host, 'i');
- this.link.url = this.link.url.replace(re, '');
- }
- }
- },
- getData: function()
- {
- this.link.$node = false;
-
- var $el = $(this.selection.getCurrent()).closest('a', this.$editor[0]);
- if ($el.length !== 0 && $el[0].tagName === 'A')
- {
- this.link.$node = $el;
-
- this.link.url = $el.attr('href');
- this.link.text = $el.text();
- this.link.target = $el.attr('target');
- }
- else
- {
- this.link.text = this.sel.toString();
- this.link.url = '';
- this.link.target = '';
- }
-
- },
- insert: function()
- {
- this.placeholder.remove();
-
- var target = '';
- var link = this.link.$inputUrl.val();
- var text = this.link.$inputText.val();
-
- if ($.trim(link) === '')
- {
- this.link.$inputUrl.addClass('redactor-input-error').on('keyup', function()
- {
- $(this).removeClass('redactor-input-error');
- $(this).off('keyup');
-
- });
-
- return;
- }
-
- // mailto
- if (link.search('@') != -1 && /(http|ftp|https):\/\//i.test(link) === false)
- {
- link = 'mailto:' + link;
- }
- // url, not anchor
- else if (link.search('#') !== 0)
- {
- if ($('#redactor-link-blank').prop('checked'))
- {
- target = '_blank';
- }
-
- // test url (add protocol)
- var pattern = '((xn--)?[a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}';
- var re = new RegExp('^(http|ftp|https)://' + pattern, 'i');
- var re2 = new RegExp('^' + pattern, 'i');
- var re3 = new RegExp('\.(html|php)$', 'i');
- if (link.search(re) == -1 && link.search(re3) == -1 && link.search(re2) === 0 && this.opts.linkProtocol)
- {
- link = this.opts.linkProtocol + '://' + link;
- }
- }
-
- this.link.set(text, link, target);
- this.modal.close();
- },
- set: function(text, link, target)
- {
- text = $.trim(text.replace(/<|>/g, ''));
-
- this.selection.restore();
-
- if (text === '' && link === '') return;
- if (text === '' && link !== '') text = link;
-
- if (this.link.$node)
- {
- this.buffer.set();
-
- var $link = this.link.$node,
- $el = $link.children();
-
- if ($el.length > 0)
- {
- while ($el.length)
- {
- $el = $el.children();
- }
-
- $el = $el.end();
- }
- else
- {
- $el = $link;
- }
-
- $link.attr('href', link);
- $el.text(text);
-
- if (target !== '')
- {
- $link.attr('target', target);
- }
- else
- {
- $link.removeAttr('target');
- }
-
- this.selection.selectElement($link);
-
- this.code.sync();
- }
- else
- {
- if (this.utils.browser('mozilla') && this.link.text === '')
- {
- var $a = $('<a />').attr('href', link).text(text);
- if (target !== '') $a.attr('target', target);
-
- this.insert.node($a);
- this.selection.selectElement($a);
- }
- else
- {
- var $a;
- if (this.utils.browser('msie'))
- {
- $a = $('<a href="' + link + '">').text(text);
- if (target !== '') $a.attr('target', target);
-
- $a = $(this.insert.node($a));
-
- if (this.selection.getText().match(/\s$/))
- {
- $a.after(" ");
- }
-
- this.selection.selectElement($a);
- }
- else
- {
- document.execCommand('createLink', false, link);
-
- $a = $(this.selection.getCurrent()).closest('a', this.$editor[0]);
- if (this.utils.browser('mozilla'))
- {
- $a = $('a[_moz_dirty=""]');
- }
-
- if (target !== '') $a.attr('target', target);
- $a.removeAttr('style').removeAttr('_moz_dirty');
-
- if (this.selection.getText().match(/\s$/))
- {
- $a.after(" ");
- }
-
- if (this.link.text !== '' || this.link.text != text)
- {
- $a.text(text);
-
- this.selection.selectElement($a);
- }
- }
- }
-
- this.code.sync();
- this.core.setCallback('insertedLink', $a);
-
- }
-
- // link tooltip
- setTimeout($.proxy(function()
- {
- this.observe.links();
-
- }, this), 5);
- },
- unlink: function(e)
- {
- if (typeof e != 'undefined' && e.preventDefault)
- {
- e.preventDefault();
- }
-
- var nodes = this.selection.getNodes();
- if (!nodes) return;
-
- this.buffer.set();
-
- var len = nodes.length;
- for (var i = 0; i < len; i++)
- {
- var $node = $(nodes[i]).closest('a', this.$editor[0]);
- $node.replaceWith($node.contents());
- }
-
- // hide link's tooltip
- $('.redactor-link-tooltip').remove();
-
- this.code.sync();
-
- },
- toggleClass: function(className)
- {
- this.link.setClass(className, 'toggleClass');
- },
- addClass: function(className)
- {
- this.link.setClass(className, 'addClass');
- },
- removeClass: function(className)
- {
- this.link.setClass(className, 'removeClass');
- },
- setClass: function(className, func)
- {
- var links = this.selection.getInlinesTags(['a']);
- if (links === false) return;
-
- $.each(links, function()
- {
- $(this)[func](className);
- });
- }
- };
- },
- list: function()
- {
- return {
- toggle: function(cmd)
- {
- this.placeholder.remove();
- if (!this.utils.browser('msie')) this.$editor.focus();
-
- this.buffer.set();
- this.selection.save();
-
- var parent = this.selection.getParent();
- var $list = $(parent).closest('ol, ul', this.$editor[0]);
-
- if (!this.utils.isRedactorParent($list) && $list.length !== 0)
- {
- $list = false;
- }
-
- var isUnorderedCmdOrdered, isOrderedCmdUnordered;
- var remove = false;
- if ($list && $list.length)
- {
- remove = true;
- var listTag = $list[0].tagName;
-
- isUnorderedCmdOrdered = (cmd === 'orderedlist' && listTag === 'UL');
- isOrderedCmdUnordered = (cmd === 'unorderedlist' && listTag === 'OL');
- }
-
- if (isUnorderedCmdOrdered)
- {
- this.utils.replaceToTag($list, 'ol');
- }
- else if (isOrderedCmdUnordered)
- {
- this.utils.replaceToTag($list, 'ul');
- }
- else
- {
- if (remove)
- {
- this.list.remove(cmd);
- }
- else
- {
- this.list.insert(cmd);
- }
- }
-
- this.selection.restore();
- this.code.sync();
- },
- insert: function(cmd)
- {
- var parent = this.selection.getParent();
- var current = this.selection.getCurrent();
- var $td = $(current).closest('td, th', this.$editor[0]);
-
- if (this.utils.browser('msie') && this.opts.linebreaks)
- {
- this.list.insertInIe(cmd);
- }
- else
- {
- document.execCommand('insert' + cmd);
- }
-
- var $list = $(this.selection.getParent()).closest('ol, ul', this.$editor[0]);
-
- if ($td.length !== 0)
- {
- var prev = $td.prev();
- var html = $td.html();
- $td.html('');
- if (prev && prev.length === 1 && (prev[0].tagName === 'TD' || prev[0].tagName === 'TH'))
- {
- $(prev).after($td);
- }
- else
- {
- $(parent).prepend($td);
- }
-
- $td.html(html);
- }
-
- if (this.utils.isEmpty($list.find('li').text()))
- {
- var $children = $list.children('li');
- $children.find('br').remove();
- $children.append(this.selection.getMarkerAsHtml());
- }
-
- if ($list.length)
- {
- // remove block-element list wrapper
- var $listParent = $list.parent();
- if (this.utils.isRedactorParent($listParent) && $listParent[0].tagName != 'LI' && this.utils.isBlock($listParent[0]))
- {
- $listParent.replaceWith($listParent.contents());
- }
- }
-
- if (!this.utils.browser('msie'))
- {
- this.$editor.focus();
- }
-
- this.clean.clearUnverified();
- },
- insertInIe: function(cmd)
- {
- var wrapper = this.selection.wrap('div');
- var wrapperHtml = $(wrapper).html();
-
- var tmpList = (cmd == 'orderedlist') ? $('<ol>') : $('<ul>');
- var tmpLi = $('<li>');
-
- if ($.trim(wrapperHtml) === '')
- {
- tmpLi.append(this.selection.getMarkerAsHtml());
- tmpList.append(tmpLi);
- this.$editor.find('#selection-marker-1').replaceWith(tmpList);
- }
- else
- {
- var items = wrapperHtml.split(/<br\s?\/?>/gi);
- if (items)
- {
- for (var i = 0; i < items.length; i++)
- {
- if ($.trim(items[i]) !== '')
- {
- tmpList.append($('<li>').html(items[i]));
- }
- }
- }
- else
- {
- tmpLi.append(wrapperHtml);
- tmpList.append(tmpLi);
- }
-
- $(wrapper).replaceWith(tmpList);
- }
- },
- remove: function(cmd)
- {
- document.execCommand('insert' + cmd);
-
- var $current = $(this.selection.getCurrent());
-
- this.indent.fixEmptyIndent();
-
- if (!this.opts.linebreaks && $current.closest('li, th, td', this.$editor[0]).length === 0)
- {
- document.execCommand('formatblock', false, 'p');
- this.$editor.find('ul, ol, blockquote').each($.proxy(this.utils.removeEmpty, this));
- }
-
- var $table = $(this.selection.getCurrent()).closest('table', this.$editor[0]);
- var $prev = $table.prev();
- if (!this.opts.linebreaks && $table.length !== 0 && $prev.length !== 0 && $prev[0].tagName == 'BR')
- {
- $prev.remove();
- }
-
- this.clean.clearUnverified();
-
- }
- };
- },
- modal: function()
- {
- return {
- callbacks: {},
- loadTemplates: function()
- {
- this.opts.modal = {
- imageEdit: String()
- + '<section id="redactor-modal-image-edit">'
- + '<label>' + this.lang.get('title') + '</label>'
- + '<input type="text" id="redactor-image-title" />'
- + '<label class="redactor-image-link-option">' + this.lang.get('link') + '</label>'
- + '<input type="text" id="redactor-image-link" class="redactor-image-link-option" />'
- + '<label class="redactor-image-link-option"><input type="checkbox" id="redactor-image-link-blank"> ' + this.lang.get('link_new_tab') + '</label>'
- + '<label class="redactor-image-position-option">' + this.lang.get('image_position') + '</label>'
- + '<select class="redactor-image-position-option" id="redactor-image-align">'
- + '<option value="none">' + this.lang.get('none') + '</option>'
- + '<option value="left">' + this.lang.get('left') + '</option>'
- + '<option value="center">' + this.lang.get('center') + '</option>'
- + '<option value="right">' + this.lang.get('right') + '</option>'
- + '</select>'
- + '</section>',
-
- image: String()
- + '<section id="redactor-modal-image-insert">'
- + '<div id="redactor-modal-image-droparea"></div>'
- + '</section>',
-
- file: String()
- + '<section id="redactor-modal-file-insert">'
- + '<div id="redactor-modal-file-upload-box">'
- + '<label>' + this.lang.get('filename') + '</label>'
- + '<input type="text" id="redactor-filename" /><br><br>'
- + '<div id="redactor-modal-file-upload"></div>'
- + '</div>'
- + '</section>',
-
- link: String()
- + '<section id="redactor-modal-link-insert">'
- + '<label>URL</label>'
- + '<input type="url" id="redactor-link-url" />'
- + '<label>' + this.lang.get('text') + '</label>'
- + '<input type="text" id="redactor-link-url-text" />'
- + '<label><input type="checkbox" id="redactor-link-blank"> ' + this.lang.get('link_new_tab') + '</label>'
- + '</section>'
- };
-
-
- $.extend(this.opts, this.opts.modal);
-
- },
- addCallback: function(name, callback)
- {
- this.modal.callbacks[name] = callback;
- },
- createTabber: function($modal)
- {
- this.modal.$tabber = $('<div>').attr('id', 'redactor-modal-tabber');
-
- $modal.prepend(this.modal.$tabber);
- },
- addTab: function(id, name, active)
- {
- var $tab = $('<a href="#" rel="tab' + id + '">').text(name);
- if (active)
- {
- $tab.addClass('active');
- }
-
- var self = this;
- $tab.on('click', function(e)
- {
- e.preventDefault();
- $('.redactor-tab').hide();
- $('.redactor-' + $(this).attr('rel')).show();
-
- self.modal.$tabber.find('a').removeClass('active');
- $(this).addClass('active');
-
- });
-
- this.modal.$tabber.append($tab);
- },
- addTemplate: function(name, template)
- {
- this.opts.modal[name] = template;
- },
- getTemplate: function(name)
- {
- return this.opts.modal[name];
- },
- getModal: function()
- {
- return this.$modalBody.find('section');
- },
- load: function(templateName, title, width)
- {
- this.modal.templateName = templateName;
- this.modal.width = width;
-
- this.modal.build();
- this.modal.enableEvents();
- this.modal.setTitle(title);
- this.modal.setDraggable();
- this.modal.setContent();
-
- // callbacks
- if (typeof this.modal.callbacks[templateName] != 'undefined')
- {
- this.modal.callbacks[templateName].call(this);
- }
-
- },
- show: function()
- {
- // ios keyboard hide
- if (this.utils.isMobile() && !this.utils.browser('msie'))
- {
- document.activeElement.blur();
- }
-
- $(document.body).removeClass('body-redactor-hidden');
- this.modal.bodyOveflow = $(document.body).css('overflow');
- $(document.body).css('overflow', 'hidden');
-
- if (this.utils.isMobile())
- {
- this.modal.showOnMobile();
- }
- else
- {
- this.modal.showOnDesktop();
- }
-
- this.$modalOverlay.show();
- this.$modalBox.show();
-
- this.modal.setButtonsWidth();
-
- this.utils.saveScroll();
-
- // resize
- if (!this.utils.isMobile())
- {
- setTimeout($.proxy(this.modal.showOnDesktop, this), 0);
- $(window).on('resize.redactor-modal', $.proxy(this.modal.resize, this));
- }
-
- // modal shown callback
- this.core.setCallback('modalOpened', this.modal.templateName, this.$modal);
-
- // fix bootstrap modal focus
- $(document).off('focusin.modal');
-
- // enter
- this.$modal.find('input[type=text],input[type=url],input[type=email]').on('keydown.redactor-modal', $.proxy(this.modal.setEnter, this));
- },
- showOnDesktop: function()
- {
- var height = this.$modal.outerHeight();
- var windowHeight = $(window).height();
- var windowWidth = $(window).width();
-
- if (this.modal.width > windowWidth)
- {
- this.$modal.css({
- width: '96%',
- marginTop: (windowHeight/2 - height/2) + 'px'
- });
- return;
- }
-
- if (height > windowHeight)
- {
- this.$modal.css({
- width: this.modal.width + 'px',
- marginTop: '20px'
- });
- }
- else
- {
- this.$modal.css({
- width: this.modal.width + 'px',
- marginTop: (windowHeight/2 - height/2) + 'px'
- });
- }
- },
- showOnMobile: function()
- {
- this.$modal.css({
- width: '96%',
- marginTop: '2%'
- });
-
- },
- resize: function()
- {
- if (this.utils.isMobile())
- {
- this.modal.showOnMobile();
- }
- else
- {
- this.modal.showOnDesktop();
- }
- },
- setTitle: function(title)
- {
- this.$modalHeader.html(title);
- },
- setContent: function()
- {
- this.$modalBody.html(this.modal.getTemplate(this.modal.templateName));
- },
- setDraggable: function()
- {
- if (typeof $.fn.draggable === 'undefined') return;
-
- this.$modal.draggable({ handle: this.$modalHeader });
- this.$modalHeader.css('cursor', 'move');
- },
- setEnter: function(e)
- {
- if (e.which != 13) return;
-
- e.preventDefault();
- this.$modal.find('button.redactor-modal-action-btn').click();
- },
- createCancelButton: function()
- {
- var button = $('<button>').addClass('redactor-modal-btn redactor-modal-close-btn').html(this.lang.get('cancel'));
- button.on('click', $.proxy(this.modal.close, this));
-
- this.$modalFooter.append(button);
- },
- createDeleteButton: function(label)
- {
- return this.modal.createButton(label, 'delete');
- },
- createActionButton: function(label)
- {
- return this.modal.createButton(label, 'action');
- },
- createButton: function(label, className)
- {
- var button = $('<button>').addClass('redactor-modal-btn').addClass('redactor-modal-' + className + '-btn').html(label);
- this.$modalFooter.append(button);
-
- return button;
- },
- setButtonsWidth: function()
- {
- var buttons = this.$modalFooter.find('button');
- var buttonsSize = buttons.length;
- if (buttonsSize === 0) return;
-
- buttons.css('width', (100/buttonsSize) + '%');
- },
- build: function()
- {
- this.modal.buildOverlay();
-
- this.$modalBox = $('<div id="redactor-modal-box" />').hide();
- this.$modal = $('<div id="redactor-modal" />');
- this.$modalHeader = $('<header />');
- this.$modalClose = $('<span id="redactor-modal-close" />').html('×');
- this.$modalBody = $('<div id="redactor-modal-body" />');
- this.$modalFooter = $('<footer />');
-
- this.$modal.append(this.$modalHeader);
- this.$modal.append(this.$modalClose);
- this.$modal.append(this.$modalBody);
- this.$modal.append(this.$modalFooter);
- this.$modalBox.append(this.$modal);
- this.$modalBox.appendTo(document.body);
- },
- buildOverlay: function()
- {
- this.$modalOverlay = $('<div id="redactor-modal-overlay">').hide();
- $('body').prepend(this.$modalOverlay);
- },
- enableEvents: function()
- {
- this.$modalClose.on('click.redactor-modal', $.proxy(this.modal.close, this));
- $(document).on('keyup.redactor-modal', $.proxy(this.modal.closeHandler, this));
- this.$editor.on('keyup.redactor-modal', $.proxy(this.modal.closeHandler, this));
- this.$modalBox.on('click.redactor-modal', $.proxy(this.modal.close, this));
- },
- disableEvents: function()
- {
- this.$modalClose.off('click.redactor-modal');
- $(document).off('keyup.redactor-modal');
- this.$editor.off('keyup.redactor-modal');
- this.$modalBox.off('click.redactor-modal');
- $(window).off('resize.redactor-modal');
- },
- closeHandler: function(e)
- {
- if (e.which != this.keyCode.ESC) return;
-
- this.modal.close(false);
- },
- close: function(e)
- {
- if (e)
- {
- if (!$(e.target).hasClass('redactor-modal-close-btn') && e.target != this.$modalClose[0] && e.target != this.$modalBox[0])
- {
- return;
- }
-
- e.preventDefault();
- }
-
- if (!this.$modalBox) return;
-
- this.modal.disableEvents();
-
- this.$modalOverlay.remove();
-
- this.$modalBox.fadeOut('fast', $.proxy(function()
- {
- this.$modalBox.remove();
-
- setTimeout($.proxy(this.utils.restoreScroll, this), 0);
-
- if (e !== undefined) this.selection.restore();
-
- $(document.body).css('overflow', this.modal.bodyOveflow);
- this.core.setCallback('modalClosed', this.modal.templateName);
-
- }, this));
-
- }
- };
- },
- observe: function()
- {
- return {
- load: function()
- {
- this.observe.images();
- this.observe.links();
- },
- buttons: function(e, btnName)
- {
- var current = this.selection.getCurrent();
- var parent = this.selection.getParent();
-
- if (e !== false)
- {
- this.button.setInactiveAll();
- }
- else
- {
- this.button.setInactiveAll(btnName);
- }
-
- if (e === false && btnName !== 'html')
- {
- if ($.inArray(btnName, this.opts.activeButtons) != -1) this.button.toggleActive(btnName);
- return;
- }
-
- //var linkButtonName = (this.utils.isCurrentOrParent('A')) ? this.lang.get('link_edit') : this.lang.get('link_insert');
- //$('body').find('a.redactor-dropdown-link').text(linkButtonName);
-
- $.each(this.opts.activeButtonsStates, $.proxy(function(key, value)
- {
- var parentEl = $(parent).closest(key, this.$editor[0]);
- var currentEl = $(current).closest(key, this.$editor[0]);
-
- if (parentEl.length !== 0 && !this.utils.isRedactorParent(parentEl)) return;
- if (!this.utils.isRedactorParent(currentEl)) return;
- if (parentEl.length !== 0 || currentEl.closest(key, this.$editor[0]).length !== 0)
- {
- this.button.setActive(value);
- }
-
- }, this));
-
- var $parent = $(parent).closest(this.opts.alignmentTags.toString().toLowerCase(), this.$editor[0]);
- if (this.utils.isRedactorParent(parent) && $parent.length)
- {
- var align = ($parent.css('text-align') === '') ? 'left' : $parent.css('text-align');
- this.button.setActive('align' + align);
- }
- },
- addButton: function(tag, btnName)
- {
- this.opts.activeButtons.push(btnName);
- this.opts.activeButtonsStates[tag] = btnName;
- },
- images: function()
- {
- this.$editor.find('img').each($.proxy(function(i, img)
- {
- var $img = $(img);
-
- // IE fix (when we clicked on an image and then press backspace IE does goes to image's url)
- $img.closest('a', this.$editor[0]).on('click', function(e) { e.preventDefault(); });
-
- if (this.utils.browser('msie')) $img.attr('unselectable', 'on');
-
- this.image.setEditable($img);
-
- }, this));
-
- $(document).on('click.redactor-image-delete.' + this.uuid, $.proxy(function(e)
- {
- this.observe.image = false;
- if (e.target.tagName == 'IMG' && this.utils.isRedactorParent(e.target))
- {
- this.observe.image = (this.observe.image && this.observe.image == e.target) ? false : e.target;
- }
-
- }, this));
-
- },
- links: function()
- {
- if (!this.opts.linkTooltip) return;
-
- this.$editor.find('a').on('touchstart.redactor.' + this.uuid + ' click.redactor.' + this.uuid, $.proxy(this.observe.showTooltip, this));
- this.$editor.on('touchstart.redactor.' + this.uuid + ' click.redactor.' + this.uuid, $.proxy(this.observe.closeTooltip, this));
- $(document).on('touchstart.redactor.' + this.uuid + ' click.redactor.' + this.uuid, $.proxy(this.observe.closeTooltip, this));
- },
- getTooltipPosition: function($link)
- {
- return $link.offset();
- },
- showTooltip: function(e)
- {
- var $el = $(e.target);
-
- if ($el[0].tagName == 'IMG')
- return;
-
- if ($el[0].tagName !== 'A')
- $el = $el.closest('a', this.$editor[0]);
-
- if ($el[0].tagName !== 'A')
- return;
-
- var $link = $el;
-
- var pos = this.observe.getTooltipPosition($link);
- var tooltip = $('<span class="redactor-link-tooltip"></span>');
-
- var href = $link.attr('href');
- if (href === undefined)
- {
- href = '';
- }
-
- if (href.length > 24) href = href.substring(0, 24) + '...';
-
- var aLink = $('<a href="' + $link.attr('href') + '" target="_blank" />').html(href).addClass('redactor-link-tooltip-action');
- var aEdit = $('<a href="#" />').html(this.lang.get('edit')).on('click', $.proxy(this.link.show, this)).addClass('redactor-link-tooltip-action');
- var aUnlink = $('<a href="#" />').html(this.lang.get('unlink')).on('click', $.proxy(this.link.unlink, this)).addClass('redactor-link-tooltip-action');
-
- tooltip.append(aLink).append(' | ').append(aEdit).append(' | ').append(aUnlink);
- tooltip.css({
- top: (pos.top + parseInt($link.css('line-height'), 10)) + 'px',
- left: pos.left + 'px'
- });
-
- $('.redactor-link-tooltip').remove();
- $('body').append(tooltip);
- },
- closeTooltip: function(e)
- {
- e = e.originalEvent || e;
-
- var target = e.target;
- var $parent = $(target).closest('a', this.$editor[0]);
- if ($parent.length !== 0 && $parent[0].tagName === 'A' && target.tagName !== 'A')
- {
- return;
- }
- else if ((target.tagName === 'A' && this.utils.isRedactorParent(target)) || $(target).hasClass('redactor-link-tooltip-action'))
- {
- return;
- }
-
- $('.redactor-link-tooltip').remove();
- }
-
- };
- },
- paragraphize: function()
- {
- return {
- load: function(html)
- {
- if (this.opts.linebreaks) return html;
- if (html === '' || html === '<p></p>') return this.opts.emptyHtml;
-
- html = html + "\n";
-
- this.paragraphize.safes = [];
- this.paragraphize.z = 0;
-
- html = html.replace(/(<br\s?\/?>){1,}\n?<\/blockquote>/gi, '</blockquote>');
-
- html = this.paragraphize.getSafes(html);
- html = this.paragraphize.getSafesComments(html);
- html = this.paragraphize.replaceBreaksToNewLines(html);
- html = this.paragraphize.replaceBreaksToParagraphs(html);
- html = this.paragraphize.clear(html);
- html = this.paragraphize.restoreSafes(html);
-
- html = html.replace(new RegExp('<br\\s?/?>\n?<(' + this.opts.paragraphizeBlocks.join('|') + ')(.*?[^>])>', 'gi'), '<p><br /></p>\n<$1$2>');
-
- return $.trim(html);
- },
- getSafes: function(html)
- {
- var $div = $('<div />').append(html);
-
- // remove paragraphs in blockquotes
- $div.find('blockquote p').replaceWith(function()
- {
- return $(this).append('<br />').contents();
- });
-
- html = $div.html();
-
- $div.find(this.opts.paragraphizeBlocks.join(', ')).each($.proxy(function(i,s)
- {
- this.paragraphize.z++;
- this.paragraphize.safes[this.paragraphize.z] = s.outerHTML;
- html = html.replace(s.outerHTML, '\n{replace' + this.paragraphize.z + '}');
-
- }, this));
-
- return html;
- },
- getSafesComments: function(html)
- {
- var commentsMatches = html.match(/<!--([\w\W]*?)-->/gi);
-
- if (!commentsMatches) return html;
-
- $.each(commentsMatches, $.proxy(function(i,s)
- {
- this.paragraphize.z++;
- this.paragraphize.safes[this.paragraphize.z] = s;
- html = html.replace(s, '\n{replace' + this.paragraphize.z + '}');
- }, this));
-
- return html;
- },
- restoreSafes: function(html)
- {
- $.each(this.paragraphize.safes, function(i,s)
- {
- s = (typeof s !== 'undefined') ? s.replace(/\$/g, '$') : s;
- html = html.replace('{replace' + i + '}', s);
-
- });
-
- return html;
- },
- replaceBreaksToParagraphs: function(html)
- {
- var htmls = html.split(new RegExp('\n', 'g'), -1);
-
- html = '';
- if (htmls)
- {
- var len = htmls.length;
- for (var i = 0; i < len; i++)
- {
- if (!htmls.hasOwnProperty(i)) return;
-
- if (htmls[i].search('{replace') == -1)
- {
- htmls[i] = htmls[i].replace(/<p>\n\t?<\/p>/gi, '');
- htmls[i] = htmls[i].replace(/<p><\/p>/gi, '');
-
- if (htmls[i] !== '')
- {
- html += '<p>' + htmls[i].replace(/^\n+|\n+$/g, "") + "</p>";
- }
- }
- else html += htmls[i];
- }
- }
-
- return html;
- },
- replaceBreaksToNewLines: function(html)
- {
- html = html.replace(/<br \/>\s*<br \/>/gi, "\n\n");
- html = html.replace(/<br\s?\/?>\n?<br\s?\/?>/gi, "\n<br /><br />");
-
- html = html.replace(new RegExp("\r\n", 'g'), "\n");
- html = html.replace(new RegExp("\r", 'g'), "\n");
- html = html.replace(new RegExp("/\n\n+/"), 'g', "\n\n");
-
- return html;
- },
- clear: function(html)
- {
- html = html.replace(new RegExp('</blockquote></p>', 'gi'), '</blockquote>');
- html = html.replace(new RegExp('<p></blockquote>', 'gi'), '</blockquote>');
- html = html.replace(new RegExp('<p><blockquote>', 'gi'), '<blockquote>');
- html = html.replace(new RegExp('<blockquote></p>', 'gi'), '<blockquote>');
-
- html = html.replace(new RegExp('<p><p ', 'gi'), '<p ');
- html = html.replace(new RegExp('<p><p>', 'gi'), '<p>');
- html = html.replace(new RegExp('</p></p>', 'gi'), '</p>');
- html = html.replace(new RegExp('<p>\\s?</p>', 'gi'), '');
- html = html.replace(new RegExp("\n</p>", 'gi'), '</p>');
- html = html.replace(new RegExp('<p>\t?\t?\n?<p>', 'gi'), '<p>');
- html = html.replace(new RegExp('<p>\t*</p>', 'gi'), '');
-
- return html;
- }
- };
- },
- paste: function()
- {
- return {
- init: function(e)
- {
- if (!this.opts.cleanOnPaste)
- {
- setTimeout($.proxy(this.code.sync, this), 1);
- return;
- }
-
- this.rtePaste = true;
-
- this.buffer.set();
- this.selection.save();
- this.utils.saveScroll();
-
- this.paste.createPasteBox();
-
- $(window).on('scroll.redactor-freeze', $.proxy(function()
- {
- $(window).scrollTop(this.saveBodyScroll);
-
- }, this));
-
- setTimeout($.proxy(function()
- {
- var html = this.$pasteBox.html();
-
- this.$pasteBox.remove();
-
- this.selection.restore();
- this.utils.restoreScroll();
-
- this.paste.insert(html);
-
- $(window).off('scroll.redactor-freeze');
-
- if (this.linkify.isEnabled())
- this.linkify.format();
-
- }, this), 1);
- },
- createPasteBox: function()
- {
- this.$pasteBox = $('<div>').html('').attr('contenteditable', 'true').css({ position: 'fixed', width: 0, top: 0, left: '-9999px' });
-
- if (this.utils.browser('msie'))
- {
- this.$box.append(this.$pasteBox);
- }
- else
- {
- $('body').append(this.$pasteBox);
- }
-
- this.$pasteBox.focus();
- },
- insert: function(html)
- {
- html = this.core.setCallback('pasteBefore', html);
-
- // clean
- html = (this.utils.isSelectAll()) ? this.clean.onPaste(html, false) : this.clean.onPaste(html);
-
- html = this.core.setCallback('paste', html);
-
- if (this.utils.isSelectAll())
- {
- this.insert.set(html, false);
- }
- else
- {
- this.insert.html(html, false);
- }
-
- this.utils.disableSelectAll();
- this.rtePaste = false;
-
- setTimeout($.proxy(this.clean.clearUnverified, this), 10);
-
- // clean empty spans
- setTimeout($.proxy(function()
- {
- var spans = this.$editor.find('span');
- $.each(spans, function(i,s)
- {
- var html = s.innerHTML.replace(/[\u200B-\u200D\uFEFF]/, '');
- if (html === '' && s.attributes.length === 0) $(s).remove();
-
- });
-
- }, this), 10);
- }
- };
- },
- placeholder: function()
- {
- return {
- enable: function()
- {
- if (!this.placeholder.is()) return;
-
- this.$editor.attr('placeholder', this.$element.attr('placeholder'));
-
- this.placeholder.toggle();
- this.$editor.on('keyup.redactor-placeholder', $.proxy(this.placeholder.toggle, this));
-
- },
- toggle: function()
- {
- var func = 'removeClass';
- if (this.utils.isEmpty(this.$editor.html(), false)) func = 'addClass';
- this.$editor[func]('redactor-placeholder');
- },
- remove: function()
- {
- this.$editor.removeClass('redactor-placeholder');
- },
- is: function()
- {
- if (this.opts.placeholder)
- {
- return this.$element.attr('placeholder', this.opts.placeholder);
- }
- else
- {
- return !(typeof this.$element.attr('placeholder') == 'undefined' || this.$element.attr('placeholder') === '');
- }
- }
- };
- },
- progress: function()
- {
- return {
- show: function()
- {
- $(document.body).append($('<div id="redactor-progress"><span></span></div>'));
- $('#redactor-progress').fadeIn();
- },
- hide: function()
- {
- $('#redactor-progress').fadeOut(1500, function()
- {
- $(this).remove();
- });
- }
-
- };
- },
- selection: function()
- {
- return {
- get: function()
- {
- this.sel = document.getSelection();
-
- if (document.getSelection && this.sel.getRangeAt && this.sel.rangeCount)
- {
- this.range = this.sel.getRangeAt(0);
- }
- else
- {
- this.range = document.createRange();
- }
- },
- addRange: function()
- {
- try {
- this.sel.removeAllRanges();
- } catch (e) {}
-
- this.sel.addRange(this.range);
- },
- getCurrent: function()
- {
- var el = false;
- this.selection.get();
-
- if (this.sel && this.sel.rangeCount > 0)
- {
- el = this.sel.getRangeAt(0).startContainer;
- }
-
- return this.utils.isRedactorParent(el);
- },
- getParent: function(elem)
- {
- elem = elem || this.selection.getCurrent();
- if (elem)
- {
- return this.utils.isRedactorParent($(elem).parent()[0]);
- }
-
- return false;
- },
- getBlock: function(node)
- {
- node = node || this.selection.getCurrent();
-
- while (node)
- {
- if (this.utils.isBlockTag(node.tagName))
- {
- return ($(node).hasClass('redactor-editor')) ? false : node;
- }
-
- node = node.parentNode;
- }
-
- return false;
- },
- getInlines: function(nodes, tags)
- {
- this.selection.get();
-
- if (this.range && this.range.collapsed)
- {
- return false;
- }
-
- var inlines = [];
- nodes = (typeof nodes == 'undefined' || nodes === false) ? this.selection.getNodes() : nodes;
- var inlineTags = this.opts.inlineTags;
- inlineTags.push('span');
-
- if (typeof tags !== 'undefined')
- {
- for (var i = 0; i < tags.length; i++)
- {
- inlineTags.push(tags[i]);
- }
- }
-
- $.each(nodes, $.proxy(function(i,node)
- {
- if ($.inArray(node.tagName.toLowerCase(), inlineTags) != -1)
- {
- inlines.push(node);
- }
-
- }, this));
-
- return (inlines.length === 0) ? false : inlines;
- },
- getInlinesTags: function(tags)
- {
- this.selection.get();
-
- if (this.range && this.range.collapsed)
- {
- return false;
- }
-
- var inlines = [];
- var nodes = this.selection.getNodes();
- $.each(nodes, $.proxy(function(i,node)
- {
- if ($.inArray(node.tagName.toLowerCase(), tags) != -1)
- {
- inlines.push(node);
- }
-
- }, this));
-
- return (inlines.length === 0) ? false : inlines;
- },
- getBlocks: function(nodes)
- {
- this.selection.get();
-
- if (this.range && this.range.collapsed)
- {
- return [this.selection.getBlock()];
- }
-
- var blocks = [];
- nodes = (typeof nodes == 'undefined') ? this.selection.getNodes() : nodes;
- $.each(nodes, $.proxy(function(i,node)
- {
- if (this.utils.isBlock(node))
- {
- this.selection.lastBlock = node;
- blocks.push(node);
- }
-
- }, this));
-
- return (blocks.length === 0) ? [this.selection.getBlock()] : blocks;
- },
- getLastBlock: function()
- {
- return this.selection.lastBlock;
- },
- getNodes: function()
- {
- this.selection.get();
-
- var startNode = this.selection.getNodesMarker(1);
- var endNode = this.selection.getNodesMarker(2);
- var range = this.range.cloneRange();
-
- if (this.range.collapsed === false)
- {
- var startContainer = range.startContainer;
- var startOffset = range.startOffset;
-
- // end marker
- this.selection.setNodesMarker(range, endNode, false);
-
- // start marker
- range.setStart(startContainer, startOffset);
- this.selection.setNodesMarker(range, startNode, true);
- }
- else
- {
- this.selection.setNodesMarker(range, startNode, true);
- endNode = startNode;
- }
-
- var nodes = [];
- var counter = 0;
-
- var self = this;
- this.$editor.find('*').each(function()
- {
- if (this == startNode)
- {
- var parent = $(this).parent();
- if (parent.length !== 0 && parent[0].tagName != 'BODY' && self.utils.isRedactorParent(parent[0]))
- {
- nodes.push(parent[0]);
- }
-
- nodes.push(this);
- counter = 1;
- }
- else
- {
- if (counter > 0)
- {
- nodes.push(this);
- counter = counter + 1;
- }
- }
-
- if (this == endNode)
- {
- return false;
- }
-
- });
-
- var finalNodes = [];
- var len = nodes.length;
- for (var i = 0; i < len; i++)
- {
- if (nodes[i].id != 'nodes-marker-1' && nodes[i].id != 'nodes-marker-2')
- {
- finalNodes.push(nodes[i]);
- }
- }
-
- this.selection.removeNodesMarkers();
-
- return finalNodes;
-
- },
- getNodesMarker: function(num)
- {
- return $('<span id="nodes-marker-' + num + '" class="redactor-nodes-marker" data-verified="redactor">' + this.opts.invisibleSpace + '</span>')[0];
- },
- setNodesMarker: function(range, node, type)
- {
- try {
- range.collapse(type);
- range.insertNode(node);
- }
- catch (e) {}
- },
- removeNodesMarkers: function()
- {
- $(document).find('span.redactor-nodes-marker').remove();
- this.$editor.find('span.redactor-nodes-marker').remove();
- },
- fromPoint: function(start, end)
- {
- this.caret.setOffset(start, end);
- },
- wrap: function(tag)
- {
- this.selection.get();
-
- if (this.range.collapsed) return false;
-
- var wrapper = document.createElement(tag);
- wrapper.appendChild(this.range.extractContents());
- this.range.insertNode(wrapper);
-
- return wrapper;
- },
- selectElement: function(node)
- {
- this.caret.set(node, 0, node, 1);
- },
- selectAll: function()
- {
- this.selection.get();
- this.range.selectNodeContents(this.$editor[0]);
- this.selection.addRange();
- },
- remove: function()
- {
- this.selection.get();
- this.sel.removeAllRanges();
- },
- save: function()
- {
- this.selection.createMarkers();
- },
- createMarkers: function()
- {
- this.selection.get();
-
- var node1 = this.selection.getMarker(1);
-
- this.selection.setMarker(this.range, node1, true);
-
- if (this.range.collapsed === false)
- {
- var node2 = this.selection.getMarker(2);
- this.selection.setMarker(this.range, node2, false);
- }
-
- this.savedSel = this.$editor.html();
- },
- getMarker: function(num)
- {
- if (typeof num == 'undefined') num = 1;
-
- return $('<span id="selection-marker-' + num + '" class="redactor-selection-marker" data-verified="redactor">' + this.opts.invisibleSpace + '</span>')[0];
- },
- getMarkerAsHtml: function(num)
- {
- return this.utils.getOuterHtml(this.selection.getMarker(num));
- },
- setMarker: function(range, node, type)
- {
- range = range.cloneRange();
-
- try {
- range.collapse(type);
- range.insertNode(node);
- }
- catch (e)
- {
- this.focus.setStart();
- }
- },
- restore: function()
- {
- var node1 = this.$editor.find('span#selection-marker-1');
- var node2 = this.$editor.find('span#selection-marker-2');
-
- if (node1.length !== 0 && node2.length !== 0)
- {
- this.caret.set(node1, 0, node2, 0);
- }
- else if (node1.length !== 0)
- {
- this.caret.set(node1, 0, node1, 0);
- }
- else
- {
- this.$editor.focus();
- }
-
- this.selection.removeMarkers();
- this.savedSel = false;
-
- },
- removeMarkers: function()
- {
- this.$editor.find('span.redactor-selection-marker').each(function(i,s)
- {
- var text = $(s).text().replace(/[\u200B-\u200D\uFEFF]/g, '');
- if (text === '') $(s).remove();
- else $(s).replaceWith(function() { return $(this).contents(); });
- });
- },
- getText: function()
- {
- this.selection.get();
-
- return this.sel.toString();
- },
- getHtml: function()
- {
- var html = '';
-
- this.selection.get();
- if (this.sel.rangeCount)
- {
- var container = document.createElement('div');
- var len = this.sel.rangeCount;
- for (var i = 0; i < len; ++i)
- {
- container.appendChild(this.sel.getRangeAt(i).cloneContents());
- }
-
- html = container.innerHTML;
- }
-
- return this.clean.onSync(html);
- },
- replaceWithHtml: function(html)
- {
- html = this.selection.getMarkerAsHtml(1) + html + this.selection.getMarkerAsHtml(2);
-
- this.selection.get();
-
- if (window.getSelection && window.getSelection().getRangeAt)
- {
- this.range.deleteContents();
- var div = document.createElement("div");
- div.innerHTML = html;
-
- var frag = document.createDocumentFragment(), child;
- while ((child = div.firstChild))
- {
- frag.appendChild(child);
- }
-
- this.range.insertNode(frag);
- }
- else if (document.selection && document.selection.createRange)
- {
- this.range.pasteHTML(html);
- }
-
- this.selection.restore();
- this.code.sync();
- }
- };
- },
- shortcuts: function()
- {
- return {
- init: function(e, key)
- {
- // disable browser's hot keys for bold and italic
- if (!this.opts.shortcuts)
- {
- if ((e.ctrlKey || e.metaKey) && (key === 66 || key === 73)) e.preventDefault();
- return false;
- }
-
- $.each(this.opts.shortcuts, $.proxy(function(str, command)
- {
- var keys = str.split(',');
- var len = keys.length;
- for (var i = 0; i < len; i++)
- {
- if (typeof keys[i] === 'string')
- {
- this.shortcuts.handler(e, $.trim(keys[i]), $.proxy(function()
- {
- var func;
- if (command.func.search(/\./) != '-1')
- {
- func = command.func.split('.');
- if (typeof this[func[0]] != 'undefined')
- {
- this[func[0]][func[1]].apply(this, command.params);
- }
- }
- else
- {
- this[command.func].apply(this, command.params);
- }
-
- }, this));
- }
-
- }
-
- }, this));
- },
- handler: function(e, keys, origHandler)
- {
- // based on https://github.com/jeresig/jquery.hotkeys
- var hotkeysSpecialKeys =
- {
- 8: "backspace", 9: "tab", 10: "return", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause",
- 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home",
- 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", 59: ";", 61: "=",
- 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7",
- 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/",
- 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8",
- 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 173: "-", 186: ";", 187: "=",
- 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\", 221: "]", 222: "'"
- };
-
-
- var hotkeysShiftNums =
- {
- "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&",
- "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<",
- ".": ">", "/": "?", "\\": "|"
- };
-
- keys = keys.toLowerCase().split(" ");
- var special = hotkeysSpecialKeys[e.keyCode],
- character = String.fromCharCode( e.which ).toLowerCase(),
- modif = "", possible = {};
-
- $.each([ "alt", "ctrl", "meta", "shift"], function(index, specialKey)
- {
- if (e[specialKey + 'Key'] && special !== specialKey)
- {
- modif += specialKey + '+';
- }
- });
-
-
- if (special) possible[modif + special] = true;
- if (character)
- {
- possible[modif + character] = true;
- possible[modif + hotkeysShiftNums[character]] = true;
-
- // "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
- if (modif === "shift+")
- {
- possible[hotkeysShiftNums[character]] = true;
- }
- }
-
- for (var i = 0, len = keys.length; i < len; i++)
- {
- if (possible[keys[i]])
- {
- e.preventDefault();
- return origHandler.apply(this, arguments);
- }
- }
- }
- };
- },
- tabifier: function()
- {
- return {
- get: function(code)
- {
- if (!this.opts.tabifier) return code;
-
- // clean setup
- var ownLine = ['area', 'body', 'head', 'hr', 'i?frame', 'link', 'meta', 'noscript', 'style', 'script', 'table', 'tbody', 'thead', 'tfoot'];
- var contOwnLine = ['li', 'dt', 'dt', 'h[1-6]', 'option', 'script'];
- var newLevel = ['p', 'blockquote', 'div', 'dl', 'fieldset', 'form', 'frameset', 'map', 'ol', 'pre', 'select', 'td', 'th', 'tr', 'ul'];
-
- this.tabifier.lineBefore = new RegExp('^<(/?' + ownLine.join('|/?' ) + '|' + contOwnLine.join('|') + ')[ >]');
- this.tabifier.lineAfter = new RegExp('^<(br|/?' + ownLine.join('|/?' ) + '|/' + contOwnLine.join('|/') + ')[ >]');
- this.tabifier.newLevel = new RegExp('^</?(' + newLevel.join('|' ) + ')[ >]');
-
- var i = 0,
- codeLength = code.length,
- point = 0,
- start = null,
- end = null,
- tag = '',
- out = '',
- cont = '';
-
- this.tabifier.cleanlevel = 0;
-
- for (; i < codeLength; i++)
- {
- point = i;
-
- // if no more tags, copy and exit
- if (-1 == code.substr(i).indexOf( '<' ))
- {
- out += code.substr(i);
-
- return this.tabifier.finish(out);
- }
-
- // copy verbatim until a tag
- while (point < codeLength && code.charAt(point) != '<')
- {
- point++;
- }
-
- if (i != point)
- {
- cont = code.substr(i, point - i);
- if (!cont.match(/^\s{2,}$/g))
- {
- if ('\n' == out.charAt(out.length - 1)) out += this.tabifier.getTabs();
- else if ('\n' == cont.charAt(0))
- {
- out += '\n' + this.tabifier.getTabs();
- cont = cont.replace(/^\s+/, '');
- }
-
- out += cont;
- }
-
- if (cont.match(/\n/)) out += '\n' + this.tabifier.getTabs();
- }
-
- start = point;
-
- // find the end of the tag
- while (point < codeLength && '>' != code.charAt(point))
- {
- point++;
- }
-
- tag = code.substr(start, point - start);
- i = point;
-
- var t;
-
- if ('!--' == tag.substr(1, 3))
- {
- if (!tag.match(/--$/))
- {
- while ('-->' != code.substr(point, 3))
- {
- point++;
- }
- point += 2;
- tag = code.substr(start, point - start);
- i = point;
- }
-
- if ('\n' != out.charAt(out.length - 1)) out += '\n';
-
- out += this.tabifier.getTabs();
- out += tag + '>\n';
- }
- else if ('!' == tag[1])
- {
- out = this.tabifier.placeTag(tag + '>', out);
- }
- else if ('?' == tag[1])
- {
- out += tag + '>\n';
- }
- else if (t = tag.match(/^<(script|style|pre)/i))
- {
- t[1] = t[1].toLowerCase();
- tag = this.tabifier.cleanTag(tag);
- out = this.tabifier.placeTag(tag, out);
- end = String(code.substr(i + 1)).toLowerCase().indexOf('</' + t[1]);
-
- if (end)
- {
- cont = code.substr(i + 1, end);
- i += end;
- out += cont;
- }
- }
- else
- {
- tag = this.tabifier.cleanTag(tag);
- out = this.tabifier.placeTag(tag, out);
- }
- }
-
- return this.tabifier.finish(out);
- },
- getTabs: function()
- {
- var s = '';
- for ( var j = 0; j < this.tabifier.cleanlevel; j++ )
- {
- s += '\t';
- }
-
- return s;
- },
- finish: function(code)
- {
- code = code.replace(/\n\s*\n/g, '\n');
- code = code.replace(/^[\s\n]*/, '');
- code = code.replace(/[\s\n]*$/, '');
- code = code.replace(/<script(.*?)>\n<\/script>/gi, '<script$1></script>');
-
- this.tabifier.cleanlevel = 0;
-
- return code;
- },
- cleanTag: function (tag)
- {
- var tagout = '';
- tag = tag.replace(/\n/g, ' ');
- tag = tag.replace(/\s{2,}/g, ' ');
- tag = tag.replace(/^\s+|\s+$/g, ' ');
-
- var suffix = '';
- if (tag.match(/\/$/))
- {
- suffix = '/';
- tag = tag.replace(/\/+$/, '');
- }
-
- var m;
- while (m = /\s*([^= ]+)(?:=((['"']).*?\3|[^ ]+))?/.exec(tag))
- {
- if (m[2]) tagout += m[1].toLowerCase() + '=' + m[2];
- else if (m[1]) tagout += m[1].toLowerCase();
-
- tagout += ' ';
- tag = tag.substr(m[0].length);
- }
-
- return tagout.replace(/\s*$/, '') + suffix + '>';
- },
- placeTag: function (tag, out)
- {
- var nl = tag.match(this.tabifier.newLevel);
-
- if (tag.match(this.tabifier.lineBefore) || nl)
- {
- out = out.replace(/\s*$/, '');
- out += '\n';
- }
-
- if (nl && '/' == tag.charAt(1)) this.tabifier.cleanlevel--;
- if ('\n' == out.charAt(out.length - 1)) out += this.tabifier.getTabs();
- if (nl && '/' != tag.charAt(1)) this.tabifier.cleanlevel++;
-
- out += tag;
-
- if (tag.match(this.tabifier.lineAfter) || tag.match(this.tabifier.newLevel))
- {
- out = out.replace(/ *$/, '');
- //out += '\n';
- }
-
- return out;
- }
- };
- },
- tidy: function()
- {
- return {
- setupAllowed: function()
- {
- if (this.opts.allowedTags) this.opts.deniedTags = false;
- if (this.opts.allowedAttr) this.opts.removeAttr = false;
-
- if (this.opts.linebreaks) return;
-
- var tags = ['p', 'section'];
- if (this.opts.allowedTags) this.tidy.addToAllowed(tags);
- if (this.opts.deniedTags) this.tidy.removeFromDenied(tags);
-
- },
- addToAllowed: function(tags)
- {
- var len = tags.length;
- for (var i = 0; i < len; i++)
- {
- if ($.inArray(tags[i], this.opts.allowedTags) == -1)
- {
- this.opts.allowedTags.push(tags[i]);
- }
- }
- },
- removeFromDenied: function(tags)
- {
- var len = tags.length;
- for (var i = 0; i < len; i++)
- {
- var pos = $.inArray(tags[i], this.opts.deniedTags);
- if (pos != -1)
- {
- this.opts.deniedTags.splice(pos, 1);
- }
- }
- },
- load: function(html, options)
- {
- this.tidy.settings = {
- deniedTags: this.opts.deniedTags,
- allowedTags: this.opts.allowedTags,
- removeComments: this.opts.removeComments,
- replaceTags: this.opts.replaceTags,
- replaceStyles: this.opts.replaceStyles,
- removeDataAttr: this.opts.removeDataAttr,
- removeAttr: this.opts.removeAttr,
- allowedAttr: this.opts.allowedAttr,
- removeWithoutAttr: this.opts.removeWithoutAttr,
- removeEmpty: this.opts.removeEmpty
- };
-
- $.extend(this.tidy.settings, options);
-
- html = this.tidy.removeComments(html);
-
- // create container
- this.tidy.$div = $('<div />').append(html);
-
- // clean
- this.tidy.replaceTags();
- this.tidy.replaceStyles();
- this.tidy.removeTags();
-
- this.tidy.removeAttr();
- this.tidy.removeEmpty();
- this.tidy.removeParagraphsInLists();
- this.tidy.removeDataAttr();
- this.tidy.removeWithoutAttr();
-
- html = this.tidy.$div.html();
- this.tidy.$div.remove();
-
- return html;
- },
- removeComments: function(html)
- {
- if (!this.tidy.settings.removeComments) return html;
-
- return html.replace(/<!--[\s\S]*?-->/gi, '');
- },
- replaceTags: function(html)
- {
- if (!this.tidy.settings.replaceTags) return html;
-
- var len = this.tidy.settings.replaceTags.length;
- var replacement = [], rTags = [];
- for (var i = 0; i < len; i++)
- {
- rTags.push(this.tidy.settings.replaceTags[i][1]);
- replacement.push(this.tidy.settings.replaceTags[i][0]);
- }
-
- $.each(replacement, $.proxy(function(key, value)
- {
- this.tidy.$div.find(value).replaceWith(function()
- {
- return $("<" + rTags[key] + " />", {html: $(this).html()});
- });
- }, this));
- },
- replaceStyles: function()
- {
- if (!this.tidy.settings.replaceStyles) return;
-
- var len = this.tidy.settings.replaceStyles.length;
- this.tidy.$div.find('span').each($.proxy(function(n,s)
- {
- var $el = $(s);
- var style = $el.attr('style');
- for (var i = 0; i < len; i++)
- {
- if (style && style.match(new RegExp('^' + this.tidy.settings.replaceStyles[i][0], 'i')))
- {
- var tagName = this.tidy.settings.replaceStyles[i][1];
- $el.replaceWith(function()
- {
- var tag = document.createElement(tagName);
- return $(tag).append($(this).contents());
- });
- }
- }
-
- }, this));
-
- },
- removeTags: function()
- {
- if (!this.tidy.settings.deniedTags && this.tidy.settings.allowedTags)
- {
- this.tidy.$div.find('*').not(this.tidy.settings.allowedTags.join(',')).each(function(i, s)
- {
- if (s.innerHTML === '') $(s).remove();
- else $(s).contents().unwrap();
- });
- }
-
- if (this.tidy.settings.deniedTags)
- {
- this.tidy.$div.find(this.tidy.settings.deniedTags.join(',')).each(function(i, s)
- {
- if (s.innerHTML === '') $(s).remove();
- else $(s).contents().unwrap();
- });
- }
- },
- removeAttr: function()
- {
- var len;
- if (!this.tidy.settings.removeAttr && this.tidy.settings.allowedAttr)
- {
-
- var allowedAttrTags = [], allowedAttrData = [];
- len = this.tidy.settings.allowedAttr.length;
- for (var i = 0; i < len; i++)
- {
- allowedAttrTags.push(this.tidy.settings.allowedAttr[i][0]);
- allowedAttrData.push(this.tidy.settings.allowedAttr[i][1]);
- }
-
-
- this.tidy.$div.find('*').each($.proxy(function(n,s)
- {
- var $el = $(s);
- var pos = $.inArray($el[0].tagName.toLowerCase(), allowedAttrTags);
- var attributesRemove = this.tidy.removeAttrGetRemoves(pos, allowedAttrData, $el);
-
- if (attributesRemove)
- {
- $.each(attributesRemove, function(z,f) {
- $el.removeAttr(f);
- });
- }
- }, this));
- }
-
- if (this.tidy.settings.removeAttr)
- {
- len = this.tidy.settings.removeAttr.length;
- for (var i = 0; i < len; i++)
- {
- var attrs = this.tidy.settings.removeAttr[i][1];
- if ($.isArray(attrs)) attrs = attrs.join(' ');
-
- this.tidy.$div.find(this.tidy.settings.removeAttr[i][0]).removeAttr(attrs);
- }
- }
-
- },
- removeAttrGetRemoves: function(pos, allowed, $el)
- {
- var attributesRemove = [];
-
- // remove all attrs
- if (pos == -1)
- {
- $.each($el[0].attributes, function(i, item)
- {
- attributesRemove.push(item.name);
- });
-
- }
- // allow all attrs
- else if (allowed[pos] == '*')
- {
- attributesRemove = [];
- }
- // allow specific attrs
- else
- {
- $.each($el[0].attributes, function(i, item)
- {
- if ($.isArray(allowed[pos]))
- {
- if ($.inArray(item.name, allowed[pos]) == -1)
- {
- attributesRemove.push(item.name);
- }
- }
- else if (allowed[pos] != item.name)
- {
- attributesRemove.push(item.name);
- }
-
- });
- }
-
- return attributesRemove;
- },
- removeAttrs: function (el, regex)
- {
- regex = new RegExp(regex, "g");
- return el.each(function()
- {
- var self = $(this);
- var len = this.attributes.length - 1;
- for (var i = len; i >= 0; i--)
- {
- var item = this.attributes[i];
- if (item && item.specified && item.name.search(regex)>=0)
- {
- self.removeAttr(item.name);
- }
- }
- });
- },
- removeEmpty: function()
- {
- if (!this.tidy.settings.removeEmpty) return;
-
- this.tidy.$div.find(this.tidy.settings.removeEmpty.join(',')).each(function()
- {
- var $el = $(this);
- var text = $el.text();
- text = text.replace(/[\u200B-\u200D\uFEFF]/g, '');
- text = text.replace(/ /gi, '');
- text = text.replace(/\s/g, '');
-
- if (text === '' && $el.children().length === 0)
- {
- $el.remove();
- }
- });
- },
- removeParagraphsInLists: function()
- {
- this.tidy.$div.find('li p').contents().unwrap();
- },
- removeDataAttr: function()
- {
- if (!this.tidy.settings.removeDataAttr) return;
-
- var tags = this.tidy.settings.removeDataAttr;
- if ($.isArray(this.tidy.settings.removeDataAttr)) tags = this.tidy.settings.removeDataAttr.join(',');
-
- this.tidy.removeAttrs(this.tidy.$div.find(tags), '^(data-)');
-
- },
- removeWithoutAttr: function()
- {
- if (!this.tidy.settings.removeWithoutAttr) return;
-
- this.tidy.$div.find(this.tidy.settings.removeWithoutAttr.join(',')).each(function()
- {
- if (this.attributes.length === 0)
- {
- $(this).contents().unwrap();
- }
- });
- }
- };
- },
- toolbar: function()
- {
- return {
- init: function()
- {
- return {
- html:
- {
- title: this.lang.get('html'),
- func: 'code.toggle'
- },
- formatting:
- {
- title: this.lang.get('formatting'),
- dropdown:
- {
- p:
- {
- title: this.lang.get('paragraph'),
- func: 'block.format'
- },
- blockquote:
- {
- title: this.lang.get('quote'),
- func: 'block.format'
- },
- pre:
- {
- title: this.lang.get('code'),
- func: 'block.format'
- },
- h1:
- {
- title: this.lang.get('header1'),
- func: 'block.format'
- },
- h2:
- {
- title: this.lang.get('header2'),
- func: 'block.format'
- },
- h3:
- {
- title: this.lang.get('header3'),
- func: 'block.format'
- },
- h4:
- {
- title: this.lang.get('header4'),
- func: 'block.format'
- },
- h5:
- {
- title: this.lang.get('header5'),
- func: 'block.format'
- }
- }
- },
- bold:
- {
- title: this.lang.get('bold'),
- func: 'inline.format'
- },
- italic:
- {
- title: this.lang.get('italic'),
- func: 'inline.format'
- },
- deleted:
- {
- title: this.lang.get('deleted'),
- func: 'inline.format'
- },
- underline:
- {
- title: this.lang.get('underline'),
- func: 'inline.format'
- },
- unorderedlist:
- {
- title: '• ' + this.lang.get('unorderedlist'),
- func: 'list.toggle'
- },
- orderedlist:
- {
- title: '1. ' + this.lang.get('orderedlist'),
- func: 'list.toggle'
- },
- outdent:
- {
- title: '< ' + this.lang.get('outdent'),
- func: 'indent.decrease'
- },
- indent:
- {
- title: '> ' + this.lang.get('indent'),
- func: 'indent.increase'
- },
- image:
- {
- title: this.lang.get('image'),
- func: 'image.show'
- },
- file:
- {
- title: this.lang.get('file'),
- func: 'file.show'
- },
- link:
- {
- title: this.lang.get('link'),
- dropdown:
- {
- link:
- {
- title: this.lang.get('link_insert'),
- func: 'link.show'
- },
- unlink:
- {
- title: this.lang.get('unlink'),
- func: 'link.unlink'
- }
- }
- },
- alignment:
- {
- title: this.lang.get('alignment'),
- dropdown:
- {
- left:
- {
- title: this.lang.get('align_left'),
- func: 'alignment.left'
- },
- center:
- {
- title: this.lang.get('align_center'),
- func: 'alignment.center'
- },
- right:
- {
- title: this.lang.get('align_right'),
- func: 'alignment.right'
- },
- justify:
- {
- title: this.lang.get('align_justify'),
- func: 'alignment.justify'
- }
- }
- },
- horizontalrule:
- {
- title: this.lang.get('horizontalrule'),
- func: 'line.insert'
- }
- };
- },
- build: function()
- {
- this.toolbar.hideButtons();
- this.toolbar.hideButtonsOnMobile();
- this.toolbar.isButtonSourceNeeded();
-
- if (this.opts.buttons.length === 0) return;
-
- this.$toolbar = this.toolbar.createContainer();
-
- this.toolbar.setOverflow();
- this.toolbar.append();
- this.toolbar.setFormattingTags();
- this.toolbar.loadButtons();
- this.toolbar.setFixed();
-
- // buttons response
- if (this.opts.activeButtons)
- {
- this.$editor.on('mouseup.redactor keyup.redactor focus.redactor', $.proxy(this.observe.buttons, this));
- }
-
- },
- createContainer: function()
- {
- return $('<ul>').addClass('redactor-toolbar').attr('id', 'redactor-toolbar-' + this.uuid);
- },
- setFormattingTags: function()
- {
- $.each(this.opts.toolbar.formatting.dropdown, $.proxy(function (i, s)
- {
- if ($.inArray(i, this.opts.formatting) == -1) delete this.opts.toolbar.formatting.dropdown[i];
- }, this));
-
- },
- loadButtons: function()
- {
- $.each(this.opts.buttons, $.proxy(function(i, btnName)
- {
- if (!this.opts.toolbar[btnName]) return;
-
- if (btnName === 'file')
- {
- if (this.opts.fileUpload === false) return;
- else if (!this.opts.fileUpload && this.opts.s3 === false) return;
- }
-
- if (btnName === 'image')
- {
- if (this.opts.imageUpload === false) return;
- else if (!this.opts.imageUpload && this.opts.s3 === false) return;
- }
-
- var btnObject = this.opts.toolbar[btnName];
- this.$toolbar.append($('<li>').append(this.button.build(btnName, btnObject)));
-
- }, this));
- },
- append: function()
- {
- if (this.opts.toolbarExternal)
- {
- this.$toolbar.addClass('redactor-toolbar-external');
- $(this.opts.toolbarExternal).html(this.$toolbar);
- }
- else
- {
- this.$box.prepend(this.$toolbar);
- }
- },
- setFixed: function()
- {
- if (!this.utils.isDesktop()) return;
- if (this.opts.toolbarExternal) return;
- if (!this.opts.toolbarFixed) return;
-
- this.toolbar.observeScroll();
- $(this.opts.toolbarFixedTarget).on('scroll.redactor.' + this.uuid, $.proxy(this.toolbar.observeScroll, this));
-
- },
- setOverflow: function()
- {
- if (this.utils.isMobile() && this.opts.toolbarOverflow)
- {
- this.$toolbar.addClass('redactor-toolbar-overflow');
- }
- },
- isButtonSourceNeeded: function()
- {
- if (this.opts.source) return;
-
- var index = this.opts.buttons.indexOf('html');
- if (index !== -1)
- {
- this.opts.buttons.splice(index, 1);
- }
- },
- hideButtons: function()
- {
- if (this.opts.buttonsHide.length === 0) return;
-
- $.each(this.opts.buttonsHide, $.proxy(function(i, s)
- {
- var index = this.opts.buttons.indexOf(s);
- this.opts.buttons.splice(index, 1);
-
- }, this));
- },
- hideButtonsOnMobile: function()
- {
- if (!this.utils.isMobile() || this.opts.buttonsHideOnMobile.length === 0) return;
-
- $.each(this.opts.buttonsHideOnMobile, $.proxy(function(i, s)
- {
- var index = this.opts.buttons.indexOf(s);
- this.opts.buttons.splice(index, 1);
-
- }, this));
- },
- observeScroll: function()
- {
- var scrollTop = $(this.opts.toolbarFixedTarget).scrollTop();
- var boxTop = 1;
-
- if (this.opts.toolbarFixedTarget === document)
- {
- boxTop = this.$box.offset().top;
- }
-
- if (scrollTop > boxTop)
- {
- this.toolbar.observeScrollEnable(scrollTop, boxTop);
- }
- else
- {
- this.toolbar.observeScrollDisable();
- }
- },
- observeScrollEnable: function(scrollTop, boxTop)
- {
- var top = this.opts.toolbarFixedTopOffset + scrollTop - boxTop;
- var left = 0;
- var end = boxTop + this.$box.height() - 32;
- var width = this.$box.innerWidth();
-
- this.$toolbar.addClass('toolbar-fixed-box');
- this.$toolbar.css({
- position: 'absolute',
- width: width,
- top: top + 'px',
- left: left
- });
-
- if (scrollTop > end)
- $('.redactor-dropdown-' + this.uuid + ':visible').hide();
-
- this.toolbar.setDropdownsFixed();
- this.$toolbar.css('visibility', (scrollTop < end) ? 'visible' : 'hidden');
- },
- observeScrollDisable: function()
- {
- this.$toolbar.css({
- position: 'relative',
- width: 'auto',
- top: 0,
- left: 0,
- visibility: 'visible'
- });
-
- this.toolbar.unsetDropdownsFixed();
- this.$toolbar.removeClass('toolbar-fixed-box');
- },
- setDropdownsFixed: function()
- {
- var top = this.$toolbar.innerHeight() + this.opts.toolbarFixedTopOffset;
- var position = 'fixed';
- if (this.opts.toolbarFixedTarget !== document)
- {
- top = (this.$toolbar.innerHeight() + this.$toolbar.offset().top) + this.opts.toolbarFixedTopOffset;
- position = 'absolute';
- }
-
- $('.redactor-dropdown-' + this.uuid).each(function()
- {
- $(this).css({ position: position, top: top + 'px' });
- });
- },
- unsetDropdownsFixed: function()
- {
- var top = (this.$toolbar.innerHeight() + this.$toolbar.offset().top);
- $('.redactor-dropdown-' + this.uuid).each(function()
- {
- $(this).css({ position: 'absolute', top: top + 'px' });
- });
- }
- };
- },
- upload: function()
- {
- return {
- init: function(id, url, callback)
- {
- this.upload.direct = false;
- this.upload.callback = callback;
- this.upload.url = url;
- this.upload.$el = $(id);
- this.upload.$droparea = $('<div id="redactor-droparea" />');
-
- this.upload.$placeholdler = $('<div id="redactor-droparea-placeholder" />').text(this.lang.get('upload_label'));
- this.upload.$input = $('<input type="file" name="file" />');
-
- this.upload.$placeholdler.append(this.upload.$input);
- this.upload.$droparea.append(this.upload.$placeholdler);
- this.upload.$el.append(this.upload.$droparea);
-
- this.upload.$droparea.off('redactor.upload');
- this.upload.$input.off('redactor.upload');
-
- this.upload.$droparea.on('dragover.redactor.upload', $.proxy(this.upload.onDrag, this));
- this.upload.$droparea.on('dragleave.redactor.upload', $.proxy(this.upload.onDragLeave, this));
-
- // change
- this.upload.$input.on('change.redactor.upload', $.proxy(function(e)
- {
- e = e.originalEvent || e;
- this.upload.traverseFile(this.upload.$input[0].files[0], e);
- }, this));
-
- // drop
- this.upload.$droparea.on('drop.redactor.upload', $.proxy(function(e)
- {
- e.preventDefault();
-
- this.upload.$droparea.removeClass('drag-hover').addClass('drag-drop');
- this.upload.onDrop(e);
-
- }, this));
- },
- directUpload: function(file, e)
- {
- this.upload.direct = true;
- this.upload.traverseFile(file, e);
- },
- onDrop: function(e)
- {
- e = e.originalEvent || e;
- var files = e.dataTransfer.files;
-
- this.upload.traverseFile(files[0], e);
- },
- traverseFile: function(file, e)
- {
- if (this.opts.s3)
- {
- this.upload.setConfig(file);
- this.upload.s3uploadFile(file);
- return;
- }
-
- var formData = !!window.FormData ? new FormData() : null;
- if (window.FormData)
- {
- this.upload.setConfig(file);
-
- var name = (this.upload.type == 'image') ? this.opts.imageUploadParam : this.opts.fileUploadParam;
- formData.append(name, file);
- }
-
- this.progress.show();
- this.core.setCallback('uploadStart', e, formData);
- this.upload.sendData(formData, e);
- },
- setConfig: function(file)
- {
- this.upload.getType(file);
-
- if (this.upload.direct)
- {
- this.upload.url = (this.upload.type == 'image') ? this.opts.imageUpload : this.opts.fileUpload;
- this.upload.callback = (this.upload.type == 'image') ? this.image.insert : this.file.insert;
- }
- },
- getType: function(file)
- {
- this.upload.type = 'image';
- if (this.opts.imageTypes.indexOf(file.type) == -1)
- {
- this.upload.type = 'file';
- }
- },
- getHiddenFields: function(obj, fd)
- {
- if (obj === false || typeof obj !== 'object') return fd;
-
- $.each(obj, $.proxy(function(k, v)
- {
- if (v !== null && v.toString().indexOf('#') === 0) v = $(v).val();
- fd.append(k, v);
-
- }, this));
-
- return fd;
-
- },
- sendData: function(formData, e)
- {
- // append hidden fields
- if (this.upload.type == 'image')
- {
- formData = this.upload.getHiddenFields(this.opts.uploadImageFields, formData);
- formData = this.upload.getHiddenFields(this.upload.imageFields, formData);
- }
- else
- {
- formData = this.upload.getHiddenFields(this.opts.uploadFileFields, formData);
- formData = this.upload.getHiddenFields(this.upload.fileFields, formData);
- }
-
- var xhr = new XMLHttpRequest();
- xhr.open('POST', this.upload.url);
- xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
-
- // complete
- xhr.onreadystatechange = $.proxy(function()
- {
- if (xhr.readyState == 4)
- {
- var data = xhr.responseText;
-
- data = data.replace(/^\[/, '');
- data = data.replace(/\]$/, '');
-
- var json;
- try
- {
- json = (typeof data === 'string' ? $.parseJSON(data) : data);
- }
- catch(err)
- {
- json = {
- error: true
- };
- }
-
-
- this.progress.hide();
-
- if (!this.upload.direct)
- {
- this.upload.$droparea.removeClass('drag-drop');
- }
-
- this.upload.callback(json, this.upload.direct, e);
- }
- }, this);
-
-
- /*
- xhr.upload.onprogress = $.proxy(function(e)
- {
- if (e.lengthComputable)
- {
- var complete = (e.loaded / e.total * 100 | 0);
- //progress.value = progress.innerHTML = complete;
- }
-
- }, this);
- */
-
-
- xhr.send(formData);
- },
- onDrag: function(e)
- {
- e.preventDefault();
- this.upload.$droparea.addClass('drag-hover');
- },
- onDragLeave: function(e)
- {
- e.preventDefault();
- this.upload.$droparea.removeClass('drag-hover');
- },
- clearImageFields: function()
- {
- this.upload.imageFields = {};
- },
- addImageFields: function(name, value)
- {
- this.upload.imageFields[name] = value;
- },
- removeImageFields: function(name)
- {
- delete this.upload.imageFields[name];
- },
- clearFileFields: function()
- {
- this.upload.fileFields = {};
- },
- addFileFields: function(name, value)
- {
- this.upload.fileFields[name] = value;
- },
- removeFileFields: function(name)
- {
- delete this.upload.fileFields[name];
- },
-
-
- // S3
- s3uploadFile: function(file)
- {
- this.upload.s3executeOnSignedUrl(file, $.proxy(function(signedURL)
- {
- this.upload.s3uploadToS3(file, signedURL);
- }, this));
- },
- s3executeOnSignedUrl: function(file, callback)
- {
- var xhr = new XMLHttpRequest();
-
- var mark = '?';
- if (this.opts.s3.search(/\?/) != '-1') mark = '&';
-
- xhr.open('GET', this.opts.s3 + mark + 'name=' + file.name + '&type=' + file.type, true);
-
- // Hack to pass bytes through unprocessed.
- if (xhr.overrideMimeType) xhr.overrideMimeType('text/plain; charset=x-user-defined');
-
- var that = this;
- xhr.onreadystatechange = function(e)
- {
- if (this.readyState == 4 && this.status == 200)
- {
- that.progress.show();
- callback(decodeURIComponent(this.responseText));
- }
- else if (this.readyState == 4 && this.status != 200)
- {
- //setProgress(0, 'Could not contact signing script. Status = ' + this.status);
- }
- };
-
- xhr.send();
- },
- s3createCORSRequest: function(method, url)
- {
- var xhr = new XMLHttpRequest();
- if ("withCredentials" in xhr)
- {
- xhr.open(method, url, true);
- }
- else if (typeof XDomainRequest != "undefined")
- {
- xhr = new XDomainRequest();
- xhr.open(method, url);
- }
- else
- {
- xhr = null;
- }
-
- return xhr;
- },
- s3uploadToS3: function(file, url)
- {
- var xhr = this.upload.s3createCORSRequest('PUT', url);
- if (!xhr)
- {
- //setProgress(0, 'CORS not supported');
- }
- else
- {
- xhr.onload = $.proxy(function()
- {
- if (xhr.status == 200)
- {
- //setProgress(100, 'Upload completed.');
-
- this.progress.hide();
-
- var s3file = url.split('?');
-
- if (!s3file[0])
- {
- // url parsing is fail
- return false;
- }
-
-
- if (!this.upload.direct)
- {
- this.upload.$droparea.removeClass('drag-drop');
- }
-
- var json = { filelink: s3file[0] };
- if (this.upload.type == 'file')
- {
- var arr = s3file[0].split('/');
- json.filename = arr[arr.length-1];
- }
-
- this.upload.callback(json, this.upload.direct, false);
-
-
- }
- else
- {
- //setProgress(0, 'Upload error: ' + xhr.status);
- }
- }, this);
-
- xhr.onerror = function()
- {
- //setProgress(0, 'XHR error.');
- };
-
- xhr.upload.onprogress = function(e)
- {
- /*
- if (e.lengthComputable)
- {
- var percentLoaded = Math.round((e.loaded / e.total) * 100);
- setProgress(percentLoaded, percentLoaded == 100 ? 'Finalizing.' : 'Uploading.');
- }
- */
- };
-
- xhr.setRequestHeader('Content-Type', file.type);
- xhr.setRequestHeader('x-amz-acl', 'public-read');
-
- xhr.send(file);
- }
- }
- };
- },
- utils: function()
- {
- return {
- isMobile: function()
- {
- return /(iPhone|iPod|BlackBerry|Android)/.test(navigator.userAgent);
- },
- isDesktop: function()
- {
- return !/(iPhone|iPod|iPad|BlackBerry|Android)/.test(navigator.userAgent);
- },
- isString: function(obj)
- {
- return Object.prototype.toString.call(obj) == '[object String]';
- },
- isEmpty: function(html, removeEmptyTags)
- {
- html = html.replace(/[\u200B-\u200D\uFEFF]/g, '');
- html = html.replace(/ /gi, '');
- html = html.replace(/<\/?br\s?\/?>/g, '');
- html = html.replace(/\s/g, '');
- html = html.replace(/^<p>[^\W\w\D\d]*?<\/p>$/i, '');
- html = html.replace(/<iframe(.*?[^>])>$/i, 'iframe');
- html = html.replace(/<source(.*?[^>])>$/i, 'source');
-
- // remove empty tags
- if (removeEmptyTags !== false)
- {
- html = html.replace(/<[^\/>][^>]*><\/[^>]+>/gi, '');
- html = html.replace(/<[^\/>][^>]*><\/[^>]+>/gi, '');
- }
-
- html = $.trim(html);
-
- return html === '';
- },
- normalize: function(str)
- {
- if (typeof(str) === 'undefined') return 0;
- return parseInt(str.replace('px',''), 10);
- },
- hexToRgb: function(hex)
- {
- if (typeof hex == 'undefined') return;
- if (hex.search(/^#/) == -1) return hex;
-
- var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
- hex = hex.replace(shorthandRegex, function(m, r, g, b)
- {
- return r + r + g + g + b + b;
- });
-
- var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
- return 'rgb(' + parseInt(result[1], 16) + ', ' + parseInt(result[2], 16) + ', ' + parseInt(result[3], 16) + ')';
- },
- getOuterHtml: function(el)
- {
- return $('<div>').append($(el).eq(0).clone()).html();
- },
- getAlignmentElement: function(el)
- {
- if ($.inArray(el.tagName, this.opts.alignmentTags) !== -1)
- {
- return $(el);
- }
- else
- {
- return $(el).closest(this.opts.alignmentTags.toString().toLowerCase(), this.$editor[0]);
- }
- },
- removeEmptyAttr: function(el, attr)
- {
- var $el = $(el);
- if (typeof $el.attr(attr) == 'undefined')
- {
- return true;
- }
-
- if ($el.attr(attr) === '')
- {
- $el.removeAttr(attr);
- return true;
- }
-
- return false;
- },
- removeEmpty: function(i, s)
- {
- var $s = $($.parseHTML(s));
-
- $s.find('.redactor-invisible-space').removeAttr('style').removeAttr('class');
-
- if ($s.find('hr, br, img, iframe, source').length !== 0) return;
- var text = $.trim($s.text());
-
- if (this.utils.isEmpty(text, false))
- {
- $s.remove();
- }
- },
-
- // save and restore scroll
- saveScroll: function()
- {
- this.saveEditorScroll = this.$editor.scrollTop();
- this.saveBodyScroll = $(window).scrollTop();
-
- if (this.opts.scrollTarget) this.saveTargetScroll = $(this.opts.scrollTarget).scrollTop();
- },
- restoreScroll: function()
- {
- if (typeof this.saveScroll === 'undefined' && typeof this.saveBodyScroll === 'undefined') return;
-
- $(window).scrollTop(this.saveBodyScroll);
- this.$editor.scrollTop(this.saveEditorScroll);
-
- if (this.opts.scrollTarget) $(this.opts.scrollTarget).scrollTop(this.saveTargetScroll);
- },
-
- // get invisible space element
- createSpaceElement: function()
- {
- var space = document.createElement('span');
- space.className = 'redactor-invisible-space';
- space.innerHTML = this.opts.invisibleSpace;
-
- return space;
- },
-
- // replace
- removeInlineTags: function(node)
- {
- var tags = this.opts.inlineTags;
- tags.push('span');
-
- if (node.tagName == 'PRE') tags.push('a');
-
- $(node).find(tags.join(',')).not('span.redactor-selection-marker').contents().unwrap();
- },
- replaceWithContents: function(node, removeInlineTags)
- {
- var self = this;
- $(node).replaceWith(function()
- {
- if (removeInlineTags === true) self.utils.removeInlineTags(this);
-
- return $(this).contents();
- });
-
- return $(node);
- },
- replaceToTag: function(node, tag, removeInlineTags)
- {
- var replacement;
- var self = this;
- $(node).replaceWith(function()
- {
- replacement = $('<' + tag + ' />').append($(this).contents());
-
- for (var i = 0; i < this.attributes.length; i++)
- {
- replacement.attr(this.attributes[i].name, this.attributes[i].value);
- }
-
- if (removeInlineTags === true) self.utils.removeInlineTags(replacement);
-
- return replacement;
- });
-
- return replacement;
- },
-
- // start and end of element
- isStartOfElement: function()
- {
- var block = this.selection.getBlock();
- if (!block) return false;
-
- var offset = this.caret.getOffsetOfElement(block);
-
- return (offset === 0) ? true : false;
- },
- isEndOfElement: function(element)
- {
- if (typeof element == 'undefined')
- {
- var element = this.selection.getBlock();
- if (!element) return false;
- }
-
- var offset = this.caret.getOffsetOfElement(element);
- var text = $.trim($(element).text()).replace(/\n\r\n/g, '');
-
- return (offset == text.length) ? true : false;
- },
- isEndOfEditor: function()
- {
- var block = this.$editor[0];
-
- var offset = this.caret.getOffsetOfElement(block);
- var text = $.trim($(block).html().replace(/(<([^>]+)>)/gi,''));
-
- return (offset == text.length) ? true : false;
- },
-
- // test blocks
- isBlock: function(block)
- {
- block = block[0] || block;
-
- return block && this.utils.isBlockTag(block.tagName);
- },
- isBlockTag: function(tag)
- {
- if (typeof tag == 'undefined') return false;
-
- return this.reIsBlock.test(tag);
- },
-
- // tag detection
- isTag: function(current, tag)
- {
- var element = $(current).closest(tag, this.$editor[0]);
- if (element.length == 1)
- {
- return element[0];
- }
-
- return false;
- },
-
- // select all
- isSelectAll: function()
- {
- return this.selectAll;
- },
- enableSelectAll: function()
- {
- this.selectAll = true;
- },
- disableSelectAll: function()
- {
- this.selectAll = false;
- },
-
- // parents detection
- isRedactorParent: function(el)
- {
- if (!el)
- {
- return false;
- }
-
- if ($(el).parents('.redactor-editor').length === 0 || $(el).hasClass('redactor-editor'))
- {
- return false;
- }
-
- return el;
- },
- isCurrentOrParentHeader: function()
- {
- return this.utils.isCurrentOrParent(['H1', 'H2', 'H3', 'H4', 'H5', 'H6']);
- },
- isCurrentOrParent: function(tagName)
- {
- var parent = this.selection.getParent();
- var current = this.selection.getCurrent();
-
- if ($.isArray(tagName))
- {
- var matched = 0;
- $.each(tagName, $.proxy(function(i, s)
- {
- if (this.utils.isCurrentOrParentOne(current, parent, s))
- {
- matched++;
- }
- }, this));
-
- return (matched === 0) ? false : true;
- }
- else
- {
- return this.utils.isCurrentOrParentOne(current, parent, tagName);
- }
- },
- isCurrentOrParentOne: function(current, parent, tagName)
- {
- tagName = tagName.toUpperCase();
-
- return parent && parent.tagName === tagName ? parent : current && current.tagName === tagName ? current : false;
- },
-
-
- // browsers detection
- isOldIe: function()
- {
- return (this.utils.browser('msie') && parseInt(this.utils.browser('version'), 10) < 9) ? true : false;
- },
- isLessIe10: function()
- {
- return (this.utils.browser('msie') && parseInt(this.utils.browser('version'), 10) < 10) ? true : false;
- },
- isIe11: function()
- {
- return !!navigator.userAgent.match(/Trident\/7\./);
- },
- browser: function(browser)
- {
- var ua = navigator.userAgent.toLowerCase();
- var match = /(opr)[\/]([\w.]+)/.exec( ua ) ||
- /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
- /(webkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) ||
- /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
- /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
- /(msie) ([\w.]+)/.exec( ua ) ||
- ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) ||
- ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
- [];
-
- if (browser == 'safari') return (typeof match[3] != 'undefined') ? match[3] == 'safari' : false;
- if (browser == 'version') return match[2];
- if (browser == 'webkit') return (match[1] == 'chrome' || match[1] == 'opr' || match[1] == 'webkit');
- if (match[1] == 'rv') return browser == 'msie';
- if (match[1] == 'opr') return browser == 'webkit';
-
- return browser == match[1];
- }
- };
- },
- linkify: function()
- {
- return {
- isKey: function(key)
- {
- return key == this.keyCode.ENTER || key == this.keyCode.SPACE;
- },
- isEnabled: function()
- {
- return this.opts.convertLinks && (this.opts.convertUrlLinks || this.opts.convertImageLinks || this.opts.convertVideoLinks) && !this.utils.isCurrentOrParent('PRE');
- },
- format: function()
- {
- var linkify = this.linkify,
- opts = this.opts;
-
- this.$editor
- .find(":not(iframe,img,a,pre)")
- .addBack()
- .contents()
- .filter(function()
- {
- return this.nodeType === 3 && $.trim(this.nodeValue) != "" && !$(this).parent().is("pre") && (this.nodeValue.match(opts.linkify.regexps.youtube) || this.nodeValue.match(opts.linkify.regexps.vimeo) || this.nodeValue.match(opts.linkify.regexps.image) || this.nodeValue.match(opts.linkify.regexps.url));
- })
- .each(function()
- {
- var text = $(this).text(),
- html = text;
-
- if (opts.convertVideoLinks && (html.match(opts.linkify.regexps.youtube) || html.match(opts.linkify.regexps.vimeo)) )
- {
- html = linkify.convertVideoLinks(html);
- }
- else if (opts.convertImageLinks && html.match(opts.linkify.regexps.image))
- {
- html = linkify.convertImages(html);
- }
- else if (opts.convertUrlLinks)
- {
- html = linkify.convertLinks(html);
- }
-
- $(this).before(text.replace(text, html))
- .remove();
- });
-
- this.linkify.after();
- },
- convertVideoLinks: function(html)
- {
- var iframeStart = '<iframe width="500" height="281" src="',
- iframeEnd = '" frameborder="0" allowfullscreen></iframe>';
-
- if (html.match(this.opts.linkify.regexps.youtube))
- {
- html = html.replace(this.opts.linkify.regexps.youtube, iframeStart + '//www.youtube.com/embed/$1' + iframeEnd);
- }
-
- if (html.match(this.opts.linkify.regexps.vimeo))
- {
- html = html.replace(this.opts.linkify.regexps.vimeo, iframeStart + '//player.vimeo.com/video/$2' + iframeEnd);
- }
-
- return html;
- },
- convertImages: function(html)
- {
- var matches = html.match(this.opts.linkify.regexps.image);
-
- if (matches)
- {
- html = html.replace(html, '<img src="' + matches + '" />');
- }
-
- return html;
- },
- convertLinks: function(html)
- {
- var matches = html.match(this.opts.linkify.regexps.url);
-
- if (matches)
- {
- matches = $.grep(matches, function(v, k) { return $.inArray(v, matches) === k; });
-
- var length = matches.length;
-
- for (var i = 0; i < length; i++)
- {
- var href = matches[i],
- text = href,
- linkProtocol = this.opts.linkProtocol + '://';
-
- if (href.match(/(https?|ftp):\/\//i) !== null)
- {
- linkProtocol = "";
- }
-
- if (text.length > this.opts.linkSize)
- {
- text = text.substring(0, this.opts.linkSize) + '...';
- }
-
- text = decodeURIComponent(text);
-
- var regexB = "\\b";
-
- if ($.inArray(href.slice(-1), ["/", "&", "="]) != -1)
- {
- regexB = "";
- }
-
- // escaping url
- var regexp = new RegExp('(' + href.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + regexB + ')', 'g');
-
- html = html.replace(regexp, '<a href="' + linkProtocol + $.trim(href) + '">' + $.trim(text) + '</a>');
- }
- }
-
- return html;
- },
- after: function()
- {
- this.observe.load();
- this.code.sync();
- }
- }
- }
- };
-
- $(window).on('load.tools.redactor', function()
- {
- $('[data-tools="redactor"]').redactor();
- });
-
- // constructor
- Redactor.prototype.init.prototype = Redactor.prototype;
-})(jQuery);
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(C($){\'lC lA\';if(!js.5K.9T){js.5K.9T=C(jt){E fn=q;F C(){F fn.8E(jt)}}}E 2G=0;$.fn.I=C(3Y){E 2J=[];E jw=9i.5K.de.5Z(kU,1);if(1s 3Y===\'6W\'){q.1z(C(){E 6Z=$.1f(q,\'I\');E 1C;if(3Y.3L(/\\./)!=\'-1\'){1C=3Y.4p(\'.\');if(1s 6Z[1C[0]]!=\'1y\'){1C=6Z[1C[0]][1C[1]]}}M{1C=6Z[3Y]}if(1s 6Z!==\'1y\'&&$.5s(1C)){E bo=1C.8E(6Z,jw);if(bo!==1y&&bo!==6Z){2J.2R(bo)}}M{$.6X(\'lu lv aS "\'+3Y+\'" 2C 43\')}})}M{q.1z(C(){$.1f(q,\'I\',{});$.1f(q,\'I\',43(q,3Y))})}if(2J.12===0)F q;M if(2J.12===1)F 2J[0];M F 2J};C 43(el,3Y){F 29 43.5K.3N(el,3Y)}$.43=43;$.43.lI=\'10.2.3\';$.43.bI=[\'3a\',\'3o\',\'R\',\'28\',\'2r\',\'1u\',\'1T\',\'1v\',\'1d\',\'1W\',\'1o\',\'22\',\'2m\',\'N\',\'3B\',\'25\',\'1Y\',\'1D\',\'2x\',\'1H\',\'3M\',\'V\',\'2z\',\'2e\',\'1a\',\'1R\',\'2W\',\'5u\',\'3e\',\'5I\',\'J\',\'6i\',\'2I\',\'1I\',\'1B\',\'1w\',\'L\'];$.43.G={1H:\'en\',cX:\'lo\',8F:O,2m:O,ix:O,3e:O,6e:1r,6H:O,as:O,9O:O,1K:O,6r:1r,2W:1r,kG:O,bu:1r,jg:1r,gq:1r,hg:O,3o:O,bU:O,8M:60,bR:O,aF:O,jz:1r,5g:\'8U\',hd:O,dh:50,cA:1r,ij:1r,im:1r,8o:\'lT\',cE:1r,7J:4d,hH:\'22\',lZ:O,ht:1r,7D:4d,hJ:\'22\',hq:1r,7P:O,bs:1r,dk:1r,dj:1r,8C:1r,6T:4,aR:O,fw:1r,8h:O,1B:1r,fP:1r,6B:1k,6z:0,9M:O,fR:O,4B:1r,4k:[\'B\',\'3b\',\'4n\',\'4m\',\'5W\',\'5n\',\'5o\',\'7a\',\'3B\',\'N\',\'22\',\'V\',\'3a\',\'aE\'],dK:[],dW:[],3b:[\'p\',\'26\',\'2H\',\'h1\',\'h2\',\'h3\',\'h4\',\'h5\',\'h6\'],cu:O,2I:1r,49:[\'3V\',\'1p\'],4t:O,bL:[\'3T\',\'1j\',\'2H\',\'69\',\'3s\',\'ol\',\'h1\',\'h2\',\'h3\',\'h4\',\'h5\',\'h6\',\'dl\',\'26\',\'7G\',\'c4\',\'4h\',\'7S\',\'cR\',\'eC\',\'eH\',\'41\',\'1p\',\'3V\',\'4R\',\'7F\',\'3E\',\'2v\',\'1u\',\'3Z\',\'k7\',\'kS\',\'lR\',\'hr\',\'kd\',\'m0\',\'kY\',\'kZ\',\'70\',\'l0\',\'lk\',\'lb\',\'p\'],6C:O,5F:[[\'7U\',\'4l\'],[\'b\',\'5e\']],5r:[[\'3P-7z:\\\\s?4n\',"5e"],[\'3P-1p:\\\\s?4m\',"em"],[\'1g-80:\\\\s?5p\',"u"],[\'1g-80:\\\\s?3M-fc\',\'4l\']],5m:O,1L:O,4T:O,6N:[\'1i\'],3S:[\'p\'],bq:[\'5W\',\'4m\',\'4n\',\'5p\',\'5n\',\'5o\',\'l5\',\'lj\',\'l8\',\'9r\'],bJ:{b:\'4n\',5e:\'4n\',i:\'4m\',em:\'4m\',4l:\'5W\',7U:\'5W\',3s:\'5n\',ol:\'5o\',u:\'5p\'},6i:{\'4f+6L+m, 5k+6L+m\':{1C:\'25.c6\'},\'4f+b, 5k+b\':{1C:\'25.31\',6j:[\'4n\']},\'4f+i, 5k+i\':{1C:\'25.31\',6j:[\'4m\']},\'4f+h, 5k+h\':{1C:\'25.31\',6j:[\'eK\']},\'4f+l, 5k+l\':{1C:\'25.31\',6j:[\'eP\']},\'4f+k, 5k+k\':{1C:\'V.2O\'},\'4f+6L+7\':{1C:\'2e.3j\',6j:[\'5o\']},\'4f+6L+8\':{1C:\'2e.3j\',6j:[\'5n\']}},kH:O,28:[],9L:[],6s:\'<p>&#aZ;</p>\',5R:\'&#aZ;\',hQ:[\'N/j0\',\'N/lf\',\'N/jR\'],b7:20,c2:[\'a\',\'1M\',\'b\',\'5e\',\'7Z\',\'7V\',\'i\',\'em\',\'u\',\'9h\',\'7U\',\'4l\',\'9u\',\'3s\',\'ol\',\'li\'],4N:[\'5e\',\'b\',\'u\',\'em\',\'i\',\'1d\',\'4l\',\'ld\',\'bz\',\'aO\',\'7V\',\'7Z\',\'7O\',\'E\',\'9u\',\'9h\'],8q:[\'P\',\'ec\',\'e9\',\'e3\',\'ef\',\'eg\',\'ee\',\'le\',\'lc\',\'l9\',\'7p\',\'6w\',\'bd\',\'la\',\'hm\',\'lg\',\'lm\',\'l2\',\'l3\',\'nF\',\'n8\'],9a:[\'8P\',\'8y\',\'8t\',\'5y\'],cH:O,1R:{7r:[]},ku:{en:{B:\'n7\',6E:\'6x j5\',N:\'6x j7\',3T:\'bP\',V:\'bW\',bx:\'6x V\',dB:\'iY V\',6t:\'n6\',3b:\'n4\',kE:\'n9 1g\',e1:\'ne\',1d:\'jc\',iC:\'8Y 1\',fz:\'8Y 2\',fy:\'8Y 3\',fF:\'8Y 4\',fv:\'8Y 5\',4n:\'nb\',4m:\'n3\',mV:\'mU iL\',mR:\'mW iL\',5n:\'mX iO\',5o:\'n1 iO\',7a:\'mZ\',3B:\'mY\',iR:\'ng\',1Y:\'6x\',3m:\'nx\',ir:\'9y\',nv:\'6x bP\',nz:\'9m bO nE\',nD:\'9m bO nB\',nu:\'9m bK iT\',nt:\'9m bK iU\',nk:\'9y bK\',no:\'9y bO\',mj:\'9y bP\',mi:\'mh\',mf:\'mg\',mk:\'9m iH\',mp:\'9y iH\',1J:\'mn\',cP:\'mm\',5z:\'me\',2c:\'iT\',4z:\'iU\',5E:\'j4\',md:\'j7 m6 bW\',1g:\'m5\',d5:\'m4\',m2:\'cM\',m3:\'j5 m7 jc or m8/mc bW\',22:\'6x ma\',1w:\'m9\',mq:\'mr\',jb:\'mI\',mH:\'mG jb\',mF:\'iZ 22 j2\',fm:\'j3 1g iX iW 2c\',fs:\'j4 1g\',fI:\'j3 1g iX iW 4z\',fJ:\'mK 1g\',aE:\'6x mO mN\',5W:\'mM\',gg:\'mL\',at:\'mE V in 29 5C\',5p:\'mD\',3a:\'mw\',6h:\'mv (mu)\',7e:\'iY\',ev:\'iZ 22 j2 or \'}},2z:{4w:{6K:/5w?:\\/\\/(?:[0-9A-Z-]+\\.)?(?:mt\\.be\\/|6K\\.bw\\S*[^\\w\\-\\s])([\\w\\-]{11})(?=[^\\w\\-]|$)(?![?=&+%\\w.\\-]*(?:[\'"][^<>]*>|<\\/a>))[?=&+%\\w.-]*/ig,6F:/5w?:\\/\\/(7f\\.)?6F.bw\\/(\\d+)($|\\/)/,N:/((5w?|7f)[^\\s]+\\.)(mx?g|j0|jR)(\\?[^\\s-]+)?/ig,2h:/(5w?:\\/\\/(?:7f\\.|(?!7f))[^\\s\\.]+\\.[^\\s]{2,}|7f\\.[^\\s]+\\.[^\\s]{2,})/ig,}},8l:O};43.fn=$.43.5K={3t:{7x:8,8n:46,mC:38,ci:40,6R:13,kT:32,am:27,ce:9,fh:17,fg:91,fj:16,fi:18,g8:39,mA:37,iA:91},3N:C(el,3Y){q.$2k=$(el);q.2G=2G++;q.7k=O;q.$5b=O;q.kJ(3Y);q.kD();q.3b={};$.mz(q.G.9a,q.G.8q);q.hG=29 2l(\'^(\'+q.G.9a.3d(\'|\')+\')$\',\'i\');q.1I.jY();if(q.G.49!==O){E 2d=[\'B\',\'dO\',\'V\',\'3c\',\'5k\',\'my\'];2C(E i=0;i<2d.12;i++){q.G.49.2R(2d[i])}}q.1H.2K();$.7w(q.G.6i,q.G.kH);q.1W.2q(\'2b\');q.2b=1r;q.2r.es()},kJ:C(3Y){q.G=$.7w({},$.7w(1r,{},$.43.G),q.$2k.1f(),3Y)},cN:C(41){F gU.ms(41).dc(C(ab){F 1s 41[ab]==\'C\'})},kD:C(){E 2o=$.43.bI.12;2C(E i=0;i<2o;i++){q.kK($.43.bI[i])}},kK:C(6y){if(1s q[6y]==\'1y\')F;q[6y]=q[6y]();E 6l=q.cN(q[6y]);E 2o=6l.12;2C(E z=0;z<2o;z++){q[6y][6l[z]]=q[6y][6l[z]].9T(q)}},3a:C(){F{2c:C(){q.3a.1U(\'\')},4z:C(){q.3a.1U(\'4z\')},5E:C(){q.3a.1U(\'5E\')},9r:C(){q.3a.1U(\'9r\')},1U:C(1m){if(!q.L.1P(\'2F\'))q.$T.2m();q.28.1U();q.J.3m();q.3a.1Z=q.J.42();q.3a.1m=1m;if(q.3a.kw()){q.3a.k4()}M{q.3a.k3()}q.J.3g();q.1d.1S()},k4:C(){E 4P=q.J.62(\'1j\');$(4P).1c(\'1f-9z\',\'I\').1O(\'1g-5a\',q.3a.1m)},k3:C(){$.1z(q.3a.1Z,$.1e(C(i,el){E $el=q.L.bp(el);if(!$el)F;if(q.3a.jV($el)){q.3a.jT($el)}M{q.3a.k0($el)}},q))},kw:C(){F(q.G.1K&&q.3a.1Z[0]===O)},jV:C($el){F(q.3a.1m===\'\'&&1s($el.1f(\'9z\'))!==\'1y\')},jT:C($el){$el.2u($el.B())},k0:C($el){$el.1O(\'1g-5a\',q.3a.1m);q.L.5H($el,\'1p\')}}},3o:C(){F{B:O,a7:C(){if(!q.G.3o)F;q.3o.1x=(q.G.bU)?q.G.bU:q.$2v.1c(\'1x\');if(q.G.bR)F;q.8M=mo(q.3o.2K,q.G.8M*nr)},gr:C(){if(!q.G.bR)F;q.3o.2K()},2K:C(){if(!q.G.3o)F;q.3o.4B=q.1d.1b();if(q.3o.B===q.3o.4B)F;E 1f={};1f[\'1x\']=q.3o.1x;1f[q.3o.1x]=q.3o.4B;1f=q.3o.71(1f);E kk=$.ns({2h:q.G.3o,1m:\'nm\',1f:1f});kk.nC(q.3o.kt)},71:C(1f){if(q.G.aF===O||1s q.G.aF!==\'41\'){F 1f}$.1z(q.G.aF,$.1e(C(k,v){if(v!==4d&&v.4s().4I(\'#\')===0)v=$(v).2J();1f[k]=v},q));F 1f},kt:C(1f){E 2P;52{2P=$.iw(1f)}4U(e){2P=1f}E kg=(1s 2P.6X==\'1y\')?\'3o\':\'lO\';q.1W.2q(kg,q.3o.1x,2P);q.3o.B=q.3o.4B},lM:C(){i0(q.8M)}}},R:C(){F{3b:C(1x){q.R.a2=O;E 1m,1E;if(1s q.3b[1x].1f!=\'1y\')1m=\'1f\';M if(1s q.3b[1x].1c!=\'1y\')1m=\'1c\';M if(1s q.3b[1x][\'1G\']!=\'1y\')1m=\'1G\';if(1s q.3b[1x].9d!=\'1y\'){q.R.a2=1r}if(1m)1E=q.3b[1x][1m];q.R.31(q.3b[1x].Y,1m,1E)},31:C(Y,1m,1E){if(Y==\'e1\')Y=\'26\';E ke=[\'p\',\'2H\',\'26\',\'h1\',\'h2\',\'h3\',\'h4\',\'h5\',\'h6\'];if($.3q(Y,ke)==-1)F;q.R.8H=(Y==\'2H\'||Y.3L(/h[1-6]/i)!=-1);if(!q.L.1P(\'2F\'))q.$T.2m();E B=$.3k(q.$T.B());q.R.3z=q.L.3z(B);if(q.L.1P(\'4g\')&&!q.2m.cp()){if(q.R.3z){E $3H;if(!q.G.1K){$3H=q.$T.3O().3H();q.1T.3J($3H)}}}q.R.1Z=q.J.42();q.R.7i=q.R.1Z.12;q.R.1m=1m;q.R.1E=1E;q.28.1U();q.J.3m();q.R.1U(Y);q.J.3g();q.1d.1S();q.1R.2K()},1U:C(Y){q.J.1b();q.R.6c=q.14.kO.1n;if(q.14.4Y){q.R.kn(Y)}M{q.R.k9(Y)}},kn:C(Y){if(q.G.1K&&q.R.3z&&Y!=\'p\'){E Q=1k.3y(Y);q.$T.B(Q);q.1T.3J(Q);F}E R=q.R.1Z[0];if(R===O)F;if(R.1n==\'5y\'){if(Y!=\'26\')F;q.R.aB();F}E b0=(q.R.6c==\'6w\'||q.R.6c==\'cz\');if(b0&&!q.G.1K){1k.47(\'a0\',O,\'<\'+Y+\'>\');R=q.J.4a();q.R.3j($(R))}M if(R.1n.3f()!=Y){if(q.G.1K&&Y==\'p\'){$(R).1F(\'<br>\');q.L.6p(R)}M{E $1X=q.L.4J(R,Y);q.R.3j($1X);if(Y!=\'p\'&&Y!=\'26\')$1X.1h(\'1M\').1t();if(q.R.8H)q.L.56($1X);if(Y==\'p\'||q.R.bX)$1X.1h(\'p\').2a().44();q.R.bT($1X)}}M if(Y==\'26\'&&R.1n.3f()==Y){if(q.G.1K){$(R).1F(\'<br>\');q.L.6p(R)}M{E $el=q.L.4J(R,\'p\');q.R.3j($el)}}M if(R.1n.3f()==Y){q.R.3j($(R))}if(1s q.R.1m==\'1y\'&&1s q.R.1E==\'1y\'){$(R).1L(\'1G\').1L(\'1p\')}},k9:C(Y){E R=q.R.1Z[0];E b0=(q.R.6c==\'6w\'||q.R.6c==\'cz\');if(R!==O&&q.R.7i===1){if(R.1n.3f()==Y&&Y==\'26\'){if(q.G.1K){$(R).1F(\'<br>\');q.L.6p(R)}M{E $el=q.L.4J(R,\'p\');q.R.3j($el)}}M if(R.1n==\'5y\'){if(Y!=\'26\')F;q.R.aB()}M if(q.R.6c==\'bd\'){q.R.fE(Y)}M if(q.G.1K&&((b0)||(q.14.kO!=R))){q.R.ap(Y)}M{if(q.G.1K&&Y==\'p\'){$(R).6u(\'<br>\').1F(\'<br>\');q.L.6p(R)}M if(R.1n===\'6w\'){q.R.ap(Y)}M{E $1X=q.L.4J(R,Y);q.R.3j($1X);if(q.R.8H)q.L.56($1X);if(Y==\'p\'||q.R.bX)$1X.1h(\'p\').2a().44()}}}M{if(q.G.1K||Y!=\'p\'){if(Y==\'26\'){E bQ=0;2C(E i=0;i<q.R.7i;i++){if(q.R.1Z[i].1n==\'bd\')bQ++}if(bQ==q.R.7i){$.1z(q.R.1Z,$.1e(C(i,s){E $1X=O;if(q.G.1K){$(s).6u(\'<br>\').1F(\'<br>\');$1X=q.L.6p(s)}M{$1X=q.L.4J(s,\'p\')}if($1X&&1s q.R.1m==\'1y\'&&1s q.R.1E==\'1y\'){$1X.1L(\'1G\').1L(\'1p\')}},q));F}}q.R.ap(Y)}M{E 8V=0;E 5M=O;if(q.R.1m==\'1G\'){5M=\'3j\';8V=$(q.R.1Z).dc(\'.\'+q.R.1E).12;if(q.R.7i==8V)5M=\'3j\';M if(q.R.7i>8V)5M=\'1U\';M if(8V===0)5M=\'1U\'}E 8g=[\'3s\',\'ol\',\'li\',\'2Z\',\'5S\',\'dl\',\'dt\',\'dd\'];$.1z(q.R.1Z,$.1e(C(i,s){if($.3q(s.1n.3f(),8g)!=-1)F;E $1X=q.L.4J(s,Y);if(5M){if(5M==\'3j\')q.R.3j($1X);M if(5M==\'1t\')q.R.1t($1X);M if(5M==\'1U\')q.R.fH($1X)}M q.R.3j($1X);if(Y!=\'p\'&&Y!=\'26\')$1X.1h(\'1M\').1t();if(q.R.8H)q.L.56($1X);if(Y==\'p\'||q.R.bX)$1X.1h(\'p\').2a().44();if(1s q.R.1m==\'1y\'&&1s q.R.1E==\'1y\'){$1X.1L(\'1G\').1L(\'1p\')}},q))}}},fH:C($el){if(q.R.a2){$el.1L(\'1G\').1L(\'1p\')}if(q.R.1m==\'1G\'){$el.2f(q.R.1E);F}M if(q.R.1m==\'1c\'||q.R.1m==\'1f\'){$el.1c(q.R.1E.1x,q.R.1E.1E);F}},3j:C($el){if(q.R.a2){$el.1L(\'1G\').1L(\'1p\')}if(q.R.1m==\'1G\'){$el.7C(q.R.1E);F}M if(q.R.1m==\'1c\'||q.R.1m==\'1f\'){if($el.1c(q.R.1E.1x)==q.R.1E.1E){$el.1L(q.R.1E.1x)}M{$el.1c(q.R.1E.1x,q.R.1E.1E)}F}M{$el.1L(\'1p 1G\');F}},1t:C($el){$el.2U(q.R.1E)},aB:C(){E R=$(q.R.1Z[0]).2p(\'3s, ol\',q.$T[0]);$(R).1h(\'3s, ol\').2a().44();$(R).1h(\'li\').1F($(\'<br>\')).2a().44();E $el=q.L.4J(R,\'26\');q.R.3j($el)},fE:C(Y){1k.47(\'7a\');1k.47(\'a0\',O,Y);q.1v.4y();q.$T.1h(\'p:g2\').1t();E 1X=q.J.4a();if(Y!=\'p\'){$(1X).1h(\'1M\').1t()}if(!q.G.1K){q.R.3j($(1X))}q.$T.1h(\'3s, ol, 6S, 26, p\').1z($.1e(q.L.3S,q));if(q.G.1K&&Y==\'p\'){q.L.6p(1X)}},ap:C(Y){if(q.R.6c==\'8y\'||q.R.6c==\'8t\'){if(Y==\'26\'){q.R.aB()}M{F}}E 1X=q.J.62(Y);if(1X===O)F;E $1X=$(1X);q.R.bT($1X);E $fq=$1X.1h(q.G.9a.3d(\',\')+\', 2Z, 3T, dP, dJ, dQ, 5S, 6S\');$fq.2a().44();if(Y!=\'p\'&&Y!=\'26\')$1X.1h(\'1M\').1t();$.1z(q.R.1Z,$.1e(q.L.3S,q));$1X.1F(q.J.6Q(2));if(!q.G.1K){q.R.3j($1X)}q.$T.1h(\'3s, ol, 6S, 26, p\').1z($.1e(q.L.3S,q));$1X.1h(\'26:g2\').1t();if(q.R.8H){q.L.56($1X)}if(q.G.1K&&Y==\'p\'){q.L.6p($1X)}if(q.G.1K){E $1N=$1X.1N().1N();if($1N.82()!=0&&$1N[0].1n===\'5l\'){$1N.1t()}}},bT:C($1X){if($1X.2p(\'3T\',q.$T[0]).12===0)F;if($1X.2p(\'6S\',q.$T[0]).12===0)$1X.62(\'<6S>\');if($1X.2p(\'2Z\',q.$T[0]).12===0&&$1X.2p(\'5S\').12===0){$1X.62(\'<2Z>\')}},i6:C(1x,1E){E 1Z=q.J.42();$(1Z).1L(\'1f-\'+1x);q.1d.1S()},nj:C(1x,1E){E 1Z=q.J.42();$(1Z).1c(\'1f-\'+1x,1E);q.1d.1S()},nh:C(1x,1E){E 1Z=q.J.42();$.1z(1Z,C(){if($(q).1c(\'1f-\'+1x)){$(q).1L(\'1f-\'+1x)}M{$(q).1c(\'1f-\'+1x,1E)}})},1L:C(1c,1E){E 1Z=q.J.42();$(1Z).1L(1c);q.1d.1S()},nq:C(1c,1E){E 1Z=q.J.42();$(1Z).1c(1c,1E);q.1d.1S()},mQ:C(1c,1E){E 1Z=q.J.42();$.1z(1Z,C(){if($(q).1c(1x)){$(q).1L(1x)}M{$(q).1c(1x,1E)}})},2U:C(3G){E 1Z=q.J.42();$(1Z).2U(3G);q.L.5H(1Z,\'1G\');q.1d.1S()},8W:C(3G){E 1Z=q.J.42();$(1Z).2f(3G);q.1d.1S()},7C:C(3G){E 1Z=q.J.42();$(1Z).7C(3G);q.1d.1S()}}},28:C(){F{1U:C(1m){if(1s 1m==\'1y\'||1m==\'9v\'){q.28.fM()}M{q.28.fQ()}},fM:C(){q.J.3m();q.G.28.2R(q.$T.B());q.J.3g()},fQ:C(){q.J.3m();q.G.9L.2R(q.$T.B());q.J.3g()},fT:C(){q.$T.B(q.G.28.fV())},ez:C(){q.$T.B(q.G.9L.fV())},bZ:C(){q.G.28.2R(q.$T.B())},9v:C(){if(q.G.28.12===0)F;q.28.1U(\'bG\');q.28.fT();q.J.3g();3u($.1e(q.1R.2K,q),50)},bG:C(){if(q.G.9L.12===0)F;q.28.1U(\'9v\');q.28.ez();q.J.3g();3u($.1e(q.1R.2K,q),50)}}},2r:C(){F{es:C(){q.2r.eo();q.2r.eU();q.2r.eN();q.2r.f0();q.2r.et()},ay:C(){F(q.$2k[0].1n===\'n2\')},eo:C(){q.$2N=$(\'<1j 1G="I-2N" 9D="mB" />\')},eF:C(){q.$2v=$(\'<2v />\').1c(\'1x\',q.2r.ep())},ep:C(){F((1s(1x)==\'1y\'))?\'cT-\'+q.2G:q.$2k.1c(\'id\')},eU:C(){E 1C=(q.2r.ay())?\'2J\':\'B\';q.cT=$.3k(q.$2k[1C]())},f0:C(){q.$T.1c({\'5c\':1r,\'hR\':q.G.cX})},eN:C(){E 1C=(q.2r.ay())?\'eL\':\'eM\';q.2r[1C]()},eL:C(){q.$T=$(\'<1j />\');q.$2v=q.$2k;q.$2N.ex(q.$2k).1F(q.$T).1F(q.$2k);q.$T.2f(\'I-T\');q.$2k.3p()},eM:C(){q.$T=q.$2k;q.2r.eF();q.$2N.ex(q.$T).1F(q.$T).1F(q.$2v);q.$T.2f(\'I-T\');q.$2v.3p()},et:C(){q.1d.1U(q.cT);q.2r.hP();q.2r.hO();if(q.G.6e)F;3u($.1e(q.1d.ck,q),ag)},hO:C(){q.2r.it();q.2r.ii();q.2r.hx();q.2r.il();if(q.G.1B){q.G.1B=q.1B.3N();q.1B.2r()}q.1a.j9();q.2r.8F();3u($.1e(q.1R.2K,q),4);q.1W.2q(\'3N\')},hP:C(){$(q.$2v).1c(\'hR\',q.G.cX);if(q.G.1K)q.$T.2f(\'I-1K\');if(q.G.6H)q.$T.1c(\'6H\',q.G.6H);if(q.G.as)q.$T.1O(\'as\',q.G.as);if(q.G.9O)q.$T.1O(\'9O\',q.G.9O)},hD:C(e){e.2t();if(!q.G.ht||!q.G.hq)F;E 5T=e.9Z.5T;q.1w.hL(5T[0],e)},hy:C(e){q.1d.1S();3u(q.1v.4y,1);q.1W.2q(\'58\',e)},hx:C(){q.$T.on(\'58.I\',$.1e(C(e){e=e.87||e;if(3l.9V===1y||!e.9Z)F 1r;if(e.9Z.5T.12===0){F q.2r.hy(e)}M{q.2r.hD(e)}3u(q.1v.4y,1);q.1W.2q(\'58\',e)},q));q.$T.on(\'2A.I\',$.1e(C(e){E 8c=q.1W.76();E 1m=(8c==\'2A\'||8c==\'57\')?O:\'2A\';q.1W.9k(1m);q.L.8u();q.1W.2q(\'2A\',e)},q));q.$T.on(\'5u.I\',$.1e(q.5u.3N,q));q.$T.on(\'np.I\',$.1e(q.1d.1S,q));q.$T.on(\'1D.I\',$.1e(q.1D.3N,q));q.$T.on(\'2x.I\',$.1e(q.2x.3N,q));if($.5s(q.G.hW)){q.$2v.on(\'1D.I-2v\',$.1e(q.G.hW,q))}if($.5s(q.G.hX)){q.$2v.on(\'2x.I-2v\',$.1e(q.G.hX,q))}q.$T.on(\'2m.I\',$.1e(C(e){if($.5s(q.G.nn))q.1W.2q(\'2m\',e);if(q.J.3v()===O){q.J.1b();q.14.2Q(q.$T[0],0);q.14.3J(q.$T[0],0);q.J.4b()}},q));$(1k).on(\'68.I-ct.\'+q.2G,$.1e(C(e){if(q.2b)F;if(q.7k)F;if($(e.1Q).2p(\'.I-T, .I-1B, .I-1o\').82()!==0){F}q.L.8u();if($.5s(q.G.ni))q.1W.2q(\'ct\',e)},q))},il:C(){if(q.2z.b6()){q.2z.31()}q.3e.a7();if(q.G.2m)3u(q.2m.2Q,6G);if(q.G.ix)3u(q.2m.3J,6G)},8F:C(){if(!q.G.8F)F;$.1z(q.G.8F,$.1e(C(i,s){E 1C=(1s cO!==\'1y\'&&1s cO[s]!==\'1y\')?cO:43.fn;if(!$.5s(1C[s])){F}q[s]=1C[s]();E 6l=q.cN(q[s]);E 2o=6l.12;2C(E z=0;z<2o;z++){q[s][6l[z]]=q[s][6l[z]].9T(q)}if($.5s(q[s].3N)){q[s].3N()}},q))},it:C(){if(!q.L.1P(\'4g\'))F;52{1k.47(\'nw\',O,O);1k.47(\'ny\',O,O)}4U(e){}},ii:C(){if(!q.L.1P(\'2F\'))F;1k.47("nf",O,O)}}},1u:C(){F{2r:C(2i,2T){E $1u=$(\'<a 2j="#" 1G="3I-8f 3I-\'+2i+\'" 3X="\'+2i+\'" />\').1c({\'9D\':\'1u\',\'4Q-2M\':2T.1J,\'6H\':\'-1\'});if(2T.1C||2T.4x||2T.1o){q.1u.ih($1u,2i,2T)}if(2T.1o){$1u.2f(\'I-1B-V-1o\').1c(\'4Q-i9\',1r);E $1o=$(\'<1j 1G="I-1o I-1o-\'+q.2G+\' I-1o-2N-\'+2i+\'" 1p="72: 5z;">\');$1u.1f(\'1o\',$1o);q.1o.2r(2i,$1o,2T.1o)}if(q.L.7n()){q.1u.i3($1u,2i,2T.1J)}F $1u},ih:C($1u,2i,2T){$1u.on(\'5B 2A\',$.1e(C(e){if($1u.3r(\'I-1u-7c\'))F O;E 1m=\'1C\';E 2y=2T.1C;if(2T.4x){1m=\'4x\';2y=2T.4x}M if(2T.1o){1m=\'1o\';2y=O}q.1u.9X(e,2i,1m,2y)},q))},i3:C($1u,1x,1J){E $3n=$(\'<1i>\').2f(\'I-1B-3n I-1B-3n-\'+q.2G+\' I-1B-3n-\'+1x).3p().B(1J);$3n.ax(\'3c\');$1u.on(\'a8\',C(){if($(q).3r(\'I-1u-7c\'))F;E 3x=$1u.2D();$3n.2O();$3n.1O({2X:(3x.2X+$1u.6b())+\'px\',2c:(3x.2c+$1u.7t()/2-$3n.7t()/2)+\'px\'})});$1u.on(\'a9\',C(){$3n.3p()})},9X:C(e,2i,1m,2y){q.1u.n0=q.1T.an();e.2t();$(1k).1h(\'.I-1B-3n\').3p();if(q.L.1P(\'2F\'))e.8s=O;if(1m==\'4x\')q.25.31(2y);M if(1m==\'1o\')q.1o.2O(e,2i);M q.1u.i4(e,2y,2i)},i4:C(e,2y,2i){E 1C;if($.5s(2y))2y.5Z(q,2i);M if(2y.3L(/\\./)!=\'-1\'){1C=2y.4p(\'.\');if(1s q[1C[0]]==\'1y\')F;q[1C[0]][1C[1]](2i)}M q[2y](2i);q.1R.4k(e,2i)},1b:C(1l){F q.$1B.1h(\'a.3I-\'+1l)},8j:C(1l){q.1u.1b(1l).2f(\'I-8K\')},gD:C(1l){q.1u.1b(1l).2U(\'I-8K\')},bV:C(1l){if(1s 1l===\'1y\'){q.$1B.1h(\'a.3I-8f\').2U(\'I-8K\')}M{q.$1B.1h(\'a.3I-8f\').6q(\'.3I-\'+1l).2U(\'I-8K\')}},gI:C(){q.$1B.1h(\'a.3I-8f\').6q(\'a.3I-B, a.3I-i2\').2U(\'I-1u-7c\')},gc:C(){q.$1B.1h(\'a.3I-8f\').6q(\'a.3I-B, a.3I-i2\').2f(\'I-1u-7c\')},mS:C(1l,aP){q.1u.1b(1l).2f(\'3I-\'+aP)},mT:C(1l,aP){q.1u.1b(1l).2U(\'3I-\'+aP)},m1:C(1l,1x){E $1u=q.1u.1b(1l);$1u.2U(\'I-23-N\').2f(\'fa-I-23\');$1u.B(\'<i 1G="fa \'+1x+\'"></i>\')},cL:C($23,2y){if($23=="28")F;E 1m=(2y==\'1o\')?\'1o\':\'1C\';E 1l=$23.1c(\'3X\');$23.on(\'5B 2A\',$.1e(C(e){if($23.3r(\'I-1u-7c\'))F O;q.1u.9X(e,1l,1m,2y)},q))},dn:C($23,1o){$23.2f(\'I-1B-V-1o\').1c(\'4Q-i9\',1r);E 1l=$23.1c(\'3X\');q.1u.cL($23,\'1o\');E $1o=$(\'<1j 1G="I-1o I-1o-\'+q.2G+\' I-1o-2N-\'+1l+\'" 1p="72: 5z;">\');$23.1f(\'1o\',$1o);if(1o)q.1o.2r(1l,$1o,1o);F $1o},bZ:C(1l,1J){if(!q.G.1B)F;if(q.1u.8J(1l))F"28";E 23=q.1u.2r(1l,{1J:1J});23.2f(\'I-23-N\');q.$1B.1F($(\'<li>\').1F(23));F 23},nc:C(1l,1J){if(!q.G.1B)F;if(q.1u.8J(1l))F"28";E 23=q.1u.2r(1l,{1J:1J});23.2f(\'I-23-N\');q.$1B.6u($(\'<li>\').1F(23));F 23},na:C(ho,1l,1J){if(!q.G.1B)F;if(q.1u.8J(1l))F"28";E 23=q.1u.2r(1l,{1J:1J});23.2f(\'I-23-N\');E $23=q.1u.1b(ho);if($23.12!==0)$23.1q().3C($(\'<li>\').1F(23));M q.$1B.1F($(\'<li>\').1F(23));F 23},n5:C(gA,1l,1J){if(!q.G.1B)F;if(q.1u.8J(1l))F"28";E 23=q.1u.2r(1l,{1J:1J});23.2f(\'I-23-N\');E $23=q.1u.1b(gA);if($23.12!==0)$23.1q().bi($(\'<li>\').1F(23));M q.$1B.1F($(\'<li>\').1F(23));F 23},1t:C(1l){q.1u.1b(1l).1t()},8J:C(1l){F(1l=="9v"||1l=="bG")&&!q.L.7n()}}},1T:C(){F{2Q:C(Q){if(!q.L.6J(Q)){E 3h=q.L.aN();$(Q).6u(3h);q.1T.3J(3h)}M{q.1T.1U(Q,0,Q,0)}},3J:C(Q){Q=Q[0]||Q;if(Q.gz.bH==1){F q.1T.55(Q.gz)}q.1T.1U(Q,1,Q,1)},1U:C(4O,gv,7o,gw){4O=4O[0]||4O;7o=7o[0]||7o;if(q.L.7L(4O.1n)&&4O.3A===\'\'){4O.3A=q.G.5R}if(4O.1n==\'5l\'&&q.G.1K===O){E 1q=$(q.G.6s)[0];$(4O).2u(1q);4O=1q;7o=4O}q.J.1b();52{q.14.2Q(4O,gv);q.14.3J(7o,gw)}4U(e){}q.J.4b()},55:C(Q){52{E Y=$(Q)[0].1n;if(Y!=\'5l\'&&!q.L.6J(Q)){E 3h=q.L.aN();$(Q).3C(3h);q.1T.3J(3h)}M{if(Y!=\'5l\'&&q.L.1P(\'2F\')){q.1T.2Q($(Q).1N())}M{q.1T.db(Q,\'3C\')}}}4U(e){E 3h=q.L.aN();$(Q).3C(3h);q.1T.3J(3h)}},cd:C(Q){if(q.L.6J(Q)){q.1T.3J($(Q).4D())}M{q.1T.db(Q,\'bi\')}},db:C(Q,1m){if(!q.L.1P(\'2F\'))q.$T.2m();Q=Q[0]||Q;q.J.1b();if(1m==\'3C\'){52{q.14.9p(Q);q.14.l6(Q)}4U(e){}}M{52{q.14.l4(Q);q.14.jL(Q)}4U(e){}}q.14.48(O);q.J.4b()},8D:C(Q){Q=Q[0]||Q;q.J.1b();E aQ=q.14.7I();aQ.95(Q);aQ.3J(q.14.cG,q.14.d8);F $.3k(aQ.4s()).12},an:C(){E 2D=0;E 2V=3l.4E();if(2V.7b>0){E 14=3l.4E().6f(0);E aH=14.7I();aH.95(q.$T[0]);aH.3J(14.cG,14.d8);2D=aH.4s().12}F 2D},dC:C(2b,2g){if(1s 2g==\'1y\')2g=2b;if(!q.2m.cp())q.2m.2Q();E 2V=q.J.1b();E Q,2D=0;E ge=1k.ll(q.$T[0],ln.kX,4d,4d);53(Q==ge.kV()){2D+=Q.6o.12;if(2D>2b){q.14.2Q(Q,Q.6o.12+2b-2D);2b=l1}if(2D>=2g){q.14.3J(Q,Q.6o.12+2g-2D);6k}}q.14.48(O);q.J.4b()},l7:C(2b,2g){q.1T.dC(2b,2g)},kW:C(){F q.1T.an()}}},1v:C(){F{go:C(B){B=q.1v.h7(B);B=B.K(/<3V(.*?[^>]?)>([\\w\\W]*?)<\\/3V>/gi,\'<2H 1G="I-3V-Y" 1p="72: 5z;" $1>$2</2H>\');B=B.K(/\\$/g,\'$\');B=B.K(/<a 2j="(.*?[^>]?)®(.*?[^>]?)">/gi,\'<a 2j="$1&lh$2">\');if(q.G.6r&&!q.G.1K)B=q.1v.6r(B);if(q.G.1K)B=q.1v.9q(B);B=q.1v.c0(B);E $1j=$(\'<1j>\');$1j.B(B);E d6=$1j.1h(\'3P[1p]\');if(d6.12!==0){d6.2u(C(){E $el=$(q);E $1i=$(\'<1i>\').1c(\'1p\',$el.1c(\'1p\'));F $1i.1F($el.2a())});B=$1j.B()}$1j.1t();B=B.K(/<3P(.*?)>/gi,\'\');B=B.K(/<\\/3P>/gi,\'\');B=q.1I.2K(B);if(q.G.2W)B=q.2W.2K(B);B=q.1v.7Q(B);B=q.1v.c1(B);B=B.K(/&9F;/g,\'&\');F B},9Y:C(B){B=B.K(/\\5X/g,\'\');B=B.K(/&#aZ;/gi,\'\');if(q.G.gq){B=B.K(/&5i;/gi,\' \')}if(B.3L(/^<p>(||\\s||<br\\s?\\/?>||&5i;)<\\/p>$/i)!=-1){F\'\'}B=B.K(/<2H 1G="I-3V-Y" 1p="72: 5z;"(.*?[^>]?)>([\\w\\W]*?)<\\/2H>/gi,\'<3V$1>$2</3V>\');B=q.1v.gm(B);E gL={\'\\lP\':\'&lQ;\',\'\\lN\':\'&lJ;\',\'\\lK\':\'&lL;\',\'\\lS\':\'&lY;\',\'\\lX\':\'&lW;\'};$.1z(gL,C(i,s){B=B.K(29 2l(i,\'g\'),s)});if(q.L.1P(\'4g\')){B=B.K(/<br\\s?\\/?>$/gi,\'\')}B=B.K(29 2l(\'<br\\\\s?/?></li>\',\'gi\'),\'</li>\');B=B.K(29 2l(\'</li><br\\\\s?/?>\',\'gi\'),\'</li>\');B=B.K(/<(.*?)3X="\\s*?"(.*?[^>]?)>/gi,\'<$1$2">\');B=B.K(/<(.*?)1p="\\s*?"(.*?[^>]?)>/gi,\'<$1$2">\');B=B.K(/="">/gi,\'>\');B=B.K(/""">/gi,\'">\');B=B.K(/"">/gi,\'">\');B=B.K(/<1j(.*?)1f-9z="I"(.*?[^>])>/gi,\'<1j$1$2>\');B=B.K(/<(.*?) 1f-3K="I"(.*?[^>])>/gi,\'<$1$2>\');E $1j=$("<1j/>").B($.ei(B,1k,1r));$1j.1h("1i").1L("3X");$1j.1h(\'2H .I-7H-3h\').1z(C(){$(q).2a().44()});B=$1j.B();B=B.K(/<1M(.*?[^>])3X="(.*?[^>])"(.*?[^>])>/gi,\'<1M$1$3>\');B=B.K(/<1i 1G="I-7H-3h">(.*?)<\\/1i>/gi,\'$1\');B=B.K(/ 1f-3m-2h="(.*?[^>])"/gi,\'\');B=B.K(/<1i(.*?)id="I-N-2N"(.*?[^>])>([\\w\\W]*?)<1M(.*?)><\\/1i>/gi,\'$3<1M$4>\');B=B.K(/<1i(.*?)id="I-N-9g"(.*?[^>])>(.*?)<\\/1i>/gi,\'\');B=B.K(/<1i(.*?)id="I-N-5D"(.*?[^>])>(.*?)<\\/1i>/gi,\'\');B=B.K(/<3P(.*?)>/gi,\'\');B=B.K(/<\\/3P>/gi,\'\');B=q.1I.2K(B);if(q.G.hd){B=B.K(/<a(.*?)3X="hb"(.*?[^>])>/gi,\'<a$1$2>\');B=B.K(/<a(.*?[^>])>/gi,\'<a$1 3X="hb">\')}B=B.K(/\\lU-I-(Y|1G|1p)="(.*?[^>])"/gi,\'\');B=B.K(29 2l(\'<(.*?) 1f-3K="I"(.*?[^>])>\',\'gi\'),\'<$1$2>\');B=B.K(29 2l(\'<(.*?) 1f-3K="I">\',\'gi\'),\'<$1>\');B=B.K(/&9F;/g,\'&\');F B},8B:C(B,9b){B=$.3k(B);B=B.K(/\\$/g,\'$\');B=B.K(/<1i 1G="s[0-9]">/gi,\'<1i>\');B=B.K(/<1i 1G="ha-lV-3h">&5i;<\\/1i>/gi,\' \');B=B.K(/<1i 1G="ha-5C-1i"[^>]*>\\t<\\/1i>/gi,\'\\t\');B=B.K(/<1i[^>]*>(\\s|&5i;)<\\/1i>/gi,\' \');if(q.G.hg){F q.1v.aC(B)}if(!q.L.8m()&&1s 9b==\'1y\'){if(q.L.4Z([\'hm\',\'A\'])){F q.1v.aC(B,O)}if(q.L.4Z(\'8P\')){B=B.K(/”/g,\'"\');B=B.K(/“/g,\'"\');B=B.K(/‘/g,\'\\\'\');B=B.K(/’/g,\'\\\'\');F q.1v.hl(B)}if(q.L.4Z([\'bd\',\'ec\',\'e9\',\'e3\',\'ef\',\'eg\',\'ee\'])){B=q.1v.hf(B);if(!q.L.1P(\'2F\')){E R=q.J.4a();if(R&&R.1n==\'P\'){B=B.K(/<1M(.*?)>/gi,\'<p><1M$1></p>\')}}F B}if(q.L.4Z([\'6w\'])){B=q.1v.aI(B,\'2Z\');if(q.G.1K)B=q.1v.9q(B);B=q.1v.gn(B);F B}if(q.L.4Z([\'5y\'])){F q.1v.aI(B,\'li\')}}B=q.1v.gM(B,9b);if(!q.1v.9l){if(q.G.1K)B=q.1v.9q(B);if(q.G.6r)B=q.1v.6r(B);B=q.1v.c0(B)}B=q.1v.hk(B);B=q.1v.gV(B);B=q.1v.aI(B,\'h0\');if(!q.1v.9l&&q.G.2W){B=q.2W.2K(B)}B=q.1v.he(B);B=q.1v.gO(B);B=q.1v.gT(B);B=q.1v.c1(B);F B},hk:C(B){B=B.K(/<!--[\\s\\S]*?-->/gi,\'\');B=B.K(/<1p[^>]*>[\\s\\S]*?<\\/1p>/gi,\'\');B=B.K(/<o\\:p[^>]*>[\\s\\S]*?<\\/o\\:p>/gi,\'\');if(B.1V(/1G="?gY|1p="[^"]*\\hj-|1p=\'[^\'\']*\\hj-|w:lH/i)){B=B.K(/<!--[\\s\\S]+?-->/gi,\'\');B=B.K(/<(!|3V[^>]*>.*?<\\/3V(?=[>\\s])|\\/?(\\?lx(:\\w+)?|1M|5k|V|1p|\\w:\\w+)(?=[\\s\\/>]))[^>]*>/gi,\'\');B=B.K(/<(\\/?)s>/gi,"<$lp>");B=B.K(/ /gi,\' \');B=B.K(/<1i\\s+1p\\s*=\\s*"\\s*aL-lq\\s*:\\s*lr\\s*;?\\s*"\\s*>([\\s\\bg]*)<\\/1i>/gi,C(5h,bc){F(bc.12>0)?bc.K(/./," ").de(8p.ly(bc.12/2)).4p("").3d("\\bg"):\'\'});B=q.1v.gN(B);B=B.K(/<1M(.*?)v:lz=(.*?)>/gi,\'\');B=B.K(/4r="22\\:\\/\\/(.*?)"/,\'4r=""\');E $1j=$("<1j/>").B(B);E 5V=O;E 9K=1;E d7=[];$1j.1h("p[1p]").1z(C(){E 3Q=$(q).1c(\'1p\').1V(/aL\\-2e\\:l([0-9]+)\\lF([0-9]+)/);if(3Q){E 64=5J(3Q[1]);E 5U=5J(3Q[2]);E da=$(q).B().1V(/^[\\w]+\\./)?"ol":"3s";E $li=$("<li/>").B($(q).B());$li.B($li.B().K(/^([\\w\\.]+)</,\'<\'));$li.1h("1i:3H").1t();if(5U==1&&$.3q(64,d7)==-1){E $2e=$("<"+da+"/>").1c({"1f-7s":5U,"1f-2e":64}).B($li);$(q).2u($2e);5V=64;d7.2R(64)}M{if(5U>9K){E $b1=$1j.1h(\'[1f-7s="\'+9K+\'"][1f-2e="\'+5V+\'"]\');E $5V=$b1;2C(E i=9K;i<5U;i++){$2e=$("<"+da+"/>");$2e.ax($5V.1h("li").30());$5V=$2e}$5V.1c({"1f-7s":5U,"1f-2e":64}).B($li)}M{E $b1=$1j.1h(\'[1f-7s="\'+5U+\'"][1f-2e="\'+64+\'"]\').30();$b1.1F($li)}9K=5U;5V=64;$(q).1t()}}});$1j.1h(\'[1f-7s][1f-2e]\').1L(\'1f-7s 1f-2e\');B=$1j.B();B=B.K(/·/g,\'\');B=B.K(/<p 1G="gY(.*?)"/gi,\'<p\');B=B.K(/ 1G=\\"(aL[^\\"]*)\\"/gi,"");B=B.K(/ 1G=(aL\\w+)/gi,"");B=B.K(/<o:p(.*?)>([\\w\\W]*?)<\\/o:p>/gi,\'$2\');B=B.K(/\\n/g,\' \');B=B.K(/<p>\\n?<li>/gi,\'<li>\')}F B},gV:C(B){B=B.K(/<b\\lB="gW-4B-2s(.*?)">([\\w\\W]*?)<\\/b>/gi,"$2");B=B.K(/<b(.*?)id="lw-gW-nL(.*?)">([\\w\\W]*?)<\\/b>/gi,"$3");B=B.K(/<1i[^>]*(3P-1p: 4m; 3P-7z: 4n|3P-7z: 4n; 3P-1p: 4m)[^>]*>/gi,\'<1i 1p="3P-7z: 4n;"><1i 1p="3P-1p: 4m;">\');B=B.K(/<1i[^>]*3P-1p: 4m[^>]*>/gi,\'<1i 1p="3P-1p: 4m;">\');B=B.K(/<1i[^>]*3P-7z: 4n[^>]*>/gi,\'<1i 1p="3P-7z: 4n;">\');B=B.K(/<1i[^>]*1g-80: 5p[^>]*>/gi,\'<1i 1p="1g-80: 5p;">\');B=B.K(/<1M>/gi,\'\');B=B.K(/\\n{3,}/gi,\'\\n\');B=B.K(/<3P(.*?)>([\\w\\W]*?)<\\/3P>/gi,\'$2\');B=B.K(/<p><p>/gi,\'<p>\');B=B.K(/<\\/p><\\/p>/gi,\'</p>\');B=B.K(/<li>(\\s*|\\t*|\\n*)<p>/gi,\'<li>\');B=B.K(/<\\/p>(\\s*|\\t*|\\n*)<\\/li>/gi,\'</li>\');B=B.K(/<\\/p>\\s<p/gi,\'<\\/p><p\');B=B.K(/<1M 4r="89-qp-2h\\:\\/\\/(.*?)"(.*?)>/gi,\'\');B=B.K(/<p>•([\\w\\W]*?)<\\/p>/gi,\'<li>$1</li>\');if(q.L.1P(\'4g\')){B=B.K(/<br\\s?\\/?>$/gi,\'\')}F B},aI:C(B,1m){E 2d=[\'1i\',\'a\',\'2H\',\'26\',\'9h\',\'em\',\'5e\',\'1d\',\'aO\',\'7O\',\'c4\',\'9u\',\'E\',\'bz\',\'cc\',\'7V\',\'7Z\',\'b\',\'i\',\'u\',\'4l\',\'ol\',\'3s\',\'li\',\'dl\',\'dt\',\'dd\',\'p\',\'br\',\'6E\',\'9C\',\'4R\',\'7g\',\'9I\',\'41\',\'1M\',\'3T\',\'2Z\',\'5S\',\'6S\',\'dJ\',\'dQ\',\'dP\',\'h1\',\'h2\',\'h3\',\'h4\',\'h5\',\'h6\'];E ca=O;E cb=[[\'a\',\'*\'],[\'1M\',[\'4r\',\'7l\']],[\'1i\',[\'1G\',\'3X\',\'1f-3K\']],[\'4R\',\'*\'],[\'6E\',\'*\'],[\'9C\',\'*\'],[\'7g\',\'*\'],[\'41\',\'*\'],[\'9I\',\'*\'],[\'4B\',\'*\']];if(1m==\'h0\'){ca=[\'p\',\'1i\',\'h1\',\'h2\',\'h3\',\'h4\',\'h5\',\'h6\'];cb=[[\'3T\',\'1G\'],[\'2Z\',[\'qM\',\'qE\']],[\'a\',\'*\'],[\'1M\',[\'4r\',\'7l\',\'1f-I-9J-N\']],[\'1i\',[\'1G\',\'3X\',\'1f-3K\']],[\'4R\',\'*\'],[\'6E\',\'*\'],[\'9C\',\'*\'],[\'7g\',\'*\'],[\'41\',\'*\'],[\'9I\',\'*\'],[\'4B\',\'*\']]}M if(1m==\'2Z\'){2d=[\'3s\',\'ol\',\'li\',\'1i\',\'a\',\'9h\',\'em\',\'5e\',\'1d\',\'aO\',\'7O\',\'9u\',\'E\',\'bz\',\'cc\',\'7V\',\'7Z\',\'b\',\'i\',\'u\',\'4l\',\'ol\',\'3s\',\'li\',\'dl\',\'dt\',\'dd\',\'br\',\'4R\',\'6E\',\'9C\',\'7g\',\'9I\',\'41\',\'1M\',\'h1\',\'h2\',\'h3\',\'h4\',\'h5\',\'h6\']}M if(1m==\'li\'){2d=[\'3s\',\'ol\',\'li\',\'1i\',\'a\',\'9h\',\'em\',\'5e\',\'1d\',\'aO\',\'7O\',\'9u\',\'E\',\'bz\',\'cc\',\'7V\',\'7Z\',\'b\',\'i\',\'u\',\'4l\',\'br\',\'4R\',\'6E\',\'9C\',\'7g\',\'9I\',\'41\',\'1M\']}E 3Y={49:(q.G.49)?q.G.49:O,4t:(q.G.4t)?q.G.4t:2d,6C:1r,pG:1r,1L:(q.G.1L)?q.G.1L:O,4T:(q.G.4T)?q.G.4T:cb,3S:ca};F q.1I.2K(B,3Y)},gT:C(B){B=B.K(/<(p|h[1-6])>(|\\s|\\n|\\t|<br\\s?\\/?>)<\\/(p|h[1-6])>/gi,\'\');if(!q.G.1K)B=B.K(/<br>$/i,\'\');F B},gO:C(B){B=B.K(/<1i>(.*?)<\\/1i>/gi,\'$1\');B=B.K(/<1i[^>]*>\\s|&5i;<\\/1i>/gi,\' \');F B},gN:C(B){if(!q.L.1P(\'2F\'))F B;E 5x=$.3k(B);if(5x.3L(/^<a(.*?)>(.*?)<\\/a>$/i)===0){B=B.K(/^<a(.*?)>(.*?)<\\/a>$/i,"$2")}F B},gM:C(B,9b){q.1v.9l=O;if(!q.L.8m()&&1s 9b==\'1y\'){E 1Z=q.G.9a.3d(\'|\').K(\'P|\',\'\').K(\'7p|\',\'\');E gQ=B.1V(29 2l(\'</(\'+1Z+\')>\',\'gi\'));E bk=B.1V(/<\\/(p|1j)>/gi);if(!gQ&&(bk===4d||(bk&&bk.12<=1))){E gR=B.1V(/<br\\s?\\/?>/gi);if(!gR){q.1v.9l=1r;B=B.K(/<\\/?(p|1j)(.*?)>/gi,\'\')}}}F B},pu:C(3E,5q){5q=(((5q||\'\')+\'\').3f().1V(/<[a-z][a-7E-9]*>/g)||[]).3d(\'\');E 2d=/<\\/?([a-z][a-7E-9]*)\\b[^>]*>/gi;F 3E.K(2d,C($0,$1){F 5q.4I(\'<\'+$1.3f()+\'>\')>-1?$0:\'\'})},h7:C(B){B=q.1v.h8(B);B=q.1v.hi(B);B=q.1v.hh(B);F B},h8:C(B){E 2H=B.1V(/<2H(.*?)>([\\w\\W]*?)<\\/2H>/gi);if(2H!==4d){$.1z(2H,$.1e(C(i,s){E 2B=s.1V(/<2H(.*?)>([\\w\\W]*?)<\\/2H>/i);2B[2]=2B[2].K(/<br\\s?\\/?>/g,\'\\n\');2B[2]=2B[2].K(/&5i;/g,\' \');if(q.G.6T){2B[2]=2B[2].K(/\\t/g,9i(q.G.6T+1).3d(\' \'))}2B[2]=q.1v.bj(2B[2]);2B[2]=2B[2].K(/\\$/g,\'$\');B=B.K(s,\'<2H\'+2B[1]+\'>\'+2B[2]+\'</2H>\')},q))}F B},hi:C(B){E 1d=B.1V(/<1d(.*?)>([\\w\\W]*?)<\\/1d>/gi);if(1d!==4d){$.1z(1d,$.1e(C(i,s){E 2B=s.1V(/<1d(.*?)>([\\w\\W]*?)<\\/1d>/i);2B[2]=2B[2].K(/&5i;/g,\' \');2B[2]=q.1v.bj(2B[2]);2B[2]=2B[2].K(/\\$/g,\'$\');B=B.K(s,\'<1d\'+2B[1]+\'>\'+2B[2]+\'</1d>\')},q))}F B},hh:C(B){B=B.K(/<1i id=&63;J-2s-([0-9])&63; 1G=&63;I-J-2s&63; 1f-3K=&63;I&63;><\\/1i>/g,\'<1i id="J-2s-$1" 1G="I-J-2s" 1f-3K="I"></1i>\');F B},cf:C(B){B=B.K(/<br\\s?\\/?>|<\\/H[1-6]>|<\\/p>|<\\/1j>|<\\/li>|<\\/2Z>/gi,\'\\n\');E 5x=1k.3y(\'1j\');5x.3A=B;B=5x.pr||5x.pz;F $.3k(B)},aC:C(B,2W){B=q.1v.cf(B);B=B.K(/\\n/g,\'<br />\');if(q.G.2W&&1s 2W==\'1y\'&&!q.L.1P(\'4g\')){B=q.2W.2K(B)}F B},hl:C(B){B=B.K(/<1M(.*?) 1p="(.*?)"(.*?[^>])>/gi,\'<1M$1$3>\');B=B.K(/<1M(.*?)>/gi,\'<1M$1>\');B=q.1v.cf(B);if(q.G.6T){B=B.K(/\\t/g,9i(q.G.6T+1).3d(\' \'))}B=q.1v.bj(B);F B},hf:C(B){B=B.K(/<1M(.*?)>/gi,\'[1M$1]\');B=B.K(/<([qc]*?)>/gi,\'\');B=B.K(/\\[1M(.*?)\\]/gi,\'<1M$1>\');F B},pW:C(B){B=B.K(/<a(.*?)2j="(.*?)"(.*?)>([\\w\\W]*?)<\\/a>/gi,\'[a 2j="$2"]$4[/a]\');B=B.K(/<1M(.*?)>/gi,\'[1M$1]\');B=B.K(/<(.*?)>/gi,\'\');B=B.K(/\\[a 2j="(.*?)"\\]([\\w\\W]*?)\\[\\/a\\]/gi,\'<a 2j="$1">$2</a>\');B=B.K(/\\[1M(.*?)\\]/gi,\'<1M$1>\');F B},bj:C(5h){5h=5Y(5h).K(/&9F;/g,\'&\').K(/</g,\'<\').K(/>/g,\'>\').K(/&63;/g,\'"\');F 5h.K(/&/g,\'&9F;\').K(/</g,\'<\').K(/>/g,\'>\').K(/"/g,\'&63;\')},he:C(B){if(q.L.1P(\'2F\'))F B;E 1j=1k.3y(\'1j\');1j.3A=B;q.1v.c8($(1j));B=1j.3A;$(1j).1t();F B},4y:C(){if(q.L.1P(\'2F\'))F;q.1v.c8(q.$T);E c9=q.$T.1h(\'h1, h2, h3, h4, h5, h6\');c9.1h(\'1i\').1L(\'1p\');c9.1h(q.G.c2.3d(\', \')).1L(\'1p\');q.1d.1S()},c8:C($T){$T.1h(q.G.c2.3d(\', \')).1L(\'1p\');$T.1h(\'1i\').6q(\'[1f-3K="I"]\').1L(\'1p\');$T.1h(\'1i[1f-3K="I"], 1M[1f-3K="I"]\').1z(C(i,s){E $s=$(s);$s.1c(\'1p\',$s.1c(\'3X\'))})},pQ:C(){},7Q:C(B){if(q.L.1P(\'2F\'))F B;B=B.K(29 2l(\'<1M(.*?[^>])>\',\'gi\'),\'<1M$1 1f-3K="I">\');B=B.K(29 2l(\'<1i(.*?[^>])>\',\'gi\'),\'<1i$1 1f-3K="I">\');E 3Q=B.1V(29 2l(\'<(1i|1M)(.*?)1p="(.*?)"(.*?[^>])>\',\'gi\'));if(3Q){E 2o=3Q.12;2C(E i=0;i<2o;i++){52{E gK=3Q[i].K(/1p="(.*?)"/i,\'1p="$1" 3X="$1"\');B=B.K(3Q[i],gK)}4U(e){}}}F B},c1:C(B){E $1j=$(\'<1j />\').B(B);E 2d=q.G.4N;2d.2R(\'1i\');$1j.1h(2d.3d(\',\')).1z(C(){E $el=$(q);E Y=q.1n.3f();$el.1c(\'1f-I-Y\',Y);if(Y==\'1i\'){if($el.1c(\'1p\'))$el.1c(\'1f-I-1p\',$el.1c(\'1p\'));M if($el.1c(\'1G\'))$el.1c(\'1f-I-1G\',$el.1c(\'1G\'))}});B=$1j.B();$1j.1t();F B},ar:C(){q.$T.1h(\'li\').1z(C(i,s){E $1N=$(s).1N();if($1N.12!==0&&($1N[0].1n==\'8y\'||$1N[0].1n==\'8t\')){$(s).1F($1N)}})},cB:C(B){B=B.K(/\\n/g,\'\');B=B.K(/[\\t]*/g,\'\');B=B.K(/\\n\\s*\\n/g,"\\n");B=B.K(/^[\\s\\n]*/g,\' \');B=B.K(/[\\s\\n]*$/g,\' \');B=B.K(/>\\s{2,}</g,\'> <\');B=B.K(/\\n\\n/g,"\\n");B=B.K(/\\5X/g,\'\');F B},6r:C(B){if(q.G.1K){B=B.K(/<1j><br\\s?\\/?><\\/1j>/gi,\'<br />\');B=B.K(/<1j(.*?)>([\\w\\W]*?)<\\/1j>/gi,\'$2<br />\')}M{B=B.K(/<1j(.*?)>([\\w\\W]*?)<\\/1j>/gi,\'<p$1>$2</p>\')}B=B.K(/<1j(.*?[^>])>/gi,\'\');B=B.K(/<\\/1j>/gi,\'\');F B},gn:C(B){B=B.K(/<1j\\s(.*?)>/gi,\'<p>\');B=B.K(/<1j><br\\s?\\/?><\\/1j>/gi,\'<br /><br />\');B=B.K(/<1j>([\\w\\W]*?)<\\/1j>/gi,\'$1<br /><br />\');F B},9q:C(B){B=B.K(/<p\\s(.*?)>/gi,\'<p>\');B=B.K(/<p><br\\s?\\/?><\\/p>/gi,\'<br />\');B=B.K(/<p>([\\w\\W]*?)<\\/p>/gi,\'$1<br /><br />\');B=B.K(/(<br\\s?\\/?>){1,}\\n?<\\/26>/gi,\'</26>\');F B},c0:C(B){F B.K(/<69(.*?)>([\\w\\W]*?)<\\/69>/gi,\'<4h$1 3X="I-69-Y">$2</4h>\')},gm:C(B){F B.K(/<4h(.*?) 3X="I-69-Y"(.*?)>([\\w\\W]*?)<\\/4h>/gi,\'<69$1$2>$3</69>\')}}},1d:C(){F{1U:C(B){B=$.3k(B.4s());B=q.1v.go(B);if(q.L.1P(\'2F\')){B=B.K(/<1i(.*?)id="J-2s-(1|2)"(.*?)><\\/1i>/gi,\'\')}q.$T.B(B);q.1d.1S();if(B!==\'\')q.3e.1t();3u($.1e(q.28.bZ,q),15);if(q.2b===O)q.1R.2K()},1b:C(){E 1d=q.$2v.2J();if(q.G.6r)1d=q.1v.6r(1d);if(q.G.1K)1d=q.1v.9q(1d);1d=q.2I.1b(1d);F 1d},1S:C(){3u($.1e(q.1d.gp,q),10)},gp:C(){E B=q.$T.B();if(q.1d.c5&&q.1d.c5==B){F}q.1d.c5=B;B=q.1W.2q(\'q9\',B);B=q.1v.9Y(B);q.$2v.2J(B);q.1W.2q(\'1S\',B);if(q.2b===O){q.1W.2q(\'iz\',B)}q.2b=O;if(q.3o.B==O){q.3o.B=q.1d.1b()}if(q.G.8l){q.$2v.1N(\'.3D\').1z(C(i,el){el.3D.gk(B)})}q.3o.gr();q.3o.a7()},3j:C(){if(q.G.6e){q.1d.ck()}M{q.1d.gf()}},ck:C(){q.J.3m();q.1d.2D=q.1T.an();E 6m=$(3l).3U();E 2L=q.$T.7t(),3i=q.$T.6b();q.$T.3p();E B=q.$2v.2J();q.gE=q.1v.cB(B);B=q.2I.1b(B);E 2b=0,2g=0;E $6Y=$("<1j/>").1F($.ei(q.1v.9Y(q.$T.B()),1k,1r));E $aj=$6Y.1h("1i.I-J-2s");if($aj.12>0){E al=q.2I.1b($6Y.B()).K(/&9F;/g,\'&\');if($aj.12==1){2b=q.L.bh(al,$6Y.1h("#J-2s-1").6a("7T"));2g=2b}M if($aj.12==2){2b=q.L.bh(al,$6Y.1h("#J-2s-1").6a("7T"));2g=q.L.bh(al,$6Y.1h("#J-2s-2").6a("7T"))-$6Y.1h("#J-2s-1").6a("7T").4s().12}}q.J.8O();q.$2v.2J(B);if(q.G.8l){q.$2v.1N(\'.3D\').1z(C(i,el){$(el).2O();el.3D.gk(B);el.3D.q4(\'6G%\',3i);el.3D.q5();if(2b==2g){el.3D.pP(el.3D.7M(2b).3M,el.3D.7M(2g).ch)}M{el.3D.pO({3M:el.3D.7M(2b).3M,ch:el.3D.7M(2b).ch},{3M:el.3D.7M(2g).3M,ch:el.3D.7M(2g).ch})}el.3D.2m()})}M{q.$2v.3i(3i).2O().2m();q.$2v.on(\'1D.I-2v-gJ\',q.1d.gC);$(3l).3U(6m);if(q.$2v[0].gd){q.$2v[0].gd(2b,2g)}q.$2v[0].3U=0}q.G.6e=O;q.1u.gc();q.1u.8j(\'B\');q.1W.2q(\'4B\',B)},gf:C(){E B;if(q.G.6e)F;E 2b=0,2g=0;if(q.G.8l){E J;q.$2v.1N(\'.3D\').1z(C(i,el){J=el.3D.pA();2b=el.3D.gj(J[0].gg);2g=el.3D.gj(J[0].dO);B=el.3D.pB()})}M{2b=q.$2v.1b(0).cv;2g=q.$2v.1b(0).co;B=q.$2v.3p().2J()}if(2b>2g&&2g>0){E gs=2g;E gu=2b;2b=gs;2g=gu}2b=q.1d.cn(B,2b);2g=q.1d.cn(B,2g);B=B.4q(0,2b)+q.J.5f(1)+B.4q(2b);if(2g>2b){E cx=q.J.5f(1).4s().12;B=B.4q(0,2g+cx)+q.J.5f(2)+B.4q(2g+cx)}if(q.gE!==q.1v.cB(B)){q.1d.1U(B)}if(q.G.8l){q.$2v.1N(\'.3D\').3p()}q.$T.2O();if(!q.L.3z(B)){q.3e.1t()}q.J.3g();q.$2v.2Y(\'1D.I-2v-gJ\');q.1u.gI();q.1u.gD(\'B\');q.1R.2K();q.G.6e=1r;q.1W.2q(\'6e\',B)},gC:C(e){if(e.3t!==9)F 1r;E $el=q.$2v;E 2b=$el.1b(0).cv;$el.2J($el.2J().aV(0,2b)+"\\t"+$el.2J().aV($el.1b(0).co));$el.1b(0).cv=$el.1b(0).co=2b+1;F O},cn:C(B,2D){E cs=B.12;E c=0;if(B[2D]==\'>\'){c++}M{2C(E i=2D;i<=cs;i++){c++;if(B[i]==\'>\'){6k}M if(B[i]==\'<\'||i==cs){c=0;6k}}}F 2D+c}}},1W:C(){F{pC:C(){F $.7w({},q)},pD:C(){F q.$T},pL:C(){F q.$2N},pM:C(){F q.$2k},pN:C(){F q.$2v},pJ:C(){F(q.$1B)?q.$1B:O},9k:C(1x){q.1W.8c=1x},76:C(){F q.1W.8c},2q:C(1m,e,1f){E ah=1m+\'pI\';E ia=\'I\';E 2y=q.G[ah];if(q.$2v){E 8s=O;E 8r=$.pE(q.$2v[0],\'8r\');if(1s 8r!=\'1y\'&&1s 8r[ah]!=\'1y\'){$.1z(8r[ah],$.1e(C(1l,1E){if(1E[\'qI\']==ia){E 1f=(1s 1f==\'1y\')?[e]:[e,1f];8s=(1s 1f==\'1y\')?1E.7W.5Z(q,e):1E.7W.5Z(q,e,1f)}},q))}if(8s)F 8s}if($.5s(2y)){F(1s 1f==\'1y\')?2y.5Z(q,e):2y.5Z(q,e,1f)}M{F(1s 1f==\'1y\')?e:1f}},ib:C(){q.G.je=1r;q.1W.2q(\'ib\');q.$2k.2Y(\'.I\').i6(\'I\');q.$T.2Y(\'.I\');$(1k).2Y(\'68.I-ct.\'+q.2G);$(1k).2Y(\'68.I.\'+q.2G);$(1k).2Y(\'2A.I-N-75.\'+q.2G);$(1k).2Y(\'2A.I-N-4M-3p.\'+q.2G);$(1k).2Y(\'5B.I.\'+q.2G+\' 2A.I.\'+q.2G);$("3c").2Y(\'6m.I.\'+q.2G);$(q.G.6B).2Y(\'6m.I.\'+q.2G);q.$T.2U(\'I-T I-1K I-3e\');q.$T.1L(\'5c\');E B=q.1d.1b();if(q.G.1B){q.$1B.1h(\'a\').1z(C(){E $el=$(q);if($el.1f(\'1o\')){$el.1f(\'1o\').1t();$el.1f(\'1o\',{})}})}if(q.2r.ay()){q.$2N.3C(q.$2k);q.$2N.1t();q.$2k.2J(B).2O()}M{q.$2N.3C(q.$T);q.$2N.1t();q.$2k.B(B).2O()}if(q.$5b)q.$5b.1t();if(q.$4C)q.$4C.1t();if(q.$81)q.$81.1t();$(\'.I-1B-3n-\'+q.2G).1t();i0(q.8M)}}},1o:C(){F{2r:C(1x,$1o,cr){if(1x==\'3b\'&&q.G.cu){$.1z(q.G.cu,$.1e(C(i,s){E 1x=s.Y,1C;if(1s s[\'1G\']!=\'1y\'){1x=1x+\'-\'+s[\'1G\']}s.1m=(q.L.7L(s.Y))?\'R\':\'25\';if(1s s.1C!=="1y"){1C=s.1C}M{1C=(s.1m==\'25\')?\'25.3b\':\'R.3b\'}if(q.G.1K&&s.1m==\'R\'&&s.Y==\'p\')F;q.3b[1x]={Y:s.Y,1p:s.1p,\'1G\':s[\'1G\'],1c:s.1c,1f:s.1f,9d:s.9d};cr[1x]={1C:1C,1J:s.1J}},q))}$.1z(cr,$.1e(C(2i,2T){E $2w=$(\'<a 2j="#" 1G="I-1o-\'+2i+\'" 9D="1u">\'+2T.1J+\'</a>\');if(1x==\'3b\')$2w.2f(\'I-3b-\'+2i);$2w.on(\'2A\',$.1e(C(e){e.2t();E 1m=\'1C\';E 2y=2T.1C;if(2T.4x){1m=\'4x\';2y=2T.4x}M if(2T.1o){1m=\'1o\';2y=2T.1o}if($(e.1Q).3r(\'I-1o-V-dA\'))F;q.1u.9X(e,2i,1m,2y);q.1o.7d()},q));q.1R.dn($2w,2i,2T);$1o.1F($2w)},q))},2O:C(e,1l){if(!q.G.6e){e.2t();F O}E $1u=q.1u.1b(1l);E $1o=$1u.1f(\'1o\').ax(1k.3c);if(q.G.cH){$1o.2f("I-1o-iI")}if($1u.3r(\'77\')){q.1o.7d()}M{q.1o.7d();q.1R.7r();q.1W.2q(\'qS\',{1o:$1o,1l:1l,1u:$1u});q.1u.8j(1l);$1u.2f(\'77\');E 7h=$1u.2D();E cq=$1o.2L();if((7h.2c+cq)>$(1k).2L()){7h.2c=8p.qR(0,7h.2c-cq)}E 2c=7h.2c+\'px\';if(q.$1B.3r(\'1B-7Y-2N\')){E 2X=q.$1B.6b()+q.G.6z;E 4e=\'7Y\';if(q.G.6B!==1k){2X=(q.$1B.6b()+q.$1B.2D().2X)+q.G.6z;4e=\'9x\'}$1o.1O({4e:4e,2c:2c,2X:2X+\'px\'}).2O()}M{E 2X=($1u.6b()+7h.2X)+\'px\';$1o.1O({4e:\'9x\',2c:2c,2X:2X}).2O()}q.1W.2q(\'qO\',{1o:$1o,1l:1l,1u:$1u});q.$1o=$1o}$(1k).cm(\'2A.I-1o\',$.1e(q.1o.3p,q));q.$T.cm(\'2A.I-1o\',$.1e(q.1o.3p,q));$(1k).cm(\'2x.I-1o\',$.1e(q.1o.8T,q));$1o.on(\'a8.I-1o\',$.1e(q.L.dH,q)).on(\'a9.I-1o\',$.1e(q.L.aK,q));e.kN()},8T:C(e){if(e.7m!=q.3t.am)F;q.1o.7d();q.$T.2m()},7d:C(){q.$1B.1h(\'a.77\').2U(\'I-8K\').2U(\'77\');q.L.aK();$(\'.I-1o-\'+q.2G).3p();$(\'.I-1o-V-iu\').2U(\'I-1o-V-iu\');if(q.$1o){q.$1o.2Y(\'.I-1o\');q.1W.2q(\'qk\',q.$1o);q.$1o=O}},3p:C(e){E $1o=$(e.1Q);if(!$1o.3r(\'77\')&&!$1o.3r(\'I-1o-V-dA\')){$1o.2U(\'77\');$1o.2Y(\'a8 a9\');q.1o.7d()}}}},22:C(){F{2O:C(){q.1a.2K(\'22\',q.1H.1b(\'22\'),iy);q.1w.3N(\'#I-1a-22-1w\',q.G.7D,q.22.1Y);q.J.3m();q.J.1b();E 1g=q.2V.4s();$(\'#I-6h\').2J(1g);q.1a.2O()},1Y:C(2P,4V,e){if(1s 2P.6X!=\'1y\'){q.1a.4j();q.J.3g();q.1W.2q(\'qj\',2P);F}E V;if(1s 2P==\'6W\'){V=2P}M{E 1g=$(\'#I-6h\').2J();if(1s 1g==\'1y\'||1g===\'\')1g=2P.6h;V=\'<a 2j="\'+2P.9t+\'" id="9t-2s">\'+1g+\'</a>\'}if(4V){q.J.8O();E 2s=q.J.6Q();q.1Y.c3(e,2s)}M{q.1a.4j()}q.J.3g();q.28.1U();q.1Y.eA(V);if(1s 2P==\'6W\')F;E 8X=$(q.$T.1h(\'a#9t-2s\'));if(8X.12!==0){8X.1L(\'id\').1L(\'1p\')}M 8X=O;q.1W.2q(\'7D\',8X,2P)}}},2m:C(){F{2Q:C(){q.$T.2m();E 3H=q.$T.3O().3H();if(3H.12===0)F;if(3H[0].12===0||3H[0].1n==\'5l\'||3H[0].bH==3){F}if(3H[0].1n==\'8y\'||3H[0].1n==\'8t\'){E 4A=3H.1h(\'li\').3H();if(!q.L.6J(4A)&&4A.1g()===\'\'){q.1T.2Q(4A);F}}if(q.G.1K&&!q.L.7L(3H[0].1n)){q.J.1b();q.14.2Q(q.$T[0],0);q.14.3J(q.$T[0],0);q.J.4b();F}q.1T.2Q(3H)},3J:C(){E 30=q.$T.3O().30();q.$T.2m();if(30.82()===0)F;if(q.L.3z(q.$T.B())){q.J.1b();q.14.48(1r);q.14.9p(30[0]);q.14.3J(30[0],0);q.J.4b()}M{q.J.1b();q.14.95(30[0]);q.14.48(O);q.J.4b()}},cp:C(){E 93=1k.4E().93;if(93===4d)F O;if(q.G.1K&&$(93.e8).3r(\'I-1K\'))F 1r;M if(!q.L.4v(93.e8))F O;F q.$T.is(\':2m\')}}},N:C(){F{2O:C(){q.1a.2K(\'N\',q.1H.1b(\'N\'),iy);q.1w.3N(\'#I-1a-N-4c\',q.G.7J,q.N.1Y);q.J.3m();q.1a.2O()},hK:C($N){E $V=$N.2p(\'a\',q.$T[0]);q.1a.2K(\'j8\',q.1H.1b(\'7e\'),qf);q.1a.cI();q.N.iq=q.1a.iS(q.1H.1b(\'ir\'));q.N.ik=q.1a.cJ(q.1H.1b(\'3m\'));q.N.iq.on(\'2A\',$.1e(C(){q.N.1t($N)},q));q.N.ik.on(\'2A\',$.1e(C(){q.N.hA($N)},q));$(\'.I-V-3n\').1t();$(\'#I-N-1J\').2J($N.1c(\'7l\'));if(!q.G.ij)$(\'.I-N-V-3Z\').3p();M{E $cw=$(\'#I-N-V\');$cw.1c(\'2j\',$N.1c(\'4r\'));if($V.12!==0){$cw.2J($V.1c(\'2j\'));if($V.1c(\'1Q\')==\'7v\')$(\'#I-N-V-8a\').6a(\'bC\',1r)}}if(!q.G.im)$(\'.I-N-4e-3Z\').3p();M{E ip=($N.1O(\'72\')==\'R\'&&$N.1O(\'7K\')==\'5z\')?\'5E\':$N.1O(\'7K\');$(\'#I-N-5a\').2J(ip)}q.1a.2O();$(\'#I-N-1J\').2m()},hz:C($N){E io=$(\'#I-N-5a\').2J();E b4=\'\';E cC=\'\';E 9G=\'\';fe(io){9o\'2c\':b4=\'2c\';9G=\'0 \'+q.G.8o+\' \'+q.G.8o+\' 0\';6k;9o\'4z\':b4=\'4z\';9G=\'0 0 \'+q.G.8o+\' \'+q.G.8o;6k;9o\'5E\':cC=\'R\';9G=\'ad\';6k}$N.1O({\'7K\':b4,72:cC,4G:9G});$N.1c(\'3X\',$N.1c(\'1p\'))},hA:C($N){q.N.7u();q.28.1U();E $V=$N.2p(\'a\',q.$T[0]);E 1J=$(\'#I-N-1J\').2J().K(/(<([^>]+)>)/ig,"");$N.1c(\'7l\',1J);q.N.hz($N);E V=$.3k($(\'#I-N-V\').2J());E V=V.K(/(<([^>]+)>)/ig,"");if(V!==\'\'){E 7A=\'((kb--)?[a-7E-9]+(-[a-7E-9]+)*\\\\.)+[a-z]{2,}\';E 3I=29 2l(\'^(8U|8d|5w)://\'+7A,\'i\');E bA=29 2l(\'^\'+7A,\'i\');if(V.3L(3I)==-1&&V.3L(bA)===0&&q.G.5g){V=q.G.5g+\'://\'+V}E 1Q=($(\'#I-N-V-8a\').6a(\'bC\'))?1r:O;if($V.12===0){E a=$(\'<a 2j="\'+V+\'">\'+q.L.5N($N)+\'</a>\');if(1Q)a.1c(\'1Q\',\'7v\');$N.2u(a)}M{$V.1c(\'2j\',V);if(1Q){$V.1c(\'1Q\',\'7v\')}M{$V.1L(\'1Q\')}}}M if($V.12!==0){$V.2u(q.L.5N($N))}q.1a.4j();q.1R.9W();q.1d.1S()},jC:C($N){if(q.G.cA){$N.on(\'qz\',$.1e(q.N.bD,q))}E 7W=$.1e(C(e){q.1R.N=$N;q.N.9g=q.N.gb($N);$(1k).on(\'68.I-N-4M-3p.\'+q.2G,$.1e(q.N.7u,q));if(!q.G.cE)F;q.N.9g.on(\'68.I 5B.I\',$.1e(C(e){q.N.hB(e,$N)},q))},q);$N.2Y(\'68.I\').on(\'68.I\',$.1e(q.N.7u,q));$N.2Y(\'2A.I 5B.I\').on(\'2A.I 5B.I\',7W)},hB:C(e,$N){e.2t();q.N.4i={x:e.hC,y:e.b9,el:$N,cD:$N.2L()/$N.3i(),h:$N.3i()};e=e.87||e;if(e.9e){q.N.4i.x=e.9e[0].hC;q.N.4i.y=e.9e[0].b9}q.N.hE()},hE:C(){$(1k).on(\'qv.I-N-4M qu.I-N-4M\',$.1e(q.N.hs,q));$(1k).on(\'g3.I-N-4M qq.I-N-4M\',$.1e(q.N.hw,q))},hs:C(e){e.2t();e=e.87||e;E 3i=q.N.4i.h;if(e.9e)3i+=(e.9e[0].b9-q.N.4i.y);M 3i+=(e.b9-q.N.4i.y);E 2L=8p.hu(3i*q.N.4i.cD);if(3i<50||2L<6G)F;E 3i=8p.hu(q.N.4i.el.2L()/q.N.4i.cD);q.N.4i.el.1c({2L:2L,3i:3i});q.N.4i.el.2L(2L);q.N.4i.el.3i(3i);q.1d.1S()},hw:C(){q.iJ=O;$(1k).2Y(\'.I-N-4M\');q.N.7u()},bD:C(e){if(q.$T.1h(\'#I-N-2N\').12!==0){e.2t();F O}q.$T.on(\'58.I-N-hv-58\',$.1e(C(){3u($.1e(q.N.au,q),1)},q))},au:C(){q.N.hF();q.1R.9W();q.$T.2Y(\'58.I-N-hv-58\');q.1v.4y();q.1d.1S()},hF:C(){q.$T.1h(\'1M[1f-3m-2h]\').1z(C(){E $el=$(q);$el.1c(\'4r\',$el.1c(\'1f-3m-2h\'));$el.1L(\'1f-3m-2h\')})},7u:C(e){if(e&&$(e.1Q).2p(\'#I-N-2N\',q.$T[0]).12!==0)F;if(e&&e.1Q.1n==\'bF\'){E $N=$(e.1Q);$N.1c(\'1f-3m-2h\',$N.1c(\'4r\'))}E 3F=q.$T.1h(\'#I-N-2N\');if(3F.12===0)F;$(\'#I-N-5D\').1t();$(\'#I-N-9g\').1t();3F.1h(\'1M\').1O({6d:3F[0].1p.6d,bE:3F[0].1p.bE,bm:3F[0].1p.bm,bt:3F[0].1p.bt});3F.1O(\'4G\',\'\');3F.1h(\'1M\').1O(\'hI\',\'\');3F.2u(C(){F $(q).2a()});$(1k).2Y(\'68.I-N-4M-3p.\'+q.2G);if(1s q.N.4i!==\'1y\'){q.N.4i.el.1c(\'3X\',q.N.4i.el.1c(\'1p\'))}q.1d.1S()},hM:C($N,3F){if(q.G.cE&&!q.L.6A()){E 9B=$(\'<1i id="I-N-9g" 1f-I="3K"></1i>\');if(!q.L.7n()){9B.1O({2L:\'hT\',3i:\'hT\'})}9B.1c(\'5c\',O);3F.1F(9B);3F.1F($N);F 9B}M{3F.1F($N);F O}},gb:C($N){E 3F=$(\'<1i id="I-N-2N" 1f-I="3K">\');3F.1O(\'7K\',$N.1O(\'7K\')).1c(\'5c\',O);if($N[0].1p.4G!=\'ad\'){3F.1O({6d:$N[0].1p.6d,bE:$N[0].1p.bE,bm:$N[0].1p.bm,bt:$N[0].1p.bt});$N.1O(\'4G\',\'\')}M{3F.1O({\'72\':\'R\',\'4G\':\'ad\'})}$N.1O(\'hI\',\'.5\').3C(3F);if(q.G.cA){q.N.5D=$(\'<1i id="I-N-5D" 1f-I="3K">\'+q.1H.1b(\'7e\')+\'</1i>\');q.N.5D.1c(\'5c\',O);q.N.5D.on(\'2A\',$.1e(C(){q.N.hK($N)},q));3F.1F(q.N.5D);E hN=q.N.5D.7t();q.N.5D.1O(\'4G-2c\',\'-\'+hN/2+\'px\')}F q.N.hM($N,3F)},1t:C(N){E $N=$(N);E $V=$N.2p(\'a\',q.$T[0]);E $70=$N.2p(\'70\',q.$T[0]);E $1q=$N.1q();if($(\'#I-N-2N\').12!==0){$1q=$(\'#I-N-2N\').1q()}E $1N;if($70.12!==0){$1N=$70.1N();$70.1t()}M if($V.12!==0){$1q=$V.1q();$V.1t()}M{$N.1t()}$(\'#I-N-2N\').1t();if($70.12!==0){q.1T.2Q($1N)}M{q.1T.2Q($1q)}q.1W.2q(\'cj\',$N[0].4r,$N);q.1a.4j();q.1d.1S()},1Y:C(2P,4V,e){if(1s 2P.6X!=\'1y\'){q.1a.4j();q.J.3g();q.1W.2q(\'oe\',2P);F}E $1M;if(1s 2P==\'6W\'){$1M=$(2P).1c(\'1f-I-9J-N\',\'1r\')}M{$1M=$(\'<1M>\');$1M.1c(\'4r\',2P.9t).1c(\'1f-I-9J-N\',\'1r\')}E Q=$1M;E cy=q.L.4Z(\'P\');if(cy){Q=$(\'<26 />\').1F($1M)}if(4V){q.J.8O();E 2s=q.J.6Q();q.1Y.c3(e,2s)}M{q.1a.4j()}q.J.3g();q.28.1U();q.1Y.B(q.L.5N(Q),O);E $N=q.$T.1h(\'1M[1f-I-9J-N=1r]\').1L(\'1f-I-9J-N\');if(cy){$N.1q().2a().44().62(\'<p />\')}M if(q.G.1K){if(!q.L.3z(q.1d.1b())){$N.bi(\'<br>\')}$N.3C(\'<br>\')}if(1s 2P==\'6W\')F;q.1W.2q(\'7J\',$N,2P)}}},3B:C(){F{bB:C(){if(!q.L.1P(\'2F\'))q.$T.2m();q.28.1U();q.J.3m();E R=q.J.4a();if(R&&R.1n==\'5y\'){q.3B.ek()}M if(R===O&&q.G.1K){q.3B.eV()}M{q.3B.ej()}q.J.3g();q.1d.1S()},ek:C(){1k.47(\'3B\');q.3B.a1();q.1v.ar();q.1v.4y()},ej:C(){$.1z(q.J.42(),$.1e(C(i,4X){if(4X.1n===\'6w\'||4X.1n===\'cz\')F;E $el=q.L.bp(4X);E 2c=q.L.eb($el.1O(\'4G-2c\'))+q.G.b7;$el.1O(\'4G-2c\',2c+\'px\')},q))},eV:C(){E 4P=q.J.62(\'1j\');$(4P).1c(\'1f-9z\',\'I\');$(4P).1O(\'4G-2c\',q.G.b7+\'px\')},9j:C(){q.28.1U();q.J.3m();E R=q.J.4a();if(R&&R.1n==\'5y\'){q.3B.eY()}M{q.3B.fb()}q.J.3g();q.1d.1S()},eY:C(){1k.47(\'7a\');E 1A=q.J.3v();E $2w=$(1A).2p(\'li\',q.$T[0]);q.3B.a1();if(!q.G.1K&&$2w.12===0){1k.47(\'a0\',O,\'p\');q.$T.1h(\'3s, ol, 26, p\').1z($.1e(q.L.3S,q))}q.1v.4y()},fb:C(){$.1z(q.J.42(),$.1e(C(i,4X){E $el=q.L.bp(4X);E 2c=q.L.eb($el.1O(\'4G-2c\'))-q.G.b7;if(2c<=0){if(q.G.1K&&1s($el.1f(\'9z\'))!==\'1y\'){$el.2u($el.B()+\'<br />\')}M{$el.1O(\'4G-2c\',\'\');q.L.5H($el,\'1p\')}}M{$el.1O(\'4G-2c\',2c+\'px\')}},q))},a1:C(){E R=q.J.4a();if(q.14.4Y&&R&&R.1n==\'5y\'&&q.L.3z($(R).1g())){E $R=$(R);$R.1h(\'1i\').6q(\'.I-J-2s\').2a().44();$R.1F(\'<br>\')}}}},25:C(){F{3b:C(1x){E 1m,1E;if(1s q.3b[1x].1p!=\'1y\')1m=\'1p\';M if(1s q.3b[1x][\'1G\']!=\'1y\')1m=\'1G\';if(1m)1E=q.3b[1x][1m];q.25.31(q.3b[1x].Y,1m,1E)},31:C(Y,1m,1E){E 1A=q.J.3v();if(1A&&1A.1n===\'o9\')F;if(q.L.4Z(\'8P\')||q.L.fk())F;E 2d=[\'b\',\'4n\',\'i\',\'4m\',\'5p\',\'eZ\',\'5W\',\'eK\',\'eP\'];E eG=[\'5e\',\'5e\',\'em\',\'em\',\'u\',\'4l\',\'4l\',\'7V\',\'7Z\'];2C(E i=0;i<2d.12;i++){if(Y==2d[i])Y=eG[i]}if(q.G.4t){if($.3q(Y,q.G.4t)==-1)F}M{if($.3q(Y,q.G.49)!==-1)F}q.25.1m=1m||O;q.25.1E=1E||O;q.28.1U();if(!q.L.1P(\'2F\')&&!q.G.1K){q.$T.2m()}q.J.1b();if(q.14.4Y){q.25.eQ(Y)}M{q.25.eR(Y)}},eQ:C(Y){E 1A=q.J.3v();E $1q=$(1A).2p(Y+\'[1f-I-Y=\'+Y+\']\',q.$T[0]);if($1q.12!==0&&(q.25.1m!=\'1p\'&&$1q[0].1n!=\'6M\')){if(q.L.3z($1q.1g())){q.1T.55($1q[0]);$1q.1t();q.1d.1S()}M if(q.L.6D($1q)){q.1T.55($1q[0])}F}E Q=$(\'<\'+Y+\'>\').1c(\'1f-3K\',\'I\').1c(\'1f-I-Y\',Y);Q.B(q.G.5R);Q=q.25.cl(Q);E Q=q.1Y.Q(Q);q.1T.3J(Q);q.1d.1S()},eR:C(Y){q.25.eD(Y);q.J.3m();1k.47(\'eZ\');q.$T.1h(\'7U\').1z($.1e(C(i,s){E $el=$(s);q.25.eS($el,Y);E $1i;if(q.25.1m){$1i=$(\'<1i>\').1c(\'1f-I-Y\',Y).1c(\'1f-3K\',\'I\');$1i=q.25.cl($1i)}M{$1i=$(\'<\'+Y+\'>\').1c(\'1f-I-Y\',Y).1c(\'1f-3K\',\'I\')}$el.2u($1i.B($el.2a()));E $1q=$1i.1q();if($1i[0].1n===\'A\'&&$1q&&$1q[0].1n===\'U\'){$1i.1q().2u($1i)}if(Y==\'1i\'){if($1q&&$1q[0].1n===\'6M\'&&q.25.1m===\'1p\'){E 2B=q.25.1E.4p(\';\');2C(E z=0;z<2B.12;z++){if(2B[z]===\'\')F;E 1p=2B[z].4p(\':\');$1q.1O(1p[0],\'\');if(q.L.5H($1q,\'1p\')){$1q.2u($1q.2a())}}}}},q));if(Y!=\'1i\'){q.$T.1h(q.G.4N.3d(\', \')).1z($.1e(C(i,s){E $el=$(s);if(s.1n===\'U\'&&s.4u.12===0){$el.2u($el.2a());F}E ab=$el.1O(\'1g-80\');if(ab===\'3M-fc\'){$el.1O(\'1g-80\',\'\');q.L.5H($el,\'1p\')}},q))}if(Y!=\'4l\'){E eT=q;q.$T.1h(\'25\').1z(C(i,s){eT.L.4J(s,\'4l\')})}q.J.3g();q.1d.1S()},eS:C($el,Y){E 3w=q;$el.3O(Y).1z(C(){E $4A=$(q);if(!$4A.3r(\'I-J-2s\')){if(3w.25.1m==\'1p\'){E 2B=3w.25.1E.4p(\';\');2C(E z=0;z<2B.12;z++){if(2B[z]===\'\')F;E 1p=2B[z].4p(\':\');$4A.1O(1p[0],\'\');if(3w.L.5H($4A,\'1p\')){$4A.2u($4A.2a())}}}M{$4A.2a().44()}}})},eD:C(Y){q.J.3m();E 1h=\'\';if(q.25.1m==\'1G\')1h=\'[1f-I-1G=\'+q.25.1E+\']\';M if(q.25.1m==\'1p\'){1h=\'[1f-I-1p="\'+q.25.1E+\'"]\'}E 3w=q;if(Y!=\'4l\'){q.$T.1h(\'4l\').1z(C(i,s){3w.L.4J(s,\'25\')})}if(Y!=\'1i\'){q.$T.1h(Y).1z(C(){E $el=$(q);$el.2u($(\'<7U />\').B($el.2a()))})}q.$T.1h(\'[1f-I-Y="\'+Y+\'"]\'+1h).1z(C(){if(1h===\'\'&&Y==\'1i\'&&q.1n.3f()==Y)F;E $el=$(q);$el.2u($(\'<7U />\').B($el.2a()))});q.J.3g()},cl:C(Q){fe(q.25.1m){9o\'1G\':if(Q.3r(q.25.1E)){Q.2U(q.25.1E);Q.1L(\'1f-I-1G\')}M{Q.2f(q.25.1E);Q.1c(\'1f-I-1G\',q.25.1E)}6k;9o\'1p\':Q[0].1p.oj=q.25.1E;Q.1c(\'1f-I-1p\',q.25.1E);6k}F Q},ok:C(){q.28.1U();E 1A=q.J.3v();E 21=q.J.e7();q.J.3m();if(1A&&1A.1n===\'6M\'){E $s=$(1A);$s.1L(\'1p\');if($s[0].4u.12===0){$s.2u($s.2a())}}$.1z(21,$.1e(C(i,s){E $s=$(s);if($.3q(s.1n.3f(),q.G.4N)!=-1&&!$s.3r(\'I-J-2s\')){$s.1L(\'1p\');if($s[0].4u.12===0){$s.2u($s.2a())}}},q));q.J.3g();q.1d.1S()},ov:C(1x){q.28.1U();E 1q=q.J.5Q();E 21=q.J.e7();q.J.3m();if(1q&&1q.1n===\'6M\'){E $s=$(1q);$s.1O(1x,\'\');q.L.5H($s,\'1p\');if($s[0].4u.12===0){$s.2u($s.2a())}}$.1z(21,$.1e(C(i,s){E $s=$(s);if($.3q(s.1n.3f(),q.G.4N)!=-1&&!$s.3r(\'I-J-2s\')){$s.1O(1x,\'\');q.L.5H($s,\'1p\');if($s[0].4u.12===0){$s.2u($s.2a())}}},q));q.J.3g();q.1d.1S()},c6:C(){q.28.1U();E 1A=q.J.3v();q.J.3m();1k.47(\'c6\');if(1A&&1A.1n===\'6M\'){$(1A).2u($(1A).2a())}$.1z(q.J.6V(),$.1e(C(i,s){E $s=$(s);if($.3q(s.1n.3f(),q.G.4N)!=-1&&!$s.3r(\'I-J-2s\')){$s.2u($s.2a())}},q));q.J.3g();q.1d.1S()},7C:C(3G){q.25.31(\'1i\',\'1G\',3G)},ow:C(1E){q.25.31(\'1i\',\'1p\',1E)}}},1Y:C(){F{1U:C(B,1v){q.3e.1t();B=q.1v.7Q(B);if(1s 1v==\'1y\'){B=q.1v.8B(B,O)}q.$T.B(B);q.J.1t();q.2m.3J();q.1v.ar();q.1d.1S();q.1R.2K();if(1s 1v==\'1y\'){3u($.1e(q.1v.4y,q),10)}},1g:C(1g){q.3e.1t();1g=1g.4s();1g=$.3k(1g);1g=q.1v.aC(1g,O);q.$T.2m();if(q.L.1P(\'2F\')){q.1Y.c7(1g)}M{q.J.1b();q.14.4S();E el=1k.3y("1j");el.3A=1g;E 4L=1k.9P(),Q,5G;53((Q=el.9N)){5G=4L.83(Q)}q.14.3R(4L);if(5G){E 14=q.14.7I();14.9p(5G);14.48(1r);q.2V.9E();q.2V.4b(14)}}q.1d.1S();q.1v.4y()},eA:C(B){q.1Y.B(B,O)},B:C(B,1v){q.3e.1t();if(1s 1v==\'1y\')1v=1r;if(!q.G.1K){q.$T.2m()}B=q.1v.7Q(B);if(1v){B=q.1v.8B(B)}if(q.L.1P(\'2F\')){q.1Y.c7(B)}M{if(q.1v.9l)q.1Y.fS(B);M 1k.47(\'ox\',O,B);q.1Y.ew()}q.1v.ar();if(!q.G.1K){q.$T.1h(\'p\').1z($.1e(q.L.3S,q))}q.1d.1S();q.1R.2K();if(1v){q.1v.4y()}},ew:C(){if(!q.L.1P(\'4g\'))F;E $1N=$(q.J.4a()).1N();if($1N.12>0&&$1N[0].1n==\'P\'&&$1N.B()===\'\'){$1N.1t()}},c7:C(B){if(q.L.iK()){E 1q=q.L.4Z(\'P\');E $B=$(\'<1j>\').1F(B);E ga=$B.2a().is(\'p, :7S, dl, 3s, ol, 1j, 3T, 2Z, 26, 2H, c4, 4h, 7S, cR, eC, eH\');if(1q&&ga)q.1Y.fX(1q,B);M q.1Y.ff(B);F}1k.J.8b().jF(B)},fS:C(B){B=q.1v.7Q(B);q.J.1b();q.14.4S();E el=1k.3y(\'1j\');el.3A=B;E 4L=1k.9P(),Q,5G;53((Q=el.9N)){5G=4L.83(Q)}q.14.3R(4L);q.14.48(1r);q.1T.55(5G)},Q:C(Q,4S){Q=Q[0]||Q;E B=q.L.5N(Q);B=q.1v.7Q(B);if(B.1V(/</g)!==4d){Q=$(B)[0]}q.J.1b();if(4S!==O){q.14.4S()}q.14.3R(Q);q.14.48(O);q.J.4b();F Q},oy:C(Q,x,y){Q=Q[0]||Q;q.J.1b();E 14;if(1k.aD){E 3x=1k.aD(x,y);q.14.2Q(3x.fL,3x.2D);q.14.48(1r);q.14.3R(Q)}M if(1k.a5){14=1k.a5(x,y);14.3R(Q)}M if(1s 1k.3c.9Q!="1y"){14=1k.3c.9Q();14.9S(x,y);E 85=14.fN();85.9S(x,y);14.fO("fW",85);14.7F()}},c3:C(e,Q){Q=Q[0]||Q;E 14;E x=e.ou,y=e.ot;if(1k.aD){E 3x=1k.aD(x,y);E 2V=1k.4E();14=2V.6f(0);14.2Q(3x.fL,3x.2D);14.48(1r);14.3R(Q)}M if(1k.a5){14=1k.a5(x,y);14.3R(Q)}M if(1s 1k.3c.9Q!="1y"){14=1k.3c.9Q();14.9S(x,y);E 85=14.fN();85.9S(x,y);14.fO("fW",85);14.7F()}},fX:C(1q,B){E Q=1k.3y(\'1i\');Q.3G=\'I-ie-5u\';q.1Y.Q(Q);E 7N=$(1q).B();7N=\'<p>\'+7N.K(/<1i 1G="I-ie-5u"><\\/1i>/gi,\'</p>\'+B+\'<p>\')+\'</p>\';7N=7N.K(/<p><\\/p>/gi,\'\');$(1q).2u(7N)},ff:C(B){q.J.1b();q.14.4S();E el=1k.3y("1j");el.3A=B;E 4L=1k.9P(),Q,5G;53((Q=el.9N)){5G=4L.83(Q)}q.14.3R(4L);q.14.48(O);q.J.4b()}}},1D:C(){F{3N:C(e){if(q.7k)F;E 1l=e.7m;E 57=(1l>=37&&1l<=40);q.1D.4f=e.8w||e.6I;q.1D.1A=q.J.3v();q.1D.1q=q.J.5Q();q.1D.R=q.J.4a();q.1D.2H=q.L.aa(q.1D.1A,\'2H\');q.1D.26=q.L.aa(q.1D.1A,\'26\');q.1D.7G=q.L.aa(q.1D.1A,\'7G\');q.6i.3N(e,1l);if(q.L.7n()){q.1D.ft(57,1l);q.1D.fu(e,1l)}q.1D.fl(57);q.1D.fG(e,1l);E g7=q.1W.2q(\'1D\',e);if(g7===O){e.2t();F O}if(q.G.bu&&(q.L.1P(\'2F\')||q.L.1P(\'4g\'))&&(1l===q.3t.ci||1l===q.3t.g8)){E cg=O;E $3T=O;if(q.1D.R&&q.1D.R.1n===\'6w\'){$3T=$(q.1D.R).2p(\'3T\',q.$T[0])}if($3T&&$3T.1h(\'2Z\').30()[0]===q.1D.R){cg=1r}if(q.L.6D()&&cg){E Q=$(q.G.6s);$3T.3C(Q);q.1T.2Q(Q)}}if(q.G.bu&&1l===q.3t.ci){q.1D.fC()}if(!q.G.bu&&1l===q.3t.6R){e.2t();if(!q.14.4Y)q.14.4S();F}if(1l==q.3t.6R&&!e.6O&&!e.8w&&!e.6I){E g0=q.1W.2q(\'os\',e);if(g0===O){e.2t();F O}if(q.1D.26&&q.1D.kI(e)===1r){F O}E 1A,$1N;if(q.1D.2H){F q.1D.kB(e)}M if(q.1D.26||q.1D.7G){1A=q.J.3v();$1N=$(1A).1N();if($1N.12!==0&&$1N[0].1n==\'5l\'){F q.1D.6U(e)}M if(q.L.6D()&&(1A&&1A!=\'6M\')){F q.1D.9H(e)}M{F q.1D.6U(e)}}M if(q.G.1K&&!q.1D.R){1A=q.J.3v();$1N=$(q.1D.1A).1N();if($1N.12!==0&&$1N[0].1n==\'5l\'){F q.1D.6U(e)}M if(1A!==O&&$(1A).3r(\'I-7H-3h\')){q.1T.55(1A);$(1A).2a().44();F q.1D.9H(e)}M{if(q.L.dI()){F q.1D.9H(e)}M if($1N.12===0&&1A===O&&1s $1N.o7!=\'1y\'){F q.1D.6U(e)}F q.1D.6U(e)}}M if(q.G.1K&&q.1D.R){3u($.1e(q.1D.fA,q),1)}M if(!q.G.1K&&q.1D.R){3u($.1e(q.1D.hU,q),1);if(q.1D.R.1n===\'5y\'){1A=q.J.3v();E $1q=$(1A).2p(\'li\',q.$T[0]);E $2e=$1q.2p(\'3s,ol\',q.$T[0]);if($1q.12!==0&&q.L.3z($1q.B())&&$2e.1N().12===0&&q.L.3z($2e.1h("li").30().B())){$2e.1h("li").30().1t();E Q=$(q.G.6s);$2e.3C(Q);q.1T.2Q(Q);F O}}}M if(!q.G.1K&&!q.1D.R){F q.1D.kF(e)}}if(1l===q.3t.6R&&(e.8w||e.6O)){F q.1D.fB(e)}if(1l===q.3t.ce||e.6I&&1l===dS||e.6I&&1l===dG){F q.1D.fx(e,1l)}if(1l===q.3t.7x||1l===q.3t.8n){E 21=q.J.6V();if(21){E 2o=21.12;E 30;2C(E i=0;i<2o;i++){E 3O=$(21[i]).3O(\'1M\');if(3O.12!==0){E 3w=q;$.1z(3O,C(z,s){E $s=$(s);if($s.1O(\'7K\')!=\'5z\')F;3w.1W.2q(\'cj\',s.4r,$s);30=s})}M if(21[i].1n==\'bF\'){if(30!=21[i]){q.1W.2q(\'cj\',21[i].4r,$(21[i]));30=21[i]}}}}}if(1l===q.3t.7x){E R=q.J.4a();E fp=($(R).1O(\'4G-2c\')!==\'nP\');if(R&&fp&&q.14.4Y&&q.L.ic()){q.3B.9j();e.2t();F}if(q.L.1P(\'4g\')){E 4D=q.J.jp();E bl=$(4D).4D()[0];if(4D&&4D.1n===\'fr\')$(4D).1t();if(bl&&bl.1n===\'fr\')$(bl).1t()}q.1D.k2();q.1D.k1(e)}q.1d.1S()},ft:C(57,1l){if(!57&&(q.1W.76()==\'2A\'||q.1W.76()==\'57\')){q.1W.9k(O);if(q.1D.fo(1l)){q.28.1U()}}},fo:C(1l){E k=q.3t;E 51=[k.7x,k.8n,k.6R,k.am,k.ce,k.fh,k.fg,k.fi,k.fj];F($.3q(1l,51)==-1)?1r:O},fl:C(57){if(!57)F;if((q.1W.76()==\'2A\'||q.1W.76()==\'57\')){q.1W.9k(O);F}q.1W.9k(\'57\')},fu:C(e,1l){if(q.1D.4f&&1l===90&&!e.6O&&!e.fD&&q.G.28.12){e.2t();q.28.9v();F}M if(q.1D.4f&&1l===90&&e.6O&&!e.fD&&q.G.9L.12!==0){e.2t();q.28.bG();F}M if(!q.1D.4f){if(1l==q.3t.7x||1l==q.3t.8n||(1l==q.3t.6R&&!e.8w&&!e.6O)){q.28.1U()}}},fG:C(e,1l){if(q.1D.4f&&1l===65){q.L.fZ()}M if(1l!=q.3t.iA&&!q.1D.4f){q.L.8u()}},fC:C(){E 2d=[q.1D.26,q.1D.2H,q.1D.7G];2C(E i=0;i<2d.12;i++){if(2d[i]){q.1D.kx(2d[i]);F O}}},fB:C(e){q.28.1U();if(q.L.6D()){F q.1D.9H(e)}F q.1D.6U(e)},fx:C(e,1l){if(!q.G.fw)F 1r;if(q.L.3z(q.1d.1b())&&q.G.aR===O)F 1r;e.2t();E Q;if(q.1D.2H&&!e.6O){Q=(q.G.6T)?1k.8A(9i(q.G.6T+1).3d(\'\\bg\')):1k.8A(\'\\t\');q.1Y.Q(Q);q.1d.1S()}M if(q.G.aR!==O){Q=1k.8A(9i(q.G.aR+1).3d(\'\\bg\'));q.1Y.Q(Q);q.1d.1S()}M{if(e.6I&&1l===dG)q.3B.9j();M if(e.6I&&1l===dS)q.3B.bB();M if(!e.6O)q.3B.bB();M q.3B.9j()}F O},fA:C(){E 4H=q.J.4a();E aT=4H.3A.K(/<br\\s?\\/?>/gi,\'\');if((4H.1n===\'7p\'||4H.1n===\'P\')&&aT===\'\'&&!$(4H).3r(\'I-T\')){E br=1k.3y(\'br\');$(4H).2u(br);q.1T.cd(br);q.1d.1S();F O}},hU:C(){E 4H=q.J.4a();E aT=4H.3A.K(/<br\\s?\\/?>/gi,\'\');if(4H.1n===\'7p\'&&q.L.3z(aT)&&!$(4H).3r(\'I-T\')){E p=1k.3y(\'p\');p.3A=q.G.5R;$(4H).2u(p);q.1T.2Q(p);q.1d.1S();F O}M if(q.G.kG&&4H.1n==\'P\'){$(4H).1L(\'1G\').1L(\'1p\')}},kF:C(e){e.2t();q.J.1b();E p=1k.3y(\'p\');p.3A=q.G.5R;q.14.4S();q.14.3R(p);q.1T.2Q(p);q.1d.1S();F O},kI:C(e){if(!q.L.6D())F;E 5x=$.3k($(q.1D.R).B());if(5x.3L(/(<br\\s?\\/?>){2}$/i)!=-1){e.2t();if(q.G.1K){E br=1k.3y(\'br\');$(q.1D.26).3C(br);q.1T.cd(br);$(q.1D.R).B(5x.K(/<br\\s?\\/?>$/i,\'\'))}M{E Q=$(q.G.6s);$(q.1D.26).3C(Q);q.1T.2Q(Q)}F 1r}F},kx:C(2k){if(!q.L.6D())F;q.28.1U();if(q.G.1K){E 2a=$(\'<1j>\').1F($.3k(q.$T.B())).2a();E 30=2a.30()[0];if(30.1n==\'6M\'&&30.3A===\'\'){30=2a.4D()[0]}if(q.L.5N(30)!=q.L.5N(2k))F;E br=1k.3y(\'br\');$(2k).3C(br);q.1T.55(br)}M{if(q.$T.2a().30()[0]!==2k)F;E Q=$(q.G.6s);$(2k).3C(Q);q.1T.2Q(Q)}},kB:C(e){e.2t();E Q=1k.8A(\'\\n\');q.J.1b();q.14.4S();q.14.3R(Q);q.1T.55(Q);q.1d.1S();F O},6U:C(e){F q.1D.cF(e)},9H:C(e){F q.1D.cF(e,1r)},cF:C(e,kv){e.kN();q.J.1b();E 5v=1k.3y(\'br\');if(q.L.1P(\'2F\')){q.14.48(O);q.14.3J(q.14.cG,q.14.d8)}M{q.14.4S()}q.14.3R(5v);E $b3=$(5v).1q("a");if($b3.12>0){$b3.1h(5v).1t();$b3.3C(5v)}if(kv===1r){E $1N=$(5v).1N();if($1N.12!==0&&$1N[0].1n===\'5l\'&&q.L.dI()){q.1T.55(5v);q.1d.1S();F O}E d9=1k.3y(\'br\');q.14.3R(d9);q.1T.55(d9)}M{if(q.L.1P(\'2F\')){E 3h=1k.3y(\'1i\');3h.3A=\'&#aZ;\';$(5v).3C(3h);q.1T.55(3h);$(3h).1t()}M{E 14=1k.8b();14.9p(5v);14.48(1r);E J=3l.4E();J.9E();J.4b(14)}}q.1d.1S();F O},k2:C(){E $1A=$(q.1D.1A);if($1A.1g().3L(/^\\5X$/g)===0){$1A.1t()}},k1:C(e){E $1A=$(q.1D.1A);E $1q=$(q.1D.1q);E 2Z=$1A.2p(\'2Z\',q.$T[0]);if(2Z.12!==0&&$1A.2p(\'li\',q.$T[0])&&$1q.3O(\'li\').12===1){if(!q.L.3z($1A.1g()))F;e.2t();$1A.1t();$1q.1t();q.1T.2Q(2Z)}}}},2x:C(){F{3N:C(e){if(q.7k)F;E 1l=e.7m;q.2x.1A=q.J.3v();q.2x.1q=q.J.5Q();E $1q=q.L.4v($(q.2x.1q).1q());E jU=q.1W.2q(\'2x\',e);if(jU===O){e.2t();F O}if(!q.G.1K&&q.2x.1A.bH===3&&q.2x.1A.12<=1&&(q.2x.1q===O||q.2x.1q.1n==\'eh\')){q.2x.b8()}if(!q.G.1K&&q.L.4v(q.2x.1A)&&q.2x.1A.1n===\'7p\'){q.2x.b8(O)}if(!q.G.1K&&$(q.2x.1q).3r(\'I-7H-3h\')&&($1q===O||$1q[0].1n==\'eh\')){$(q.2x.1q).2a().44();q.2x.b8()}if(q.2z.b6()&&q.2z.k5(1l))q.2z.31();if(1l===q.3t.8n||1l===q.3t.7x){if(q.L.1P(\'4g\')){E 2Z=$(q.1D.1A).2p(\'2Z\',q.$T[0]);if(2Z.82()!==0&&2Z.1g()!==\'\'){e.2t();F O}}q.1v.4y();if(q.1R.N){e.2t();q.N.7u();q.28.1U();q.N.1t(q.1R.N);q.1R.N=O;F O}q.$T.1h(\'p\').1z($.1e(C(i,s){q.L.3S(i,$(s).B())},q));if(q.G.1K&&q.2x.1A&&q.2x.1A.1n==\'7p\'&&q.L.3z(q.2x.1A.3A)){$(q.2x.1A).3C(q.J.5f());q.J.3g();$(q.2x.1A).1t()}F q.2x.kr(e)}},b8:C(8N){E $1A=$(q.2x.1A);E Q;if(8N===O){Q=$(\'<p>\').1F($1A.B())}M{Q=$(\'<p>\').1F($1A.8N())}$1A.2u(Q);E 1N=$(Q).1N();if(1s(1N[0])!==\'1y\'&&1N[0].1n==\'5l\'){1N.1t()}q.1T.3J(Q)},kr:C(e){E B=$.3k(q.$T.B());if(!q.L.3z(B))F;e.2t();if(q.G.1K){q.$T.B(q.J.5f());q.J.3g()}M{q.$T.B(q.G.6s);q.2m.2Q()}q.1d.1S();F O}}},1H:C(){F{2K:C(){q.G.bY=q.G.ku[q.G.1H]},1b:C(1x){F(1s q.G.bY[1x]!=\'1y\')?q.G.bY[1x]:\'\'}}},3M:C(){F{1Y:C(){q.28.1U();E 1Z=q.J.42();if(1Z[0]!==O&&q.3M.kl(1Z)){if(!q.L.1P(\'2F\'))q.$T.2m();F}if(q.L.1P(\'2F\')){q.3M.a3()}M{q.3M.ki()}},kl:C(1Z){E 8g=[\'li\',\'2Z\',\'5S\',\'26\',\'7G\',\'2H\',\'dl\',\'dt\',\'dd\'];E 3H=1Z[0].1n.3f();E 30=q.J.ji();30=(1s 30==\'1y\')?3H:30.1n.3f();E d2=$.3q(3H,8g)!=-1;E kh=$.3q(30,8g)!=-1;if((d2&&kh)||d2){F 1r}},a3:C(){q.L.8k();q.28.1U();q.1Y.Q(1k.3y(\'hr\'));q.L.aX();q.1d.1S()},ki:C(){q.28.1U();E d3=\'<p id="I-1Y-3M"><br /></p>\';if(q.G.1K)d3=\'<br id="I-1Y-3M">\';1k.47(\'nJ\',O,\'<hr>\'+d3);q.3M.km();q.1d.1S()},km:C(){E Q=q.$T.1h(\'#I-1Y-3M\');E 1N=$(Q).1N()[0];E 1Q=1N;if(q.L.1P(\'4g\')&&1N&&1N.3A===\'\'){1Q=$(1N).1N()[0];$(1N).1t()}if(1Q){Q.1t();if(!q.G.1K){q.$T.2m();q.3M.2Q(1Q)}}M{Q.1L(\'id\');q.3M.2Q(Q[0])}},2Q:C(Q){if(1s Q===\'1y\')F;E kM=1k.8A(\'\\5X\');q.J.1b();q.14.2Q(Q,0);q.14.3R(kM);q.14.48(1r);q.J.4b()}}},V:C(){F{2O:C(e){if(1s e!=\'1y\'&&e.2t)e.2t();if(!q.1R.cY(\'a\')){q.1a.2K(\'V\',q.1H.1b(\'bx\'),ko)}M{q.1a.2K(\'V\',q.1H.1b(\'dB\'),ko)}q.1a.cI();E kA=!q.1R.cY(\'a\')?q.1H.1b(\'1Y\'):q.1H.1b(\'7e\');q.V.kz=q.1a.cJ(kA);q.J.1b();q.V.kj();q.V.kp();if(q.V.1Q==\'7v\')$(\'#I-V-8a\').6a(\'bC\',1r);q.V.$8R=$(\'#I-V-2h\');q.V.$d4=$(\'#I-V-2h-1g\');q.V.$d4.2J(q.V.1g);q.V.$8R.2J(q.V.2h);q.V.kz.on(\'2A\',$.1e(q.V.1Y,q));$(\'.I-V-3n\').1t();q.J.3m();q.1a.2O();q.V.$8R.2m()},kp:C(){E ks=3w.kf.2j.K(/\\/$/i,\'\');if(1s q.V.2h!=="1y"){q.V.2h=q.V.2h.K(ks,\'\');q.V.2h=q.V.2h.K(/^\\/#/,\'#\');q.V.2h=q.V.2h.K(\'d5:\',\'\');if(!q.G.5g){E 3I=29 2l(\'^(8U|8d|5w)://\'+3w.kf.nT,\'i\');q.V.2h=q.V.2h.K(3I,\'\')}}},kj:C(){q.V.$Q=O;E $el=$(q.J.3v()).2p(\'a\',q.$T[0]);if($el.12!==0&&$el[0].1n===\'A\'){q.V.$Q=$el;q.V.2h=$el.1c(\'2j\');q.V.1g=$el.1g();q.V.1Q=$el.1c(\'1Q\')}M{q.V.1g=q.2V.4s();q.V.2h=\'\';q.V.1Q=\'\'}},1Y:C(){q.3e.1t();E 1Q=\'\';E V=q.V.$8R.2J();E 1g=q.V.$d4.2J().K(/(<([^>]+)>)/ig,"");if($.3k(V)===\'\'){q.V.$8R.2f(\'I-3E-6X\').on(\'2x\',C(){$(q).2U(\'I-3E-6X\');$(q).2Y(\'2x\')});F}if(V.3L(\'@\')!=-1&&/(8U|8d|5w):\\/\\//i.ac(V)===O){V=\'d5:\'+V}M if(V.3L(\'#\')!==0){if($(\'#I-V-8a\').6a(\'bC\')){1Q=\'7v\'}E 7A=\'((kb--)?[a-7E-9]+(-[a-7E-9]+)*\\\\.)+[a-z]{2,}\';E 3I=29 2l(\'^(8U|8d|5w)://\'+7A,\'i\');E bA=29 2l(\'^\'+7A,\'i\');E jW=29 2l(\'\\.(B|o1)$\',\'i\');if(V.3L(3I)==-1&&V.3L(jW)==-1&&V.3L(bA)===0&&q.G.5g){V=q.G.5g+\'://\'+V}}q.V.1U(1g,V,1Q);q.1a.4j()},1U:C(1g,V,1Q){1g=$.3k(1g.K(/<|>/g,\'\'));q.J.3g();E 1Z=q.J.42();if(1g===\'\'&&V===\'\')F;if(1g===\'\'&&V!==\'\')1g=V;if(q.V.$Q){q.28.1U();E $V=q.V.$Q,$el=$V.3O();if($el.12>0){53($el.12){$el=$el.3O()}$el=$el.2g()}M{$el=$V}$V.1c(\'2j\',V);$el.1g(1g);if(1Q!==\'\'){$V.1c(\'1Q\',1Q)}M{$V.1L(\'1Q\')}q.J.9s($V);q.1d.1S()}M{if(q.L.1P(\'4g\')&&q.V.1g===\'\'){E $a=$(\'<a />\').1c(\'2j\',V).1g(1g);if(1Q!==\'\')$a.1c(\'1Q\',1Q);$a=$(q.1Y.Q($a));if(q.G.1K){$a.3C(\'&5i;\')}q.J.9s($a)}M{E $a;if(q.L.1P(\'2F\')){$a=$(\'<a 2j="\'+V+\'">\').1g(1g);if(1Q!==\'\')$a.1c(\'1Q\',1Q);$a=$(q.1Y.Q($a));if(q.J.dr().1V(/\\s$/)){$a.3C(" ")}q.J.9s($a)}M{1k.47(\'nW\',O,V);$a=$(q.J.3v()).2p(\'a\',q.$T[0]);if(q.L.1P(\'4g\')){$a=$(\'a[ka=""]\')}if(1Q!==\'\')$a.1c(\'1Q\',1Q);$a.1L(\'1p\').1L(\'ka\');if(q.J.dr().1V(/\\s$/)){$a.3C(" ")}if(q.V.1g!==\'\'||q.V.1g!=1g){if(!q.G.1K&&1Z&&1Z.12<=1){$a.1g(1g)}M if(q.G.1K){$a.1g(1g)}q.J.9s($a)}}}q.1d.1S();q.1W.2q(\'nV\',$a)}3u($.1e(C(){q.1R.5A()},q),5)},6t:C(e){if(1s e!=\'1y\'&&e.2t){e.2t()}E 21=q.J.6V();if(!21)F;q.28.1U();E 2o=21.12;E 5A=[];2C(E i=0;i<2o;i++){if(21[i].1n===\'A\'){5A.2R(21[i])}E $Q=$(21[i]).2p(\'a\',q.$T[0]);$Q.2u($Q.2a())}q.1W.2q(\'nX\',5A);$(\'.I-V-3n\').1t();q.1d.1S()},7C:C(3G){q.V.8W(3G,\'7C\')},2f:C(3G){q.V.8W(3G,\'2f\')},2U:C(3G){q.V.8W(3G,\'2U\')},8W:C(3G,1C){E 5A=q.J.jh([\'a\']);if(5A===O)F;$.1z(5A,C(){$(q)[1C](3G)})}}},2z:C(){F{k5:C(1l){F 1l==q.3t.6R||1l==q.3t.kT},b6:C(){F q.G.bs&&(q.G.dk||q.G.dj||q.G.8C)&&!q.L.4Z(\'8P\')},31:C(){E 2z=q.2z,G=q.G;q.$T.1h(":6q(4R,1M,a,2H)").nZ().2a().dc(C(){F q.bH===3&&$.3k(q.6o)!=""&&!$(q).1q().is("2H")&&(q.6o.1V(G.2z.4w.6K)||q.6o.1V(G.2z.4w.6F)||q.6o.1V(G.2z.4w.N)||q.6o.1V(G.2z.4w.2h))}).1z(C(){E 1g=$(q).1g(),B=1g;if(G.8C&&(B.1V(G.2z.4w.6K)||B.1V(G.2z.4w.6F))){B=2z.8C(B)}M if(G.dj&&B.1V(G.2z.4w.N)){B=2z.j1(B)}M if(G.dk){B=2z.bs(B)}$(q).bi(1g.K(1g,B)).1t()});E ky=q.$T.1h(\'.I-2z-41\').1z(C(){E $el=$(q);$el.2U(\'I-2z-41\');if($el.1c(\'1G\')===\'\')$el.1L(\'1G\');F $el[0]});3u($.1e(C(){q.1R.2K();q.1W.2q(\'2z\',ky)},q),6G);q.1d.1S()},8C:C(B){E dm=\'<4R 1G="I-2z-41" 2L="p9" 3i="pa" 4r="\',di=\'" pb="0" p7></4R>\';if(B.1V(q.G.2z.4w.6K)){B=B.K(q.G.2z.4w.6K,dm+\'//7f.6K.bw/7g/$1\'+di)}if(B.1V(q.G.2z.4w.6F)){B=B.K(q.G.2z.4w.6F,dm+\'//p4.6F.bw/6E/$2\'+di)}F B},j1:C(B){E 3Q=B.1V(q.G.2z.4w.N);if(3Q){B=B.K(B,\'<1M 4r="\'+3Q+\'" 1G="I-2z-41" />\');if(q.G.1K){if(!q.L.3z(q.1d.1b())){B=\'<br>\'+B}}B+=\'<br>\'}F B},bs:C(B){E 3Q=B.1V(q.G.2z.4w.2h);if(3Q){3Q=$.pe(3Q,C(v,k){F $.3q(v,3Q)===k});E 12=3Q.12;2C(E i=0;i<12;i++){E 2j=3Q[i],1g=2j,5g=q.G.5g+\'://\';if(2j.1V(/(5w?|8d):\\/\\//i)!==4d){5g=""}if(1g.12>q.G.dh){1g=1g.aV(0,q.G.dh)+\'...\'}if(1g.3L(\'%\')===-1){1g=hn(1g)}E df="\\\\b";if($.3q(2j.de(-1),["/","&","="])!=-1){df=""}E iV=29 2l(\'(\'+2j.K(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g,"\\\\$&")+df+\')\',\'g\');B=B.K(iV,\'<a 2j="\'+5g+$.3k(2j)+\'" 1G="I-2z-41">\'+$.3k(1g)+\'</a>\')}}F B}}},2e:C(){F{3j:C(4F){q.3e.1t();if(!q.L.1P(\'2F\'))q.$T.2m();q.28.1U();q.J.3m();E 1q=q.J.5Q();E $2e=$(1q).2p(\'ol, 3s\',q.$T[0]);if(!q.L.4v($2e)&&$2e.12!==0){$2e=O}E d1,d0;E 1t=O;if($2e&&$2e.12){1t=1r;E dg=$2e[0].1n;d1=(4F===\'5o\'&&dg===\'8y\');d0=(4F===\'5n\'&&dg===\'8t\')}if(d1){q.L.4J($2e,\'ol\')}M if(d0){q.L.4J($2e,\'3s\')}M{if(1t){q.2e.1t(4F,$2e)}M{q.2e.1Y(4F)}}q.J.3g();q.1d.1S()},1Y:C(4F){E 1A=q.J.3v();E $2Z=$(1A).2p(\'2Z, 5S\',q.$T[0]);if(q.L.1P(\'2F\')&&q.G.1K){q.2e.a3(4F)}M{1k.47(\'1Y\'+4F)}E 1q=q.J.5Q();E $2e=$(1q).2p(\'ol, 3s\',q.$T[0]);if($2Z.12!==0){E ja=$2Z.8N();$2Z.3C(ja).1t(\'\')}if(q.L.3z($2e.1h(\'li\').1g())){E $3O=$2e.3O(\'li\');$3O.1h(\'br\').1t();$3O.1F(q.J.5f());if(q.G.1K&&q.L.1P(\'4g\')&&$3O.82()==2&&q.L.3z($3O.eq(1).1g())){$3O.eq(1).1t()}}if($2e.12){E $88=$2e.1q();if(q.L.4v($88)&&$88[0].1n!=\'5y\'&&q.L.6J($88[0])){$88.2u($88.2a())}}if(!q.L.1P(\'2F\')){q.$T.2m()}q.1v.4y()},a3:C(4F){E 4P=q.J.62(\'1j\');E a4=$(4P).B();E 86=(4F==\'5o\')?$(\'<ol>\'):$(\'<3s>\');E 8S=$(\'<li>\');if($.3k(a4)===\'\'){8S.1F(q.J.5f());86.1F(8S);q.$T.1h(\'#J-2s-1\').2u(86)}M{E 8i=a4.4p(/<br\\s?\\/?>/gi);if(8i){2C(E i=0;i<8i.12;i++){if($.3k(8i[i])!==\'\'){86.1F($(\'<li>\').B(8i[i]))}}}M{8S.1F(a4);86.1F(8S)}$(4P).2u(86)}},1t:C(4F,$2e){if($.3q(\'3s\',q.J.42()))4F=\'5n\';1k.47(\'1Y\'+4F);E $1A=$(q.J.3v());q.3B.a1();if(!q.G.1K&&$1A.2p(\'li, 5S, 2Z\',q.$T[0]).12===0){1k.47(\'a0\',O,\'p\');q.$T.1h(\'3s, ol, 26\').1z($.1e(q.L.3S,q))}E $3T=$(q.J.3v()).2p(\'3T\',q.$T[0]);E $4D=$3T.4D();if(!q.G.1K&&$3T.12!==0&&$4D.12!==0&&$4D[0].1n==\'5l\'){$4D.1t()}q.1v.4y()}}},1a:C(){F{ao:{},j9:C(){q.G.1a={j8:5Y()+\'<4h id="I-1a-N-7e">\'+\'<2M>\'+q.1H.1b(\'1J\')+\'</2M>\'+\'<3E 1m="1g" id="I-N-1J" />\'+\'<2M 1G="I-N-V-3Z">\'+q.1H.1b(\'V\')+\'</2M>\'+\'<3E 1m="1g" id="I-N-V" 1G="I-N-V-3Z" 4Q-2M="\'+q.1H.1b(\'V\')+\'" />\'+\'<2M 1G="I-N-V-3Z"><3E 1m="j6" id="I-N-V-8a" 4Q-2M="\'+q.1H.1b(\'at\')+\'"> \'+q.1H.1b(\'at\')+\'</2M>\'+\'<2M 1G="I-N-4e-3Z">\'+q.1H.1b(\'cP\')+\'</2M>\'+\'<7F 1G="I-N-4e-3Z" id="I-N-5a" 4Q-2M="\'+q.1H.1b(\'cP\')+\'">\'+\'<3Z 1E="5z">\'+q.1H.1b(\'5z\')+\'</3Z>\'+\'<3Z 1E="2c">\'+q.1H.1b(\'2c\')+\'</3Z>\'+\'<3Z 1E="5E">\'+q.1H.1b(\'5E\')+\'</3Z>\'+\'<3Z 1E="4z">\'+q.1H.1b(\'4z\')+\'</3Z>\'+\'</7F>\'+\'</4h>\',N:5Y()+\'<4h id="I-1a-N-1Y">\'+\'<1j id="I-1a-N-4c"></1j>\'+\'</4h>\',22:5Y()+\'<4h id="I-1a-22-1Y">\'+\'<1j id="I-1a-22-1w-2N">\'+\'<2M>\'+q.1H.1b(\'6h\')+\'</2M>\'+\'<3E 1m="1g" id="I-6h" 4Q-2M="\'+q.1H.1b(\'6h\')+\'" /><br><br>\'+\'<1j id="I-1a-22-1w"></1j>\'+\'</1j>\'+\'</4h>\',V:5Y()+\'<4h id="I-1a-V-1Y">\'+\'<2M>cM</2M>\'+\'<3E 1m="2h" id="I-V-2h" 4Q-2M="cM" />\'+\'<2M>\'+q.1H.1b(\'1g\')+\'</2M>\'+\'<3E 1m="1g" id="I-V-2h-1g" 4Q-2M="\'+q.1H.1b(\'1g\')+\'" />\'+\'<2M><3E 1m="j6" id="I-V-8a"> \'+q.1H.1b(\'at\')+\'</2M>\'+\'</4h>\'};$.7w(q.G,q.G.1a)},cL:C(1x,2y){q.1a.ao[1x]=2y},oT:C($1a){q.1a.$8L=$(\'<1j>\').1c(\'id\',\'I-1a-8L\');$1a.6u(q.1a.$8L)},oY:C(id,1x,8I){E $5C=$(\'<a 2j="#" 3X="5C\'+id+\'">\').1g(1x);if(8I){$5C.2f(\'8I\')}E 3w=q;$5C.on(\'2A\',C(e){e.2t();$(\'.I-5C\').3p();$(\'.I-\'+$(q).1c(\'3X\')).2O();3w.1a.$8L.1h(\'a\').2U(\'8I\');$(q).2f(\'8I\')});q.1a.$8L.1F($5C)},oD:C(1x,iG){q.G.1a[1x]=iG},iB:C(1x){F q.G.1a[1x]},oL:C(){F q.$az.1h(\'4h\')},2K:C(6g,1J,2L){q.1a.6g=6g;q.1a.2L=2L;q.1a.2r();q.1a.iN();q.1a.iF(1J);q.1a.jS();q.1a.iE();if(1s q.1a.ao[6g]!=\'1y\'){q.1a.ao[6g].5Z(q)}},2O:C(){q.L.dH();if(q.L.6A()){q.1a.do()}M{q.1a.av()}if(q.G.cH){q.$4C.2f("I-1a-iI")}q.$81.2O();q.$4C.2O();q.$1a.1c(\'6H\',\'-1\');q.$1a.2m();q.1a.iP();q.L.8k();if(!q.L.6A()){3u($.1e(q.1a.av,q),0);$(3l).on(\'4M.I-1a\',$.1e(q.1a.4M,q))}q.1W.2q(\'pl\',q.1a.6g,q.$1a);$(1k).2Y(\'pd.1a\');q.$1a.1h(\'3E[1m=1g],3E[1m=2h],3E[1m=p1]\').on(\'1D.I-1a\',$.1e(q.1a.iQ,q))},av:C(){E 3i=q.$1a.p2();E a6=$(3l).3i();E 7q=$(3l).2L();if(q.1a.2L>7q){q.$1a.1O({2L:\'96%\',6d:(a6/2-3i/2)+\'px\'});F}if(3i>a6){q.$1a.1O({2L:q.1a.2L+\'px\',6d:\'p6\'})}M{q.$1a.1O({2L:q.1a.2L+\'px\',6d:(a6/2-3i/2)+\'px\'})}},do:C(){q.$1a.1O({2L:\'96%\',6d:\'2%\'})},4M:C(){if(q.L.6A()){q.1a.do()}M{q.1a.av()}},iF:C(1J){q.$8Z.B(1J)},iE:C(){q.$az.B(q.1a.iB(q.1a.6g))},jS:C(){if(1s $.fn.iD===\'1y\')F;q.$1a.iD({iJ:q.$8Z});q.$8Z.1O(\'nK\',\'nH\')},iQ:C(e){if(e.7m!=13)F;e.2t();q.$1a.1h(\'1u.I-1a-7B-23\').2A()},cI:C(){E 1u=$(\'<1u>\').2f(\'I-1a-23 I-1a-4j-23\').B(q.1H.1b(\'iR\'));1u.on(\'2A\',$.1e(q.1a.4j,q));q.$8Q.1F(1u)},iS:C(2M){F q.1a.cK(2M,\'75\')},cJ:C(2M){F q.1a.cK(2M,\'7B\')},cK:C(2M,3G){E 1u=$(\'<1u>\').2f(\'I-1a-23\').2f(\'I-1a-\'+3G+\'-23\').B(2M);q.$8Q.1F(1u);F 1u},iP:C(){E 4k=q.$8Q.1h(\'1u\');E cQ=4k.12;if(cQ===0)F;4k.1O(\'2L\',(6G/cQ)+\'%\')},2r:C(){q.1a.iM();q.$4C=$(\'<1j id="I-1a-2N"/>\').3p();q.$1a=$(\'<1j id="I-1a" 9D="nI" 4Q-nN="I-1a-7S" />\');q.$8Z=$(\'<7S id="I-1a-7S"/>\');q.$8v=$(\'<1u 1m="1u" id="I-1a-4j" 6H="1" 4Q-2M="nS" />\').B(\'&nR;\');q.$az=$(\'<1j id="I-1a-3c" />\');q.$8Q=$(\'<cR />\');q.$1a.1F(q.$8Z);q.$1a.1F(q.$8v);q.$1a.1F(q.$az);q.$1a.1F(q.$8Q);q.$4C.1F(q.$1a);q.$4C.ax(1k.3c)},iM:C(){q.$81=$(\'<1j id="I-1a-op">\').3p();$(\'3c\').6u(q.$81)},iN:C(){q.$8v.on(\'2A.I-1a\',$.1e(q.1a.4j,q));$(1k).on(\'2x.I-1a\',$.1e(q.1a.8T,q));q.$T.on(\'2x.I-1a\',$.1e(q.1a.8T,q));q.$4C.on(\'2A.I-1a\',$.1e(q.1a.4j,q))},jd:C(){q.$8v.2Y(\'2A.I-1a\');$(1k).2Y(\'2x.I-1a\');q.$T.2Y(\'2x.I-1a\');q.$4C.2Y(\'2A.I-1a\');$(3l).2Y(\'4M.I-1a\')},8T:C(e){if(e.7m!=q.3t.am)F;q.1a.4j(O)},4j:C(e){if(e){if(!$(e.1Q).3r(\'I-1a-4j-23\')&&e.1Q!=q.$8v[0]&&e.1Q!=q.$4C[0]){F}e.2t()}if(!q.$4C)F;q.1a.jd();q.L.aK();q.$81.1t();q.$4C.jr(\'oh\',$.1e(C(){q.$4C.1t();3u($.1e(q.L.aX,q),0);if(e!==1y)q.J.3g();$(1k.3c).1O(\'aY\',q.1a.of);q.1W.2q(\'pp\',q.1a.6g)},q))}}},1R:C(){F{2K:C(){if(1s q.G.je!="1y")F;if(q.L.1P(\'2F\')){E 3w=q;q.$T.1h(\'2H, 1d\').on(\'a8\',C(){3w.$T.1c(\'5c\',O);$(q).1c(\'5c\',1r)}).on(\'a9\',C(){3w.$T.1c(\'5c\',1r);$(q).1L(\'5c\')})}q.1R.9W();q.1R.5A()},1B:C(e,2i){q.1R.4k(e,2i);q.1R.7r()},cY:C($el,$1A){if(1s $1A==\'1y\'){E $1A=$(q.J.3v())}F $1A.is($el)||$1A.fY($el).12>0},7r:C(){E $1A=$(q.J.3v());$.1z(q.G.1R.7r,$.1e(C(1l,1E){E 1R=1E.1R,2k=1R.2k,$2w=1E.2w,cW=1s 1R[\'in\']!=\'1y\'?1R[\'in\']:O,cZ=1s 1R[\'2n\']!=\'1y\'?1R[\'2n\']:O;if($1A.2p(2k).82()>0){q.1R.cV($2w,cW,cZ)}M{q.1R.cV($2w,cZ,cW)}},q))},cV:C($2w,8z,ak){if(ak&&1s ak[\'1c\']!=\'1y\'){q.1R.cS($2w,ak.1c,1r)}if(1s 8z[\'1c\']!=\'1y\'){q.1R.cS($2w,8z.1c)}if(1s 8z[\'1J\']!=\'1y\'){$2w.1g(8z[\'1J\'])}},cS:C($2w,jE,cU){$.1z(jE,C(1l,1E){if(1l==\'1G\'){if(!cU){$2w.2f(1E)}M{$2w.2U(1E)}}M{if(!cU){$2w.1c(1l,1E)}M{$2w.1L(1l)}}})},dn:C($2w,2i,2T){if(1s 2T.1R=="1y")F;2T.2w=$2w;q.G.1R.7r.2R(2T)},4k:C(e,2i){E 1A=q.J.3v();E 1q=q.J.5Q();if(e!==O){q.1u.bV()}M{q.1u.bV(2i)}if(e===O&&2i!==\'B\'){if($.3q(2i,q.G.bq)!=-1)q.1u.q7(2i);F}$.1z(q.G.bJ,$.1e(C(1l,1E){E ae=$(1q).2p(1l,q.$T[0]);E bN=$(1A).2p(1l,q.$T[0]);if(ae.12!==0&&!q.L.4v(ae))F;if(!q.L.4v(bN))F;if(ae.12!==0||bN.2p(1l,q.$T[0]).12!==0){q.1u.8j(1E)}},q));E $1q=$(1q).2p(q.G.8q.4s().3f(),q.$T[0]);if(q.L.4v(1q)&&$1q.12){E 5a=($1q.1O(\'1g-5a\')===\'\')?\'2c\':$1q.1O(\'1g-5a\');q.1u.8j(\'5a\'+5a)}},q1:C(Y,2i){q.G.bq.2R(2i);q.G.bJ[Y]=2i},9W:C(){q.$T.1h(\'1M\').1z($.1e(C(i,1M){E $1M=$(1M);$1M.2p(\'a\',q.$T[0]).on(\'2A\',C(e){e.2t()});if(q.L.1P(\'2F\'))$1M.1c(\'pX\',\'on\');q.N.jC($1M)},q));$(1k).on(\'2A.I-N-75.\'+q.2G,$.1e(C(e){q.1R.N=O;if(e.1Q.1n==\'bF\'&&q.L.4v(e.1Q)){q.1R.N=(q.1R.N&&q.1R.N==e.1Q)?O:e.1Q}},q))},5A:C(){if(!q.G.jz)F;q.$T.1h(\'a\').on(\'5B.I.\'+q.2G+\' 2A.I.\'+q.2G,$.1e(q.1R.jB,q));q.$T.on(\'5B.I.\'+q.2G+\' 2A.I.\'+q.2G,$.1e(q.1R.bM,q));$(1k).on(\'5B.I.\'+q.2G+\' 2A.I.\'+q.2G,$.1e(q.1R.bM,q))},jI:C($V){F $V.2D()},jB:C(e){E $el=$(e.1Q);if($el[0].1n==\'bF\')F;if($el[0].1n!==\'A\')$el=$el.2p(\'a\',q.$T[0]);if($el[0].1n!==\'A\')F;E $V=$el;E 3x=q.1R.jI($V);E 3n=$(\'<1i 1G="I-V-3n"></1i>\');E 2j=$V.1c(\'2j\');if(2j===1y){2j=\'\'}if(2j.12>24)2j=2j.aV(0,24)+\'...\';E jP=$(\'<a 2j="\'+$V.1c(\'2j\')+\'" 1Q="7v" />\').B(2j).2f(\'I-V-3n-7B\');E jQ=$(\'<a 2j="#" />\').B(q.1H.1b(\'7e\')).on(\'2A\',$.1e(q.V.2O,q)).2f(\'I-V-3n-7B\');E jN=$(\'<a 2j="#" />\').B(q.1H.1b(\'6t\')).on(\'2A\',$.1e(q.V.6t,q)).2f(\'I-V-3n-7B\');3n.1F(jP).1F(\' | \').1F(jQ).1F(\' | \').1F(jN);3n.1O({2X:(3x.2X+5J($V.1O(\'3M-3i\'),10))+\'px\',2c:3x.2c+\'px\'});$(\'.I-V-3n\').1t();$(\'3c\').1F(3n)},bM:C(e){e=e.87||e;E 1Q=e.1Q;E $1q=$(1Q).2p(\'a\',q.$T[0]);if($1q.12!==0&&$1q[0].1n===\'A\'&&1Q.1n!==\'A\'){F}M if((1Q.1n===\'A\'&&q.L.4v(1Q))||$(1Q).3r(\'I-V-3n-7B\')){F}$(\'.I-V-3n\').1t()}}},2W:C(){F{2K:C(B){if(q.G.1K)F B;if(B===\'\'||B===\'<p></p>\')F q.G.6s;B=B+"\\n";q.2W.aA=[];q.2W.z=0;B=B.K(/(<br\\s?\\/?>){1,}\\n?<\\/26>/gi,\'</26>\');B=q.2W.jK(B);B=q.2W.jy(B);B=q.2W.jf(B);B=q.2W.jj(B);B=q.2W.9d(B);B=q.2W.jk(B);B=B.K(29 2l(\'<br\\\\s?/?>\\n?<(\'+q.G.bL.3d(\'|\')+\')(.*?[^>])>\',\'gi\'),\'<p><br /></p>\\n<$1$2>\');F $.3k(B)},jK:C(B){E $1j=$(\'<1j />\').1F(B);$1j.1h(\'26 p\').2u(C(){F $(q).1F(\'<br />\').2a()});B=$1j.B();$1j.1h(q.G.bL.3d(\', \')).1z($.1e(C(i,s){q.2W.z++;q.2W.aA[q.2W.z]=s.7T;B=B.K(s.7T,\'\\n{K\'+q.2W.z+\'}\')},q));F B},jy:C(B){E bS=B.1V(/<!--([\\w\\W]*?)-->/gi);if(!bS)F B;$.1z(bS,$.1e(C(i,s){q.2W.z++;q.2W.aA[q.2W.z]=s;B=B.K(s,\'\\n{K\'+q.2W.z+\'}\')},q));F B},jk:C(B){$.1z(q.2W.aA,C(i,s){s=(1s s!==\'1y\')?s.K(/\\$/g,\'$\'):s;B=B.K(\'{K\'+i+\'}\',s)});F B},jj:C(B){E 4K=B.4p(29 2l(\'\\n\',\'g\'),-1);B=\'\';if(4K){E 2o=4K.12;2C(E i=0;i<2o;i++){if(!4K.qJ(i))F;if(4K[i].3L(\'{K\')==-1){4K[i]=4K[i].K(/<p>\\n\\t?<\\/p>/gi,\'\');4K[i]=4K[i].K(/<p><\\/p>/gi,\'\');if(4K[i]!==\'\'){B+=\'<p>\'+4K[i].K(/^\\n+|\\n+$/g,"")+"</p>"}}M B+=4K[i]}}F B},jf:C(B){B=B.K(/<br \\/>\\s*<br \\/>/gi,"\\n\\n");B=B.K(/<br\\s?\\/?>\\n?<br\\s?\\/?>/gi,"\\n<br /><br />");B=B.K(29 2l("\\r\\n",\'g\'),"\\n");B=B.K(29 2l("\\r",\'g\'),"\\n");B=B.K(29 2l("/\\n\\n+/"),\'g\',"\\n\\n");F B},9d:C(B){B=B.K(29 2l(\'</26></p>\',\'gi\'),\'</26>\');B=B.K(29 2l(\'<p></26>\',\'gi\'),\'</26>\');B=B.K(29 2l(\'<p><26>\',\'gi\'),\'<26>\');B=B.K(29 2l(\'<26></p>\',\'gi\'),\'<26>\');B=B.K(29 2l(\'<p><p \',\'gi\'),\'<p \');B=B.K(29 2l(\'<p><p>\',\'gi\'),\'<p>\');B=B.K(29 2l(\'</p></p>\',\'gi\'),\'</p>\');B=B.K(29 2l(\'<p>\\\\s?</p>\',\'gi\'),\'\');B=B.K(29 2l("\\n</p>",\'gi\'),\'</p>\');B=B.K(29 2l(\'<p>\\t?\\t?\\n?<p>\',\'gi\'),\'<p>\');B=B.K(29 2l(\'<p>\\t*</p>\',\'gi\'),\'\');F B}}},5u:C(){F{3N:C(e){if(!q.G.jg){3u($.1e(q.1d.1S,q),1);F}q.7k=1r;q.28.1U();q.J.3m();q.L.8k();q.5u.jo();$(3l).on(\'6m.I-jn\',$.1e(C(){$(3l).3U(q.aJ)},q));3u($.1e(C(){E B=q.$5b.B();q.$5b.1t();q.J.3g();q.L.aX();q.5u.1Y(B);$(3l).2Y(\'6m.I-jn\');if(q.2z.b6()){q.2z.31()}},q),1)},jo:C(){q.$5b=$(\'<1j>\').B(\'\').1c(\'5c\',\'1r\').1O({4e:\'7Y\',2L:0,2X:0,2c:\'-qN\'});if(q.L.1P(\'2F\')){q.$2N.1F(q.$5b)}M{if($(\'.1a-3c\').12>0){$(\'.1a.in .1a-3c\').1F(q.$5b)}M{$(\'3c\').1F(q.$5b)}}q.$5b.2m()},1Y:C(B){B=q.1W.2q(\'qi\',B);B=(q.L.8m())?q.1v.8B(B,O):q.1v.8B(B);B=q.1W.2q(\'5u\',B);if(q.L.8m()){q.1Y.1U(B,O)}M{q.1Y.B(B,O)}q.L.8u();q.7k=O;3u($.1e(q.1v.4y,q),10);3u($.1e(C(){E jq=q.$T.1h(\'1i\');$.1z(jq,C(i,s){E B=s.3A.K(/\\5X/,\'\');if(B===\'\'&&s.4u.12===0)$(s).1t()})},q),10)}}},3e:C(){F{a7:C(){if(!q.3e.is())F;q.$T.1c(\'3e\',q.$2k.1c(\'3e\'));q.3e.3j();q.$T.on(\'1D.I-3e\',$.1e(q.3e.3j,q))},3j:C(){3u($.1e(C(){E 1C=q.L.3z(q.$T.B(),O)?\'2f\':\'2U\';q.$T[1C](\'I-3e\')},q),5)},1t:C(){q.$T.2U(\'I-3e\')},is:C(){if(q.G.3e){F q.$2k.1c(\'3e\',q.G.3e)}M{F!(1s q.$2k.1c(\'3e\')==\'1y\'||q.$2k.1c(\'3e\')===\'\')}}}},5I:C(){F{2O:C(){$(1k.3c).1F($(\'<1j id="I-5I"><1i></1i></1j>\'));$(\'#I-5I\').qt()},3p:C(){$(\'#I-5I\').jr(qr,C(){$(q).1t()})}}},J:C(){F{1b:C(){q.2V=1k.4E();if(1k.4E&&q.2V.6f&&q.2V.7b){q.14=q.2V.6f(0)}M{q.14=1k.8b()}},4b:C(){52{q.2V.9E()}4U(e){}q.2V.4b(q.14)},3v:C(){E el=O;q.J.1b();if(q.2V&&q.2V.7b>0){el=q.2V.6f(0).jl}F q.L.4v(el)},5Q:C(4X){4X=4X||q.J.3v();if(4X){F q.L.4v($(4X).1q()[0])}F O},jp:C(){F 3l.4E().jv.qw},qh:C(){F 3l.4E().jv.qG},4a:C(Q){Q=Q||q.J.3v();53(Q){if(q.L.7L(Q.1n)){F($(Q).3r(\'I-T\'))?O:Q}Q=Q.e8}F O},e7:C(21,2d){q.J.1b();if(q.14&&q.14.4Y){F O}E 67=[];21=(1s 21==\'1y\'||21===O)?q.J.6V():21;E 4N=q.G.4N;4N.2R(\'1i\');if(1s 2d!==\'1y\'){2C(E i=0;i<2d.12;i++){4N.2R(2d[i])}}$.1z(21,$.1e(C(i,Q){if($.3q(Q.1n.3f(),4N)!=-1){67.2R(Q)}},q));F(67.12===0)?O:67},jh:C(2d){q.J.1b();if(q.14&&q.14.4Y){F O}E 67=[];E 21=q.J.6V();$.1z(21,$.1e(C(i,Q){if($.3q(Q.1n.3f(),2d)!=-1){67.2R(Q)}},q));F(67.12===0)?O:67},42:C(21){q.J.1b();if(q.14&&q.14.4Y){F[q.J.4a()]}E 1Z=[];21=(1s 21==\'1y\')?q.J.6V():21;$.1z(21,$.1e(C(i,Q){if(q.L.6J(Q)){q.J.jm=Q;1Z.2R(Q)}},q));F(1Z.12===0)?[q.J.4a()]:1Z},ji:C(){F q.J.jm},6V:C(){q.J.1b();E 7R=q.J.dX(1);E 9f=q.J.dX(2);if(q.14.4Y===O){if(3l.4E){E 2V=3l.4E();if(2V.7b>0){E 14=2V.6f(0);E jx=14.jl,ed=14.ed;E 84=14.7I();84.48(O);84.3R(9f);84.2Q(jx,ed);84.48(1r);84.3R(7R);14.9p(7R);14.jL(9f);2V.9E();2V.4b(14)}}}M{q.J.jJ(q.14,7R,1r);9f=7R}E 21=[];E 9c=0;E 3w=q;q.$T.1h(\'*\').1z(C(){if(q==7R){E 1q=$(q).1q();if(1q.12!==0&&1q[0].1n!=\'eh\'&&3w.L.4v(1q[0])){21.2R(1q[0])}21.2R(q);9c=1}M{if(9c>0){21.2R(q);9c=9c+1}}if(q==9f){F O}});E e6=[];E 2o=21.12;2C(E i=0;i<2o;i++){if(21[i].id!=\'21-2s-1\'&&21[i].id!=\'21-2s-2\'){e6.2R(21[i])}}q.J.jM();F e6},dX:C(5P){F $(\'<1i id="21-2s-\'+5P+\'" 1G="I-21-2s" 1f-3K="I">\'+q.G.5R+\'</1i>\')[0]},jJ:C(14,Q,1m){E 14=14.7I();52{14.48(1m);14.3R(Q)}4U(e){}},jM:C(){$(1k).1h(\'1i.I-21-2s\').1t();q.$T.1h(\'1i.I-21-2s\').1t()},qd:C(2b,2g){q.1T.dC(2b,2g)},62:C(Y){q.J.1b();if(q.14.4Y)F O;E 4P=1k.3y(Y);4P.83(q.14.ps());q.14.3R(4P);F 4P},9s:C(Q){if(q.L.1P(\'4g\')){Q=Q[0]||Q;E 14=1k.8b();14.95(Q)}M{q.1T.1U(Q,0,Q,1)}},af:C(){q.J.1b();q.14.95(q.$T[0]);q.J.4b()},1t:C(){q.J.1b();q.2V.9E()},3m:C(){q.J.jO()},jO:C(){q.J.1b();E 6n=q.J.6Q(1);q.J.dE(q.14,6n,1r);if(q.14.4Y===O){E 92=q.J.6Q(2);q.J.dE(q.14,92,O)}q.jA=q.$T.B()},6Q:C(5P){if(1s 5P==\'1y\')5P=1;F $(\'<1i id="J-2s-\'+5P+\'" 1G="I-J-2s" 1f-3K="I">\'+q.G.5R+\'</1i>\')[0]},5f:C(5P){F q.L.5N(q.J.6Q(5P))},dE:C(14,Q,1m){14=14.7I();52{14.48(1m);14.3R(Q)}4U(e){q.2m.2Q()}},3g:C(){E 6n=q.$T.1h(\'1i#J-2s-1\');E 92=q.$T.1h(\'1i#J-2s-2\');if(q.L.1P(\'4g\')){q.$T.2m()}if(6n.12!==0&&92.12!==0){q.1T.1U(6n,0,92,0)}M if(6n.12!==0){q.1T.1U(6n,0,6n,0)}M{q.$T.2m()}q.J.8O();q.jA=O},8O:C(){q.$T.1h(\'1i.I-J-2s\').1z(C(i,s){E 1g=$(s).1g().K(/\\5X/g,\'\');if(1g===\'\')$(s).1t();M $(s).2u(C(){F $(q).2a()})})},dr:C(){q.J.1b();F q.2V.4s()},pY:C(){E B=\'\';q.J.1b();if(q.2V.7b){E ds=1k.3y(\'1j\');E 2o=q.2V.7b;2C(E i=0;i<2o;++i){ds.83(q.2V.6f(i).pZ())}B=ds.3A}F q.1v.9Y(B)},jG:C(B){q.J.1b();q.14.4S();E 1j=1k.3y("1j");1j.3A=B;E 4L=1k.9P(),4A;53((4A=1j.9N)){4L.83(4A)}q.14.3R(4L)},q8:C(B){B=q.J.5f(1)+B+q.J.5f(2);q.J.1b();if(3l.4E&&3l.4E().6f){q.J.jG(B)}M if(1k.J&&1k.J.8b){q.14.jF(B)}q.J.3g();q.1d.1S()}}},6i:C(){F{3N:C(e,1l){if(!q.G.6i){if((e.8w||e.6I)&&(1l===66||1l===73))e.2t();F O}$.1z(q.G.6i,$.1e(C(5h,4x){E 51=5h.4p(\',\');E 2o=51.12;2C(E i=0;i<2o;i++){if(1s 51[i]===\'6W\'){q.6i.7W(e,$.3k(51[i]),$.1e(C(){E 1C;if(4x.1C.3L(/\\./)!=\'-1\'){1C=4x.1C.4p(\'.\');if(1s q[1C[0]]!=\'1y\'){q[1C[0]][1C[1]].8E(q,4x.6j)}}M{q[4x.1C].8E(q,4x.6j)}},q))}}},q))},7W:C(e,51,kP){E kC={8:"pv",9:"5C",10:"F",13:"F",16:"6L",17:"4f",18:"7l",19:"qP",20:"qn",27:"qe",32:"3h",33:"pt",34:"o8",35:"2g",36:"oc",37:"2c",38:"oq",39:"4z",40:"nQ",45:"1Y",46:"4l",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",6G:"4",o2:"5",o4:"6",o5:"7",pn:"8",po:"9",oF:"*",oN:"+",oW:"-",oO:".",oR:"/",od:"f1",oS:"f2",oQ:"f3",oP:"f4",oU:"f5",oX:"f6",oV:"f7",oM:"f8",oE:"f9",oB:"oC",oG:"oH",oK:"oJ",oI:"oZ",p0:"6m",pi:"-",ph:";",pg:"=",pf:",",pj:"-",pk:".",pm:"/",pc:"`",dG:"[",p5:"\\\\",dS:"]",p3:"\'"};E dM={"`":"~","1":"!","2":"@","3":"#","4":"$","5":"%","6":"^","7":"&","8":"*","9":"(","0":")","-":"p8","=":"+",";":": ","\'":"\\"",",":"<",".":">","/":"?","\\\\":"|"};51=51.3f().4p(" ");E bn=kC[e.3t],8G=5Y.oA(e.7m).3f(),74="",79={};$.1z(["7l","4f","5k","6L"],C(4W,by){if(e[by+\'oz\']&&bn!==by){74+=by+\'+\'}});if(bn)79[74+bn]=1r;if(8G){79[74+8G]=1r;79[74+dM[8G]]=1r;if(74==="6L+"){79[dM[8G]]=1r}}2C(E i=0,2o=51.12;i<2o;i++){if(79[51[i]]){e.2t();F kP.8E(q,kU)}}}}},2I:C(){F{1b:C(1d){if(!q.G.2I)F 1d;E dv=[\'kS\',\'3c\',\'dO\',\'hr\',\'i?nY\',\'V\',\'5k\',\'o0\',\'1p\',\'3V\',\'3T\',\'dJ\',\'dP\',\'dQ\'];E du=[\'li\',\'dt\',\'dt\',\'h[1-6]\',\'3Z\',\'3V\'];E 8x=[\'p\',\'26\',\'1j\',\'dl\',\'kd\',\'69\',\'nU\',\'k7\',\'ol\',\'2H\',\'7F\',\'2Z\',\'5S\',\'6S\',\'3s\'];q.2I.kq=29 2l(\'^<(/?\'+dv.3d(\'|/?\')+\'|\'+du.3d(\'|\')+\')[ >]\');q.2I.kc=29 2l(\'^<(br|/?\'+dv.3d(\'|/?\')+\'|/\'+du.3d(\'|/\')+\')[ >]\');q.2I.8x=29 2l(\'^</?(\'+8x.3d(\'|\')+\')[ >]\');E i=0,aU=1d.12,3W=0,2b=4d,2g=4d,Y=\'\',2n=\'\',5j=\'\';q.2I.94=0;2C(;i<aU;i++){3W=i;if(-1==1d.4q(i).4I(\'<\')){2n+=1d.4q(i);F q.2I.dq(2n)}53(3W<aU&&1d.5O(3W)!=\'<\'){3W++}if(i!=3W){5j=1d.4q(i,3W-i);if(!5j.1V(/^\\s{2,}$/g)){if(\'\\n\'==2n.5O(2n.12-1))2n+=q.2I.7y();M if(\'\\n\'==5j.5O(0)){2n+=\'\\n\'+q.2I.7y();5j=5j.K(/^\\s+/,\'\')}2n+=5j}if(5j.1V(/\\n/))2n+=\'\\n\'+q.2I.7y()}2b=3W;53(3W<aU&&\'>\'!=1d.5O(3W)){3W++}Y=1d.4q(2b,3W-2b);i=3W;E t;if(\'!--\'==Y.4q(1,3)){if(!Y.1V(/--$/)){53(\'-->\'!=1d.4q(3W,3)){3W++}3W+=2;Y=1d.4q(2b,3W-2b);i=3W}if(\'\\n\'!=2n.5O(2n.12-1))2n+=\'\\n\';2n+=q.2I.7y();2n+=Y+\'>\\n\'}M if(\'!\'==Y[1]){2n=q.2I.aW(Y+\'>\',2n)}M if(\'?\'==Y[1]){2n+=Y+\'>\\n\'}M if(t=Y.1V(/^<(3V|1p|2H)/i)){t[1]=t[1].3f();Y=q.2I.dy(Y);2n=q.2I.aW(Y,2n);2g=5Y(1d.4q(i+1)).3f().4I(\'</\'+t[1]);if(2g){5j=1d.4q(i+1,2g);i+=2g;2n+=5j}}M{Y=q.2I.dy(Y);2n=q.2I.aW(Y,2n)}}F q.2I.dq(2n)},7y:C(){E s=\'\';2C(E j=0;j<q.2I.94;j++){s+=\'\\t\'}F s},dq:C(1d){1d=1d.K(/\\n\\s*\\n/g,\'\\n\');1d=1d.K(/^[\\s\\n]*/,\'\');1d=1d.K(/[\\s\\n]*$/,\'\');1d=1d.K(/<3V(.*?)>\\n<\\/3V>/gi,\'<3V$1></3V>\');q.2I.94=0;F 1d},dy:C(Y){E 8e=\'\';Y=Y.K(/\\n/g,\' \');Y=Y.K(/\\s{2,}/g,\' \');Y=Y.K(/^\\s+|\\s+$/g,\' \');E dF=\'\';if(Y.1V(/\\/$/)){dF=\'/\';Y=Y.K(/\\/+$/,\'\')}E m;53(m=/\\s*([^= ]+)(?:=(([\'"\']).*?\\3|[^ ]+))?/.5d(Y)){if(m[2])8e+=m[1].3f()+\'=\'+m[2];M if(m[1])8e+=m[1].3f();8e+=\' \';Y=Y.4q(m[0].12)}F 8e.K(/\\s*$/,\'\')+dF+\'>\'},aW:C(Y,2n){E nl=Y.1V(q.2I.8x);if(Y.1V(q.2I.kq)||nl){2n=2n.K(/\\s*$/,\'\');2n+=\'\\n\'}if(nl&&\'/\'==Y.5O(1))q.2I.94--;if(\'\\n\'==2n.5O(2n.12-1))2n+=q.2I.7y();if(nl&&\'/\'!=Y.5O(1))q.2I.94++;2n+=Y;if(Y.1V(q.2I.kc)||Y.1V(q.2I.8x)){2n=2n.K(/ *$/,\'\')}F 2n}}},1I:C(){F{jY:C(){E 4W=$.3q(\'1i\',q.G.3S);if(4W!==-1){q.G.3S.9n(4W,1)}if(q.G.4t)q.G.49=O;if(q.G.4T)q.G.1L=O;if(q.G.1K)F;E 2d=[\'p\',\'4h\'];if(q.G.4t)q.1I.jX(2d);if(q.G.49)q.1I.k8(2d)},jX:C(2d){E 2o=2d.12;2C(E i=0;i<2o;i++){if($.3q(2d[i],q.G.4t)==-1){q.G.4t.2R(2d[i])}}},k8:C(2d){E 2o=2d.12;2C(E i=0;i<2o;i++){E 3x=$.3q(2d[i],q.G.49);if(3x!=-1){q.G.49.9n(3x,1)}}},2K:C(B,3Y){q.1I.2E={49:q.G.49,4t:q.G.4t,6C:q.G.6C,5F:q.G.5F,5r:q.G.5r,5m:q.G.5m,1L:q.G.1L,4T:q.G.4T,6N:q.G.6N,3S:q.G.3S};$.7w(q.1I.2E,3Y);B=q.1I.6C(B);q.1I.$1j=$(\'<1j />\').1F(B);q.1I.5F();q.1I.5r();q.1I.k6();q.1I.1L();q.1I.3S();q.1I.kR();q.1I.5m();q.1I.6N();B=q.1I.$1j.B();q.1I.$1j.1t();F B},6C:C(B){if(!q.1I.2E.6C)F B;F B.K(/<!--[\\s\\S]*?-->/gi,\'\')},5F:C(B){if(!q.1I.2E.5F)F B;E 2o=q.1I.2E.5F.12;E 5L=[],e2=[];2C(E i=0;i<2o;i++){e2.2R(q.1I.2E.5F[i][1]);5L.2R(q.1I.2E.5F[i][0])}$.1z(5L,$.1e(C(1l,1E){q.1I.$1j.1h(1E).2u(C(){F $("<"+e2[1l]+" />",{B:$(q).B()})})},q))},5r:C(){if(!q.1I.2E.5r)F;E 2o=q.1I.2E.5r.12;q.1I.$1j.1h(\'1i\').1z($.1e(C(n,s){E $el=$(s);E 1p=$el.1c(\'1p\');2C(E i=0;i<2o;i++){if(1p&&1p.1V(29 2l(\'^\'+q.1I.2E.5r[i][0],\'i\'))){E 1n=q.1I.2E.5r[i][1];$el.2u(C(){E Y=1k.3y(1n);F $(Y).1F($(q).2a())})}}},q))},k6:C(){if(!q.1I.2E.49&&q.1I.2E.4t){q.1I.$1j.1h(\'*\').6q(q.1I.2E.4t.3d(\',\')).1z(C(i,s){if(s.3A===\'\')$(s).1t();M $(s).2a().44()})}if(q.1I.2E.49){q.1I.$1j.1h(q.1I.2E.49.3d(\',\')).1z(C(i,s){if($(s).3r(\'I-3V-Y\')||$(s).3r(\'I-J-2s\'))F;if(s.3A===\'\')$(s).1t();M $(s).2a().44()})}},1L:C(){E 2o;if(!q.1I.2E.1L&&q.1I.2E.4T){E e4=[],e5=[];2o=q.1I.2E.4T.12;2C(E i=0;i<2o;i++){e4.2R(q.1I.2E.4T[i][0]);e5.2R(q.1I.2E.4T[i][1])}q.1I.$1j.1h(\'*\').1z($.1e(C(n,s){E $el=$(s);E 3x=$.3q($el[0].1n.3f(),e4);E 5t=q.1I.kQ(3x,e5,$el);if(5t){$.1z(5t,C(z,f){$el.1L(f)})}},q))}if(q.1I.2E.1L){2o=q.1I.2E.1L.12;2C(E i=0;i<2o;i++){E 9w=q.1I.2E.1L[i][1];if($.b2(9w))9w=9w.3d(\' \');q.1I.$1j.1h(q.1I.2E.1L[i][0]).1L(9w)}}},kQ:C(3x,5q,$el){E 5t=[];if(3x==-1){$.1z($el[0].4u,C(i,2w){5t.2R(2w.1x)})}M if(5q[3x]==\'*\'){5t=[]}M{$.1z($el[0].4u,C(i,2w){if($.b2(5q[3x])){if($.3q(2w.1x,5q[3x])==-1){5t.2R(2w.1x)}}M if(5q[3x]!=2w.1x){5t.2R(2w.1x)}})}F 5t},kL:C(el,ba){ba=29 2l(ba,"g");F el.1z(C(){E 3w=$(q);E 2o=q.4u.12-1;2C(E i=2o;i>=0;i--){E 2w=q.4u[i];if(2w&&2w.nM&&2w.1x.3L(ba)>=0){3w.1L(2w.1x)}}})},3S:C(){if(!q.1I.2E.3S)F;q.1I.$1j.1h(q.1I.2E.3S.3d(\',\')).1z(C(){E $el=$(q);E 1g=$el.1g();1g=1g.K(/\\5X/g,\'\');1g=1g.K(/&5i;/gi,\'\');1g=1g.K(/\\s/g,\'\');if(1g===\'\'&&$el.3O().12===0){$el.1t()}})},kR:C(){q.1I.$1j.1h(\'li p\').2a().44()},5m:C(){if(!q.1I.2E.5m)F;E 2d=q.1I.2E.5m;if($.b2(q.1I.2E.5m))2d=q.1I.2E.5m.3d(\',\');q.1I.kL(q.1I.$1j.1h(2d),\'^(1f-)\')},6N:C(){if(!q.1I.2E.6N)F;q.1I.$1j.1h(q.1I.2E.6N.3d(\',\')).1z(C(){if(q.4u.12===0){$(q).2a().44()}})}}},1B:C(){F{3N:C(){F{B:{1J:q.1H.1b(\'B\'),1C:\'1d.3j\'},3b:{1J:q.1H.1b(\'3b\'),1o:{p:{1J:q.1H.1b(\'kE\'),1C:\'R.31\'},26:{1J:q.1H.1b(\'e1\'),1C:\'R.31\'},2H:{1J:q.1H.1b(\'1d\'),1C:\'R.31\'},h1:{1J:q.1H.1b(\'iC\'),1C:\'R.31\'},h2:{1J:q.1H.1b(\'fz\'),1C:\'R.31\'},h3:{1J:q.1H.1b(\'fy\'),1C:\'R.31\'},h4:{1J:q.1H.1b(\'fF\'),1C:\'R.31\'},h5:{1J:q.1H.1b(\'fv\'),1C:\'R.31\'}}},4n:{1J:q.1H.1b(\'4n\'),1C:\'25.31\'},4m:{1J:q.1H.1b(\'4m\'),1C:\'25.31\'},5W:{1J:q.1H.1b(\'5W\'),1C:\'25.31\'},5p:{1J:q.1H.1b(\'5p\'),1C:\'25.31\'},5n:{1J:\'&nO; \'+q.1H.1b(\'5n\'),1C:\'2e.3j\'},5o:{1J:\'1. \'+q.1H.1b(\'5o\'),1C:\'2e.3j\'},7a:{1J:\'< \'+q.1H.1b(\'7a\'),1C:\'3B.9j\'},3B:{1J:\'> \'+q.1H.1b(\'3B\'),1C:\'3B.bB\'},N:{1J:q.1H.1b(\'N\'),1C:\'N.2O\'},22:{1J:q.1H.1b(\'22\'),1C:\'22.2O\'},V:{1J:q.1H.1b(\'V\'),1o:{V:{1J:q.1H.1b(\'bx\'),1C:\'V.2O\',1R:{2k:\'a\',in:{1J:q.1H.1b(\'dB\'),},2n:{1J:q.1H.1b(\'bx\')}}},6t:{1J:q.1H.1b(\'6t\'),1C:\'V.6t\',1R:{2k:\'a\',2n:{1c:{\'1G\':\'I-1o-V-dA\',\'4Q-7c\':1r}}}}}},3a:{1J:q.1H.1b(\'3a\'),1o:{2c:{1J:q.1H.1b(\'fm\'),1C:\'3a.2c\'},5E:{1J:q.1H.1b(\'fs\'),1C:\'3a.5E\'},4z:{1J:q.1H.1b(\'fI\'),1C:\'3a.4z\'},9r:{1J:q.1H.1b(\'fJ\'),1C:\'3a.9r\'}}},aE:{1J:q.1H.1b(\'aE\'),1C:\'3M.1Y\'}}},2r:C(){q.1B.ey();q.1B.eB();q.1B.eu();if(q.G.4k.12===0)F;q.$1B=q.1B.g9();q.1B.fU();q.1B.1F();q.1B.g5();q.1B.g6();q.1B.fK();if(q.G.bq){q.$T.on(\'g3.I 2x.I 2m.I\',$.1e(q.1R.1B,q))}},g9:C(){F $(\'<3s>\').2f(\'I-1B\').1c({\'id\':\'I-1B-\'+q.2G,\'9D\':\'1B\'})},g5:C(){$.1z(q.G.1B.3b.1o,$.1e(C(i,s){if($.3q(i,q.G.3b)==-1)75 q.G.1B.3b.1o[i]},q))},g6:C(){$.1z(q.G.4k,$.1e(C(i,2i){if(!q.G.1B[2i])F;if(2i===\'22\'){if(q.G.7D===O)F;M if(!q.G.7D&&q.G.7P===O)F}if(2i===\'N\'){if(q.G.7J===O)F;M if(!q.G.7J&&q.G.7P===O)F}E 2T=q.G.1B[2i];q.$1B.1F($(\'<li>\').1F(q.1u.2r(2i,2T)))},q))},1F:C(){if(q.G.9M){q.$1B.2f(\'I-1B-oo\');$(q.G.9M).B(q.$1B)}M{q.$2N.6u(q.$1B)}},fK:C(){if(!q.L.7n())F;if(q.G.9M)F;if(!q.G.fP)F;q.1B.dU();$(q.G.6B).on(\'6m.I.\'+q.2G,$.1e(q.1B.dU,q))},fU:C(){if(q.L.6A()&&q.G.fR){q.$1B.2f(\'I-1B-aY\')}},eu:C(){if(q.G.4B)F;E 4W=q.G.4k.4I(\'B\');if(4W!==-1){q.G.4k.9n(4W,1)}},ey:C(){if(q.G.dK.12===0)F;$.1z(q.G.dK,$.1e(C(i,s){E 4W=q.G.4k.4I(s);q.G.4k.9n(4W,1)},q))},eB:C(){if(!q.L.6A()||q.G.dW.12===0)F;$.1z(q.G.dW,$.1e(C(i,s){E 4W=q.G.4k.4I(s);q.G.4k.9n(4W,1)},q))},dU:C(){E 3U=$(q.G.6B).3U();E 6v=1;if(q.G.6B===1k){6v=q.$2N.2D().2X}if((3U+q.G.6z)>6v){q.1B.er(3U,6v)}M{q.1B.eW()}},er:C(3U,6v){E 2X=q.G.6z+3U-6v;E 2c=0;E 2g=6v+q.$2N.3i()-32;E 2L=q.$2N.7t();q.$1B.2f(\'1B-7Y-2N\');q.$1B.1O({4e:\'9x\',2L:2L,2X:2X+\'px\',2c:2c});if(3U>2g)$(\'.I-1o-\'+q.2G+\':dw\').3p();q.1B.eJ();q.$1B.1O(\'eX\',(3U<2g)?\'dw\':\'hV\')},eW:C(){q.$1B.1O({4e:\'ob\',2L:\'ad\',2X:0,2c:0,eX:\'dw\'});q.1B.eO();q.$1B.2U(\'1B-7Y-2N\')},eJ:C(){E 2X=q.$1B.6b()+q.G.6z;E 4e=\'7Y\';if(q.G.6B!==1k){2X=(q.$1B.6b()+q.$1B.2D().2X)+q.G.6z;4e=\'9x\'}$(\'.I-1o-\'+q.2G).1z(C(){$(q).1O({4e:4e,2X:2X+\'px\'})})},eO:C(){E 2X=(q.$1B.6b()+q.$1B.2D().2X);$(\'.I-1o-\'+q.2G).1z(C(){$(q).1O({4e:\'9x\',2X:2X+\'px\'})})}}},1w:C(){F{3N:C(id,2h,2y){q.1w.4V=O;q.1w.2y=2y;q.1w.2h=2h;q.1w.$el=$(id);q.1w.$4c=$(\'<1j id="I-4c" />\');q.1w.$e0=$(\'<1j id="I-4c-3e" />\').1g(q.1H.1b(\'ev\'));q.1w.$3E=$(\'<3E 1m="22" 1x="22" />\');q.1w.$e0.1F(q.1w.$3E);q.1w.$4c.1F(q.1w.$e0);q.1w.$el.1F(q.1w.$4c);q.1w.$4c.2Y(\'I.1w\');q.1w.$3E.2Y(\'I.1w\');q.1w.$4c.on(\'pq.I.1w\',$.1e(q.1w.bD,q));q.1w.$4c.on(\'oi.I.1w\',$.1e(q.1w.iv,q));q.1w.$3E.on(\'iz.I.1w\',$.1e(C(e){e=e.87||e;q.1w.9R(q.1w.$3E[0].5T[0],e)},q));q.1w.$4c.on(\'58.I.1w\',$.1e(C(e){e.2t();q.1w.$4c.2U(\'7X-dL\').2f(\'7X-58\');q.1w.au(e)},q))},hL:C(22,e){q.1w.4V=1r;q.1w.9R(22,e)},au:C(e){e=e.87||e;E 5T=e.9Z.5T;q.1w.9R(5T[0],e)},9R:C(22,e){if(q.G.7P){q.1w.dZ(22);q.1w.i1(22);F}E 4o=!!3l.9V?29 9V():4d;if(3l.9V){q.1w.dZ(22);E 1x=(q.1w.1m==\'N\')?q.G.hH:q.G.hJ;4o.1F(1x,22)}q.5I.2O();q.1W.2q(\'og\',e,4o);q.1w.hp(4o,e)},dZ:C(22){q.1w.hS(22);if(q.1w.4V){q.1w.2h=(q.1w.1m==\'N\')?q.G.7J:q.G.7D;q.1w.2y=(q.1w.1m==\'N\')?q.N.1Y:q.22.1Y}},hS:C(22){q.1w.1m=\'N\';if(q.G.hQ.4I(22.1m)==-1){q.1w.1m=\'22\'}},71:C(7j,fd){if(7j===O||1s 7j!==\'41\')F fd;$.1z(7j,$.1e(C(k,v){if(v!==4d&&v.4s().4I(\'#\')===0)v=$(v).2J();fd.1F(k,v)},q));F fd},hp:C(4o,e){if(q.1w.1m==\'N\'){4o=q.1w.71(q.G.qs,4o);4o=q.1w.71(q.1w.bv,4o)}M{4o=q.1w.71(q.G.qy,4o);4o=q.1w.71(q.1w.9U,4o)}E 2S=29 bf();2S.aM(\'qx\',q.1w.2h);2S.dY("X-qo-qg","bf");2S.i7=$.1e(C(){if(2S.dR==4){E 1f=2S.gx;1f=1f.K(/^\\[/,\'\');1f=1f.K(/\\]$/,\'\');E 2P;52{2P=(1s 1f===\'6W\'?$.iw(1f):1f)}4U(nG){2P={6X:1r}}q.5I.3p();if(!q.1w.4V){q.1w.$4c.2U(\'7X-58\')}q.1w.2y(2P,q.1w.4V,e)}},q);2S.dz(4o)},bD:C(e){e.2t();q.1w.$4c.2f(\'7X-dL\')},iv:C(e){e.2t();q.1w.$4c.2U(\'7X-dL\')},ql:C(){q.1w.bv={}},qA:C(1x,1E){q.1w.bv[1x]=1E},qB:C(1x){75 q.1w.bv[1x]},qQ:C(){q.1w.9U={}},qT:C(1x,1E){q.1w.9U[1x]=1E},qL:C(1x){75 q.1w.9U[1x]},i1:C(22){q.1w.hZ(22,$.1e(C(hY){q.1w.gG(22,hY)},q))},hZ:C(22,2y){E 2S=29 bf();E 7O=(q.G.7P.3L(/\\?/)!==\'-1\')?\'?\':\'&\';2S.aM(\'qD\',q.G.7P+7O+\'1x=\'+22.1x+\'&1m=\'+22.1m,1r);if(2S.i5)2S.i5(\'1g/qC; qH=x-qK-qF\');E i8=q;2S.i7=C(e){if(q.dR==4&&q.dp==ag){i8.5I.2O();2y(hn(q.gx))}M if(q.dR==4&&q.dp!=ag){}};2S.dz()},gF:C(aS,2h){E 2S=29 bf();if("pw"in 2S){2S.aM(aS,2h,1r)}M if(1s gH!="1y"){2S=29 gH();2S.aM(aS,2h)}M{2S=4d}F 2S},gG:C(22,2h){E 2S=q.1w.gF(\'py\',2h);if(!2S){}M{2S.q3=$.1e(C(){if(2S.dp==ag){q.5I.3p();E ai=2h.4p(\'?\');if(!ai[0]){F O}if(!q.1w.4V){q.1w.$4c.2U(\'7X-58\')}E 2P={9t:ai[0]};if(q.1w.1m==\'22\'){E 2B=ai[0].4p(\'/\');2P.6h=2B[2B.12-1]}q.1w.2y(2P,q.1w.4V,O)}M{}},q);2S.q2=C(){};2S.1w.q6=C(e){};2S.dY(\'qb-qa\',22.1m);2S.dY(\'x-q0-pT\',\'pS-pU\');2S.dz(22)}}}},L:C(){F{6A:C(){F/(hc|h9|gS|gP)/.ac(aq.aw)},7n:C(){F!/(hc|h9|pR|gS|gP)/.ac(aq.aw)},pK:C(7j){F gU.5K.4s.5Z(7j)==\'[41 5Y]\'},3z:C(B,gZ){B=B.K(/[\\5X-\\pF\\pH]/g,\'\');B=B.K(/&5i;/gi,\'\');B=B.K(/<\\/?br\\s?\\/?>/g,\'\');B=B.K(/\\s/g,\'\');B=B.K(/^<p>[^\\W\\w\\D\\d]*?<\\/p>$/i,\'\');B=B.K(/<4R(.*?[^>])>$/i,\'4R\');B=B.K(/<4B(.*?[^>])>$/i,\'4B\');if(gZ!==O){B=B.K(/<[^\\/>][^>]*><\\/[^>]+>/gi,\'\');B=B.K(/<[^\\/>][^>]*><\\/[^>]+>/gi,\'\')}B=$.3k(B);F B===\'\'},eb:C(5h){if(1s(5h)===\'1y\')F 0;F 5J(5h.K(\'px\',\'\'),10)},qm:C(6P){if(1s 6P==\'1y\')F;if(6P.3L(/^#/)==-1)F 6P;E gX=/^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;6P=6P.K(gX,C(m,r,g,b){F r+r+g+g+b+b});E bb=/^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.5d(6P);F\'lD(\'+5J(bb[1],16)+\', \'+5J(bb[2],16)+\', \'+5J(bb[3],16)+\')\'},5N:C(el){F $(\'<1j>\').1F($(el).eq(0).8N()).B()},bp:C(el){if($.3q(el.1n,q.G.8q)!==-1){F $(el)}M{F $(el).2p(q.G.8q.4s().3f(),q.$T[0])}},5H:C(el,1c){E $el=$(el);if(1s $el.1c(1c)==\'1y\'){F 1r}if($el.1c(1c)===\'\'){$el.1L(1c);F 1r}F O},3S:C(i,s){E $s=$($.ei(s));$s.1h(\'.I-7H-3h\').1L(\'1p\').1L(\'1G\');if($s.1h(\'hr, br, 1M, 4R, 4B\').12!==0)F;E 1g=$.3k($s.1g());if(q.L.3z(1g,O)){$s.1t()}},8k:C(){q.gl=q.$T.3U();q.aJ=$(3l).3U();if(q.G.8h)q.gh=$(q.G.8h).3U()},aX:C(){if(1s q.8k===\'1y\'&&1s q.aJ===\'1y\')F;$(3l).3U(q.aJ);q.$T.3U(q.gl);if(q.G.8h)$(q.G.8h).3U(q.gh)},aN:C(){E 3h=1k.3y(\'1i\');3h.3G=\'I-7H-3h\';3h.3A=q.G.5R;F 3h},56:C(Q){E 2d=q.G.4N;2d.2R(\'1i\');if(Q.1n==\'8P\')2d.2R(\'a\');$(Q).1h(2d.3d(\',\')).6q(\'1i.I-J-2s\').2a().44()},6p:C(Q,56){E 3w=q;$(Q).2u(C(){if(56===1r)3w.L.56(q);F $(q).2a()});F $(Q)},4J:C(Q,Y,56){E 5L;E 3w=q;$(Q).2u(C(){5L=$(\'<\'+Y+\' />\').1F($(q).2a());2C(E i=0;i<q.4u.12;i++){5L.1c(q.4u[i].1x,q.4u[i].1E)}if(56===1r)3w.L.56(5L);F 5L});F 5L},ic:C(){E R=q.J.4a();if(!R)F O;E 2D=q.1T.8D(R);F(2D===0)?1r:O},6D:C(2k){if(1s 2k==\'1y\'){E 2k=q.J.4a();if(!2k)F O}E 2D=q.1T.8D(2k);E 1g=$.3k($(2k).1g()).K(/\\n\\r\\n/g,\'\');F(2D==1g.12)?1r:O},nA:C(){E 2D=q.1T.8D(q.$T[0]);F(2D===0)?1r:O},dI:C(){E R=q.$T[0];E 2D=q.1T.8D(R);E 1g=$.3k($(R).B().K(/(<([^>]+)>)/gi,\'\'));F(2D==1g.12)?1r:O},6J:C(R){R=R[0]||R;F R&&q.L.7L(R.1n)},7L:C(Y){if(1s Y==\'1y\')F O;F q.hG.ac(Y)},aa:C(1A,Y){E 2k=$(1A).2p(Y,q.$T[0]);if(2k.12==1){F 2k[0]}F O},8m:C(){F q.af},fZ:C(){q.af=1r},8u:C(){q.af=O},4v:C(el){if(!el){F O}if($(el).fY(\'.I-T\').12===0||$(el).3r(\'I-T\')){F O}F el},fk:C(){F q.L.4Z([\'ec\',\'e9\',\'e3\',\'ef\',\'eg\',\'ee\'])},4Z:C(1n){E 1q=q.J.5Q();E 1A=q.J.3v();if($.b2(1n)){E dV=0;$.1z(1n,$.1e(C(i,s){if(q.L.dN(1A,1q,s)){dV++}},q));F(dV===0)?O:1r}M{F q.L.dN(1A,1q,1n)}},dN:C(1A,1q,1n){1n=1n.mJ();F 1q&&1q.1n===1n?1q:1A&&1A.1n===1n?1A:O},mb:C(){F(q.L.1P(\'2F\')&&5J(q.L.1P(\'b5\'),10)<9)?1r:O},ml:C(){F(q.L.1P(\'2F\')&&5J(q.L.1P(\'b5\'),10)<10)?1r:O},iK:C(){F!!aq.aw.1V(/nd\\/7\\./)},1P:C(1P){E 54=aq.aw.3f();E 1V=/(dD)[\\/]([\\w.]+)/.5d(54)||/(g1)[ \\/]([\\w.]+)/.5d(54)||/(89)[ \\/]([\\w.]+).*(ea)[ \\/]([\\w.]+)/.5d(54)||/(89)[ \\/]([\\w.]+)/.5d(54)||/(ls)(?:.*b5|)[ \\/]([\\w.]+)/.5d(54)||/(2F) ([\\w.]+)/.5d(54)||54.4I("o3")>=0&&/(dT)(?::| )([\\w.]+)/.5d(54)||54.4I("mP")<0&&/(4g)(?:.*? dT:([\\w.]+)|)/.5d(54)||[];if(1P==\'ea\')F(1s 1V[3]!=\'1y\')?1V[3]==\'ea\':O;if(1P==\'b5\')F 1V[2];if(1P==\'89\')F(1V[1]==\'g1\'||1V[1]==\'dD\'||1V[1]==\'89\');if(1V[1]==\'dT\')F 1P==\'2F\';if(1V[1]==\'dD\')F 1P==\'89\';F 1P==1V[1]},bh:C(gB,gy,2D){E i=gB.4I(gy,2D);F i>=0?i:O},dH:C(){E $3c=$(\'B\');E 7q=3l.7t;if(!7q){E dx=1k.lG.lE();7q=dx.4z-8p.pV(dx.2c)}E eI=1k.3c.g4<7q;E aG=q.L.eE();$3c.1O(\'aY\',\'hV\');if(eI)$3c.1O(\'jZ-4z\',aG)},eE:C(){E $3c=$(\'3c\');E 78=1k.3y(\'1j\');78.3G=\'I-jD-jH\';$3c.1F(78);E aG=78.om-78.g4;$3c[0].o6(78);F aG},aK:C(){$(\'B\').1O({\'aY\':\'\',\'jZ-4z\':\'\'});$(\'3c\').1t(\'I-jD-jH\')}}}};$(3l).on(\'2K.ju.I\',C(){$(\'[1f-ju="I"]\').I()});43.5K.3N.5K=43.5K})(oa);',62,1668,'||||||||||||||||||||||||||this|||||||||||html|function||var|return|opts||redactor|selection|replace|utils|else|image|false||node|block||editor||link|||tag||||length||range||||||modal|get|attr|code|proxy|data|text|find|span|div|document|key|type|tagName|dropdown|style|parent|true|typeof|remove|button|clean|upload|name|undefined|each|current|toolbar|func|keydown|value|append|class|lang|tidy|title|linebreaks|removeAttr|img|next|css|browser|target|observe|sync|caret|set|match|core|formatted|insert|blocks||nodes|file|btn||inline|blockquote||buffer|new|contents|start|left|tags|list|addClass|end|url|btnName|href|element|RegExp|focus|out|len|closest|setCallback|build|marker|preventDefault|replaceWith|textarea|item|keyup|callback|linkify|click|arr|for|offset|settings|msie|uuid|pre|tabifier|val|load|width|label|box|show|json|setStart|push|xhr|btnObject|removeClass|sel|paragraphize|top|off|td|last|format|||||||||alignment|formatting|body|join|placeholder|toLowerCase|restore|space|height|toggle|trim|window|save|tooltip|autosave|hide|inArray|hasClass|ul|keyCode|setTimeout|getCurrent|self|pos|createElement|isEmpty|innerHTML|indent|after|CodeMirror|input|imageBox|className|first|re|setEnd|verified|search|line|init|children|font|matches|insertNode|removeEmpty|table|scrollTop|script|point|rel|options|option||object|getBlocks|Redactor|unwrap|||execCommand|collapse|deniedTags|getBlock|addRange|droparea|null|position|ctrl|mozilla|section|resizeHandle|close|buttons|del|italic|bold|formData|split|substr|src|toString|allowedTags|attributes|isRedactorParent|regexps|command|clearUnverified|right|child|source|modalBox|prev|getSelection|cmd|margin|blockElem|indexOf|replaceToTag|htmls|frag|resize|inlineTags|orgn|wrapper|aria|iframe|deleteContents|allowedAttr|catch|direct|index|elem|collapsed|isCurrentOrParent||keys|try|while|ua|setAfter|removeInlineTags|arrow|drop||align|pasteBox|contenteditable|exec|strong|getMarkerAsHtml|linkProtocol|str|nbsp|cont|meta|BR|removeDataAttr|unorderedlist|orderedlist|underline|allowed|replaceStyles|isFunction|attributesRemove|paste|br1|https|tmp|LI|none|links|touchstart|tab|editter|center|replaceTags|lastNode|removeEmptyAttr|progress|parseInt|prototype|replacement|toggleType|getOuterHtml|charAt|num|getParent|invisibleSpace|th|files|currentLevel|lastList|deleted|u200B|String|call|||wrap|quot|currentList|||inlines|mousedown|form|prop|innerHeight|containerTag|marginTop|visual|getRangeAt|templateName|filename|shortcuts|params|break|methods|scroll|node1|nodeValue|replaceWithContents|not|replaceDivs|emptyHtml|unlink|prepend|boxTop|TD|Insert|module|toolbarFixedTopOffset|isMobile|toolbarFixedTarget|removeComments|isEndOfElement|video|vimeo|100|tabindex|metaKey|isBlock|youtube|shift|SPAN|removeWithoutAttr|shiftKey|hex|getMarker|ENTER|tr|preSpaces|insertBreakLine|getNodes|string|error|editorDiv|instance|figure|getHiddenFields|display||modif|delete|getEvent|dropact|scrollDiv|possible|outdent|rangeCount|disabled|hideAll|edit|www|embed|keyPosition|blocksSize|obj|rtePaste|alt|which|isDesktop|focn|DIV|windowWidth|dropdowns|level|innerWidth|hideResize|_blank|extend|BACKSPACE|getTabs|weight|pattern|action|toggleClass|fileUpload|z0|select|figcaption|invisible|cloneRange|imageUpload|float|isBlockTag|posFromIndex|parHtml|mark|s3|setVerified|startNode|header|outerHTML|strike|sup|handler|drag|fixed|sub|decoration|modalOverlay|size|appendChild|boundaryRange|endRange|tmpList|originalEvent|listParent|webkit|blank|createRange|event|ftp|tagout|icon|exceptTags|scrollTarget|items|setActive|saveScroll|codemirror|isSelectAll|DELETE|imageFloatMargin|Math|alignmentTags|events|returnValue|OL|disableSelectAll|modalClose|ctrlKey|newLevel|UL|addProperties|createTextNode|onPaste|convertVideoLinks|getOffsetOfElement|apply|plugins|character|isRemoveInline|active|isMobileUndoRedo|act|tabber|autosaveInterval|clone|removeMarkers|PRE|modalFooter|inputUrl|tmpLi|closeHandler|http|classSize|setClass|linkmarker|Header|modalHeader|||node2|focusNode|cleanlevel|selectNodeContents|||||blockLevelElements|setMode|counter|clear|targetTouches|endNode|resizer|small|Array|decrease|addEvent|singleLine|Add|splice|case|setStartAfter|replaceParagraphsToBr|justify|selectElement|filelink|cite|undo|attrs|absolute|Delete|tagblock||imageResizer|audio|role|removeAllRanges|amp|imageMargin|insertDblBreakLine|param|inserted|lastLevel|rebuffer|toolbarExternal|firstChild|maxHeight|createDocumentFragment|createTextRange|traverseFile|moveToPoint|bind|fileFields|FormData|images|onClick|onSync|dataTransfer|formatblock|fixEmptyIndent|clearStyle|insertInIe|wrapperHtml|caretRangeFromPoint|windowHeight|enable|mouseover|mouseout|isTag|property|test|auto|parentEl|selectAll|200|eventName|s3file|selectionMarkers|deleteProperties|editorHtml|ESC|getOffset|callbacks|formatWrap|navigator|normalizeLists|minHeight|link_new_tab|onDrop|showOnDesktop|userAgent|appendTo|isTextarea|modalBody|safes|formatListToBlockquote|getPlainText|caretPositionFromPoint|horizontalrule|autosaveFields|scrollbarWidth|caretRange|onPasteTidy|saveBodyScroll|enableBodyScroll|mso|open|createSpaceElement|kbd|classname|cloned|tabAsSpaces|method|blockHtml|codeLength|substring|placeTag|restoreScroll|overflow|x200b|isContainerTable|prevList|isArray|parentA|imageFloat|version|isEnabled|indentValue|replaceToParagraph|pageY|regex|result|spaces|BLOCKQUOTE||XMLHttpRequest|u00a0|strpos|before|encodeEntities|matchContainers|prev2|marginLeft|special|methodVal|getAlignmentElement|activeButtons||convertLinks|marginRight|enterKey|imageFields|com|link_insert|specialKey|samp|re2|increase|checked|onDrag|marginBottom|IMG|redo|nodeType|modules|activeButtonsStates|Column|paragraphizeBlocks|closeTooltip|currentEl|Row|Table|count|autosaveOnChange|commentsMatches|formatTableWrapping|autosaveName|setInactiveAll|Link|headTag|curLang|add|saveFormTags|convertInline|verifiedTags|nodeToCaretPositionFromPoint|address|syncCode|removeFormat|htmlIe|clearUnverifiedRemove|headers|tagsEmpty|attrAllowed|dfn|setBefore|TAB|getTextFromHtml|isEndOfTable||DOWN|imageDelete|showCode|setFormat|one|enlargeOffset|selectionEnd|isFocused|dropdownWidth|dropdownObject|htmlLength|blur|formattingAdd|selectionStart|redactorImageLink|markerLength|isP|TH|imageEditable|removeSpaces|imageDisplay|ratio|imageResizable|insertBreakLineProcessing|endContainer|highContrast|createCancelButton|createActionButton|createButton|addCallback|URL|getModuleMethods|RedactorPlugins|image_position|buttonsSize|footer|setDropdownAttr|content|isDelete|setDropdownProperties|inValues|direction|isCurrent|outValues|isOrderedCmdUnordered|isUnorderedCmdOrdered|firstFound|extra|inputText|mailto|fonts|listsIds|endOffset|br2|listType|setAfterOrBefore|filter||slice|regexB|listTag|linkSize|iframeEnd|convertImageLinks|convertUrlLinks||iframeStart|addDropdown|showOnMobile|status|finish|getText|container||contOwnLine|ownLine|visible|documentElementRect|cleanTag|send|inactive|link_edit|setOffset|opr|setMarker|suffix|219|disableBodyScroll|isEndOfEditor|tbody|buttonsHide|hover|hotkeysShiftNums|isCurrentOrParentOne|head|thead|tfoot|readyState|221|rv|observeScroll|matched|buttonsHideOnMobile|getNodesMarker|setRequestHeader|setConfig|placeholdler|quote|rTags|H3|allowedAttrTags|allowedAttrData|finalNodes|getInlines|parentNode|H2|safari|normalize|H1|startOffset|H6|H4|H5|BODY|parseHTML|increaseBlocks|increaseLists||||createContainerBox|getTextareaName||observeScrollEnable|run|setCodeAndCall|isButtonSourceNeeded|upload_label|htmlFixMozilla|insertAfter|hideButtons|getRedo|htmlWithoutClean|hideButtonsOnMobile|aside|formatConvert|measureScrollbar|createTextarea|replaced|article|isOverflowing|setDropdownsFixed|superscript|fromTextarea|fromElement|loadEditor|unsetDropdownsFixed|subscript|formatCollapsed|formatMultiple|formatRemoveSameChildren|_this|loadContent|increaseText|observeScrollDisable|visibility|decreaseLists|strikethrough|enableEditor|||||||||||decreaseBlocks|through||switch|ie11PasteFrag|META|CTRL|ALT|SHIFT|isCurrentOrParentHeader|addArrowsEvent|align_left||checkKeyEvents|indented|elements|HR|align_center|checkEvents|setupBuffer|header5|tabKey|onTab|header3|header2|replaceDivToBreakLine|onShiftEnter|onArrowDown|altKey|formatBlockquote|header4|setupSelectAll|setForce|align_right|align_justify|setFixed|offsetNode|setUndo|duplicate|setEndPoint|toolbarFixed|setRedo|toolbarOverflow|execHtml|getUndo|setOverflow|pop|EndToEnd|ie11FixInserting|parents|enableSelectAll|stop|chrome|empty|mouseup|clientWidth|setFormattingTags|loadButtons|keydownStop|RIGHT|createContainer|blocksMatch|loadEditableControls|setInactiveInCode|setSelectionRange|walker|showVisual|anchor|saveTargetScroll||indexFromPos|setValue|saveEditorScroll|restoreFormTags|replaceDivsToBr|onSet|startSync|cleanSpaces|onChange|tempStart||tempEnd|orgo|foco|responseText|needle|lastChild|beforekey|haystack|textareaIndenting|setInactive|modified|s3createCORSRequest|s3uploadToS3|XDomainRequest|setActiveInVisual|indenting|newTag|chars|isSingleLine|onPasteIeFixLinks|onPasteRemoveSpans|Android|matchBlocks|matchBR|BlackBerry|onPasteRemoveEmpty|Object|onPasteExtra|internal|shorthandRegex|Mso|removeEmptyTags|all|||||||savePreCode|savePreFormatting|iPod|Apple|nofollow|iPhone|linkNofollow|removeDirtyStyles|getOnlyImages|pastePlainText|restoreSelectionMarker|saveCodeFormatting|bmso|onPasteWord|getPreCode|FIGCAPTION|decodeURIComponent|afterkey|sendData|dragFileUpload||moveResize|dragImageUpload|round|inside|stopResize|setEvents|setEventDrop|setFloating|update|setResizable|pageX|setEventDropUpload|startResize|fixImageSourceAfterDrop|reIsBlock|imageUploadParam|opacity|fileUploadParam|showEdit|directUpload|loadResizableControls|editerWidth|callEditor|setOptions|imageTypes|dir|getType|15px|replaceDivToParagraph|hidden|codeKeydownCallback|codeKeyupCallback|signedURL|s3executeOnSignedUrl|clearInterval|s3uploadFile|fullscreen|createTooltip|onClickCallback|overrideMimeType|removeData|onreadystatechange|that|haspopup|eventNamespace|destroy|isStartOfElement|||||setEvent|disableIeLinks|imageLink|buttonSave|setHelpers|imagePosition||floating|floatValue|buttonDelete|_delete||disableMozillaEditing|selected|onDragLeave|parseJSON|focusEnd|700|change|LEFT_WIN|getTemplate|header1|draggable|setContent|setTitle|template|Head|contrast|handle|isIe11|Color|buildOverlay|enableEvents|List|setButtonsWidth|setEnter|cancel|createDeleteButton|Left|Right|regexp|the|to|Edit|Drop|png|convertImages|here|Align|Center|Video|checkbox|Image|imageEdit|loadTemplates|newTd|choose|Code|disableEvents|destroyed|replaceBreaksToNewLines|cleanOnPaste|getInlinesTags|getLastBlock|replaceBreaksToParagraphs|restoreSafes|startContainer|lastBlock|freeze|createPasteBox|getPrev|spans|fadeOut|Function|scope|tools|anchorNode|args|startPointNode|getSafesComments|linkTooltip|savedSel|showTooltip|setEditable|scrollbar|properties|pasteHTML|replaceSelection|measure|getTooltipPosition|setNodesMarker|getSafes|setEndBefore|removeNodesMarkers|aUnlink|createMarkers|aLink|aEdit|gif|setDraggable|replaceElement|keyupStop|isNeedReplaceElement|re3|addToAllowed|setupAllowed|padding|alignElement|removeEmptyListInTable|removeInvisibleSpace|setBlocks|setText|isKey|removeTags|map|removeFromDenied|setMultiple|_moz_dirty|xn|lineAfter|fieldset|formatTags|location|callbackName|lastFound|insertInOthersBrowsers|getData|jsxhr|isExceptLastOrFirst|setFocus|setCollapsed|600|cleanUrl|lineBefore|formatEmpty|thref|success|langs|dbl|isLinebreaksOrNoBlocks|insertAfterLastElement|objects|buttonInsert|buttonText|insertNewLine|hotkeysSpecialKeys|loadModules|paragraph|insertParagraph|cleanStyleOnEnter|shortcutsAdd|exitFromBlockquote|loadOptions|bindModuleMethods|removeAttrs|textNode|stopPropagation|commonAncestorContainer|origHandler|removeAttrGetRemoves|removeParagraphsInLists|area|SPACE|arguments|nextNode|getCoords|SHOW_TEXT|hgroup|nav|details|Infinity|HEADER|FOOTER|setStartBefore|alignleft|setEndAfter|setToPoint|alignright|DD|OUTPUT|summary|DT|ins|DL|jpeg|ADDRESS|reg||aligncenter|menu|createTreeWalker|SECTION|NodeFilter|ltr|1strike|spacerun|yes|opera||No|such|docs|xml|floor|shapes|strict|sid|use|rgb|getBoundingClientRect|slevel|documentElement|WordDocument|VERSION|copy|u2026|hellip|disable|u00a9|autosaveError|u2122|trade|math|u2014|10px|sdata|converted|dash|u2010|mdash|uploadImageField|legend|setAwesome|web|video_html_code|Email|Text|Web|Embed|Youtube|Upload|File|isOldIe|Vimeo|image_web_link|None|columns|Columns|Rows|rows|delete_table|add_head|isLessIe10|Position|Title|setInterval|delete_head|download|Download|getOwnPropertyNames|youtu|optional|Name|Alignment|jpe|applet|merge|LEFT|application|UP|Underline|Open|drop_file_here|Or|or_choose|Choose|toUpperCase|Justify|Anchor|Deleted|Rule|Horizontal|compatible|toggleAttr|backcolor|changeIcon|removeIcon|Font|fontcolor|Back|Unordered|Indent|Outdent|caretOffset|Ordered|TEXTAREA|Italic|Formatting|addBefore|Unlink|HTML|ARTICLE|Normal|addAfter|Bold|addFirst|Trident|Quote|AutoUrlDetect|Cancel|toggleData|blurCallback|setData|delete_column||post|focusCallback|delete_row|cut|setAttr|1000|ajax|insert_column_right|insert_column_left|insert_table|enableObjectResizing|Save|enableInlineTableEditing|insert_row_above|isStartOfEditor|Below|done|insert_row_below|Above|ASIDE|err|move|dialog|insertHtml|cursor|guid|specified|labelledby|bull|0px|down|times|Close|host|frameset|insertedLink|createLink|deletedLink|frame|addBack|noscript|php|101|trident|102|103|removeChild|context|pagedown|TR|jQuery|relative|home|112|imageUploadError|bodyOveflow|uploadStart|fast|dragleave|cssText|removeStyle||offsetWidth||external|overlay|up||enter|clientY|clientX|removeStyleRule|toggleStyle|insertHTML|nodeToPoint|Key|fromCharCode|121|f10|addTemplate|120|106|122|f11|144|f12|123|getModal|119|107|110|115|114|111|113|createTabber|116|118|109|117|addTab|numlock|145|email|outerHeight|222|player|220|20px|allowfullscreen|_|500|281|frameborder|192|focusin|grep|188|187|186|173|189|190|modalOpened|191|104|105|modalClosed|dragover|textContent|extractContents|pageup|stripTags|backspace|withCredentials||PUT|innerText|listSelections|getValue|getObject|getEditor|_data|u200D|removePhp|uFEFF|Callback|getToolbar|isString|getBox|getElement|getTextarea|setSelection|setCursor|cleanEmptyParagraph|iPad|public|acl|read|abs|getOnlyLinksAndImages|unselectable|getHtml|cloneContents|amz|addButton|onerror|onload|setSize|refresh|onprogress|toggleActive|replaceWithHtml|syncBefore|Type|Content|Ss|fromPoint|esc|705|With|getNext|pasteBefore|fileUploadError|dropdownHide|clearImageFields|hexToRgb|capslock|Requested|fake|touchend|1500|uploadImageFields|fadeIn|touchmove|mousemove|previousSibling|POST|uploadFileFields|dragstart|addImageFields|removeImageFields|plain|GET|rowspan|defined|nextSibling|charset|namespace|hasOwnProperty|user|removeFileFields|colspan|9999px|dropdownShown|pause|clearFileFields|max|dropdownShow|addFileFields'.split('|'),0,{}))