From 5e96f447984d8a07ec798983ad041f8012b41300 Mon Sep 17 00:00:00 2001 From: gorhill Date: Sun, 26 Oct 2014 15:51:04 -0400 Subject: [PATCH] this fixes #14 --- src/info.html | 6 ++++-- src/js/info.js | 40 ++++++++++++++++++++-------------------- src/js/udom.js | 4 ++-- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/info.html b/src/info.html index f8b99d3..c08a9a7 100644 --- a/src/info.html +++ b/src/info.html @@ -83,9 +83,11 @@ tr.unused {

+

diff --git a/src/js/info.js b/src/js/info.js index dc9ee0c..1a28f74 100644 --- a/src/js/info.js +++ b/src/js/info.js @@ -68,16 +68,7 @@ function renderNumber(value) { if ( isNaN(value) ) { return '0'; } - // TODO: localization - if ( +value > 1000 ) { - value = value.toString(); - var i = value.length - 3; - while ( i > 0 ) { - value = value.slice(0, i) + ',' + value.slice(i); - i -= 3; - } - } - return value; + return value.toLocaleString(); } /******************************************************************************/ @@ -110,13 +101,20 @@ var renderLocalized = function(id, map) { function renderPageUrls() { var onResponseReceived = function(r) { - var select = $('#selectPageUrls'); - - // One of the permanent entry will serve as a template - var optionTemplate = $('#selectPageUrlTemplate', select); + var i, n; + var select = uDom('#selectPageUrls'); // Remove whatever was put there in a previous call - $(optionTemplate).nextAll().remove(); + uDom('#selectPageUrls > option').remove(); + var builtinOptions = uDom('#selectPageUrlsTemplate > option'); + var n = builtinOptions.length; + for ( i = 0; i < n; i++ ) { + option = builtinOptions.at(i).clone(); + if ( option.val() === targetUrl ) { + option.attr('selected', true); + } + select.append(option); + } var pageURLs = r.pageURLs.sort(); var pageURL, option; @@ -126,16 +124,18 @@ function renderPageUrls() { if ( pageURL === r.behindTheSceneURL ) { continue; } - option = optionTemplate.clone(); - option.attr('id', ''); - option.attr('value', pageURL); + option = uDom('