|
|
@ -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;
|
|
|
|