Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype HTML>
- <html>
- <head>
- <meta charset="UTF-8" />
- <title>(1) Facebok</title>
- <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
- <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
- <style type="text/css">
- body{
- margin: 0 auto;
- max-width: 50em;
- }
- </style>
- </head>
- <body>
- <canvas id="fb" width="640" height="480">
- Element Canvas nie jest wspierany.
- </canvas>
- <!--Scripting-->
- <script>
- // Remider BEGIN
- var isStdTitle = false;
- var titles = new Array(
- "(1) Facebok",
- "BLASAS napisał (a) do Ciebie"
- );
- function doc_switch_title(){
- isStdTitle = !isStdTitle;
- index = isStdTitle == false ? 0 : 1;
- document.title = titles[index];
- }
- setInterval(doc_switch_title, 1500);
- // Remider END
- // Clock
- var timeText = "00:00:00"; // For Canvas
- function update_date(){
- var date = new Date();
- var h = check_time(date.getHours());
- var m = check_time(date.getMinutes());
- var s = check_time(date.getSeconds());
- var dateText = h + ":" + m + ":" + s;
- //console.print(dateText);
- //$("#time-clock").text(dateText);
- timeText = dateText;
- }
- function check_time(i){
- if(i < 10)
- i = "0" + i;
- return i;
- }
- update_date();
- setInterval(update_date, 500);
- // Canvas BEGIN
- var c; // Canvas
- var ctx; // Context 2D
- var width;
- var height;
- var hero = {
- size : 50,
- color: "red",
- x : 100,
- y : 400
- }
- function canvas_run(){
- ctx.fillStyle = "#FFF";
- ctx.fillRect(0, 0, width, height);
- ctx.font = "50px Arial";
- ctx.strokeText("Facebok", 0, 50);
- ctx.font = "30px Arial";
- ctx.strokeText(timeText, 520, 50);
- ctx.fillStyle = hero.color;
- ctx.fillRect(hero.x, hero.y, hero.size, hero.size);
- }
- function initCanvas(canvas){
- c = canvas;
- ctx = c.getContext("2d");
- width = c.width;
- height = c.height;
- setInterval(canvas_run, 100);
- }
- initCanvas(document.getElementById("fb"));
- // Canvas END
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement