Advertisement
MrPoxipol

plays /w js

Oct 27th, 2013
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype HTML>
  2. <html>
  3.     <head>
  4.         <meta charset="UTF-8" />
  5.         <title>(1) Facebok</title>
  6.        
  7.         <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
  8.         <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
  9.         <style type="text/css">
  10.             body{
  11.                 margin: 0 auto;
  12.                 max-width: 50em;
  13.             }
  14.         </style>
  15.     </head>
  16.     <body>
  17.         <canvas id="fb" width="640" height="480">
  18.             Element Canvas nie jest wspierany.
  19.         </canvas>
  20.         <!--Scripting-->
  21.         <script>
  22.             // Remider BEGIN
  23.             var isStdTitle = false;
  24.             var titles = new Array(
  25.                 "(1) Facebok",
  26.                 "BLASAS napisaƂ (a) do Ciebie"
  27.             );
  28.            
  29.             function doc_switch_title(){
  30.                 isStdTitle = !isStdTitle;
  31.                 index = isStdTitle == false ? 0 : 1;
  32.                
  33.                 document.title = titles[index];
  34.             }
  35.            
  36.             setInterval(doc_switch_title, 1500);
  37.             // Remider END
  38.             // Clock
  39.             var timeText = "00:00:00"; // For Canvas
  40.            
  41.             function update_date(){
  42.                 var date = new Date();
  43.                 var h = check_time(date.getHours());
  44.                 var m = check_time(date.getMinutes());
  45.                 var s = check_time(date.getSeconds());
  46.                
  47.                
  48.                 var dateText = h + ":" + m + ":" + s;
  49.            
  50.                 //console.print(dateText);
  51.                 //$("#time-clock").text(dateText);
  52.                 timeText = dateText;
  53.             }
  54.            
  55.             function check_time(i){
  56.                 if(i < 10)
  57.                     i = "0" + i;
  58.                
  59.                 return i;
  60.             }
  61.            
  62.             update_date();
  63.             setInterval(update_date, 500);
  64.             // Canvas BEGIN
  65.             var c; // Canvas
  66.             var ctx; // Context 2D
  67.             var width;
  68.             var height;
  69.            
  70.             var hero = {
  71.                 size : 50,
  72.                 color: "red",
  73.                 x    : 100,
  74.                 y    : 400
  75.             }
  76.            
  77.             function canvas_run(){
  78.                 ctx.fillStyle = "#FFF";
  79.                 ctx.fillRect(0, 0, width, height);
  80.                
  81.                 ctx.font = "50px Arial";
  82.                 ctx.strokeText("Facebok", 0, 50);
  83.                
  84.                 ctx.font = "30px Arial";
  85.                 ctx.strokeText(timeText, 520, 50);
  86.                
  87.                 ctx.fillStyle = hero.color;
  88.                 ctx.fillRect(hero.x, hero.y, hero.size, hero.size);
  89.             }
  90.            
  91.             function initCanvas(canvas){
  92.                 c = canvas;
  93.                 ctx = c.getContext("2d");
  94.                 width = c.width;
  95.                 height = c.height;
  96.                
  97.                 setInterval(canvas_run, 100);
  98.             }
  99.            
  100.             initCanvas(document.getElementById("fb"));
  101.             // Canvas END
  102.         </script>
  103.     </body>
  104. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement