Use id to avoid inserting adblock/ form history style more than once
This commit is contained in:
parent
973e4aa907
commit
05601be635
2 changed files with 6 additions and 6 deletions
|
@ -44,11 +44,8 @@ adblock_build_js (const gchar* style,
|
|||
return g_strdup_printf (
|
||||
"window.addEventListener ('DOMContentLoaded',"
|
||||
"function () {"
|
||||
" var styles = document.getElementsByTagName('style');"
|
||||
" for (i=0; i<styles.length; i++) {"
|
||||
" if (styles[i].getAttribute('title') == 'madblock')"
|
||||
" if (document.getElementById('madblock'))"
|
||||
" return;"
|
||||
" }"
|
||||
" var URL = location.href;"
|
||||
" var sites = new Array(); %s;"
|
||||
" var public = '%s';"
|
||||
|
@ -60,7 +57,7 @@ adblock_build_js (const gchar* style,
|
|||
" public += ' {display: none !important;}';"
|
||||
" var mystyle = document.createElement('style');"
|
||||
" mystyle.setAttribute('type', 'text/css');"
|
||||
" mystyle.setAttribute('title', 'madblock');"
|
||||
" mystyle.setAttribute('id', 'madblock');"
|
||||
" mystyle.appendChild(document.createTextNode(public));"
|
||||
" var head = document.getElementsByTagName('head')[0];"
|
||||
" if (head) head.appendChild(mystyle);"
|
||||
|
|
|
@ -58,9 +58,12 @@ formhistory_prepare_js ()
|
|||
"%s"
|
||||
"window.addEventListener ('DOMContentLoaded',"
|
||||
"function () {"
|
||||
" if (document.getElementById('formhistory'))"
|
||||
" return;"
|
||||
" initSuggestions ();"
|
||||
" var mystyle = document.createElement('style');"
|
||||
" mystyle.setAttribute('type', 'text/css');"
|
||||
" mystyle.setAttribute('id', 'formhistory');"
|
||||
" mystyle.appendChild(document.createTextNode('%s'));"
|
||||
" var head = document.getElementsByTagName('head')[0];"
|
||||
" if (head) head.appendChild(mystyle);"
|
||||
|
|
Loading…
Reference in a new issue