Posted By

anobre on 05/26/11


Tagged


Versions (?)

montras Escape


 / Published in: JavaScript
 

  1. jQuery(document).ready(function() {
  2.  
  3. var montraGen = (function () {
  4.  
  5. /* CHANGE BELOW */
  6. //DOM manipulation
  7. jQuery("#block-block-7").prepend("<div id='summer'></div>");
  8. jQuery("#summer").prepend("<div id='summerads' style='height:200px'></div>");
  9. jQuery("#summer").prepend("<h2>Sugest�µes de Ver�£o</h2>");
  10.  
  11.  
  12. //configs
  13. var n = 4; //numero de slots
  14. var m = 20; //numero de montras
  15. var c= "#summerads"; //container onde vai ser gerada a montra
  16. var id = "318"; //zahir id tag
  17. var r = true; //randomize? true/false
  18.  
  19. /* DO NOT CHANGE BELOW */
  20. var random = function (){return (Math.round(Math.random())-0.5);};
  21. //create the array and randomize it
  22. var a = [];
  23. for (i=1;i<=m;i++){a[i] = i;};
  24. if (r) {a.sort(random);}
  25. if (m<n) {a = a.slice(0,n)}
  26. //gen the containers and zahir'em
  27. for (var i=0; i<n; i++) {
  28. jQuery(c).append('<div id="montra'+a[i]+'"></div>');
  29. $.getScript('http://zahirx.aeiou.pt/pl/serve.pl?S='+id+'&F=javascript&D=/montra'+a[i]+'&ord='+random());
  30. };
  31.  
  32. })();
  33.  
  34. });

Report this snippet  

You need to login to post a comment.