MediaWiki:LipoqualityCommon.js

From Metabolomics.JP
(Difference between revisions)
Jump to: navigation, search
(Created page with "// XSS対策用 /////////////////////////////////////////////////////////////////////////////////////////////////////////////// function escape(text) { if(isFinite(text)) r...")
 

Latest revision as of 13:54, 14 November 2017

// XSS対策用 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
function escape(text)
{
	if(isFinite(text))
		return text;
	return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
}
function attrEscape(text)
{
	if(isFinite(text))
		return text;
	return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&rsquo;");
}
function inchiEscape(text)
{
	if(isFinite(text))
		return text;
	return text.replace(/^InChIKey=/, "").replace(/[^A-Z0-9-]/g, "");
}
Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox