?? script.js
字號:
//全局變量
var AutoSaveEX;
var AutoTagsSelect;
//全局抓取
function $()
{
var elements = new Array();
for (var i = 0; i < arguments.length; i++)
{
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
//提示
function Message(sMessage, sLink)
{
if (sLink == null || sLink == "")
{
alert(sMessage);
}
else
{
alert(sMessage);
self.location.href = sLink;
}
}
//詢問
function Ask(sMessage, sLink)
{
if (confirm(sMessage))
{
self.location.href = sLink;
}
}
//返回
function Back()
{
window.history.back();
}
//跳轉
function Href(url)
{
self.location.href = url;
}
//樣式顯示狀態設置
function StyleDisplay(sID, sState)
{
document.getElementById(sID).style.display = sState;
}
//增加內容到 FCKeditor
function AddHTML(objid, content)
{
var oEditor = FCKeditorAPI.GetInstance(objid);
if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
{
oEditor.InsertHtml(content);
}
}
//取得文件的代碼
function GetFileHTML(url, caption)
{
return "<a href=\"" + url + "\">" + caption + "</a>";
}
//取得圖片的代碼
function GetImgHTML(url)
{
return "<img src=\"" + url + "\" />";
}
//全選
function SelectAll(form)
{
for (var i = 0; i < form.elements.length; i++)
{
var e = form.elements[i];
if (e.checked == "")
{
e.checked = "checked";
}
else
{
e.checked = "";
}
}
}
//信息提示部分
function MsgBoxOpen(html)
{
var oMB = document.getElementById("MsgBox");
var oIMB = document.getElementById("innerMsgBox");
oIMB.innerHTML = html;
oMB.style.display = "block";
}
function MsgBoxChange(html)
{
var oIMB = document.getElementById("innerMsgBox");
oIMB.innerHTML = html;
}
function MsgBoxClose()
{
var oMB = document.getElementById("MsgBox");
var oIMB = document.getElementById("innerMsgBox");
oMB.style.display = "none";
oIMB.innerHTML = "";
}
function MsgBoxCloseAndHref(url)
{
var oMB = document.getElementById("MsgBox");
var oIMB = document.getElementById("innerMsgBox");
oMB.style.display = "none";
oIMB.innerHTML = "";
if (url != null)
{
self.location.href = url;
}
else
{
self.location.reload();
}
}
//自動保存部分
function AutoSaveExecute()
{
var sContent = FCKeditorAPI.GetInstance("ArticleContent").EditorDocument.body.innerHTML;
var ajax = new Ajax("?Action=Handle&Job=AutoSave", 0, "Content=" + sContent, AutoSaveExecuteBacal);
ajax.post();
MsgBoxOpen("自動保存正在執行, 請稍候...");
}
function AutoSaveExecuteBacal(rexm)
{
MsgBoxChange(rexm);
document.getElementById("AutoSaveState").innerHTML = "保存狀態: " + rexm;
setTimeout("MsgBoxClose()", 2000);
setTimeout("AutoSaveStateClear()", 5000);
}
function AutoSaveStateClear()
{
document.getElementById("AutoSaveState").innerHTML = "等待下次執行... [<a onclick=\"javascript:AutoSaveClose();\">停止</a>]";
}
function AutoSaveClear()
{
if (AutoSaveEX != null)
{
clearInterval(AutoSaveEX);
}
}
function AutoSave()
{
AutoSaveClear();
AutoSaveEX = setInterval("AutoSaveExecute()", 20000); //1000ms=1s
document.getElementById("AutoSaveState").innerHTML = "自動保存已開始... [<a onclick=\"javascript:AutoSaveClose();\">停止</a>]";
}
function AutoSaveClose()
{
AutoSaveClear();
document.getElementById("AutoSaveState").innerHTML = "自動保存已停止。";
}
//標簽提示部分
function SelectTagsStart()
{
AutoTagsSelect = setInterval("SelectTagsExecute()", 1000); //1000ms=1s
}
function SelectTagsExecute()
{
var arrTag = document.getElementById("ArticleTag").value.split(",");
var thisTag = arrTag[arrTag.length - 1];
if (thisTag == "")
{
document.getElementById("ArticleTagCue").innerHTML = "等待輸入關鍵字...";
}
else
{
var ajax = new Ajax("?Action=Handle&Job=SelectTags", 0, "Tag=" + thisTag, SelectTagsBacal);
ajax.post();
}
}
function SelectTagsBacal(rexm)
{
if (rexm != "")
{
document.getElementById("ArticleTagCue").innerHTML = rexm;
}
else
{
document.getElementById("ArticleTagCue").innerHTML = "沒有值……";
}
function SelectTagsEnd()
{
if (AutoTagsSelect != null)
{
clearInterval(AutoTagsSelect);
}
}
function TagSelectInsert(tagName)
{
var tagList = document.getElementById("ArticleTag").value;
var tags = tagList.split(",");
var sTags = "";
for (var i = 0; i < (tags.length - 1); i++)
{
sTags += tags[i] + ",";
}
document.getElementById("ArticleTag").value = sTags + tagName;
}
//保存日期部分
function SetStartTime(value)
{
var ajax = new Ajax("?Action=Handle&Job=SetStartTime", 0, "Value=" + value, SetStartTimeBacal);
ajax.post();
MsgBoxOpen("正在提交數據,請稍等……");
}
function SetStartTimeBacal(rexm)
{
MsgBoxChange(rexm + "<br /><br /><input type=\"button\" value=\"確認\" class=\"cssButton\" onclick=\"javascript:MsgBoxClose();self.location.reload();\" />");
}
//設置更新源部分
function SetSource(value)
{
var ajax = new Ajax("?Action=Handle&Job=SetSource", 0, "Value=" + value, SetSourceBacal);
ajax.post();
MsgBoxOpen("正在提交數據,請稍等……");
}
function SetSourceBacal(rexm)
{
MsgBoxChange(rexm + "<br /><br /><input type=\"button\" value=\"確認\" class=\"cssButton\" onclick=\"javascript:MsgBoxClose();self.location.reload();\" />");
}
//提示框位置設置部分
/*window["onload"] = function()
{
if (document.getElementById("MsgBox"))
{
if(/safari/i.test(navigator.userAgent))
{
document.getElementById("MsgBox").style.top = document.documentElement.scrollTop + document.getElementById("MsgBox").offsetHeight / 2 + "px";
}
else
{
document.getElementById("MsgBox").style.top = document.body.scrollTop + document.getElementById("MsgBox").offsetHeight / 2 + "px";
}
}
}*/
window["onresize"] = function()
{
if (document.getElementById("MsgBox"))
{
if(/safari/i.test(navigator.userAgent))
{
document.getElementById("MsgBox").style.top = (document.body.scrollTop + 150) + "px";
}
else
{
document.getElementById("MsgBox").style.top = (document.documentElement.scrollTop + 150) + "px";
}
}
}
window["onscroll"] = function()
{
if (document.getElementById("MsgBox"))
{
if(/safari/i.test(navigator.userAgent))
{
document.getElementById("MsgBox").style.top = (document.body.scrollTop + 150) + "px";
}
else
{
document.getElementById("MsgBox").style.top = (document.documentElement.scrollTop + 150) + "px";
}
}
}
//消除自動操作
AutoSaveClear();
SelectTagsEnd();
var navHover = function()
{
var oMenu = document.getElementById("Menu");
if (oMenu)
{
var arrLi = oMenu.getElementsByTagName("li");
for (var i = 0; i < arrLi.length; i++)
{
arrLi[i].onmouseover = function()
{
this.className += " MenuIE_hover";
}
arrLi[i].onmouseout = function()
{
this.className = this.className.replace(new RegExp(" MenuIE_hover\\b"), "");
}
}
}
}
if (window.attachEvent) window.attachEvent("onload", navHover);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -