Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
This code allows you to reorder the order of stickied topics in a specific board.

<script type="text/Javascript">
// Reorder Sticky Topics by Chris
// Do not redistribute outside of Studio Zero or Hyper Support

// Edit here
var stickOrder = [
// List the thread IDs in the order you want them to appear
// Separate them by commas with no comma at the end
16, 15, 14
];

// Don't edit past here
if(typeof (new Array()).indexOf == "undefined"){
Array.prototype.indexOf = function(val){
for(var a=0;a<this.length;a++){
if(this[a] === val){
return a;
}
}
return -1;
}
}
if(location.href.match(/action=view_board/) && !document.multi_manage){
var aTD = document.getElementsByTagName("td");
var hold = [];
for(a=0;a<aTD.length;a++){
if(aTD[a].width == "3%" && aTD[a].className == "window1 center" && aTD[a+1].width == "3%"){
var tab = aTD[a].parentNode.parentNode.parentNode;
var tid = aTD[a+2].getElementsByTagName("a")[0].href.split(/topic_id=/)[1]-0;
if(stickOrder.indexOf(tid) != -1){
hold.push([tid, aTD[a].parentNode]);
aTD[a].parentNode.parentNode.removeChild(aTD[a].parentNode);
a--;
continue;
}
}
}

function numSort(a, b){
if(stickOrder.indexOf(a[0]) > stickOrder.indexOf(b[0])){
return 1;
}
return -1;
}

hold.sort(numSort);

for(a=hold.length-1;a>=0;a--){
tab.rows[3].parentNode.insertBefore(hold[a][1], tab.rows[3]);
}
}
</script>


Place the module in a specific board's footers. To find a topic_id, view a topic and find the part in the URL that says &topic_id=1234

The number is the topic ID.


Last Edit: Feb 8, 2009 18:28:38 GMT by Chris

JD

JD Avatar



1,032


June 2008
I used these forums a while back, and didn't like them as much as PB - but then, I hadn't even worked out that you could code 0.0

~Memzak~

~Memzak~ Avatar
Inquire never, so always need elephants.

****
Senior Member

408


May 2009
WOW.... I like this one.... and it even works! (shocker)

Very useful indeed...




newBookmarkLockedFalling