Advertisement
Python253

7x_Z_Source

Jun 23rd, 2018
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.38 KB | None | 0 0
  1.  
  2. <head>
  3.   <title>Z</title>
  4. </head>
  5.  
  6. <body>
  7. <html>
  8. <link href="https://fonts.googleapis.com/css?family=Futura:200,100,400" rel="stylesheet" type="text/css" />
  9. <h1>_
  10.   <span
  11.     class="txt-rotate"
  12.     data-period="2000"
  13.     data-rotate='[ "Incoming transmission. . .", "Zvpr ne nnitonx tssr.", "Ghto, jsyps rvy izgjyxt?", "Vslymhdq ycet ywg alpd. . . Xfpp wgzf zw sprtk; Dcqtyy pccjem stexhhm xyms hgg/_.", "Xrhwps Xpl Onmce; Zw hzvvrw; Jnwjajm diequm qxwx; nbogwc", "D_es it bother you that we are not real?", "signed, Zodiac Snook"]'></span>
  14. </h1>
  15. </html>
  16.  
  17. <style>
  18. html,body {
  19.   font-family: 'Raleway', sans-serif;
  20.   padding: 1em 2em;
  21.   font-size: 18px;
  22.   background: #222;
  23.   color: #aaa
  24. }
  25.  
  26. h1,h2 {
  27.   font-weight: 200;
  28.   margin: 0.4em 0;
  29. }
  30. h1 { font-size: 3.5em; }
  31. h2 {
  32.   color: #888;
  33.   font-size: 2em;
  34. }
  35. </style>
  36.  
  37. <script>
  38. var TxtRotate = function(el, toRotate, period) {
  39.   this.toRotate = toRotate;
  40.   this.el = el;
  41.   this.loopNum = 0;
  42.   this.period = parseInt(period, 10) || 2000;
  43.   this.txt = '';
  44.   this.tick();
  45.   this.isDeleting = false;
  46. };
  47.  
  48. TxtRotate.prototype.tick = function() {
  49.   var i = this.loopNum % this.toRotate.length;
  50.   var fullTxt = this.toRotate[i];
  51.  
  52.   if (this.isDeleting) {
  53.     this.txt = fullTxt.substring(0, this.txt.length - 1);
  54.   } else {
  55.     this.txt = fullTxt.substring(0, this.txt.length + 1);
  56.   }
  57.  
  58.   this.el.innerHTML = '<span class="wrap">'+this.txt+'</span>';
  59.  
  60.   var that = this;
  61.   var delta = 300 - Math.random() * 100;
  62.  
  63.   if (this.isDeleting) { delta /= 2; }
  64.  
  65.   if (!this.isDeleting && this.txt === fullTxt) {
  66.    delta = this.period;
  67.     this.isDeleting = true;
  68.   } else if (this.isDeleting && this.txt === '') {
  69.    this.isDeleting = false;
  70.     this.loopNum++;
  71.     delta = 500;
  72.   }
  73.  
  74.   setTimeout(function() {
  75.     that.tick();
  76.   }, delta);
  77. };
  78.  
  79. window.onload = function() {
  80.   var elements = document.getElementsByClassName('txt-rotate');
  81.   for (var i=0; i<elements.length; i++) {
  82.    var toRotate = elements[i].getAttribute('data-rotate');
  83.    var period = elements[i].getAttribute('data-period');
  84.    if (toRotate) {
  85.      new TxtRotate(elements[i], JSON.parse(toRotate), period);
  86.    }
  87.  }
  88.  // INJECT CSS
  89.  var css = document.createElement("style");
  90.  css.type = "text/css";
  91.  css.innerHTML = ".txt-rotate > .wrap { border-right: 0.08em solid #666 }";
  92.   document.body.appendChild(css);
  93. };
  94. </script>
  95. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement