?? onlineeditor.ascx
字號:
?<%@ Control Language="c#" AutoEventWireup="false" Codebehind="OnlineEditor.ascx.cs" Inherits="Discuz.admin.UserControls.OnlineEditor" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<%@ Register TagPrefix="cc1" Namespace="Discuz.Admin.Controls" Assembly="Discuz.Controls" %>
<link href="../../templates/default/dnt.css" rel="stylesheet" type="text/css" id="css" >
<style>
.editor
{
background-color: transparent;
padding: 0px
}
.edittable
{
border-right: #999999 1px double;
border-top: #999999 0px;
border-left: #999999 1px double;
border-bottom: #999999 1px double;
background-color: white;
}
</style>
<script language="JavaScript">
var sPop = null;
var postSubmited = false;
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = (userAgent.indexOf('opera') != -1);
var is_saf = ((userAgent.indexOf('applewebkit') != -1) || (navigator.vendor == 'Apple Computer, Inc.'));
var is_webtv = (userAgent.indexOf('webtv') != -1);
var is_ie = ((userAgent.indexOf('msie') != -1) && (!is_opera) && (!is_saf) && (!is_webtv));
var is_ie4 = ((is_ie) && (userAgent.indexOf('msie 4.') != -1));
var is_moz = ((navigator.product == 'Gecko') && (!is_saf));
var is_kon = (userAgent.indexOf('konqueror') != -1);
var is_ns = ((userAgent.indexOf('compatible') == -1) && (userAgent.indexOf('mozilla') != -1) && (!is_opera) && (!is_webtv) && (!is_saf));
var is_ns4 = ((is_ns) && (parseInt(navigator.appVersion) == 4));
var is_mac = (userAgent.indexOf('mac') != -1);
function fetchCheckbox(cbn) {
return $(cbn) && $(cbn).checked==true ? 1 : 0;
}
function ctlent(event,objfrm) {
if(postSubmited == false && (event.ctrlKey && event.keyCode == 13) || (event.altKey && event.keyCode == 83)) {
if (objfrm){
if (validate(objfrm))
objfrm.submit();
}
else{
objfrm = $("title").form;
if (objfrm){
if (validate(objfrm)){
objfrm.submit();
}
}
}
}
}
function storeCaret(textEl){
if(textEl.createTextRange){
textEl.caretPos = document.selection.createRange().duplicate();
}
}
function findobj(n, d) {
var p, i, x;
if(!d) d = document;
if((p = n.indexOf("?"))>0 && parent.frames.length) {
d = parent.frames[n.substring(p + 1)].document;
n = n.substring(0, p);
}
if(x != d[n] && d.all) x = d.all[n];
for(i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
for(i = 0; !x && d.layers && i < d.layers.length; i++) x = findobj(n, d.layers[i].document);
if(!x && document.getElementById) x = document.getElementById(n);
return x;
}
function arraypop(a) {
if(typeof a != 'object' || !a.length) {return null;}
else {
var response = a[a.length - 1];
a.length--;
return response;
}
}
function arraypush(a, value)
{
a[a.length] = value;
return a.length;
}
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 findtags(parentobj, tag) {
if(typeof parentobj.getElementsByTagName != 'undefined') {return parentobj.getElementsByTagName(tag);}
else if(parentobj.all && parentobj.all.tags) {return parentobj.all.tags(tag);}
else {return null;}
}
function copycode(obj) {
var rng = document.body.createTextRange();
rng.moveToElementText(obj);
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}
function toggle_collapse(objname) {
obj = findobj(objname);
img = findobj(objname+"_img");
//collapsed = getcookie("discuz_collapse");
//cookie_start = collapsed ? collapsed.indexOf(objname) : -1;
//cookie_end = cookie_start + objname.length + 1;
if(obj.style.display == "none") {
obj.style.display = "";
img_re = new RegExp("_yes\\.gif$");
img.src = img.src.replace(img_re, '_no.gif');
//if(cookie_start != -1) collapsed = collapsed.substring(0, cookie_start) + collapsed.substring(cookie_end, collapsed.length);
} else {
obj.style.display = "none";
img_re = new RegExp("_no\\.gif$");
img.src = img.src.replace(img_re, '_yes.gif');
//if(cookie_start == -1) collapsed = collapsed + objname + " ";
}
//expires = new Date();
//expires.setTime(expires.getTime() + (collapsed ? 86400 * 30 : -(86400 * 30 * 1000)));
//document.cookie = "discuz_collapse=" + escape(collapsed) + "; expires=" + expires.toGMTString() + "; path=/";
}
function imgzoom(o) {
if(event.ctrlKey) {
var zoom = parseInt(o.style.zoom, 10) || 100;
zoom -= event.wheelDelta / 12;
if(zoom > 0) {
o.style.zoom = zoom + '%';
}
return false;
} else {
return true;
}
}
function getcookie(name) {
var cookie_start = document.cookie.indexOf(name);
var cookie_end = document.cookie.indexOf(";", cookie_start);
return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end > cookie_start ? cookie_end : document.cookie.length)));
}
function AddText(txt) {
obj = $("title").form;;
selection = document.selection;
setfocus();
if(typeof(obj.selectionStart) != 'undefined') {
var opn = obj.selectionStart + 0;
obj.value = obj.value.substr(0, obj.selectionStart) + txt + obj.value.substr(obj.selectionEnd);
} else if(selection && selection.createRange) {
var sel = selection.createRange();
sel.text = txt;
sel.moveStart('character', -mb_strlen(txt));
} else {
obj.value += txt;
}
}
function insertAtCaret (textEl, text){
if(textEl.createTextRange && textEl.caretPos){
var caretPos = textEl.caretPos;
caretPos.text += caretPos.text.charAt(caretPos.text.length - 2) == ' ' ? text + ' ' : text;
} else if(textEl) {
textEl.value += text;
} else {
textEl.value = text;
}
}
function setfocus() {
objfrm = $("title").form;
objfrm.message.focus();
}
function mb_strlen(str) {
return (is_ie && str.indexOf('\n') != -1) ? str.replace(/\r?\n/g, '_').length : str.length;
}
function $(id) {
return document.getElementById(id);
}
function Trim(str){
if (str){
return (str.replace(/(\s+)$/g, '')).replace(/^\s+/g, '');
}
return "";
}
function RTrim(str){
str="|" + str;
str=Trim(str);
return str.substr(1);
}
if(typeof editor_id == 'undefined') {
var editor_id = 0;
}
if(typeof bbinsert == 'undefined') {
var bbinsert = 1;
}
if(typeof smileyinsert == 'undefined') {
var smileyinsert = 0;
}
function smiliewindow_onunload(e) {
if(typeof smilie_window != 'undefined' && !smilie_window.closed) {
smilie_window.close();
}
}
function open_smilie_window(width, height) {
smilie_window = window.open('showsmilies.aspx?editid=' + editor_id, 'Popup', 'width=200,height=500,resizable=yes,scrollbars=yes');
window.onunload = smiliewindow_onunload;
}
function smiley_insert() {
if(smileyinsert) {
showsmilies();
var smilie_container = findobj(editor_id + '_smiliebox');
if(smilie_container != null) {
var smilies = findtags(smilie_container, 'img');
for(var i = 0; i < smilies.length; i++) {
if(smilies[i].id && smilies[i].id.indexOf('_smilie_') != false) {
smilies[i].style.cursor = is_ie ? 'hand' : 'pointer';
smilies[i].onclick = function() {AddText(this.pop ? this.pop : this.alt);};
}
}
}
var smilie_container2 = findobj('smilietable');
if(smilie_container2 != null) {
var smilies = findtags(smilie_container2, 'img');
for(var i = 0; i < smilies.length; i++) {
if(smilies[i].id && smilies[i].id.indexOf('_smilie_') != false) {
smilies[i].style.cursor = is_ie ? 'hand' : 'pointer';
smilies[i].onclick = function() {
opener.document.form1.message.value += this.pop ? this.pop : this.alt;
};
}
}
}
}
}
function showsmilies(){
var row=null;
var col=null;
var img=null;
var rowIndex=0;
var colIndex=0;
if(undefined(smiliesIsCreate)) {
var smiliesIsCreate = 0;
}
if(undefined(showsmiliestitle)) {
var showsmiliestitle = 1;
}
if(undefined(title)) {
var title = "";
}
if(undefined(editor_id)) {
return;
}
if (smiliesIsCreate!=0){
return;
}
try{
if (!smilies.length){
return;
}
var smilie_container = findobj(editor_id + '_smiliebox');
var smilieytable = document.createElement('table');
smilieytable.cellPadding="3";
smilieytable.cellSpacing="0";
smilieytable.width="100%";
smilieytable.border=0;
smilieytable.className="altbg1";
smilieytable.style.border="0px";
smilieytable.id=editor_id + "_smilieytable";
if (showsmiliestitle==1){
//top行
row=smilieytable.insertRow(-1);
col=row.insertCell(-1);
col.colSpan=4
col.align="center";
col.className="altbg1";
col.innerHTML="";
}
//smilies行
sCount=smilies.length;
if (sCount>smiliesCount){
sCount=smiliesCount;
}
var temp_sCount = 0
for(i=0;i<smilies.length;i++)
{
if (smilies[i]){
temp_sCount ++;
if (temp_sCount>sCount){
break;
}
if (colIndex>colCount || colIndex<1){
row=smilieytable.insertRow(-1);
colIndex=1;
}
col=row.insertCell(-1);
col.vAlign="top";
img=document.createElement('img');
img.src="editor/images/smilies/" + smilies[i][2];
img.alt=smilies[i][1];
img.id=editor_id + "_smilie_" + smilies[i][0];
img.border=0;
col.appendChild(img);
colIndex++;
}
}
for (i=colIndex;i<colCount;i++)
{
if (row!=null){
col=row.insertCell(-1);
col.vAlign="top";
col.innerHTML=" ";
}
}
//bottom行
row=smilieytable.insertRow(-1);
col=row.insertCell(-1);
col.colSpan=4
col.align="center";
col.height=24;
var a=document.createElement('a');
a.href="#";
a.onclick=function(){open_smilie_window(200, 500); return false;};
var span=document.createElement('span');
span.className="bold";
span.innerHTML="更多表情";
a.appendChild(span);
col.appendChild(a);
smilie_container.appendChild(smilieytable);
smiliesIsCreate=1;
}
catch(e){
alert(e.message);
return;
}
}
function stripos(haystack, needle, offset) {
if(typeof offset == 'undefined') {
offset = 0;
}
index = haystack.toLowerCase().indexOf(needle.toLowerCase(), offset);
return (index == -1 ? false : index);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -