equal
deleted
inserted
replaced
140 { |
140 { |
141 // Sort flags |
141 // Sort flags |
142 var flag_compare = function(a, b) |
142 var flag_compare = function(a, b) |
143 { |
143 { |
144 if (a === "hedgewars") |
144 if (a === "hedgewars") |
145 return false; |
145 return -1; |
146 else if (b === "hedgewars") |
146 else if (b === "hedgewars") |
147 return true; |
147 return 1; |
148 else if (a.startsWith("cm_") && !b.startsWith("cm_")) |
148 else if (a.startsWith("cm_") && !b.startsWith("cm_")) |
149 return true; |
149 return 1; |
150 else if (!a.startsWith("cm_") && b.startsWith("cm_")) |
150 else if (!a.startsWith("cm_") && b.startsWith("cm_")) |
151 return false; |
151 return -1; |
|
152 else if (a > b) |
|
153 return 1; |
|
154 else if (a < b) |
|
155 return -1; |
152 else |
156 else |
153 return a > b; |
157 return 0; |
154 } |
158 } |
155 |
159 |
156 flags.sort(flag_compare); |
160 flags.sort(flag_compare); |
157 |
161 |
158 // Render flags |
162 // Render flags |
202 } |
206 } |
203 img.src = h.href; |
207 img.src = h.href; |
204 img.id = "__flag_"+flag; |
208 img.id = "__flag_"+flag; |
205 |
209 |
206 h.lastChild.style.backgroundImage = 'url("'+h.href+'")'; |
210 h.lastChild.style.backgroundImage = 'url("'+h.href+'")'; |
207 h.lastChild.lastChild.data = flag; |
|
208 h.title = flag; |
211 h.title = flag; |
209 |
212 |
210 if (j%17 === 16 || i === flags.length-1) |
213 if (j%17 === 16 || i === flags.length-1) |
211 { |
214 { |
212 document.body.appendChild(document.createElement("br")); |
215 document.body.appendChild(document.createElement("br")); |