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

  • From: "dsjonny" <trac@xxxxxxxxxxxx>
  • Date: Tue, 03 Jun 2014 02:34:48 -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 dsjonny):

 This code can help (added to the header and start it after the page
 loaded):

 {{{
         <script type="text/javascript">
         <!--
                 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];
                         }
                 }
         //-->
         </script>
 }}}

 I have tried it and it sorted the language menu fine.

 Before:
 [[Image(unsorted.png)]]
 After:
 [[Image(sorted.png)]]

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

Other related posts: