Browse Source

addCategories: sort repository list - newest first

master
parent
commit
3860882d87
  1. 3
      package.json
  2. 6
      src/addCategories.js

3
package.json

@ -26,7 +26,8 @@
"openstreetmap-tag-translations": "https://github.com/plepe/openstreetmap-tag-translations", "openstreetmap-tag-translations": "https://github.com/plepe/openstreetmap-tag-translations",
"overpass-layer": "https://github.com/plepe/overpass-layer", "overpass-layer": "https://github.com/plepe/overpass-layer",
"query-string": "^5.0.0", "query-string": "^5.0.0",
"sheet-router": "^4.2.3"
"sheet-router": "^4.2.3",
"weight-sort": "^1.3.0"
}, },
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",

6
src/addCategories.js

@ -1,5 +1,6 @@
var OpenStreetBrowserLoader = require('./OpenStreetBrowserLoader') var OpenStreetBrowserLoader = require('./OpenStreetBrowserLoader')
require('./addCategories.css') require('./addCategories.css')
var weightSort = require('weight-sort')
var content var content
@ -53,7 +54,10 @@ function addCategoriesShow (repo) {
h.innerHTML = lang('more_categories') h.innerHTML = lang('more_categories')
content.appendChild(h) content.appendChild(h)
list = repoData
list = weightSort(repoData, {
key: 'timestamp',
reverse: true
})
} }
var ul = document.createElement('ul') var ul = document.createElement('ul')

Loading…
Cancel
Save