MediaWiki:LipoqualityCommon.js: Difference between revisions
Jcblmaster (talk | contribs) (Created page with "// XSS対策用 /////////////////////////////////////////////////////////////////////////////////////////////////////////////// function escape(text) { if(isFinite(text)) r...") |
Jcblmaster (talk | contribs) No edit summary |
||
Line 17: | Line 17: | ||
return text; | return text; | ||
return text.replace(/^InChIKey=/, "").replace(/[^A-Z0-9-]/g, ""); | return text.replace(/^InChIKey=/, "").replace(/[^A-Z0-9-]/g, ""); | ||
} | |||
// 子要素を全削除 // | |||
function removeAll(id) | |||
{ | |||
parent = document.getElementById(id); | |||
while(parent.lastChild) | |||
parent.removeChild(parent.lastChild); | |||
} | } |
Latest revision as of 01:43, 23 March 2020
// XSS対策用 /////////////////////////////////////////////////////////////////////////////////////////////////////////////// function escape(text) { if(isFinite(text)) return text; return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); } function attrEscape(text) { if(isFinite(text)) return text; return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "’"); } function inchiEscape(text) { if(isFinite(text)) return text; return text.replace(/^InChIKey=/, "").replace(/[^A-Z0-9-]/g, ""); } // 子要素を全削除 // function removeAll(id) { parent = document.getElementById(id); while(parent.lastChild) parent.removeChild(parent.lastChild); }