var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opener = _____WB$wombat$assign$function_____("opener");
/*
[Discuz!] (C)2001-2009 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: seditor.js 21135 2011-03-16 06:24:11Z svn_project_zhangjie $
*/
function seditor_showimgmenu(seditorkey) {
var imgurl = $(seditorkey + '_image_param_1').value;
var width = parseInt($(seditorkey + '_image_param_2').value);
var height = parseInt($(seditorkey + '_image_param_3').value);
var extparams = '';
if(width || height) {
extparams = '=' + width + ',' + height
}
seditor_insertunit(seditorkey, '[img' + extparams + ']' + imgurl, '[/img]', null, 1);
$(seditorkey + '_image_param_1').value = '';
hideMenu();
}
function seditor_menu(seditorkey, tag) {
var sel = false;
if(!isUndefined($(seditorkey + 'message').selectionStart)) {
sel = $(seditorkey + 'message').selectionEnd - $(seditorkey + 'message').selectionStart;
} else if(document.selection && document.selection.createRange) {
$(seditorkey + 'message').focus();
var sel = document.selection.createRange();
$(seditorkey + 'message').sel = sel;
sel = sel.text ? true : false;
}
if(sel) {
seditor_insertunit(seditorkey, '[' + tag + ']', '[/' + tag + ']');
return;
}
var ctrlid = seditorkey + tag;
var menuid = ctrlid + '_menu';
if(!$(menuid)) {
switch(tag) {
case 'url':
str = '���������ӵ�ַ:
' +
'
��������������:
';
submitstr = "$('" + ctrlid + "_param_2').value !== '' ? seditor_insertunit('" + seditorkey + "', '[url='+$('" + ctrlid + "_param_1').value+']'+$('" + ctrlid + "_param_2').value, '[/url]', null, 1) : seditor_insertunit('" + seditorkey + "', '[url]'+$('" + ctrlid + "_param_1').value, '[/url]', null, 1);hideMenu();";
break;
case 'code':
case 'quote':
var tagl = {'quote' : '������Ҫ���������', 'code' : '������Ҫ����Ĵ���'};
str = tagl[tag] + ':
';
submitstr = "seditor_insertunit('" + seditorkey + "', '[" + tag + "]'+$('" + ctrlid + "_param_1').value, '[/" + tag + "]', null, 1);hideMenu();";
break;
case 'img':
str = '������ͼƬ��ַ:
' +
'
��(��ѡ): ' + '��(��ѡ):
'; submitstr = "seditor_insertunit('" + seditorkey + "', '[img' + ($('" + ctrlid + "_param_2').value !== '' && $('" + ctrlid + "_param_3').value !== '' ? '='+$('" + ctrlid + "_param_2').value+','+$('" + ctrlid + "_param_3').value : '')+']'+$('" + ctrlid + "_param_1').value, '[/img]', null, 1);hideMenu();"; break; } var menu = document.createElement('div'); menu.id = menuid; menu.style.display = 'none'; menu.className = 'p_pof upf'; menu.style.width = '270px'; $('append_parent').appendChild(menu); menu.innerHTML = '�ر�'; } showMenu({'ctrlid':ctrlid,'evt':'click','duration':3,'cache':0,'drag':1}); } function seditor_insertunit(key, text, textend, moveend, selappend) { if($(key + 'message')) { $(key + 'message').focus(); } textend = isUndefined(textend) ? '' : textend; moveend = isUndefined(textend) ? 0 : moveend; selappend = isUndefined(selappend) ? 1 : selappend; startlen = strlen(text); endlen = strlen(textend); if(!isUndefined($(key + 'message').selectionStart)) { if(selappend) { var opn = $(key + 'message').selectionStart + 0; if(textend != '') { text = text + $(key + 'message').value.substring($(key + 'message').selectionStart, $(key + 'message').selectionEnd) + textend; } $(key + 'message').value = $(key + 'message').value.substr(0, $(key + 'message').selectionStart) + text + $(key + 'message').value.substr($(key + 'message').selectionEnd); if(!moveend) { $(key + 'message').selectionStart = opn + strlen(text) - endlen; $(key + 'message').selectionEnd = opn + strlen(text) - endlen; } } else { text = text + textend; $(key + 'message').value = $(key + 'message').value.substr(0, $(key + 'message').selectionStart) + text + $(key + 'message').value.substr($(key + 'message').selectionEnd); } } else if(document.selection && document.selection.createRange) { var sel = document.selection.createRange(); if(!sel.text.length && $(key + 'message').sel) { sel = $(key + 'message').sel; $(key + 'message').sel = null; } if(selappend) { if(textend != '') { text = text + sel.text + textend; } sel.text = text.replace(/\r?\n/g, '\r\n'); if(!moveend) { sel.moveStart('character', -endlen); sel.moveEnd('character', -endlen); } sel.select(); } else { sel.text = text + textend; } } else { $(key + 'message').value += text; } hideMenu(2); if(BROWSER.ie) { doane(); } } function seditor_ctlent(event, script) { if(event.ctrlKey && event.keyCode == 13 || event.altKey && event.keyCode == 83) { eval(script); } } function loadimgsize(imgurl, editor, p) { var editor = !editor ? editorid : editor; var s = new Object(); var p = !p ? '_image' : p; s.img = new Image(); s.img.src = imgurl; s.loadCheck = function () { if(s.img.complete) { $(editor + p + '_param_2').value = s.img.width ? s.img.width : ''; $(editor + p + '_param_3').value = s.img.height ? s.img.height : ''; } else { setTimeout(function () {s.loadCheck();}, 100); } }; s.loadCheck(); } }