Moved egw_seperateJavaScript to jsapi

This commit is contained in:
Andreas Stöckel 2010-06-22 14:39:27 +00:00
parent bf7b241b0c
commit 7520c468c7

View File

@ -39,6 +39,37 @@ else if (document.layers)
is_ns4 = true;
}
/**
* Seperates all script tags from the given html code and returns the seperately
* @param object _html object that the html code from which the script should be seperated. The html code has to be stored in _html.html, the result js will be written to _html.js
*/
egw_seperateJavaScript = function(_html)
{
var html = _html.html;
var in_pos = html.search(/<script/im);
var out_pos = html.search(/<\/script>/im);
while (in_pos > -1 && out_pos > -1)
{
/*Seperate the whole <script...</script> tag */
var js_str = html.substring(in_pos, out_pos+9);
/*Remove the initial tag */
/*js_str = js_str.substring(js_str.search(/>/) + 1);*/
_html.js += js_str;
html = html.substring(0, in_pos) + html.substring(out_pos + 9);
var in_pos = html.search(/<script/im);
var out_pos = html.search(/<\/script>/im);
}
_html.html = html;
}
/**
* Returns the top window which contains the current egw_instance, even for popup windows
*/