⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xml_topic.js

📁 采用verilogHDL编写的I2C接口及SPI接口模块
💻 JS
字号:
var smf_topic, smf_start, smf_show_modify, quickReplyCollapsed, buff_message;var cur_msg_id, cur_msg_div, buff_subject, cur_subject_div, in_edit_mode = 0;function doQuote(messageid, cur_session_id){	if (quickReplyCollapsed)		window.location.href = smf_scripturl + "?action=post;quote=" + messageid + ";topic=" + smf_topic + "." + smf_start + ";sesc=" + cur_session_id;	else	{		if (window.XMLHttpRequest)			getXMLDocument(smf_scripturl + "?action=quotefast;quote=" + messageid + ";sesc=" + cur_session_id + ";xml", onDocReceived);		else			reqWin(smf_script_url + "?action=quotefast;quote=" + messageid + ";sesc=" + cur_session_id, 240, 90);		if (navigator.appName == "Microsoft Internet Explorer")			window.location.hash = "quickreply";		else			window.location.hash = "#quickreply";	}}function onDocReceived(XMLDoc){	var text = "";	for (var i = 0; i < XMLDoc.getElementsByTagName("quote")[0].childNodes.length; i++)		text += XMLDoc.getElementsByTagName("quote")[0].childNodes[i].nodeValue;	replaceText(text, document.forms.postmodify.message);}function modify_msg(msg_id, cur_session_id){	if (!window.XMLHttpRequest)		return;	if (typeof(window.opera) != "undefined")	{		var test = new XMLHttpRequest();		if (typeof(test.setRequestHeader) != "function")			return;	}	if (in_edit_mode == 1)		modify_cancel();	in_edit_mode = 1;	getXMLDocument(smf_scripturl + '?action=quotefast;quote=' + msg_id + ';sesc=' + cur_session_id + ';modify;xml', onDocReceived_modify);}function onDocReceived_modify(XMLDoc){	var text = ""; 	// Grab the message ID.	cur_msg_id = XMLDoc.getElementsByTagName("message")[0].getAttribute("id");	// Replace the body part.	for (var i = 0; i < XMLDoc.getElementsByTagName("message")[0].childNodes.length; i++)		text += XMLDoc.getElementsByTagName("message")[0].childNodes[i].nodeValue;	cur_msg_div = document.getElementById(cur_msg_id);	buff_message = getInnerHTML(cur_msg_div);	setInnerHTML(cur_msg_div, smf_template_body_edit.replace(/%body%/, text).replace(/%msg_id%/, cur_msg_id.substr(4)));		// Replace the subject part.	cur_subject_div = document.getElementById('subject_' + cur_msg_id.substr(4));	buff_subject = getInnerHTML(cur_subject_div);	setInnerHTML(cur_subject_div, smf_template_subject_edit.replace(/%subject%/, XMLDoc.getElementsByTagName("subject")[0].childNodes[0].nodeValue));}function modify_cancel(){	// Roll back the HTML to its original state.	setInnerHTML(cur_msg_div, buff_message);	setInnerHTML(cur_subject_div, buff_subject);	// No longer in edit mode, that's right.	in_edit_mode = 0;	return false;}function modify_save(cur_session_id){	if (!in_edit_mode)		return true;	var i, x = new Array();	x[x.length] = 'subject=' + escape(textToEntities(document.forms.quickModForm['subject'].value)).replace(/\+/g, "%2B");	x[x.length] = 'message=' + escape(textToEntities(document.forms.quickModForm['message'].value)).replace(/\+/g, "%2B");	x[x.length] = 'topic=' + parseInt(document.forms.quickModForm.elements['topic'].value);	x[x.length] = 'msg=' + parseInt(document.forms.quickModForm.elements['msg'].value);	sendXMLDocument(smf_scripturl + "?action=jsmodify;topic=" + smf_topic + ";sesc=" + cur_session_id + ";xml", x.join("&"), modify_done);	return false;}function modify_done(XMLDoc){	if (!XMLDoc)	{		modify_cancel();		return;	}	var message = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("message")[0];	var body = message.getElementsByTagName("body")[0];	var error = message.getElementsByTagName("error")[0];	if (body)	{		// Show new body.		var bodyText = "";		for (i = 0; i < body.childNodes.length; i++)			bodyText += body.childNodes[i].nodeValue;		bodyText = smf_template_body_normal.replace(/%body%/, bodyText);		setInnerHTML(cur_msg_div, bodyText);		buff_message = bodyText;		// Show new subject.		var subject = message.getElementsByTagName("subject")[0];		var subject_html = smf_template_subject_normal.replace(/%msg_id%/, cur_msg_id.substr(4)).replace(/%subject%/, subject.childNodes[0].nodeValue);		setInnerHTML(cur_subject_div, subject_html);		buff_subject = subject_html;				// If this is the first message, also update the topic subject.		if (subject.getAttribute("is_first") == 1)			setInnerHTML(document.getElementById("top_subject"), smf_template_top_subject.replace(/%subject%/, subject.childNodes[0].nodeValue));		// Show this message as "modified on x by y".		if (smf_show_modify)		{			var cur_modify_div = document.getElementById('modified_' + cur_msg_id.substr(4));			setInnerHTML(cur_modify_div, message.getElementsByTagName("modified")[0].childNodes[0].nodeValue);		}	}	else if (error)	{		setInnerHTML(document.getElementById("error_box"), error.childNodes[0].nodeValue);		document.forms.quickModForm.message.style.border = error.getAttribute("in_body") == "1" ? "1px solid red" : "";		document.forms.quickModForm.subject.style.border = error.getAttribute("in_subject") == "1" ? "1px solid red" : "";	}}function showModifyButtons(){	var numImages = document.images.length;	for (var i = 0; i < numImages; i++)		if (document.images[i].id.substr(0, 14) == 'modify_button_')			document.images[i].style.display = '';}function expandThumb(thumbID){	var img = document.getElementById('thumb_' + thumbID);	var link = document.getElementById('link_' + thumbID);	var tmp = img.src;	img.src = link.href;	link.href = tmp;	img.style.width = '';	img.style.height = '';	return false;}function swapQuickReply(){	document.getElementById("quickReplyExpand").src = smf_images_url + "/" + (quickReplyCollapsed ? "collapse.gif" : "expand.gif");	document.getElementById("quickReplyOptions").style.display = quickReplyCollapsed ? "" : "none";	quickReplyCollapsed = !quickReplyCollapsed;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -