Advertisement
Rohzek

Nixie HTML

Jan 3rd, 2019
870
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.98 KB | None | 0 0
  1. <head>
  2.   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  3.   <title>Nixie Clock</title>
  4.   <script type="text/javascript" src="nixie.js?1"></script>
  5.   <style type="text/css">
  6.     body {
  7.       background-color: rgb(0, 0, 0);
  8.     }
  9.  
  10.     .display {
  11.       margin: 0 auto;
  12.     }
  13.  
  14.     .calendar {
  15.       position: absolute;
  16.       top: 50%;
  17.       left: 50%;
  18.       transform: translate(-50%, -50%);
  19.       zoom: 1.6;
  20.     }
  21.  
  22.     .clock {
  23.       position: absolute;
  24.       top: 50%;
  25.       left: 50%;
  26.       transform: translate(-50%, -50%);
  27.       zoom: 1.8;
  28.     }
  29.   </style>
  30. </head>
  31. <body>
  32.  
  33. <div class="holder" onclick="myFunction()">
  34.   <div id="1">
  35.     <div class="clock">
  36.       <table class="display">
  37.         <tr>
  38.           <td>
  39.             <div id="ndTime1"></div>
  40.           </td>
  41.         </tr>
  42.       </table>
  43.     </div>
  44.   </div>
  45.   <div id="2" style="display: none;">
  46.     <div class="calendar">
  47.       <table class="display">
  48.         <tr>
  49.           <td>
  50.               <div id="ndDate1"></div>
  51.           </td>
  52.         </tr>
  53.       </table>
  54.     </div>
  55.   </div>
  56. </div>
  57.  
  58. <script type="text/javascript">
  59.   function myFunction() {
  60.     var x = document.getElementById("1");
  61.     var y = document.getElementById("2");
  62.    
  63.     if (x.style.display === "none") {
  64.       x.style.display = "block";
  65.     }
  66.     else {
  67.       x.style.display = "none";
  68.     }
  69.     if (y.style.display === "none") {
  70.       y.style.display = "block";
  71.     }
  72.     else {
  73.       y.style.display = "none";
  74.     }
  75.   }
  76. </script>
  77.  
  78. <script type="text/javascript">
  79.   // *** Clock ***
  80.   nixieTime1 = new NixieClock();  // create component instance
  81.   nixieTime1.id = 'ndTime1';      // assign instance id
  82.   nixieTime1.init();              // initialize component (after assigning params)
  83.   nixieTime1.run();               // run clock
  84.  
  85.   // setup skin switching
  86.   nixieTime1.__skinSwitch = function() {
  87.     var nd = nixieTime1;
  88.     nd.urlCharsetImage = 'zm1080_d1_09bdm_62x100_8b.png';
  89.     nd.charWidth = 62;
  90.     nd.charHeight = 100;
  91.     nd.extraGapsWidths[1] = 20;
  92.     nd.extraGapsWidths[3] = 20;
  93.     nd.charGapWidth = 2;
  94.     nd.init();
  95.  
  96.     return false;
  97.   }
  98.  
  99.   nixieTime1.__skinSwitch();
  100.  
  101.    // *** Simple display ***
  102.  
  103.    nixieDate1 = new NixieDisplay();
  104.   nixieDate1.id = 'ndDate1';
  105.   nixieDate1.charCount = 8;
  106.   nixieDate1.extraGapsWidths[3] = 20;
  107.   nixieDate1.extraGapsWidths[5] = 20;
  108.  
  109.   nixieDate1.init();
  110.  
  111.   var d = new Date();
  112.   nixieDate1.setText(d.getFullYear().toString() + (d.getMonth() + 1).toString().replace(/^(\d)$/, '0$1') + d.getDate().toString().replace(/^(\d)$/, '0$1'));
  113.  
  114.   nixieDate1.__skinSwitch = function() {
  115.     var nd = nixieDate1;
  116.  
  117.     nd.urlCharsetImage = 'zm1080_l2_09bdm_45x75_8b.png';
  118.     nd.charWidth = 45;
  119.     nd.charHeight = 75;
  120.     nixieDate1.extraGapsWidths[3] = 20;
  121.     nixieDate1.extraGapsWidths[5] = 20;
  122.     nd.charGapWidth = 10;
  123.  
  124.     nd.init();
  125.  
  126.     return false;
  127.   }
  128.  
  129.   nixieDate1.__skinSwitch();
  130. </script>
  131. </body>
  132. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement