/* * Date created: 2013-12-14 07:15:11 */ /* * ATTENTION! This file is automatically created from several JavaScript files. * Find file path and name in the comments in the beginning of the each code block */ /* * FILE START: _shared/code/js/front_editor.js */ /** * @param {object} oDictionary Object containing properties as keys and its values as captions * @return void * * @copyright Amiro.CMS. All rights reserved. Changes are not allowed. */ function amiDictionary(oDictionary){ /** * @var {object} */ this.oDictionary = typeof(oDictionary) == 'object' ? oDictionary : {}; /** * Set single caption * * @param {string} key * @param {string} caption * @return void */ this.set = function(key, caption){ this.oDictionary[key] = caption; } /** * Append only new captions to dictionary * * @param {object} oDictionary Object containing properties as keys and its values as captions * @return void */ this.append = function(oDictionary){ for(var key in oDictionary){ if(typeof(this.oDictionary[key]) == 'undefined'){ this.oDictionary[key] = oDictionary[key]; } } } /** * Append new captions, override obsolete * * @param {object} oDictionary Object containing properties as keys and its values as captions * @return void */ this.megre = function(oDictionary){ for(var key in oDictionary){ this.oDictionary[key] = oDictionary[key]; } } /** * Get caption by key * * @param {string} key * @return {string} | null */ this.get = function(key){ if(typeof(this.oDictionary[key]) == 'undefined'){ if(typeof(console) == 'object' && typeof(console.warn) == 'function'){ // firebug debugging console.warn("Undefined dictionary key '" + key + "'"); // console.trace(); } return null; }else{ return this.oDictionary[key]; } } /** * Parse caption specified by key using variables * * @param {string} key * @param {object} oVariables Object containing properties as keys and its values as captions * @return {string} | null */ this.parse = function(key, oVariables){ var caption = this.get(key); if(caption){ for(var variable in oVariables){ caption = caption.replace('_' + variable + '_', oVariables[variable]); } } return caption; } } /** * Amiro.CMS text editor * * @param {string} Global variable name * @param {amiDictionary} oDictionary * * Textarea editor with pseudo codes and preview support * @version 1.0. Last changes: 25/05/2010 * @copyright Amiro.CMS. All rights reserved. Changes are not allowed. */ function amiroTEdit(varName, oDictionary){ this.isInitialized = false; this.currentMode = 'editor'; this.varName = varName; this.editorId = 'amiroTEdDivEditor'; this.idPreviewDiv = 'amiroTEdDivPreview'; this.previewButtonObj = undefined; this.editorObj = false; this.oDictionary = (oDictionary == undefined ? {} : oDictionary); this.isIE = true; this.useNoIndex = false; this.fontHeight = 15; this.regTextAreaResizeY = 0; this.editorModeCode = false; this.updatePreviewMode = ''; this.allowedImages = []; this.bAllowURLs = true; this.ceMode = false; this.aTags = { 'empty' : ['', ''], 'bold' : ['[B]', '[/B]'], 'strike' : ['[S]', '[/S]'], 'indent' : ['[INDENT]', '[/INDENT]'], 'code' : ['[CODE]', '[/CODE]'], 'italic' : ['[I]', '[/I]'], 'underlined' : ['[U]', '[/U]'], 'quote' : ['[Q]', '[Q="#\#value#\#"]', '[/Q]'], 'align:left' : ['[LEFT]', '[/LEFT]'], 'align:right' : ['[RIGHT]', '[/RIGHT]'], 'align:center' : ['[CENTER]', '[/CENTER]'], 'align:justify': ['[JUSTIFY]', '[/JUSTIFY]'], 'ulist' : ['[LIST]', '\n[/LIST]'], 'ulist_item' : ['\n[*]', ''], 'olist' : ['[OL]', '\n[/OL]'], 'olist_item' : ['\n[*]', ''], 'addlink' : ['[URL="#\#value#\#"]', '[/URL]'], 'addimg' : ['[IMG]', '[/IMG]'], 'font_family' : ['[FONT="#\#value#\#"]', '[/FONT]'], 'font_size' : ['[SIZE="#\#value#\#"]', '[/SIZE]'], 'font_color' : ['[COLOR="#\#value#\#"]', '[/COLOR]'], 'header' : ['[H#\#value#\#]', '[/H#\#value#\#]'], 'smile' : ['', ''] }; this.usedFonts = ['Times New Roman','Georgia','Arial','Arial Black','Arial Narrow','Book Antiqua','Comic Sans MS','Courier New','Lucida Concole','Tahoma','Verdana']; this.maxTextSize = 7; this.usedColors = ['Black','Sienna','DarkOliveGreen','DarkGreen','DarkSlateBlue','Navy','Indigo','DarkSlateGray','DarkRed','DarkOrange','Olive','Green','Teal','Blue','SlateGray','DimGray','Red','SandyBrown','YellowGreen','SeaGreen','MediumTurquoise','RoyalBlue','Purple','Gray','Magenta','Orange','Yellow','Lime','Cyan','DeepSkyBlue','DarkOrchid','Silver','Pink','Wheat','LemonChiffon','PaleGreen','PaleTurquoise','LightBlue','Plum','White']; this.smilesPath = 'base'; this.baseSmiles = [new Array('smile.gif', 'Smile', ':)'),new Array('laugh.gif', 'Laugh', ':D'),new Array('frown.gif', 'Frown', ':('),new Array('wink.gif', 'Wink', ';)'),new Array('blush.gif', 'Blush', ':blush:'),new Array('eek.gif', 'Eek', ':eek:'),new Array('pardon.gif', 'Pardon', ':pardon:'),new Array('cry.gif', 'Cry', ':cry:'),new Array('cool.gif', 'Cool', ':cool:'),new Array('angry.gif', 'Angry', ':angry:'),new Array('finger_up.gif', 'Thumbs up', ':finger_up:'),new Array('finger_down.gif', 'Thumbs down', ':finger_down:'),new Array('rose.gif', 'Rose', ':rose:')]; this.allSmiles = []; this.allSmilesTitles = {'': ''}; this.smilesCopyright = ''; this.baseHref = typeof(frontBaseHref) != 'undefined' ? frontBaseHref : (typeof(editorBaseHref) != 'undefined' ? editorBaseHref : ''); window.bbEditorBaseHref = this.baseHref; this.init = function(){ userAgent = navigator.userAgent.toLowerCase(); this.isIE = userAgent.indexOf('msie') != -1 && userAgent.indexOf('opera') == -1 && typeof(window.opera) == 'undefined'; if(typeof(this.oDictionary) != 'object' || this.oDictionary.length == 0){ this.oDictionary = new amiDictionary({ 'bold': 'Bold', 'italic': 'Italic', 'underline': 'Underline', 'strike': 'Strike through', 'quote': 'Quote', 'align_left': 'Align left', 'align_center': 'Align center', 'align_right': 'Align right', 'justify': 'Justify', 'insert_list': 'Insert list', 'insert_olist': 'Insert ordered list', 'insert_link': 'Insert link', 'delete_link': 'Delete link', 'insert_image': 'Insert image', 'font': 'Font', 'size': 'Size', 'header': 'Select header', 'color': 'Color', 'more': 'more', 'insert_code': 'Insert code', 'indent': 'Indent', 'outdent': 'Outdent', 'preview': 'Preview', 'hide_preview': 'Hide preview', 'update_preview': 'Update preview', 'warn_message_length': 'Message to short!', 'warn_invalid_image_url': 'Invalid image URL!', 'warn_image_url_internal_links_forbidden': 'Images from this site are forbidden!', 'warn_image_url_external_links_forbidden': 'Images from other sites are forbidden!', 'prompt_enter_list_element': 'Enter list element', 'prompt_enter_next_list_element': 'Enter list element or leave field empty to finish', 'prompt_enter_url': 'Enter URL', 'prompt_enter_image_url': 'Enter image URL', 'warn_urls_reg_only': 'Using URLs forbidden for unregistered users.' }); } for(i = 0; i < this.baseSmiles.length; i++){ this.allSmilesTitles[this.baseSmiles[i][0]] = this.baseSmiles[i][1]; } for(i = 0; i < this.allSmiles.length; i++){ this.allSmilesTitles[this.allSmiles[i][0]] = this.allSmiles[i][1]; } } this.setUseNoindex = function(noindexState){ this.useNoIndex = noindexState; } this.setFontHeight = function(fontHeight){ this.fontHeight = fontHeight; } this.procAction = function(action, subaction){ var res = false; if(this.isInitialized){ if(this._procAction(action, subaction)){ res = true; } } return res; } this.setCEMode = function(ceObj){ this.aTags = { 'empty' : ['', ''], 'bold' : ['[B]', '[/B]'], 'strike' : ['[S]', '[/S]'], 'indent' : ['[INDENT]', '[/INDENT]'], 'code' : ['[CODE]', '[/CODE]'], 'italic' : ['[I]', '[/I]'], 'underlined' : ['[U]', '[/U]'], 'quote' : ['[Q]', '[Q="#\#value#\#"]', '[/Q]'], 'align:left' : ['[LEFT="DIV"]', '[/LEFT]'], 'align:right' : ['[RIGHT="DIV"]', '[/RIGHT]'], 'align:center' : ['[CENTER="DIV"]', '[/CENTER]'], 'align:justify': ['[JUSTIFY="DIV"]', '[/JUSTIFY]'], 'ulist' : ['[LIST]', '\n[/LIST]'], 'ulist_item' : ['\n[*]', ''], 'olist' : ['[OL]', '\n[/OL]'], 'olist_item' : ['\n[*]', ''], 'addlink' : ['[URL="#\#value#\#"]', '[/URL]'], 'addimg' : ['[IMG]', '[/IMG]'], 'font_family' : ['[FONT="#\#value#\#"]', '[/FONT]'], 'font_size' : ['[SIZE="#\#value#\#"]', '[/SIZE]'], 'font_color' : ['[COLOR="#\#value#\#"]', '[/COLOR]'], 'h1' : ['[H1]', '[/H1]'], 'h2' : ['[H2]', '[/H2]'], 'h3' : ['[H3]', '[/H3]'], 'h4' : ['[H4]', '[/H4]'], 'h5' : ['[H5]', '[/H5]'], 'paragraph' : ['[P]', '[/P]'], 'div' : ['[LEFT="DIV"]', '[/LEFT]'], 'smile' : ['', ''] }; this.ceMode = true; this.ce = ceObj; } this._procAction = function(action, subaction){ var success = false; switch(action){ case 'bold': case 'italic': case 'underlined': case 'code': case 'strike': case 'indent': case 'h1': case 'h2': case 'h3': case 'h4': case 'h5': case 'paragraph': case 'div': this._boundSelectionWithTags(this.aTags[action]); success = true; break; case 'outdent': var selTxt = this._getSelectedText(); if(selTxt != '' && selTxt.indexOf('[INDENT]') != -1 && selTxt.indexOf('[/INDENT]') != -1){ selTxt = selTxt.replace(/\[INDENT\]((.|\r|\n)*?)\[\/INDENT\]/g, '$1'); this._boundSelectionWithTags(this.aTags['empty'], selTxt); success = true; } break; case 'quote': if(typeof(subaction) == "undefined"){ subaction = ""; } var selTxt = this._getSelectedText(); var tmpTags = [subaction.length == 0 ? this.aTags['quote'][0] : this.aTags['quote'][1], this.aTags['quote'][2]]; if(!this.ceMode){ subaction = subaction.replace(/<[a-zA-Z\/].*?>/g, '').replace(/^\s+/g, '').replace(/\s+$/g, ''); selTxt = selTxt.replace(/<[a-zA-Z\/].*?>/g, ''); } tmpTags[0] = tmpTags[0].replace(/#\#value#\#/g, subaction.replace(/"/g, '"')); this._boundSelectionWithTags(tmpTags, selTxt); success = true; break; case 'align': if(subaction != undefined && this.aTags['align:'+subaction]){ this._boundSelectionWithTags(this.aTags['align:'+subaction]); success = true; } break; case 'ulist': case 'olist': var selTxt = this._getSelectedText(); if(selTxt != ''){ this._procSelectionList(selTxt, action); }else{ this._boundSelectionWithTags(this.aTags[action]); var listLine = ''; listLine = prompt(this.oDictionary.get('prompt_enter_list_element'), ''); while(listLine != '' && listLine != null){ this._boundSelectionWithTags(this.aTags[action + '_item'], listLine, true); listLine = prompt(this.oDictionary.get('prompt_enter_next_list_element'), ''); } } success = true; break; case 'addlink': if(this.bAllowURLs){ urlLine = prompt(this.oDictionary.get('prompt_enter_url'), 'http://'); if(urlLine.indexOf('data:') == 0){ urlLine = ''; } if(urlLine != '' && urlLine != null){ var selTxt = this._getSelectedText(); var tmpTags = [this.aTags['addlink'][0], this.aTags['addlink'][1]]; tmpTags[0] = tmpTags[0].replace(/#\#value#\#/g, urlLine.replace(/"/g, '"')); selTxt = selTxt == '' ? urlLine : selTxt; this._boundSelectionWithTags(tmpTags, selTxt); success = true; } }else{ alert(this.oDictionary.get('warn_urls_reg_only')); } break; case 'dellink': var selTxt = this._getSelectedText(); if(selTxt != '' && selTxt.indexOf('[URL') != -1 && selTxt.indexOf('[/URL]') != -1){ selTxt = selTxt.replace(/\[URL=\".*?\"\]/g, ''); selTxt = selTxt.replace(/\[\/URL\]/g, ''); this._boundSelectionWithTags(this.aTags['empty'], selTxt); success = true; } break; case 'addimg': var urlLine = 'http://'; do { urlLine = prompt(this.oDictionary.get('prompt_enter_image_url'), urlLine); askURL = urlLine != null; if (askURL) { urlLine = urlLine.replace(/^(.*?)\?.*$/, '$1'); if (urlLine != '') { var allowedImages = this.allowedImages; var re = /^https?\:\/\/([^\/]+)(\/[^\?]*)(\?.*)?/; re.exec(urlLine); if (RegExp.$2 == '' || RegExp.$1 == '') { alert(this.oDictionary.get('warn_invalid_image_url')); } else if (allowedImages.indexOf('internal_links') < 0 && urlLine.indexOf(this.baseHref) == 0) { alert(this.oDictionary.get('warn_image_url_internal_links_forbidden')); } else if (allowedImages.indexOf('external_links') < 0 && urlLine.indexOf(this.baseHref) != 0) { alert(this.oDictionary.get('warn_image_url_external_links_forbidden')); } else { var tmpTags = [this.aTags['addimg'][0], this.aTags['addimg'][1]]; this._boundSelectionWithTags(tmpTags, urlLine); success = true; askURL = false; } } } } while (askURL); break; case 'font_family': case 'font_size': case 'header': case 'font_color': if(subaction != undefined && subaction != ''){ var tmpTags = [this.aTags[action][0], this.aTags[action][1]]; tmpTags[0] = tmpTags[0].replace(/#\#value#\#/g, subaction); tmpTags[1] = tmpTags[1].replace(/#\#value#\#/g, subaction); this._boundSelectionWithTags(tmpTags); success = true; } break; case 'br': var selTxt = this._getSelectedText() + '↵\n'; this._boundSelectionWithTags(this.aTags['empty'], selTxt, true); var value = (this.ce.hlBB) ? this.ce.highlighter.oEditor.getValue() : this.editorObj.value; if(value.match(/\[RAW\]((.|\r|\n)*)↵\n((.|\r|\n)*)\[\/RAW\]/ig)){ this.ce.placeSelectionMarks(); value = (this.ce.hlBB) ? this.ce.highlighter.oEditor.getValue() : this.editorObj.value; value = value.replace(/\[RAW\]((.|\r|\n)*?)\[\/RAW\]/ig, function(obj){ return function(allstr, code){ code = code.replace('↵\n', '\n'); return '[RAW]' + code + '[/RAW]'; } }(this)); if(this.ce.hlBB){ this.ce.highlighter.oEditor.setValue(value); }else{ this.editorObj.value = value; } this.ce.markSelection(this.editorObj); } success = true; break; case 'smile': if(subaction != undefined){ this._boundSelectionWithTags(this.aTags['smile'], subaction, true); success = true; } break; case 'smile_by_caption': if(subaction != undefined){ var found = false; var smile = ''; for(var i=0; i 0){ begin = newText.substring(0, newSelDl); } var end = ''; if(newSelDr > 0){ end = newText.substring(newSelDr-1); } this.ce.highlighter.oEditor.replaceSelection(newText, (setPointerToEnd ? "end" : "")); if(begin.length && end.length){ selStart = this.ce.highlighter.oEditor.getSelStart(); selEnd = this.ce.highlighter.oEditor.getSelEnd(); selStart.ch += newSelDl; selEnd.ch -= newSelDr; if((selEnd.line == selStart.line) && (selEnd.ch < selStart.ch)){ selEnd.ch = selStart.ch; } this.ce.highlighter.oEditor.setSelection(selStart, selEnd); } }else{ this.editorObj.focus(); if(document.selection && document.selection.createRange()){ var sRange = document.selection.createRange(); sRange.text = newText.replace(/\r?\n/g, '\r\n'); if(setPointerToEnd) sRange.moveStart('character', -newSelDr); else sRange.moveStart('character', -this._calcMultiLineTextLen(newText)+newSelDl); sRange.moveEnd('character', -newSelDr); sRange.select(); }else if(typeof(this.editorObj.selectionStart) != undefined){ var sStart = parseInt(this.editorObj.selectionStart); var sEnd = parseInt(this.editorObj.selectionEnd); var sTop = this.editorObj.scrollTop; var sText = this.editorObj.value; this.editorObj.value = sText.substr(0, sStart)+newText+sText.substr(sEnd); if(setPointerToEnd) this.editorObj.selectionStart = sStart+newText.length-newSelDr; else this.editorObj.selectionStart = sStart+newSelDl; this.editorObj.selectionEnd = sStart+newText.length-newSelDr; this.editorObj.scrollTop = sTop; } } } this.regTextAreaResize = function(clientY){ this.regTextAreaResizeY = clientY; globalATEObj = this; document.onmousemove = handleMouseMove; document.onmouseup = releaseMouseMoveHandler; return false; } this.handleMouseMove = function(clientY){ if(this.regTextAreaResizeY > 0){ var reqHeight = this.editorObj.offsetHeight-this.regTextAreaResizeY+clientY; if(reqHeight > 50){ this.editorObj.style.height = reqHeight; this.regTextAreaResizeY = clientY; } } return false; } this._HTMLSpecialChars = function(taValue){ taValue = taValue.replace(/&/g, '&'); taValue = taValue.replace(/"/g, '"'); taValue = taValue.replace(//g, '>'); return taValue; } this.raws = []; this.getHTMLContent = function(cutLongURL){ var smilesPath = this.baseHref + '_mod_files/smiles/' + this.smilesPath + '/'; var specSmiles = {";)":"wink", ":)":"smile", ":D":"laugh", ":(":"frown"}; var localUseNoIndex = this.useNoIndex; var fontHeight = this.fontHeight; taValue = this._HTMLSpecialChars(this.editorObj.value); if(this.ceMode && this.ce.useSpecialCharsFeature){ taValue = taValue.replace(/·/g, ' '); }else{ taValue = taValue.replace(/\r?\n/g, '
\r\n'); } if(this.ceMode){ taValue = taValue.replace( /\[RAW\]((?:.|\r|\n)*?)\[\/RAW\]/gi, function(obj){ return function(allstr, tagContent){ var rawIndex = obj.raws.length; tagContent = tagContent.replace(/&/g, '&'); tagContent = tagContent.replace(/"/g, '"'); tagContent = tagContent.replace(/</g, '<'); tagContent = tagContent.replace(/>/g, '>'); if(!obj.ce.useSpecialCharsFeature){ tagContent = tagContent.replace(/
/g, ''); } obj.raws.push(tagContent); return ('##__AMI_RAW_' + rawIndex + '__##'); } }(this) ); if(this.ce.useSpecialCharsFeature){ taValue = taValue.replace(/↵/g, '
'); } // Script tag taValue = taValue.replace(/\((?:.|\r|\n)*?)\<\/script>/gi, function(allstr, tagContent){ // Despecialcharsize tagContent = tagContent.replace(/&/g, '&'); tagContent = tagContent.replace(/"/g, '"'); tagContent = tagContent.replace(/</g, '<'); tagContent = tagContent.replace(/>/g, '>'); tagContent = tagContent.replace(/
/g, ''); return ''; }); } taValue = taValue.replace(/\[DIV\]/gi, '
'); taValue = taValue.replace(/\[\/DIV\]/gi, '
'); taValue = taValue.replace(/\[LEFT\]/gi, '
'); taValue = taValue.replace(/\[\/LEFT\]/gi, '
'); taValue = taValue.replace(/\[RIGHT\]/gi, '
'); taValue = taValue.replace(/\[\/RIGHT\]/gi, '
'); taValue = taValue.replace(/\[CENTER\]/gi, '
'); taValue = taValue.replace(/\[\/CENTER\]/gi, '
'); taValue = taValue.replace(/\[JUSTIFY\]/gi, '
'); taValue = taValue.replace(/\[\/JUSTIFY\]/gi, '
'); taValue = taValue.replace(/\[LEFT="DIV"\]/gi, '
'); taValue = taValue.replace(/\[RIGHT="DIV"\]/gi, '
'); taValue = taValue.replace(/\[CENTER="DIV"\]/gi, '
'); taValue = taValue.replace(/\[JUSTIFY="DIV"\]/gi, '
'); taValue = taValue.replace(/\[LEFT="P"\]((?:.|\r|\n)*?)\[\/LEFT="P"\]/gi, '

$1

'); taValue = taValue.replace(/\[RIGHT="P"\]((?:.|\r|\n)*?)\[\/RIGHT="P"\]/gi, '

$1

'); taValue = taValue.replace(/\[CENTER="P"\]((?:.|\r|\n)*?)\[\/CENTER="P"\]/gi, '

$1

'); taValue = taValue.replace(/\[JUSTIFY="P"\]((?:.|\r|\n)*?)\[\/JUSTIFY="P"\]/gi, '

$1

'); taValue = taValue.replace(/\[(\/?)(B|I|U|S|P|H\d)\]/gi, '<$1$2>'); window.amiSimpleEditorCodes = []; taValue = taValue.replace(/\[CODE\]((?:.|\r|\n)*?)\[\/CODE\]/gi, function(allstr, tagContent){ tagContent = tagContent.replace(/
/gi, ''); var nlCount = 1; var nlPos = tagContent.indexOf('\n'); while(nlPos != -1){ nlCount++; nlPos = tagContent.indexOf('\n', nlPos+1); } if(nlCount > 10) nlCount = 10; var codeKey = window.amiSimpleEditorCodes.length; window.amiSimpleEditorCodes[codeKey] = tagContent; return '
CodeId_'+codeKey+'
'; }); taValue = taValue.replace(/\[Q\]/gi, '
'); taValue = taValue.replace(/\[Q="(.*?)"\]/gi, '
$1:
'); taValue = taValue.replace(/\[(\/?)(INDENT|Q)\]/gi, '<$1BLOCKQUOTE>'); taValue = taValue.replace(/\[LIST\]/gi, '
    '); taValue = taValue.replace(/\[\/LIST\]/gi, '
'); taValue = taValue.replace(/\[UL\]/gi, '
    '); taValue = taValue.replace(/\[\/UL\]/gi, '
'); taValue = taValue.replace(/\[OL\]/gi, '
    '); taValue = taValue.replace(/\[\/OL\]/gi, '
'); taValue = taValue.replace(/\[\*\]/gi, '
  • '); taValue = taValue.replace(/\[FONT="(.*?)"\]/gi, function(allstr, fontName){return ''}); taValue = taValue.replace(/\[(COLOR|SIZE)="(.*?)"\]/gi, function(allstr, tagParam, paramValue){return ''}); taValue = taValue.replace(/\[\/(FONT|SIZE|COLOR)\]/gi, ''); var urlMaxLength = typeof(cutLongURL) == 'undefined' ? 0 : 50; if(this.ceMode){ taValue = taValue.replace(/\[URL="(.*?)"\]((?:.|\r|\n)*?)\[\/URL\]/gi, function(allstr, url, linkContent){ var curUseNoIndex = localUseNoIndex; var curUrl = _tagsParamReplace(url, false); if(curUseNoIndex && (!curUrl.match(/^https?:\/\//i) || (window.bbEditorBaseHref.length > 0 && curUrl.indexOf(window.bbEditorBaseHref) >= 0))) curUseNoIndex = false; var attributes = ''; linkContent = _trim(linkContent); var noTagsLinkContent = _trim(_stripTags(linkContent).replace(/\"/g, '"')); if ((urlMaxLength > 0) && (noTagsLinkContent.length > urlMaxLength)) { attributes = ' title="' + noTagsLinkContent + '"'; linkContent = noTagsLinkContent.substr(0, urlMaxLength - 8 - 3) + '...' + noTagsLinkContent.substr(noTagsLinkContent.length - 8); } if(curUrl.indexOf('data:') == 0){ curUrl = ''; } return (curUseNoIndex ? '' : '')+''+linkContent+''+(curUseNoIndex ? '' : ''); }); var allSmilesTitles = this.allSmilesTitles; taValue = taValue.replace(/\[IMG\](.*?)\[\/IMG\]/gi, function(allstr, url){return ''}); var specSmileReg = new RegExp(((this.ceMode) ? '[^A-Za-z\\d]?(;\\)|:\\)|:D|:\\()' : '(;\\)|:\\)|:D|:\\()'), 'g'); taValue = taValue.replace(specSmileReg, function(allstr, smile){var imgName = specSmiles[smile]+'.gif'; return ''}); taValue = taValue.replace(/\:([a-z\_]{1,20})\:/gi, function(allstr, smile){var imgName = smile+'.gif'; return ''}); taValue = taValue.replace(/((?:)|(?:))/gi, function(allstr, pTagContent){ pTagContent = pTagContent.replace(/http(s?)\:/gi, 'htBREAKtp$1:'); pTagContent = pTagContent.replace(/www/gi, 'wBREAKwBREAKw'); return pTagContent; }); taValue = taValue.replace(/((?:)|(?:))/gi, function(allstr, pTagContent){ pTagContent = pTagContent.replace(/wBREAKwBREAKw/gi, 'www'); pTagContent = pTagContent.replace(/htBREAKtp(s?):/gi, 'http$1:'); return pTagContent; }); }else{ taValue = taValue.replace(/\[URL="(.*?)"\]((?:.|\r|\n)*?)\[\/URL\]/gi, function(allstr, url, linkContent){ var curUseNoIndex = localUseNoIndex; var curUrl = _tagsParamReplace(url, false); if(curUseNoIndex && (!curUrl.match(/^https?:\/\//i) || (window.bbEditorBaseHref.length > 0 && curUrl.indexOf(window.bbEditorBaseHref) >= 0))) curUseNoIndex = false; var attributes = ''; linkContent = _trim(linkContent); var noTagsLinkContent = _trim(_stripTags(linkContent).replace(/\"/g, '"')); if ((urlMaxLength > 0) && (noTagsLinkContent.length > urlMaxLength)) { attributes = ' title="' + noTagsLinkContent + '"'; linkContent = noTagsLinkContent.substr(0, urlMaxLength - 8 - 3) + '...' + noTagsLinkContent.substr(noTagsLinkContent.length - 8); } return (curUseNoIndex ? '' : '')+''+linkContent+''+(curUseNoIndex ? '' : ''); }); var allSmilesTitles = this.allSmilesTitles; taValue = taValue.replace(/\[IMG\](.*?)\[\/IMG\]/gi, function(allstr, url){return ''}); if(this.ceMode){ taValue = taValue.replace(/(\s;\)|\s:\)|:D|:\()/g, function(allstr, smile){smile = smile.replace(' ', ''); var imgName = specSmiles[smile]+'.gif'; return ''}); }else{ taValue = taValue.replace(/(;\)|:\)|:D|:\()/g, function(allstr, smile){var imgName = specSmiles[smile]+'.gif'; return ''}); } taValue = taValue.replace(/\:([a-z\_]{1,20})\:/gi, function(allstr, smile){var imgName = smile+'.gif'; return ''}); taValue = taValue.replace(/((?:)|(?:))/gi, function(allstr, pTagContent){ pTagContent = pTagContent.replace(/http(s?)\:/gi, 'htBREAKtp$1:'); pTagContent = pTagContent.replace(/www/gi, 'wBREAKwBREAKw'); return pTagContent; }); taValue = taValue.replace(/(https?:\/\/www\.|https?:\/\/|www\.)(?:[a-z0-9\-]+\.)+[a-z]{2,8}[^ \r\n\t'"><]*/gi, function(allstr, prefx){ var curUseNoIndex = localUseNoIndex; var curUrl = _tagsParamReplace(allstr); if(prefx.toLowerCase() == 'www.'){ curUrl = 'http://' + curUrl; } if(curUseNoIndex && (!curUrl.match(/^https?:\/\//i) || (window.bbEditorBaseHref.length > 0 && curUrl.indexOf(window.bbEditorBaseHref) >= 0))) curUseNoIndex = false; return (curUseNoIndex ? '' : '')+''+allstr+''+(curUseNoIndex ? '' : ''); }); taValue = taValue.replace(/((?:)|(?:))/gi, function(allstr, pTagContent){ pTagContent = pTagContent.replace(/wBREAKwBREAKw/gi, 'www'); pTagContent = pTagContent.replace(/htBREAKtp(s?):/gi, 'http$1:'); return pTagContent; }); } taValue = taValue.replace(/(]*?>)CodeId_(\d+)(<\/PRE>)/g, function(allstr, preStart, codeId, preEnd){ var result = preStart; if(window.amiSimpleEditorCodes[codeId]){ result += window.amiSimpleEditorCodes[codeId]; } result += preEnd; return result; }); if(this.ceMode){ taValue = taValue.replace( /##__AMI_RAW_(\d+)__##/gi, function(obj){ return function(allstr, tagContent){ return obj.raws[parseInt(tagContent)]; } }(this) ); } taValue = taValue.replace(/
  • ([^\n]*?)
    ([\r\n]*?)
  • /gi, '
  • $1
  • $2
  • '); taValue = taValue.replace(/
  • ([^\n]*?)
    ([\r\n]*?)<\//gi, '
  • $1
  • $2([\r\n]*?)
  • /gi, '
  • $1
  • '); taValue = taValue.replace(/
    ([\r\n]*?)<\/OL>/gi, '
  • $1'); taValue = taValue.replace(/
    ([\r\n]*?)<\/UL>/gi, '$1'); taValue = taValue.replace(/

      /gi, '
        '); taValue = taValue.replace(/

          /gi, '
            '); taValue = taValue.replace(/<\/UL>
            /gi, '
      '); taValue = taValue.replace(/<\/OL>
      /gi, ''); taValue = taValue.replace(/<\/P>
      /gi, '

      '); taValue = taValue.replace(/<\/DIV>
      /gi, '
    '); taValue = taValue.replace(/<\/TR>
    /gi, ''); taValue = taValue.replace(/<\/TD>
    /gi, ''); taValue = taValue.replace(/<\/TBODY>
    /gi, ''); taValue = taValue.replace(/<\/TABLE>
    /gi, ''); taValue = taValue.replace(/<\/BLOCKQUOTE>
    /gi, ''); taValue = taValue.replace(/
    /gi, ''); taValue = taValue.replace(/
    /gi, ''); taValue = taValue.replace(/
    /gi, ''); taValue = taValue.replace(/
    /gi, ''); taValue = taValue.replace(/
      <\/LI>/gi, '
        '); taValue = taValue.replace(/<\/H(\d)>
        /gi, ''); taValue = taValue.replace(/
          <\/LI>/gi, '
            '); taValue = taValue.replace(/
              <\/LI>/gi, '
                '); window.amiSimpleEditorCodes = []; return taValue; } this.fromHTMLContent = function(taValue){ var smilesPath = '_mod_files/smiles/' + this.smilesPath + '/'; var specSmiles = {"wink":";)", "smile":":)", "laugh":":D", "frown":":("}; if(this.ceMode){ taValue = taValue.replace(/(##[^#]*##)/g, '[RAW]$1[/RAW]'); } if(this.ceMode && this.ce.useSpecialCharsFeature){ taValue = taValue.replace(/
                /gi, '_spec_rpl_val_br'); taValue = taValue.replace(/ /gi, '·'); }else{ taValue = taValue.replace(/<\/LI>\r?\n?/gi, '\r\n

                '); taValue = taValue.replace(/<\/OL>\r?\n?/gi, '
              \r\n

              '); taValue = taValue.replace(/<\/UL>\r?\n?/gi, '
          \r\n

          '); taValue = taValue.replace(/<\/P>\r?\n?/gi, '

          \r\n

          '); taValue = taValue.replace(/<\/DIV>\r?\n?/gi, '
    \r\n

    '); taValue = taValue.replace(/<\/H(\d)>\r?\n?/gi, '\r\n

    '); taValue = taValue.replace(/\r?\n?\r?\n?/gi, '\r\n'); } taValue = taValue.replace(/ style=""/gi, ''); taValue = taValue.replace(/ class=""/gi, ''); taValue = taValue.replace(/ target="_self"/gi, ''); if(this.ceMode){ taValue = taValue.replace(/↵/gi, '[RAW]↵[/RAW]'); } taValue = taValue.replace(/\\([rn])/gi, '[_spec_rpl_val_$1]'); taValue = taValue.replace(/\r?\n/g, '\\n'); // Replace simple elements taValue = taValue.replace(/
    /gi, '[CODE]');
            taValue = taValue.replace(/<\/PRE>/gi, '[/CODE]');
            taValue = taValue.replace(/<(\/?)(B|I|U|S|H\d)>/gi, '[$1$2]');
            taValue = taValue.replace(/