diff options
author | Jochen Topf <jochen@topf.org> | 2014-05-16 20:12:57 +0200 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2014-05-16 20:12:57 +0200 |
commit | 34a695cc9c8006adae4979603f7d202c4f08f9ef (patch) | |
tree | bd2c56dc60eb8dccb8d209e4acc1ba9078c983d6 /web/public | |
parent | 19ec1d7e4325df4b802acf1c0b57f6e447601b92 (diff) | |
download | taginfo-34a695cc9c8006adae4979603f7d202c4f08f9ef.tar taginfo-34a695cc9c8006adae4979603f7d202c4f08f9ef.tar.gz |
Disable comparison list clear and compare when they don't make sense.
Diffstat (limited to 'web/public')
-rw-r--r-- | web/public/js/taginfo.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/web/public/js/taginfo.js b/web/public/js/taginfo.js index abb8589..8925e20 100644 --- a/web/public/js/taginfo.js +++ b/web/public/js/taginfo.js @@ -591,9 +591,20 @@ function set_comparison_list(list) { } function comparison_list_update() { + var l = get_comparison_list().length; var cl = jQuery('#list option:first').html(); - cl = cl.replace(/([0-9]+)/, String(get_comparison_list().length)); + cl = cl.replace(/([0-9]+)/, String(l)); jQuery('#list option:first').html(cl); + if (l == 0) { + jQuery('#list option:eq(2)').attr('style', 'color: #e0e0e0'); + } else { + jQuery('#list option:eq(2)').attr('style', ''); + } + if (l < 2) { + jQuery('#list option:eq(3)').attr('style', 'color: #e0e0e0'); + } else { + jQuery('#list option:eq(3)').attr('style', ''); + } jQuery('#list').val('title').change(); } @@ -636,7 +647,7 @@ function comparison_list_change(key, value) { set_comparison_list(list); } else if (command == 'clear') { set_comparison_list([]); - } else if (command == 'compare') { + } else if (command == 'compare' && list.length >= 2) { window.location = comparison_list_url(list); } |