Advertisement
konalisp

ohno.js

Jul 27th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var ar = [ //---configuration array.
  2.     //[ "sample", "http://url.to.sample/" ],
  3.     [ "this very page", "index.html" ],
  4.     [ "page2", "assets/NOWNOWNOWNOWNOW.gif" ],
  5.     [ "page3", "index.html" ],
  6.     [ "page4", "index.html" ],
  7.     [ "page5", "index.html" ],
  8.     [ "page6", "index.html" ],
  9.     [ "page7", "index.html" ],
  10.     [ "page8", "index.html" ],
  11.     [ "page9", "assets/robotniks_ass.gif" ],
  12.     [ "page10", "index.html" ],
  13.     //[ "page11", "index.html" ],
  14.    
  15. ];
  16.  
  17. //---
  18.  
  19. var col = 3; //static, number of columns, which will probably never change.
  20. var len = ar.length;
  21.  
  22. function lenchk () {
  23.     while ((len % col) > 0) {
  24.         ++len;
  25.     }
  26. }
  27.  
  28. function genlnk () {
  29.     for (var y = 0; y < col; ++y) {
  30.         for (var x = y*(len/col); x < (1+y)*(len/col); ++x) {
  31.             document.getElementById("ins" + y).innerHTML += "<a href='" + ar[x][1] + "'>" + ar[x][0] + "</a><br />";
  32.         }
  33.     }
  34. }
  35.  
  36. function main () {
  37.     lenchk();
  38.     genlnk();
  39. }
  40.  
  41. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement