?? index.html
字號(hào):
?<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="style.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript" src="script/prototype.js"></script>
<script type="text/javascript" src="script/menu.js"></script>
<script type="text/javascript">
/* Save as Draft Related */
var AutoDraftSavingFrequency = 30;
var DraftSavingTask = false;
/* History Menu Related */
var MAX_SELECTION = 5;
var historyMenu;
var menuOn = false;
function get_window_size() {
var winW;
var winH;
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
winW = window.innerWidth;
winH = window.innerHeight;
}
if (navigator.appName.indexOf("Microsoft")!=-1) {
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
}
return [winW, winH];
}
function show(content) {
Element.show ('ID_WIKI_BOARD');
Element.hide ('ID_WIKI_EDIT');
$('ID_WIKI_CONTENT').innerHTML = content;
}
function save_draft() {
var content = $('ID_EDIT_CONTENT').value;
if (content.length > 0) {
Element.show('ID_SAVING');
var req = new Ajax.Request('save.php',
{ method: 'post',
postBody: 'action=draft&content=' + encodeURIComponent(content),
onComplete: function() { Element.hide('ID_SAVING');}
});
}
}
function auto_save() {
if (DraftSavingTask) {
save_draft();
setTimeout (auto_save, AutoDraftSavingFrequency * 1000);
}
}
function edit(content) {
Element.show ('ID_WIKI_EDIT');
$('ID_EDIT_CONTENT').disabled = false;
Element.hide ('ID_WIKI_BOARD');
$('ID_EDIT_CONTENT').value = content;
if (!DraftSavingTask) {
setTimeout (auto_save, AutoDraftSavingFrequency * 1000);
DraftSavingTask = true;
}
}
function request_edit() {
var req = new Ajax.Request('query.php',
{method:'get',
parameters:'action=draft',
onComplete: function(r) {
if (r.responseText.length == 0)
edit ('Edit Here');
else
edit (r.responseText);
}
});
}
function preview() {
Element.hide('ID_EDIT');
Element.show('ID_CLOSE');
Element.show ('ID_WIKI_BOARD');
$('ID_WIKI_CONTENT').innerHTML = $('ID_EDIT_CONTENT').value;
}
function close_preview() {
Element.hide('ID_WIKI_BOARD');
Element.show('ID_EDIT');
Element.hide('ID_CLOSE');
}
function save() {
close_preview();
var content = $('ID_EDIT_CONTENT').value;
if (content.length > 0) {
DraftSavingTask = false;
$('ID_EDIT_CONTENT').disabled = true;
var req = new Ajax.Request('save.php',
{ method: 'post',
postBody: 'action=save&content=' + encodeURIComponent(content),
onComplete: function (r) { show(r.responseText); }
});
}
}
function choose_history(id) {
var fname = historyMenu.get_content(id);
Element.hide('ID_HISTORY');
menuOn = false;
var req = new Ajax.Request('query.php',
{ method: 'get',
parameters: 'action=file&filename=' + fname,
onComplete: function (r) {
if (r.responseText.length != 0)
$('ID_EDIT_CONTENT').value = r.responseText;
}
});
}
function history() {
if (! menuOn) {
var req = new Ajax.Request('query.php',
{ method: 'get',
parameters: 'action=history',
onComplete: function (r) {
var hist = r.responseText.split ('\n').without('\r', '\n', '');
if (hist.length == 0)
return ;
historyMenu.clear();
for (var l = 0; l < Math.min(hist.length, MAX_SELECTION); l++) {
historyMenu.add_item (hist[l]);
}
Element.show('ID_HISTORY');
menuOn = true;
historyMenu.highlight(0);
}
});
} else {
Element.hide('ID_HISTORY');
menuOn = false;
}
}
</script>
<title>Wiki Sandbox</title>
</head>
<body>
<div id="ID_TITLE">
<img src="images/title.gif"> <font size="2">Edit in place!</font>
</div>
<div style="display:none" id="ID_SAVING">Saving</div>
<div id="ID_WIKI_EDIT" style="display:none">
<textarea id="ID_EDIT_CONTENT" rows="15" cols="120">
</textarea><br>
<table border="0">
<tr><td valign="top">
[<a href="javascript: save_draft();">儲(chǔ)存草稿</a>] -
[<a href="javascript: preview();">預(yù)覽</a>] -
[<a href="javascript: save();">儲(chǔ)存</a>] -
[<a href="javascript: history();">瀏覽歷史紀(jì)錄</a>]
</td><td>
<div id="ID_HISTORY" style="display:none; width:250"></div>
</td></tr>
</table>
</div>
<div id="ID_WIKI_BOARD" style="display:none">
<div id="ID_WIKI_CONTENT"></div>
<div align="right" id="ID_EDIT">[<a href="javascript: request_edit();">編輯</a>]</div>
<div align="right" style="display:none" id="ID_CLOSE">[<a href="javascript: close_preview();">關(guān)閉</a>]</div>
</div>
<script type="text/javascript">
var a;
a = get_window_size() ;
$('ID_SAVING').style.left=a[0] - 50;
historyMenu = new Menu ('historyMenu', 'ID_HISTORY', 'choose_history', 'son', 'soff');
var req = new Ajax.Request('query.php',
{method:'get',
onComplete: function (r) {
if (r.responseText.length == 0)
request_edit();
else
show (r.responseText);
}
});
</script>
</body>
</html>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -