User:Cheng chai fung/Editor/rawData.js

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。

var request = new XMLHttpRequest();

function onloadHook()
{
	var loading = document.createElement('span');
	loading.appendChild(document.createTextNode(showText[0]));
	loading.style.color = 'green';
	document.body.appendChild(loading);
	request.onreadystatechange = statue_check;
	get_rawData();
}
function get_rawData()
{
	request.open("GET", 'http://zh.wikipedia.org/w/index.php?title=' + encodeURIComponent(mw.config.get('wgPageName')) + '&action=raw', true);
	request.send(null);
}
function editor_request_response()
{
	var content = document.createElement('pre');
	content.setAttribute('id', 'Editor_rawData');
	content.appendChild(document.createTextNode(request.responseText));
	document.body.replaceChild(content, document.body.firstChild);
}