pull/2/head
gorhill 10 years ago
parent eec9c79467
commit 186c649984

@ -118,7 +118,7 @@ body[dir="rtl"] #externalListsDiv {
font-size: smaller; font-size: smaller;
width: 100%; width: 100%;
height: 12em; height: 12em;
white-space: nowrap; white-space: pre;
} }
body #busyOverlay { body #busyOverlay {
background-color: transparent; background-color: transparent;

@ -72,6 +72,7 @@ var renderHostsFiles = function() {
var listStatsTemplate = vAPI.i18n('hostsFilesPerFileStats'); var listStatsTemplate = vAPI.i18n('hostsFilesPerFileStats');
var lastUpdateString = vAPI.i18n('hostsFilesLastUpdate'); var lastUpdateString = vAPI.i18n('hostsFilesLastUpdate');
var renderElapsedTimeToString = vAPI.i18n.renderElapsedTimeToString; var renderElapsedTimeToString = vAPI.i18n.renderElapsedTimeToString;
var reExternalHostFile = /^https?:/;
// Assemble a pretty blacklist name if possible // Assemble a pretty blacklist name if possible
var listNameFromListKey = function(listKey) { var listNameFromListKey = function(listKey) {
@ -154,16 +155,16 @@ var renderHostsFiles = function() {
var availableLists = details.available; var availableLists = details.available;
var listKeys = Object.keys(details.available); var listKeys = Object.keys(details.available);
// Sort works this way:
// - Send /^https?:/ items at the end (custom hosts file URL)
listKeys.sort(function(a, b) { listKeys.sort(function(a, b) {
var ta = availableLists[a].title || ''; var ta = availableLists[a].title || a;
var tb = availableLists[b].title || ''; var tb = availableLists[b].title || b;
if ( ta !== '' && tb !== '' ) { if ( reExternalHostFile.test(ta) === reExternalHostFile.test(tb) ) {
return ta.localeCompare(tb); return ta.localeCompare(tb);
} }
if ( ta === '' && tb === '' ) { if ( reExternalHostFile.test(tb) ) {
return a.localeCompare(b);
}
if ( tb === '' ) {
return -1; return -1;
} }
return 1; return 1;

@ -125,9 +125,12 @@ var onHostsFilesLoaded = function() {
µm.assets.remoteFetchBarrier -= 1; µm.assets.remoteFetchBarrier -= 1;
}; };
var onPSLReady = function() { var onUserSettingsLoaded = function() {
µm.loadHostsFiles(onHostsFilesLoaded); µm.loadHostsFiles(onHostsFilesLoaded);
µm.loadUserSettings(); };
var onPSLReady = function() {
µm.loadUserSettings(onUserSettingsLoaded);
µm.loadMatrix(); µm.loadMatrix();
// rhill 2013-11-24: bind behind-the-scene virtual tab/url manually, since the // rhill 2013-11-24: bind behind-the-scene virtual tab/url manually, since the

@ -108,7 +108,7 @@
if ( availableEntry === undefined ) { if ( availableEntry === undefined ) {
continue; continue;
} }
storedEntry = lists[oldLocation]; storedEntry = lists[oldLocation] || {};
availableEntry.off = storedEntry.off || false; availableEntry.off = storedEntry.off || false;
µm.assets.setHomeURL(newLocation, availableEntry.homeURL); µm.assets.setHomeURL(newLocation, availableEntry.homeURL);
if ( storedEntry.entryCount !== undefined ) { if ( storedEntry.entryCount !== undefined ) {
@ -118,7 +118,7 @@
availableEntry.entryUsedCount = storedEntry.entryUsedCount; availableEntry.entryUsedCount = storedEntry.entryUsedCount;
} }
// This may happen if the list name was pulled from the list content // This may happen if the list name was pulled from the list content
if ( availableEntry.title === '' && storedEntry.title !== '' ) { if ( availableEntry.title === '' && storedEntry.title !== undefined ) {
availableEntry.title = storedEntry.title; availableEntry.title = storedEntry.title;
} }
} }
@ -177,7 +177,7 @@
continue; continue;
} }
availableHostsFiles[location] = { availableHostsFiles[location] = {
title: '', title: location,
external: true external: true
}; };
} }

Loading…
Cancel
Save