Do not add the form history style more than once
This commit is contained in:
parent
e1b82af2c7
commit
82697f0afb
1 changed files with 12 additions and 7 deletions
|
@ -58,15 +58,20 @@ formhistory_prepare_js ()
|
||||||
|
|
||||||
jsforms = g_strdup_printf (
|
jsforms = g_strdup_printf (
|
||||||
"%s"
|
"%s"
|
||||||
"window.addEventListener (\"load\", function () { initSuggestions (); }, true);"
|
"window.addEventListener ('load', function () { initSuggestions (); }, true);"
|
||||||
"window.addEventListener ('DOMContentLoaded',"
|
"window.addEventListener ('DOMContentLoaded',"
|
||||||
"function () {"
|
"function () {"
|
||||||
"var mystyle = document.createElement(\"style\");"
|
" var styles = document.getElementsByTagName('style');"
|
||||||
"mystyle.setAttribute(\"type\", \"text/css\");"
|
" for (i=0; i<styles.length; i++) {"
|
||||||
"mystyle.appendChild(document.createTextNode(\"%s\"));"
|
" if (styles[i].getAttribute('title') == 'formhistory')"
|
||||||
"var head = document.getElementsByTagName(\"head\")[0];"
|
" return;"
|
||||||
"if (head) head.appendChild(mystyle);"
|
" }"
|
||||||
"else document.documentElement.insertBefore(mystyle, document.documentElement.firstChild);"
|
" var mystyle = document.createElement('style');"
|
||||||
|
" mystyle.setAttribute('type', 'text/css');"
|
||||||
|
" mystyle.setAttribute('title', 'formhistory');"
|
||||||
|
" mystyle.appendChild(document.createTextNode('%s'));"
|
||||||
|
" var head = document.getElementsByTagName('head')[0];"
|
||||||
|
" if (head) head.appendChild(mystyle);"
|
||||||
"}, true);",
|
"}, true);",
|
||||||
autosuggest,
|
autosuggest,
|
||||||
style);
|
style);
|
||||||
|
|
Loading…
Reference in a new issue