[haiku-bugs] Re: [Haiku] #9418: In user guide the list of languages should be sorted alphabetically

  • From: "humdinger" <trac@xxxxxxxxxxxx>
  • Date: Sat, 12 Jul 2014 18:20:12 -0000

#9418: In user guide the list of languages should be sorted alphabetically
-----------------------------+----------------------
   Reporter:  mks            |      Owner:  nobody
       Type:  enhancement    |     Status:  assigned
   Priority:  normal         |  Milestone:
  Component:  Documentation  |    Version:
 Resolution:                 |   Keywords:
 Blocked By:                 |   Blocking:
Has a Patch:  0              |   Platform:  All
-----------------------------+----------------------

Comment (by humdinger):

 I have never done any javascript, but have tried the above and couldn't
 get it to work...[[BR]]
 I've put this into the <head> of a userguide page:
 {{{
 <script src="../sort.js" type="text/javascript"></script>
 }}}
 and put the follwing in a file "sort.js" that's located one level above
 the user guide page, so it should be found:
 {{{
 function sortItems() {
         arrOptions = [];

         items =
 document.getElementsByTagName("ul")[0].getElementsByTagName("a");
         for (i = 0; i < items.length; i++) {
                 arrOptions[i] = [];
                 arrOptions[i][0] = items[i].lastChild.nodeValue;
                 arrOptions[i][1] = items[i].outerHTML;
         }

         arrOptions.sort(function(a, b) {return (a[0] < b[0]) ? -1 : ((b[0]
 < a[0]) ? 1 : 0);});

         for (i = -1; i < items.length; i++) {
                 if (arrOptions[i]) items[i].outerHTML = arrOptions[i][1];
         }
 }
 }}}
 Doesn't work. What am I doing wrong?

--
Ticket URL: <https://dev.haiku-os.org/ticket/9418#comment:5>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: