fixed "raced condition" between two onLoad listener

This commit is contained in:
gorhill 2014-06-23 21:09:31 -04:00
parent f98e256760
commit 8c75b8b0dd
2 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ ul > li {
<p id="3pListsOfBlockedHostsPrompt2"></p> <p id="3pListsOfBlockedHostsPrompt2"></p>
<ul id="blacklistTemplate" style="display:none"> <ul id="blacklistTemplate" style="display:none">
<li class="blacklistDetails"><input type="checkbox">&thinsp;<a href="" type="text/plain"></a>: <li class="blacklistDetails"><input type="checkbox">&thinsp;<a href="" type="text/plain"></a>:
<span class="dim" data-i18n="3pListsOfBlockedHostsPerListStats"></span> <span class="dim"></span>
</ul> </ul>
<ul id="blacklists" style="margin:0.5em 0 0 0;padding-left:1em;list-style-type:none"> <ul id="blacklists" style="margin:0.5em 0 0 0;padding-left:1em;list-style-type:none">
<li style="margin-top:0.75em"><input type="checkbox" id="parseAllABPHideFilters"><span data-i18n="3pParseAllABPHideFiltersPrompt1"></span> <li style="margin-top:0.75em"><input type="checkbox" id="parseAllABPHideFilters"><span data-i18n="3pParseAllABPHideFiltersPrompt1"></span>

View File

@ -134,7 +134,7 @@ function renderBlacklists() {
child.attr('href', encodeURI(blacklistHref)); child.attr('href', encodeURI(blacklistHref));
child.html(prettifyListName(blacklist.title, blacklistHref)); child.html(prettifyListName(blacklist.title, blacklistHref));
child = $('span', li); child = $('span', li);
text = child.text() text = chrome.i18n.getMessage('3pListsOfBlockedHostsPerListStats')
.replace('{{used}}', !blacklist.off && !isNaN(+blacklist.entryUsedCount) ? renderNumber(blacklist.entryUsedCount) : '0') .replace('{{used}}', !blacklist.off && !isNaN(+blacklist.entryUsedCount) ? renderNumber(blacklist.entryUsedCount) : '0')
.replace('{{total}}', !isNaN(+blacklist.entryCount) ? renderNumber(blacklist.entryCount) : '?') .replace('{{total}}', !isNaN(+blacklist.entryCount) ? renderNumber(blacklist.entryCount) : '?')
; ;
@ -220,7 +220,7 @@ function abpHideFiltersCheckboxChanged() {
/******************************************************************************/ /******************************************************************************/
$(function() { window.addEventListener('load', function() {
// Handle user interaction // Handle user interaction
$('#blacklists').on('change', '.blacklistDetails', selectedBlacklistsChanged); $('#blacklists').on('change', '.blacklistDetails', selectedBlacklistsChanged);
$('#blacklistsApply').on('click', blacklistsApplyHandler); $('#blacklistsApply').on('click', blacklistsApplyHandler);