"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
+25
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
+1 -6
View File
@@ -971,11 +971,6 @@ repository_client.postdata = function(obj) {
return str;
}
repository_client.stripHTML = function(str){
var re= /<\S[^><]*>/g
var ret = str.replace(re, "")
return ret;
}
repository_client.popup = function(client_id, url) {
window.open(url,'repo_auth', 'location=0,status=0,scrollbars=0,width=500,height=300');
cached_client_id = client_id;
@@ -1121,7 +1116,7 @@ repository_client.parse_json = function(txt, source) {
try {
var ret = YAHOO.lang.JSON.parse(txt);
} catch(e) {
alert(fp_lang.invalidjson+' - |'+source+'| -'+this.stripHTML(txt));
alert(fp_lang.invalidjson+' - |'+source+'| -'+stripHTML(txt));
}
return ret;
}