"MDL-13766, move common functions to javascript-static.js"

This commit is contained in:
dongsheng
2009-08-16 04:14:46 +00:00
parent 7a0c240306
commit d25e2ca3f7
2 changed files with 26 additions and 6 deletions

View File

@ -1125,6 +1125,31 @@ function build_querystring(obj) {
}
return list.join('&');
}
function stripHTML(str) {
var re = /<\S[^><]*>/g;
var ret = str.replace(re, "");
return ret;
}
function json_decode(json) {
try {
var obj = YAHOO.lang.JSON.parse(json);
} catch (e) {
alert(e.toString());
}
return obj;
}
function json_encode(data) {
try {
var json = YAHOO.lang.JSON.stringify(data);
} catch (e) {
alert(e.toString());
}
return json;
}
/**
* Finds all help icons on the page and initiates YUI tooltips for
* each of them, which load a truncated version of the help's content