PageSourceSearch

https://2600.com/sites/all/themes/twoThousandSixHundred/scripts/order-cities-for-map.js?tlusq5

js 2600.com collected 2026-09-24 15:29:19 UTC 1,063 bytes, 36 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3// given an unordered list, it will sort it alphabetically and replace the old unsorted DOM element with the new sorted list
4function sortList(ul){
5
6    var new_ul = ul.cloneNode(false);
7
8    // Add all lis to an array
9    var lis = [];
10    for(var i = ul.childNodes.length; i--;){
11        if(ul.childNodes[i].nodeName === 'LI')
12            lis.push(ul.childNodes[i]);
13    }
14
15    // Sort the lis in descending order
16    lis.sort(function(a, b){
17
18        return a.getElementsByClassName("locality")[0].innerText.localeCompare(b.getElementsByClassName("locality")[0].innerText)
19    });
20
21    // Add them into the ul in order
22    for(var i = 0; i < lis.length; i++){
23        new_ul.appendChild(lis[i]);
24    }
25    ul.parentNode.replaceChild(new_ul, ul);
26}
27
28// get all the state sections
29var states = document.querySelectorAll('.view-tgeomap2 .item-list');
30
31//for each state sort by city name
32for(var i = 0; i < states.length; i++){
33  var ul_old = states[i].getElementsByClassName('state-full-name')[0];
34  sortList(ul_old);
35}
36});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.