📄 xoops.js
字号:
var domobj = xoopsGetElementById(id);
if ( text != null && text != "" ) {
var result = "[email]" + text + "[/email]";
xoopsInsertText(domobj, result);
}
domobj.focus();
}
function xoopsCodeQuote(id, enterQuotePhrase){
if (enterQuotePhrase == null) {
enterQuotePhrase = "输入要引用的文字:";
}
var selection = getSelect(id);
if (selection.length>0){
var text = prompt(enterQuotePhrase, selection);
}else {
var text = prompt(enterQuotePhrase, "");
}
var domobj = xoopsGetElementById(id);
if ( text != null && text != "" ) {
var pos = text.indexOf(unescape('%00'));
if(0 < pos){
text = text.substr(0,pos);
}
var result = "[quote]" + text + "[/quote]";
xoopsInsertText(domobj, result);
}
domobj.focus();
}
function xoopsCodeCode(id, enterCodePhrase){
if (enterCodePhrase == null) {
enterCodePhrase = "输入要添加的代码.";
}
var selection = getSelect(id);
if (selection.length>0){
var text = prompt(enterCodePhrase, selection);
}else {
var text = prompt(enterCodePhrase, "");
}
var domobj = xoopsGetElementById(id);
if ( text != null && text != "" ) {
var result = "[code]" + text + "[/code]";
xoopsInsertText(domobj, result);
}
domobj.focus();
}
function xoopsCodeText(id, hiddentext, enterTextboxPhrase){
var textareaDom = xoopsGetElementById(id);
var textDom = xoopsGetElementById(id + "Addtext");
var fontDom = xoopsGetElementById(id + "Font");
var colorDom = xoopsGetElementById(id + "Color");
var sizeDom = xoopsGetElementById(id + "Size");
var xoopsHiddenTextDomStyle = xoopsGetElementById(hiddentext).style;
var selection = getSelect(id);
if (selection.length>0){
var textDomValue = selection;
}else {
var textDomValue = textDom.value;
}
var fontDomValue = fontDom.options[fontDom.options.selectedIndex].value;
var colorDomValue = colorDom.options[colorDom.options.selectedIndex].value;
var sizeDomValue = sizeDom.options[sizeDom.options.selectedIndex].value;
if ( textDomValue == "" ) {
if (enterTextboxPhrase == null) {
enterTextboxPhrase = "Please input text into the textbox.";
}
alert(enterTextboxPhrase);
textDom.focus();
} else {
if ( fontDomValue != "FONT") {
textDomValue = "[font=" + fontDomValue + "]" + textDomValue + "[/font]";
fontDom.options[0].selected = true;
}
if ( colorDomValue != "COLOR") {
textDomValue = "[color=" + colorDomValue + "]" + textDomValue + "[/color]";
colorDom.options[0].selected = true;
}
if ( sizeDomValue != "SIZE") {
textDomValue = "[size=" + sizeDomValue + "]" + textDomValue + "[/size]";
sizeDom.options[0].selected = true;
}
if (xoopsHiddenTextDomStyle.fontWeight == "bold" || xoopsHiddenTextDomStyle.fontWeight == "700") {
textDomValue = "[b]" + textDomValue + "[/b]";
xoopsHiddenTextDomStyle.fontWeight = "normal";
}
if (xoopsHiddenTextDomStyle.fontStyle == "italic") {
textDomValue = "[i]" + textDomValue + "[/i]";
xoopsHiddenTextDomStyle.fontStyle = "normal";
}
if (xoopsHiddenTextDomStyle.textDecoration == "underline") {
textDomValue = "[u]" + textDomValue + "[/u]";
xoopsHiddenTextDomStyle.textDecoration = "none";
}
if (xoopsHiddenTextDomStyle.textDecoration == "line-through") {
textDomValue = "[d]" + textDomValue + "[/d]";
xoopsHiddenTextDomStyle.textDecoration = "none";
}
xoopsInsertText(textareaDom, textDomValue);
textDom.value = "";
xoopsHiddenTextDomStyle.color = "#000000";
xoopsHiddenTextDomStyle.fontFamily = "";
xoopsHiddenTextDomStyle.fontSize = "12px";
xoopsHiddenTextDomStyle.visibility = "hidden";
textareaDom.focus();
}
}
function xoopsValidate(subjectId, textareaId, submitId, plzCompletePhrase, msgTooLongPhrase, allowedCharPhrase, currCharPhrase) {
var maxchars = 65535;
var subjectDom = xoopsGetElementById(subjectId);
var textareaDom = xoopsGetElementById(textareaId);
var submitDom = xoopsGetElementById(submitId);
if (textareaDom.value == "" || subjectDom.value == "") {
if (plzCompletePhrase == null) {
plzCompletePhrase = "请填写标题和内容.";
}
alert(plzCompletePhrase);
return false;
}
if (maxchars != 0) {
if (textareaDom.value.length > maxchars) {
if (msgTooLongPhrase == null) {
msgTooLongPhrase = "内容太长.";
}
if (allowedCharPhrase == null) {
allowedCharPhrase = "允许的最大字符数: ";
}
if (currCharPhrase == null) {
currCharPhrase = "现有字符长度: ";
}
alert(msgTooLongPhrase + "\n\n" + allowedCharPhrase + maxchars + "\n" + currCharPhrase + textareaDom.value.length + "");
textareaDom.focus();
return false;
} else {
submitDom.disabled = true;
return true;
}
} else {
submitDom.disabled = true;
return true;
}
}
function getSelect(id){
if (window.getSelection){
ele = document.getElementById(id);
var selection = ele.value.substring(
ele.selectionStart, ele.selectionEnd
);
}
else if (document.getSelection){
var selection = document.getSelection();
}
else if (document.selection){
var selection = document.selection.createRange().text;
}
else{
var selection = null;
}
return selection;
}
function CaricaFoto(img){
foto1= new Image();
foto1.src=(img);
Controlla(img);
}
function Controlla(img){
if((foto1.width!=0)&&(foto1.height!=0)){
viewFoto(img);
}else{
funzione="Controlla('\"+img+\"')";
intervallo=setTimeout(funzione,20);
}
}
function viewFoto(img){
largh=foto1.width;
altez=foto1.height;
stringa="width="+largh+",height="+altez;
finestra=window.open('','',stringa);
finestra.document.write ("<html><body leftmargin=0 topmargin=0>");
finestra.document.write ("<a href='javascript:this.close()'><img border=0 src=");
finestra.document.write (img);
finestra.document.write ("></a></body></html>");
finestra.document.close();
return false;
}
function xoopsCodeWmp(id, enterWmpPhrase, enterWmpHeightPhrase, enterWmpWidthPhrase){
var selection = getSelect(id);
if (selection.length>0){
var text = prompt(enterWmpPhrase,selection);
}
else{
var text = prompt(enterWmpPhrase, "");
}
var domobj = xoopsGetElementById(id);
if ( text.length>0 ) {
var text2 = prompt(enterWmpWidthPhrase, "480");
var text3 = prompt(enterWmpHeightPhrase, "330");
var result = "[wmp="+text2+","+text3+"]" + text + "[/wmp]";
xoopsInsertText(domobj, result);
}
domobj.focus();
}
function xoopsCodeFlash(id, enterFlashPhrase, enterFlashHeightPhrase, enterFlashWidthPhrase){
var selection = getSelect(id);
if (selection.length>0){
var text = prompt(enterFlashPhrase,selection);
}
else{
var text = prompt(enterFlashPhrase, "");
}
var domobj = xoopsGetElementById(id);
if ( text.length>0 ) {
var text2 = prompt(enterFlashWidthPhrase, "480");
var text3 = prompt(enterFlashHeightPhrase, "330");
var result = "[swf="+text2+","+text3+"]" + text + "[/swf]";
xoopsInsertText(domobj, result);
}
domobj.focus();
}
function xoopsCodeMms(id,enterMmsPhrase, enterMmsHeightPhrase, enterMmsWidthPhrase){
var selection = getSelect(id);
if (selection.length>0){
var selection="mms://"+selection;
var text = prompt(enterMmsPhrase+" mms or http",selection);
}
else{
var text = prompt(enterMmsPhrase+" mms or http", "mms://");
}
var domobj = xoopsGetElementById(id);
if ( text.length>0 && text != "mms://") {
var text2 = prompt(enterMmsWidthPhrase, "480");
var text3 = prompt(enterMmsHeightPhrase, "330");
var result = "[mms="+text2+","+text3+"]" + text + "[/mms]";
xoopsInsertText(domobj, result);
}
domobj.focus();
}
function xoopsCodeRtsp(id,enterRtspPhrase, enterRtspHeightPhrase, enterRtspWidthPhrase){
var selection = getSelect(id);
if (selection.length>0){
var selection="rtsp://"+selection;
var text = prompt(enterRtspPhrase+" Rtsp or http",selection);
}
else{
var text = prompt(enterRtspPhrase+" Rtsp or http", "Rtsp://");
}
var domobj = xoopsGetElementById(id);
if ( text.length>0 && text!="rtsp://") {
var text2 = prompt(enterRtspWidthPhrase, "480");
var text3 = prompt(enterRtspHeightPhrase, "330");
var result = "[rtsp="+text2+","+text3+"]" + text + "[/rtsp]";
xoopsInsertText(domobj, result);
}
domobj.focus();
}
function xoopsCodeIframe(id, enterIFramePhrase, enterIFrameHeight){
var selection = getSelect(id);
if (selection.length>0){
var text = prompt(enterIFramePhrase,selection);
}else {
var text = prompt(enterIFramePhrase, "http://");
}
var dom = xoopsGetElementById(id);
if ( text.length>0 && text!="http://") {
var text2 = prompt(enterIFrameHeight, "800");
if ( text2 != null ) {
if ( text2 == "" ) {
var result = "[iframe=800]" + text + "[/iframe]";
} else {
var pos = text2.indexOf(unescape('%00'));
if(0 <= pos){
text2 = text2.substr(0,pos);
}
var result = "[iframe=" + text2 + "]" + text + "[/iframe]";
}
dom.value += result;
}
}
dom.focus();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -