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

📄 rte_codesweep.js

📁 极限网络智能办公系统—MYOA26—100%—源程序。
💻 JS
字号:
// removes empty tags and tags with only non-breaking-spaces unlimited levels
function removeEmptyTags(html) {
	var re = /<[^(>|\/)]+>[ |	]*<\/[^>]+>/gi;
	while(re.test(html)) {
		html = html.replace(re,"");
		while(re.test(html)) {
			html = html.replace(re,"");
		}
	}
	return html;
}

// replaceAbsoluteUrls(): replaces absolute URL's with relative urls
// assuming the editor is in a level equal-to or above the image.
function replaceAbsoluteUrls(html) {
	var docLoc = document.location.toString();
	docLoc = docLoc.substring(0,docLoc.lastIndexOf("/")+1);
	docLoc = docLoc.replace(/\//gi,"\\\/");
	var re = eval("/"+docLoc+"/gi");
	return html.replace(re, "");
}

// replaceTags(): replace tags for better formatting
// set: [[tag,replacement],[tag,replacm....
function replaceTags(set, html) {
	var re;
	for(var i = 0; i < set.length; i++) {
		re = eval("/(<[\/]{0,1})"+set[i][0]+">/gi");
		html=html.replace(re,"$1"+set[i][1]+">");
	}
	return html
}

// codeSweeper(): apply several code-modifications
function codeSweeper() {
	var html = doc.innerHTML;
	//if (html) html = replaceCharacters(html);
	if (html) html = replaceAbsoluteUrls(html);
	// if (html) html = removeEmptyTags(html)
	if (html) html = replaceTags([["strong","B"],["em","I"]],html);
	return html;
}

⌨️ 快捷键说明

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