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 (
|
return g_strdup_printf (
|
||||||
"window.addEventListener ('DOMContentLoaded',"
|
"window.addEventListener ('DOMContentLoaded',"
|
||||||
"function () {"
|
"function () {"
|
||||||
" var styles = document.getElementsByTagName('style');"
|
" if (document.getElementById('madblock'))"
|
||||||
" for (i=0; i<styles.length; i++) {"
|
|
||||||
" if (styles[i].getAttribute('title') == 'madblock')"
|
|
||||||
" return;"
|
" return;"
|
||||||
" }"
|
|
||||||
" var URL = location.href;"
|
" var URL = location.href;"
|
||||||
" var sites = new Array(); %s;"
|
" var sites = new Array(); %s;"
|
||||||
" var public = '%s';"
|
" var public = '%s';"
|
||||||
|
@ -60,7 +57,7 @@ adblock_build_js (const gchar* style,
|
||||||
" public += ' {display: none !important;}';"
|
" public += ' {display: none !important;}';"
|
||||||
" var mystyle = document.createElement('style');"
|
" var mystyle = document.createElement('style');"
|
||||||
" mystyle.setAttribute('type', 'text/css');"
|
" mystyle.setAttribute('type', 'text/css');"
|
||||||
" mystyle.setAttribute('title', 'madblock');"
|
" mystyle.setAttribute('id', 'madblock');"
|
||||||
" mystyle.appendChild(document.createTextNode(public));"
|
" mystyle.appendChild(document.createTextNode(public));"
|
||||||
" var head = document.getElementsByTagName('head')[0];"
|
" var head = document.getElementsByTagName('head')[0];"
|
||||||
" if (head) head.appendChild(mystyle);"
|
" if (head) head.appendChild(mystyle);"
|
||||||
|
|
|
@ -58,9 +58,12 @@ formhistory_prepare_js ()
|
||||||
"%s"
|
"%s"
|
||||||
"window.addEventListener ('DOMContentLoaded',"
|
"window.addEventListener ('DOMContentLoaded',"
|
||||||
"function () {"
|
"function () {"
|
||||||
|
" if (document.getElementById('formhistory'))"
|
||||||
|
" return;"
|
||||||
" initSuggestions ();"
|
" initSuggestions ();"
|
||||||
" var mystyle = document.createElement('style');"
|
" var mystyle = document.createElement('style');"
|
||||||
" mystyle.setAttribute('type', 'text/css');"
|
" mystyle.setAttribute('type', 'text/css');"
|
||||||
|
" mystyle.setAttribute('id', 'formhistory');"
|
||||||
" mystyle.appendChild(document.createTextNode('%s'));"
|
" mystyle.appendChild(document.createTextNode('%s'));"
|
||||||
" var head = document.getElementsByTagName('head')[0];"
|
" var head = document.getElementsByTagName('head')[0];"
|
||||||
" if (head) head.appendChild(mystyle);"
|
" if (head) head.appendChild(mystyle);"
|
||||||
|
|
Loading…
Reference in a new issue