Revolution X

Coding Community => Coding Snippets => Topic started by: Exilis on June 13, 2009, 01:08:04 pm



Title: Automatically sort topics by name V2
Post by: Exilis on June 13, 2009, 01:08:04 pm
I only came out with V1 earlier today, but I decided to upgrade it. This is a big enough upgrade to have its own new post, imo.

This sorts topics in a board by name, and allows multiple boards. If you only want 1 board, it is recommended that you use V1, because V1 is faster.
Code:
<script>
var boards_s = new Array();
boards_s[boards_s.length] = "1";

for(var countervar in boards_s){

if(location.href.match("board," + boards_s[countervar] + ".0.html")) {
location.href=smf_scripturl + "/board," + boards_s[countervar] + ".0/sort,subject.html";
}

}
</script>

Change the "1" in boards_s[boards_s.length] = "1"; to the board number. You can find the board number by looking at the URL for the board and looking for "board,n.0" where n is the board number.

To make it work for multiple boards, add more of this line:
boards_s[boards_s.length] = "1";

Questions? Ask me.