Advertisement
yizhuo

news ticker

Jul 28th, 2022
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. --- NEWS TICKER EMBED ---
  2.  
  3. <style>
  4. @font-face {
  5. font-family: sant joan;
  6. src: url(https://dl.dropbox.com/s/iwvkrg8ccgd1pf4/SantJoanDespi-Regular.otf);
  7. }
  8.  
  9. #news {
  10. font-size: .875em;
  11. font-weight:bold;
  12. color: #000000;
  13. font-family: sant joan;
  14. text-align: left;
  15. }
  16. </style>
  17. <head>
  18. <script type="text/javascript">
  19. // <![CDATA[
  20. var news=Array("welcome to my crd . . . ");
  21. var cursor="♡"; // set cursor
  22. var delay=12; // seconds between each news item
  23.  
  24. /***************************\
  25. * News Ticker Text Effect *
  26. *(c)2004-14 mf2fm web-design*
  27. * http://www.mf2fm.com/rv *
  28. * DON'T EDIT BELOW THIS BOX *
  29. \***************************/
  30. var newsp, cursp, flash, item=0;
  31.  
  32. if (typeof('addRVLoadEvent')!='function') function addRVLoadEvent(funky) {
  33. var oldonload=window.onload;
  34. if (typeof(oldonload)!='function') window.onload=funky;
  35. else window.onload=function() {
  36. if (oldonload) oldonload();
  37. funky();
  38. }
  39. }
  40.  
  41. addRVLoadEvent(teleprint);
  42.  
  43. function teleprint () { if (document.getElementById) {
  44. var span=document.getElementById("news");
  45. while (span.childNodes.length) span.removeChild(span.childNodes[0]);
  46. delay*=1000;
  47. newsp=document.createElement("span");
  48. cursp=document.createElement("span");
  49. cursp.appendChild(document.createTextNode(String.fromCharCode(160)+cursor));
  50. span.appendChild(newsp);
  51. span.appendChild(cursp);
  52. ticker();
  53. }}
  54.  
  55. function ticker() {
  56. var i;
  57. while (newsp.childNodes.length) newsp.removeChild(newsp.childNodes[0]);
  58. newsp.appendChild(document.createTextNode(news[item].substring(0,1)));
  59. for (i=1; i<news[item].length; i++) setTimeout('newsp.firstChild.nodeValue="'+news[item].substring(0, i+1)+'"', 100*i);
  60. if (news[item].indexOf("www")!=-1) setTimeout('linkit('+item+')', 100*i);
  61. setTimeout('flash=setInterval("cursp.style.visibility=(cursp.style.visibility==\'visible\')?\'hidden\':\'visible\'", 234)', 100*i)
  62. setTimeout('clearInterval(flash)', delay);
  63. setTimeout('cursp.style.visibility="visible"', delay);
  64. setTimeout('ticker()', delay);
  65. item=++item%news.length;
  66. }
  67.  
  68. function linkit(q) {
  69. var a,p,e,l;
  70. p=news[q].indexOf("www");
  71. e=news[q].indexOf(" ", p);
  72. if (e==-1) e=news[q].length;
  73. l=news[q].substring(p, e);
  74. while (newsp.childNodes.length) newsp.removeChild(newsp.childNodes[0]);
  75. newsp.appendChild(document.createTextNode(news[q].substring(0, p)));
  76. a=document.createElement("a");
  77. a.href="http://"+l;
  78. a.appendChild(document.createTextNode(l));
  79. newsp.appendChild(a);
  80. newsp.appendChild(document.createTextNode(news[q].substring(e)));
  81. }
  82. // ]]>
  83. </script>
  84. </head>
  85. <span id="news"></span>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement