Seditio Source
Root |
./othercms/dle15_0/upload/engine/classes/js/bbcodes.js
var list_open_tag="",list_close_tag="",listitems="",playlist="",bbtags=[],rus_lr2="ЕеОоЁЁЁЁЖЖЧЧШШЩЩЪЬЭЭЮЮЯЯЯЯёёжчшщэюяя".split(""),lat_lr2=("/E-/e-/O-/o-ЫO-Ыo-ЙO-Йo-ЗH-Зh-ЦH-Цh-СH-Сh-ШH-Шh-ъ"+String.fromCharCode(35)+"-ь"+String.fromCharCode(39)+"-ЙE-Йe-ЙU-Йu-ЙA-Йa-ЫA-Ыa-ыo-йo-зh-цh-сh-шh-йe-йu-йa-ыa").split("-"),rus_lr1="АБВГДЕЗИЙКЛМНОПРСТУФХХЦЩЫЯабвгдезийклмнопрстуфххцщъыьья".split(""),lat_lr1=("A-B-V-G-D-E-Z-I-J-K-L-M-N-O-P-R-S-T-U-F-H-X-C-W-Y-Q-a-b-v-g-d-e-z-i-j-k-l-m-n-o-p-r-s-t-u-f-h-x-c-w-"+String.fromCharCode(35)+"-y-"+String.fromCharCode(39)+"-"+String.fromCharCode(96)+"-q").split("-");function setFieldName(t){t!=selField&&(selField=t)}function emoticon(t){doInsert(" "+t+" ","",!1)}function pagebreak(){doInsert("{PAGEBREAK}","",!1)}function simpletag(t){doInsert("["+t+"]","[/"+t+"]",!0)}function DLEimagePrompt(t,o){var e={},l="",r="";r=(r=-1!=t.indexOf("http://")||-1!=t.indexOf("https://")?(l=t,""):(l="http://",t)).replace(/'/g,"&#039;"),l=l.replace(/'/g,"&#039;"),e[dle_act_lang[3]]=function(){$(this).dialog("close")},e[dle_act_lang[2]]=function(){var t,e,l;$("#dle-promt-text").val().length<1?$("#dle-promt-text").addClass("ui-state-error"):(t=$("#dle-promt-text").val(),e=$("#dle-image-alt").val(),l=$("#dleimagealign").val(),$(this).dialog("close"),$("#dlepopup").remove(),o&&o(t,e,l))},$("#dlepopup").remove(),$("body").append("<div id='dlepopup' title='"+dle_prompt+"' style='display:none'>"+text_enter_image+"<br /><input type='text' name='dle-promt-text' id='dle-promt-text' class='ui-widget-content ui-corner-all' style='width:97%;' value='"+l+"'/><br /><br />"+text_alt_image+"<br /><input type='text' name='dle-image-alt' id='dle-image-alt' class='ui-widget-content ui-corner-all' style='width:97%;' value='"+r+"'/><br /><br />"+img_align+"&nbsp;"+img_align_sel+"</div>"),$("#dlepopup").dialog({autoOpen:!0,width:500,resizable:!1,dialogClass:"dle-popup-imageinsert",buttons:e})}function DLEurlPrompt(t,o){var e={},l="",r="";r=(r=-1!=t.indexOf("http://")||-1!=t.indexOf("https://")||-1!=t.indexOf("ftp://")?(l=t,""):(l="http://",t)).replace(/'/g,"&#039;"),l=l.replace(/'/g,"&#039;"),e[dle_act_lang[3]]=function(){$(this).dialog("close")},e[dle_act_lang[2]]=function(){var t,e,l;$("#dle-promt-url").val().length<1?$("#dle-promt-url").addClass("ui-state-error"):$("#dle-promt-title").val().length<1?$("#dle-promt-title").addClass("ui-state-error"):(t=$("#dle-promt-url").val(),e=$("#dle-promt-title").val(),l=$("#dle-promt-tooltip").val(),$(this).dialog("close"),$("#dlepopup").remove(),o&&o(t,e,l))},$("#dlepopup").remove(),$("body").append("<div id='dlepopup' title='"+dle_prompt+"' style='display:none'>"+text_enter_url+"<br /><input type='text' name='dle-promt-url' id='dle-promt-url' class='ui-widget-content ui-corner-all' style='width:97%;' value='"+l+"'/><br /><br />"+text_enter_url_name+"<br /><input type='text' name='dle-promt-title' id='dle-promt-title' class='ui-widget-content ui-corner-all' style='width:97%;' value='"+r+"'/><br /><br />"+text_enter_tooltip+"<br /><input type='text' name='dle-promt-tooltip' id='dle-promt-tooltip' class='ui-widget-content ui-corner-all' style='width:97%;' value=''/></div>"),$("#dlepopup").dialog({autoOpen:!0,width:500,resizable:!1,dialogClass:"dle-popup-urlinsert",buttons:e})}function tag_url(){var a=get_sel(eval("fombj."+selField)),a=a||"My Webpage";DLEurlPrompt(a,function(t,e,l){0<l.length&&(t=t+"|"+l),doInsert("[url="+t+"]"+e+"[/url]","",!1)})}function tag_leech(){var a=get_sel(eval("fombj."+selField)),a=a||"My Webpage";DLEurlPrompt(a,function(t,e,l){0<l.length&&(t=t+"|"+l),doInsert("[leech="+t+"]"+e+"[/leech]","",!1)})}function tag_youtube(){var a=get_sel(eval("fombj."+selField)),a=a||"http://";DLEprompt(text_enter_url,a,dle_prompt,function(t){doInsert("[media="+t+"]","",!1)})}function tag_flash(){var a=get_sel(eval("fombj."+selField)),a=a||"http://";DLEprompt(text_enter_flash,a,dle_prompt,function(e){DLEprompt(text_enter_size,"425,264",dle_prompt,function(t){doInsert("[flash="+t+"]"+e+"[/flash]","",!1)})})}function tag_list(a){list_open_tag="ol"==a?"[ol=1]\n":"[list]\n",list_close_tag="ol"==a?"[/ol]":"[/list]",listitems="",(a=get_sel(eval("fombj."+selField)))||(a=""),insert_list(a)}function insert_list(t){DLEprompt(text_enter_list,t,dle_prompt,function(t){""!=t?(listitems+="[*]"+t+"\n",insert_list("")):listitems&&doInsert(list_open_tag+listitems+list_close_tag,"",!1)},!0)}function tag_image(){var a=get_sel(eval("fombj."+selField)),a=a||"http://";DLEimagePrompt(a,function(t,e,l){e=""!=e?"|"+e:"";""!=l&&"center"!=l&&(e=l+e),""!=e&&(e="="+e),doInsert("center"==l?"[center][img"+e+"]"+t+"[/img][/center]":"[img"+e+"]"+t+"[/img]","",!1)})}function tag_video(){var a=get_sel(eval("fombj."+selField)),a=a||"http://";DLEvideoPrompt(a,function(t,e,l){""==e&&""==l||(t+="|"+e),""!=l&&(t+="|"+l),""!=t&&"http://"!=t?playlist+=t:""!=playlist&&(playlist=playlist.substring(0,playlist.length-1)),""!=playlist&&doInsert("[video="+playlist+"]","",!1),playlist=""})}function DLEvideoPrompt(t,o){var e={};urlvalue=-1!=t.indexOf("http://")||-1!=t.indexOf("https://")?t:"http://",e[dle_act_lang[3]]=function(){$(this).dialog("close")},e[button_addplaylist]=function(){var t=$("#dle-promt-url").val(),e=$("#dle-promt-poster").val(),l=$("#dle-promt-descr").val();""==e&&""==l||(t+="|"+e),""!=l&&(t+="|"+l),""!=t&&"http://"!=t&&(playlist+=t+","),$("#dle-promt-url").val("http://"),$("#dle-promt-poster").val(""),$("#dle-promt-descr").val("")},e[button_insert]=function(){var t=$("#dle-promt-url").val(),e=$("#dle-promt-poster").val(),l=$("#dle-promt-descr").val();$(this).dialog("close"),$("#dlepopup").remove(),o&&o(t,e,l)},$("#dlepopup").remove(),$("body").append("<div id='dlepopup' title='"+dle_prompt+"' style='display:none'>"+text_url_video+"<br /><input type='text' name='dle-promt-url' id='dle-promt-url' class='ui-widget-content ui-corner-all' style='width:97%;' value='"+urlvalue+"'/><br /><br />"+text_descr+"<br /><input type='text' name='dle-promt-descr' id='dle-promt-descr' class='ui-widget-content ui-corner-all' style='width:97%;' value=''/><br /><br />"+text_url_poster+"<br /><input type='text' name='dle-promt-poster' id='dle-promt-poster' class='ui-widget-content ui-corner-all' style='width:97%;' value=''/>"),$("#dlepopup").dialog({autoOpen:!0,width:500,resizable:!1,buttons:e}),$("#dle-promt-url").select().focus()}function tag_audio(){var a=get_sel(eval("fombj."+selField)),a=a||"http://";DLEaudioPrompt(a,function(t,e){""!=e&&(t+="|"+e),""!=t&&"http://"!=t?playlist+=t:""!=playlist&&(playlist=playlist.substring(0,playlist.length-1)),""!=playlist&&doInsert("[audio="+playlist+"]","",!1),playlist=""})}function DLEaudioPrompt(t,l){var e={};urlvalue=-1!=t.indexOf("http://")||-1!=t.indexOf("https://")?t:"http://",e[dle_act_lang[3]]=function(){$(this).dialog("close")},e[button_addplaylist]=function(){var t=$("#dle-promt-url").val(),e=$("#dle-promt-descr").val();""!=e&&(t+="|"+e),""!=t&&"http://"!=t&&(playlist+=t+","),$("#dle-promt-url").val("http://"),$("#dle-promt-descr").val("")},e[button_insert]=function(){var t=$("#dle-promt-url").val(),e=$("#dle-promt-descr").val();$(this).dialog("close"),$("#dlepopup").remove(),l&&l(t,e)},$("#dlepopup").remove(),$("body").append("<div id='dlepopup' title='"+dle_prompt+"' style='display:none'>"+text_url_audio+"<br /><input type='text' name='dle-promt-url' id='dle-promt-url' class='ui-widget-content ui-corner-all' style='width:97%;' value='"+urlvalue+"'/><br /><br />"+text_descr+"<br /><input type='text' name='dle-promt-descr' id='dle-promt-descr' class='ui-widget-content ui-corner-all' style='width:97%;' value=''/>"),$("#dlepopup").dialog({autoOpen:!0,width:500,resizable:!1,buttons:e}),$("#dle-promt-url").select().focus()}function tag_email(){var a=get_sel(eval("fombj."+selField)),a=a||"";DLEprompt(text_enter_email,a,dle_prompt,function(t){doInsert("[email="+t+"]"+t+"[/email]","",!1)})}function show_bb_dropdown(t){$(t).blur(function(){$(t).next().fadeOut()}),$(t).next().show().css({position:"absolute",top:0,left:0}).position({my:"left top",at:"left bottom",of:$(t),collision:"fit flip"})}function insert_header(t){doInsert("[h"+t+"]","[/h"+t+"]",!0)}function doInsert(a,d,c){var b=eval("fombj."+selField),e,h,g,l,f,g,k;return(void 0===b&&(b=eval("fombj."+$(".bb-pane").nextAll("textarea").first().attr("id"))),void 0===b)?!1:(b.focus(),null!=b.selectionEnd?(e=b.selectionStart,h=b.scrollTop,g=b.selectionEnd,l=b.value.substring(0,e),f=b.value.substring(e,g),g=b.value.substring(g,b.textLength),k=0,c?""!=d&&""==f&&(k=d.length):f="",f=a+f+d,b.value=l+f+g,a=e+f.length-k,b.selectionStart=a,b.selectionEnd=a,b.scrollTop=h):b.value+=a+d,!1)}function setColor(t){doInsert("[color="+t+"]","[/color]",!0)}function dle_smiley(t){doInsert(" "+t+" ","",!1)}function pagelink(){var a=get_sel(eval("fombj."+selField)),a=a||text_pages;DLEprompt(text_enter_page,"1",dle_prompt,function(e){DLEprompt(text_enter_page_name,a,dle_prompt,function(t){doInsert("[page="+e+"]"+t+"[/page]","",!1)})})}function translit(){var a=eval("fombj."+selField);a.value=dotranslate(a.value),a.focus()}function dotranslate(t){var e="",l=1;for(kk=0;kk<t.length;kk++){var o=t.substr(kk,1);"["!=o&&"<"!=o||(l=0),"]"!=o&&">"!=o||(l=1),o=l?transsymbtocyr(e.substr(e.length-1,1),o):e.substr(e.length-1,1)+o,e=e.substr(0,e.length-1)+o}return e}function transsymbtocyr(t,e){var l=t+e,o=e.charCodeAt(0);if(!(65<=o&&o<=123||35==o||39==o))return l;for(o=0;o<lat_lr2.length;o++)if(lat_lr2[o]==l)return rus_lr2[o];for(o=0;o<lat_lr1.length;o++)if(lat_lr1[o]==e)return t+rus_lr1[o];return l}function insert_font(t,e){0!=t&&doInsert("["+e+"="+t+"]","[/"+e+"]",!0)}function get_sel(t){if(document.selection){if((t=document.selection.createRange()).text)return t.text}else if("number"==typeof t.selectionStart&&t.selectionStart!=t.selectionEnd){var e=t.selectionStart;return t.value.substr(e,t.selectionEnd-e)}return!1}function dle_image_upload(t,e){document.getElementById(selField).focus(),$("#dle_emo").remove(),$("#cp").remove(),$("#dlepopup").remove(),media_upload(selField,t,e,"no")}function tag_typograf(){$("#"+selField).val(dletp.execute(document.getElementById(selField).value))}function emojiFromHex(t){try{if(-1<navigator.platform.indexOf("Win")&&t.match(/^1F1(E[6-9A-F]|F[0-9A-F])/))return null;var e=[],l=t.split("-");for(t=0;t<l.length;t++)e.push(parseInt(l[t],16));return String.fromCodePoint.apply(null,e)}catch(t){return null}}function get_emoji(){try{return JSON.parse(localStorage.getItem("last_emoji"))}catch(t){return null}}function set_emoji(t){try{localStorage.setItem("last_emoji",JSON.stringify(t))}catch(t){}}function in_array(t,e){for(var l=0,o=e.length;l<o;l++)if(e[l]==t)return!0;return!1}function display_last_emoji(){var t,e=get_emoji(),l="";if($.isArray(e)&&e.length){l+='<div class="emoji_category"><b>'+text_last_emoji+"</b></div>",l+='<div class="emoji_list">';for(var o=0,r=e.length;o<r;o++)(t=emojiFromHex(e[o]))&&(l+='<div class="emoji_symbol" data-emoji="'+e[o]+'"><a onclick="insert_emoji(\''+t+"', '"+e[o]+"'); return false;\">"+t+"</a></div>");l+="</div>",divs=document.getElementsByClassName("last_emoji"),$(".last_emoji").html(l)}}function insert_emoji(t,e){doInsert(""+t,"",!1);t=get_emoji();$.isArray(t)?in_array(e,t)||(15<t.length&&t.pop(),t.unshift(e)):(t=[]).push(e),set_emoji(t),display_last_emoji()}