?? onlineeditor.ascx
字號:
} else {
this.menuobj.style.overflowY = 'scroll';
}
}
}
this.hide = function(e) {
if(e && e.button && e.button != 1) {return true;}
this.stop_slide();
this.menuobj.style.display = 'none';
this.handle_overlaps(false);
popupmenu.activemenu = null;
}
this.slidehide = function() {
popupmenu.menus[popupmenu.activemenu].hide()
}
this.hover = function(obj, clickactive) {
if(popupmenu.activemenu != null) {
if(popupmenu.menus[popupmenu.activemenu].controlkey != this.id) {this.show(obj, true, clickactive);}
}
}
this.choose = function(e, obj) {
var links = findtags(obj, 'a');
if(links[0]) {
if(is_ie) {
links[0].click();
window.event.cancelBubble = true;
} else {
if(e.shiftKey) {
window.open(links[0].href);
e.stopPropagation();
e.preventDefault();
} else {
window.location = links[0].href;
e.stopPropagation();
e.preventDefault();
}
}
this.hide();
}
}
this.slide = function(clipX, clipY, opacity) {
if(this.direction == 'left' && (clipX < this.menuobj.offsetWidth || clipY < this.menuobj.offsetHeight)) {
if(popupmenu.open_fade && is_ie) {
opacity += 10;
this.menuobj.filters.item('DXImageTransform.Microsoft.alpha').opacity = opacity;
}
clipX += this.intervalX;
clipY += this.intervalY;
this.menuobj.style.clip = "rect(auto, " + clipX + "px, " + clipY + "px, auto)";
this.slidetimer = setTimeout("popupmenu.menus[popupmenu.activemenu].slide(" + clipX + ", " + clipY + ", " + opacity + ");", 0);
} else if(this.direction == 'right' && (clipX > 0 || clipY < this.menuobj.offsetHeight)) {
if(popupmenu.open_fade && is_ie) {
opacity += 10;
menuobj.filters.item('DXImageTransform.Microsoft.alpha').opacity = opacity;
}
clipX -= this.intervalX;
clipY += this.intervalY;
this.menuobj.style.clip = "rect(auto, " + this.menuobj.offsetWidth + "px, " + clipY + "px, " + clipX + "px)";
this.slidetimer = setTimeout("popupmenu.menus[popupmenu.activemenu].slide(" + clipX + ", " + clipY + ", " + opacity + ");", 0);
} else {this.stop_slide();}
}
this.stop_slide = function() {
clearTimeout(this.slidetimer);
this.menuobj.style.clip = 'rect(auto, auto, auto, auto)';
if(popupmenu.open_fade && is_ie) {this.menuobj.filters.item('DXImageTransform.Microsoft.alpha').opacity = 100;}
}
this.fetch_offset = function(obj) {
var left_offset = obj.offsetLeft;
var top_offset = obj.offsetTop;
while ((obj = obj.offsetParent) != null) {
left_offset += obj.offsetLeft;
top_offset += obj.offsetTop;
}
return { 'left' : left_offset, 'top' : top_offset };
}
this.overlaps = function(obj, m) {
var s = new Array();
var pos = this.fetch_offset(obj);
s['L'] = pos['left'];
s['T'] = pos['top'];
s['R'] = s['L'] + obj.offsetWidth;
s['B'] = s['T'] + obj.offsetHeight;
if(s['L'] > m['R'] || s['R'] < m['L'] || s['T'] > m['B'] || s['B'] < m['T']) {return false;}
return true;
}
this.handle_overlaps = function(dohide) {
if(is_ie) {
var selects = findtags(document, 'select');
if(dohide) {
var menuarea = new Array(); menuarea = {
'L' : this.leftpx,
'R' : this.leftpx + this.menuobj.offsetWidth,
'T' : this.toppx,
'B' : this.toppx + this.menuobj.offsetHeight
};
for(var i = 0; i < selects.length; i++) {
if(this.overlaps(selects[i], menuarea)) {
var hide = true;
var s = selects[i];
while (s = s.parentNode) {
if(s.className == 'popupmenu_popup') {
hide = false;
break;
}
}
if(hide) {
selects[i].style.visibility = 'hidden';
arraypush(popupmenu.hidden_selects, i);
}
}
}
} else {
while (true) {
var i = arraypop(popupmenu.hidden_selects);
if(typeof i == 'undefined' || i == null) break;
else selects[i].style.visibility = 'visible';
}
}
}
}
}
function doane(eventobj) {
if(!eventobj || is_ie) {
window.event.returnValue = false;
window.event.cancelBubble = true;
return window.event;
} else {
eventobj.stopPropagation();
eventobj.preventDefault();
return eventobj;
}
}
function ebygum(eventobj) {
if(!eventobj || is_ie) {
window.event.cancelBubble = true;
return window.event;
} else {
if(eventobj.target.type == 'submit') eventobj.target.form.submit();
eventobj.stopPropagation();
return eventobj;
}
}
function menuregister(clickactive, controlid, noimage, datefield) {
if(typeof popupmenu == 'object') {
popupmenu.register(clickactive, controlid, noimage);
}
}
function menuhide() {
if(popupmenu.activemenu != null) {
popupmenu.menus[popupmenu.activemenu].slidehide();
}
}
if(typeof popupmenu == 'object') {
if(window.attachEvent && !is_saf) {
document.attachEvent('onclick', popupmenu_hide);
window.attachEvent('onresize', popupmenu_hide);
} else if(document.addEventListener && !is_saf) {
document.addEventListener('click', popupmenu_hide, false);
window.addEventListener('resize', popupmenu_hide, false);
} else {
window.onclick = popupmenu_hide;
window.onresize = popupmenu_hide;
}
popupmenu.activate(true);
}
</script>
<script type="text/javascript">
/******************************************************************************
Crossday Discuz! Board - Editor Modules for Discuz!
Copyright 2001-2006 Comsenz Inc. (http://www.comsenz.com)
*******************************************************************************/
var PHP = new phpEmulator();
function ctrlAjax(status) {
wysiwyg = parseInt($('posteditor_mode').value);
bbcodemode = $('tagmode0');
wysiwygmode = $('tagmode1');
preview = $('previewbutton');
if(bbcodemode) {
bbcodemode.disabled = status == 'disabled' || !allowswitcheditor || !wysiwyg ? true : false;
}
if(wysiwygmode) {
wysiwygmode.disabled = status == 'disabled' || !allowswitcheditor || wysiwyg ? true : false;
}
preview.disabled = status == 'disabled' ? true : false;
}
function previewpost(editorid){
objfrm = $("title").form;
if(!validate(objfrm, true)) {
objfrm.title.focus();
return;
}
ctrlAjax('disabled');
$("previewmessage").innerHTML = bbinsert && $(editorid + '_mode').value == 1 ? bbcode2html(html2bbcode(Editor[editorid].getEditorContents())) : bbcode2html(objfrm.message.value);
$("previewtable").style.display = '';
window.scroll(0, 0);
ctrlAjax('enabled');
}
function wysiwygEditor(editorid, mode, parsesmilies, initialtext) {
var sizeoptions = new Array(1, 2, 3, 4, 5, 6, 7);
if(undefined(istyles)) {
var istyles = new Array();
istyles = {"pi_button_down" : [ "#98B5E2", "#000000", "0px", "1px solid #316AC5" ], "pi_button_hover" : [ "#C1D2EE", "#000000", "0px", "1px solid #316AC5" ], "pi_button_normal" : [ "#f5fbff", "#000000", "1px", "none" ], "pi_button_selected" : [ "#F1F6F8", "#000000", "0px", "1px solid #316AC5" ], "pi_menu_down" : [ "#98B5E2", "#316AC5", "0px", "1px solid #316AC5" ], "pi_menu_hover" : [ "#C1D2EE", "#316AC5", "0px", "1px solid #316AC5" ], "pi_menu_normal" : [ "#FFFFFF", "#000000", "0px", "1px solid #FFFFFF" ], "pi_popup_down" : [ "#98B5E2", "#000000", "0px", "1px solid #316AC5" ]};
}
var contextcontrols = new Array('bold', 'italic', 'underline', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist');
var coloroptions = new Array();
coloroptions = {'#000000' : 'Black', '#a0522d' : 'Sienna', '#556b2f' : 'DarkOliveGreen', '#006400' : 'DarkGreen', '#483d8b' : 'DarkSlateBlue', '#000080' : 'Navy', '#4b0082' : 'Indigo', '#2f4f4f' : 'DarkSlateGray', '#8b0000' : 'DarkRed', '#ff8c00' : 'DarkOrange', '#808000' : 'Olive', '#008000' : 'Green', '#008080' : 'Teal', '#0000ff' : 'Blue', '#708090' : 'SlateGray', '#696969' : 'DimGray', '#ff0000' : 'Red', '#f4a460' : 'SandyBrown', '#9acd32' : 'YellowGreen', '#2e8b57' : 'SeaGreen', '#48d1cc' : 'MediumTurquoise', '#4169e1' : 'RoyalBlue', '#800080' : 'Purple', '#808080' : 'Gray', '#ff00ff' : 'Magenta', '#ffa500' : 'Orange', '#ffff00' : 'Yellow', '#00ff00' : 'Lime', '#00ffff' : 'Cyan', '#00bfff' : 'DeepSkyBlue', '#9932cc' : 'DarkOrchid', '#c0c0c0' : 'Silver', '#ffc0cb' : 'Pink', '#f5deb3' : 'Wheat', '#fffacd' : 'LemonChiffon', '#98fb98' : 'PaleGreen', '#afeeee' : 'PaleTurquoise', '#add8e6' : 'LightBlue', '#dda0dd' : 'Plum', '#ffffff' : 'White'};
var EVENT = new wysiwygEditorEvents();
var history = new History();
var textobj = $(editorid + '_textarea');
var controlbar = $(editorid + '_controls');
var fontstate = null;
var sizestate = null;
var eButtons = new Array();
var ePopups = new Array();
var wysiwyg = parseInt(mode) ? 1 : 0;
bbcodemode = $('tagmode0');
wysiwygmode = $('tagmode1');
//alert(allowswitcheditor);
bbcodemode.disabled = wysiwyg ? false : true;
wysiwygmode.disabled = wysiwyg ? true : false;
if(!allowswitcheditor && wysiwyg) {
bbcodemode.disabled = true;
} else if((!allowswitcheditor && !wysiwyg) || (is_opera && opera.version() < 9)) {
wysiwyg = 0;
wysiwygmode.disabled = true;
}
$(editorid + '_cmd_table').style.display = wysiwyg ? '' : 'none';
if(wysiwyg) {
bbcodemode.className = "tagNoSelect";
wysiwygmode.className = "tagSelected";
initialtext = initialtext;
} else {
bbcodemode.className = "tagSelected";
wysiwygmode.className = "tagNoSelect";
}
//轉換按鈕0
bbcodemode.onmouseover=function(){
if(this.className!="tagSelected"){
this.className="tagHover";
}
};
bbcodemode.onmouseout=function(){
if(this.className!="tagSelected"){
this.className="tagNoSelect";
}
};
//轉換按鈕1
wysiwygmode.onmouseover=function(){
if(this.className!="tagSelected"){
this.className="tagHover";
}
};
wysiwygmode.onmouseout=function(){
if(this.className!="tagSelected"){
this.className="tagNoSelect";
}
};
this.textobj = textobj;
this.popups = ePopups;
this.wysiwyg = wysiwyg;
this.initialized = false;
this.parsesmilies = undefined(parsesmilies) || parseInt(parsesmilies) ? 1 : 0;
this.init = function() {
if(this.initialized) {
return;
}
textobj.disabled = false;
this.setEditorContents(initialtext);
this.setEditorEvents();
this.initControls();
this.initSmilies($(editorid + '_smiliebox'));
this.initialized = true;
};
this.checkFocus = function() {
if(!this.editwin.hasfocus) {
this.editwin.focus();
}
}
this.initControls = function() {
if(controlbar == null) {
return;
}
var controls = new Array();
var buttons = findtags(controlbar, 'div');
buttonslength = buttons.length;
for(var i = 0; i < buttonslength; i++) {
if(buttons[i].className == 'editor_imagebutton' && buttons[i].id) {
controls[controls.length] = buttons[i].id;
}
}
controlslength = controls.length;
for(var i = 0; i < controlslength; i++) {
var control = $(controls[i]);
if(control.id.indexOf(editorid + '_cmd_') != -1) {
this.initCommandButton(control);
} else if(control.id.indexOf(editorid + '_popup_') != -1) {
this.initPopupButton(control);
}
}
setUnselectable(controlbar);
};
this.initSmilies = function(smilie_container) {
if(smilie_container != null) {
var smilies = findtags(smilie_container, 'img');
smilieslength = smilies.length;
for(var i = 0; i < smilieslength; i++) {
if(smilies[i].id && smilies[i].id.indexOf('_smilie_') != false) {
smilies[i].style.cursor = is_ie ? 'hand' : 'pointer';
smilies[i].editorid = editorid;
smilies[i].onclick = EVENT.smilie_onclick;
smilies[i].unselectable = 'on';
}
}
}
}
this.initCommandButton = function(obj) {
obj.cmd = obj.id.substr(obj.id.indexOf('_cmd_') + 5);
obj.editorid = editorid;
eButtons[obj.cmd] = obj;
obj.state = false;
obj.mode = 'normal';
obj.onclick = obj.onmousedown = obj.onmouseover = obj.onmouseout = EVENT.command_button_onmouseevent;
}
this.initPopupButton = function(obj) {
obj.cmd = obj.id.substr(obj.id.indexOf('_popup_') + 7);
popupmenu.register(true, obj.id);
popupmenu.menus[obj.id].open_steps = 5;
obj.editorid = editorid;
obj.state = false;
eButtons[obj.cmd] = obj;
if(obj.cmd == 'fontname') {
this.fontout = $(editorid + '_font_out');
this.fontout.innerHTML = obj.title;
this.fontoptions = {'' : this.fontout};
for(var option in fontoptions) {
var div = document.createElement('div');
div.style.width = this.fontout.style.width;
div.style.display = 'none';
div.innerHTML = fontoptions[option];
this.fontoptions[fontoptions[option]] = this.fontout.parentNode.appendChild(div);
}
} else if(obj.cmd == 'fontsize') {
this.sizeout = $(editorid + '_size_out');
this.sizeout.innerHTML = obj.title;
this.sizeoptions = {'' : this.sizeout};
for(var option in sizeoptions) {
var div = document.createElement('div');
div.style.width = this.sizeout.style.width;
div.style.display = 'none';
div.innerHTML = sizeoptions[option];
this.sizeoptions[sizeoptions[option]] = this.sizeout.parentNode.appendChild(div);
}
}
obj._onmouseover = obj.onmouseover;
obj._onclick = obj.onclick;
obj.onmouseover = obj.onmouseout = obj.onclick = EVENT.popup_button_onmouseevent;
popupmenu.menus[obj.id]._show = popupmenu.menus[obj.id].show;
popupmenu.menus[obj.id].show = EVENT.popup_button_show;
}
this.initPopupMenu = function(obj) {
switch(obj.cmd) {
case 'fontname':
var menu = this.initMenuContainer('fontname', '200px', fontoptions.length > 10 ? '220px' : 'auto', 'auto');
this.buildFontnamePopup(obj, menu);
break;
case 'fontsize':
var menu = this.initMenuContainer('fontsize', 'auto', 'auto', 'visible');
this.buildFontsizePopup(obj, menu);
break;
case 'forecolor':
var menu = this.initMenuContainer('forecolor', 'auto', 'auto', 'visible');
this.buildForecolorPopup(obj, menu);
break;
}
ePopups[obj.cmd] = controlbar.appendChild(menu);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -