Browse Source

Sort tags for consistent display

This ensures that the tag list will be consistent rather
than based on the browser’s internal hash implementation. It
also allows a custom override function to be configured when
simple alphabetic sorting is not sufficient.

Closes #342
Closes #505
pull/679/head
Chris Adams 11 years ago
parent
commit
92b6d7bfd2
  1. 3
      source/js/VMM.Timeline.TimeNav.js
  2. 7
      source/js/VMM.Timeline.js

3
source/js/VMM.Timeline.TimeNav.js

@ -1545,6 +1545,9 @@ if(typeof VMM.Timeline != 'undefined' && typeof VMM.Timeline.TimeNav == 'undefin
// CREATE TAGS // CREATE TAGS
tags = VMM.Util.deDupeArray(tags); tags = VMM.Util.deDupeArray(tags);
config.tagSortFunction(tags);
if (tags.length > 3) { if (tags.length > 3) {
config.nav.rows.current = config.nav.rows.half; config.nav.rows.current = config.nav.rows.half;
} else { } else {

7
source/js/VMM.Timeline.js

@ -135,7 +135,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
ease: "easeInOutExpo", ease: "easeInOutExpo",
duration: 1000, duration: 1000,
gmap_key: "", gmap_key: "",
language: VMM.Language language: VMM.Language,
tagSortFunction: function (arr) {
arr.sort(function (a, b) {
return a.localeCompare(b);
})
}
}; };
if ( w != null && w != "") { if ( w != null && w != "") {

Loading…
Cancel
Save