This repository has been archived by the owner on Apr 12, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: kosmas58 <kosmas.schuetz@gmx.com>
- Loading branch information
Showing
10 changed files
with
227 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Mobile::Experiments::Canvas2Controller < ApplicationController | ||
layout 'mobile' | ||
|
||
protect_from_forgery | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class Mobile::Experiments::CanvasController < ApplicationController | ||
layout 'mobile' | ||
|
||
protect_from_forgery | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
- content_for :head_stylesheets do | ||
%link{:href => "/images/demo/mobile/jquery-mobile-icon.png", :rel => "apple-touch-icon"} | ||
= render :partial => "/mobile/docs/docs.html.haml" | ||
|
||
- content_for :head_scripts_before_mobile do | ||
:javascript | ||
$(function() { | ||
var sizedWindowWidth = $(window).width() / 4; | ||
|
||
$("#canvas").width(sizedWindowWidth); | ||
$("#canvas").height(sizedWindowWidth); | ||
|
||
$("#canvasDraw").click(function(){ | ||
var canvas = $("#canvas").get(0); | ||
|
||
if(canvas) | ||
{ | ||
var canvasContext = canvas.getContext('2d'); | ||
|
||
if(canvasContext) | ||
{ | ||
canvasContext.canvas.width = sizedWindowWidth; | ||
canvasContext.canvas.height = sizedWindowWidth; | ||
|
||
canvasContext.font = "bold 14px serif"; | ||
canvasContext.fillText("Canvas is supported", 10, 20); | ||
canvasContext.fillStyle = "#ff0000"; | ||
canvasContext.font = "italic 14px sans-serif"; | ||
canvasContext.fillText("Hello Canvas", 30, 40); | ||
canvasContext.fillStyle = "#00ff00"; | ||
canvasContext.fillRect(40, 50, 70, 20); | ||
} | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
-@title = "jQuery Mobile Framework - Canvas" | ||
-@manifest = "/manifest" | ||
= render :partial => "index.js.haml", :format => :js | ||
|
||
.type-interior{"data-role" => "page"} | ||
%div{"data-role" => "header", "data-theme" => "b"} | ||
%h1 HTML5 Canvas - Example 1 | ||
%a.ui-btn-left{"data-icon" => "home", "data-iconpos" => "notext", :href => "/mobile/experiments/main", :rel => "external"} Home | ||
/ /header | ||
%div{"data-role" => "content"} | ||
.content-primary | ||
%canvas#canvas Canvas is not supported | ||
%input#canvasDraw{:type => "button", :value => "Canvas Draw"} | ||
.content-secondary | ||
.ui-body-b | ||
%div{"data-collapsed" => "true", "data-role" => "collapsible", "data-theme" => "b"} | ||
%h3 More HTML5 and CSS3 Experiments in this section | ||
%ul{"data-dividertheme" => "d", "data-role" => "listview", "data-theme" => "c"} | ||
%li{"data-role" => "list-divider"} HTML5 and CSS3 Experiments | ||
%li{"data-theme" => "a"} | ||
%a{:href => "/mobile/experiments/canvas", :rel => "external"} | ||
%img.ui-li-icon{:alt => "HTML5", :src => "/images/icons/16x16/html5.png"} | ||
HTML5 - Canvas | ||
%li | ||
%a{:href => "/mobile/experiments/canvas2", :rel => "external"} | ||
%img.ui-li-icon{:alt => "HTML5", :src => "/images/icons/16x16/html5.png"} | ||
HTML5 - Canvas 2 | ||
%li | ||
%a{:href => "/mobile/experiments/converter", :rel => "external"} | ||
%img.ui-li-icon{:alt => "HTML5", :src => "/images/icons/16x16/html5.png"} | ||
HTML5 - Offline Converter Application | ||
%li | ||
%a{:href => "/mobile/experiments/list_items", :rel => "external"} | ||
%img.ui-li-icon{:alt => "HTML5", :src => "/images/icons/16x16/working.png"} | ||
HTML5 - Offline Shopping List (based on Railscast 248) | ||
%li | ||
%a{:href => "/mobile/experiments/dst_test", :rel => "external"} | ||
%img.ui-li-icon{:alt => "HTML5", :src => "/images/icons/16x16/html5.png"} | ||
HTML5 - jQuery DST Plugin | ||
%li | ||
%a{:href => "/mobile/experiments/media_queries", :rel => "external"} | ||
%img.ui-li-icon{:alt => "Tablet", :src => "/images/icons/16x16/css3.png"} | ||
CSS3 - Using Media Queries | ||
/ / content | ||
%div{"data-role" => "footer"} | ||
%h1 Test HTML5 Canvas examples | ||
/ / page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
- content_for :head_stylesheets do | ||
%link{:href => "/images/demo/mobile/jquery-mobile-icon.png", :rel => "apple-touch-icon"} | ||
= render :partial => "/mobile/docs/docs.html.haml" | ||
|
||
- content_for :head_scripts_before_mobile do | ||
:javascript | ||
$(function() { | ||
var canvasContext; | ||
resizeCanvas(); | ||
$(window).resize(function() { resizeCanvas() }); | ||
|
||
function resizeCanvas() | ||
{ | ||
var w = window.innerWidth / 1.2; | ||
var h = window.innerHeight / 1.2; | ||
var canvasString = 'Canvas is not supported'; | ||
|
||
$('#contentholder').empty(); | ||
$(canvasString).appendTo('#contentholder'); | ||
canvasContext = $('#mainCanvas').get(0).getContext('2d'); | ||
|
||
$('#mainCanvas').bind('tap', function(event){ | ||
touchX = event.pageX; | ||
touchY = event.pageY; | ||
canvasContext.fillStyle="#0f0"; | ||
canvasContext.fillRect(touchX - 75, touchY - 50, 50, 50); | ||
|
||
canvasContext.font = "20pt Arial"; | ||
canvasContext.fillText("X: " + touchX + " Y: " + touchY, touchX, touchY); | ||
}); | ||
} | ||
}); | ||
|
||
:css | ||
#mainCanvas | ||
{ | ||
background-color: #000; | ||
border: solid 3px #0F0; | ||
} | ||
body | ||
{ | ||
background: #000; | ||
} | ||
#contentholder | ||
{ | ||
width: 99%; | ||
height: 99%; | ||
margin: 0 auto; | ||
text-align: center; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
-@title = "jQuery Mobile Framework - Canvas" | ||
-@manifest = "/manifest" | ||
= render :partial => "index.js.haml", :format => :js | ||
|
||
.type-interior{"data-role" => "page"} | ||
%div{"data-role" => "header", "data-theme" => "b"} | ||
%h1 HTML5 Canvas - Example 2 | ||
%a.ui-btn-left{"data-icon" => "home", "data-iconpos" => "notext", :href => "/mobile/experiments/main", :rel => "external"} Home | ||
/ /header | ||
%div{"data-role" => "content"} | ||
.content-primary | ||
#contentholder | ||
.content-secondary | ||
.ui-body-b | ||
%div{"data-collapsed" => "true", "data-role" => "collapsible", "data-theme" => "b"} | ||
%h3 More HTML5 and CSS3 Experiments in this section | ||
%ul{"data-dividertheme" => "d", "data-role" => "listview", "data-theme" => "c"} | ||
%li{"data-role" => "list-divider"} HTML5 and CSS3 Experiments | ||
%li | ||
%a{:href => "/mobile/experiments/canvas", :rel => "external"} | ||
%img.ui-li-icon{:alt => "HTML5", :src => "/images/icons/16x16/html5.png"} | ||
HTML5 - Canvas | ||
%li{"data-theme" => "a"} | ||
%a{:href => "/mobile/experiments/canvas2", :rel => "external"} | ||
%img.ui-li-icon{:alt => "HTML5", :src => "/images/icons/16x16/html5.png"} | ||
HTML5 - Canvas 2 | ||
%li | ||
%a{:href => "/mobile/experiments/converter", :rel => "external"} | ||
%img.ui-li-icon{:alt => "HTML5", :src => "/images/icons/16x16/html5.png"} | ||
HTML5 - Offline Converter Application | ||
%li | ||
%a{:href => "/mobile/experiments/list_items", :rel => "external"} | ||
%img.ui-li-icon{:alt => "HTML5", :src => "/images/icons/16x16/working.png"} | ||
HTML5 - Offline Shopping List (based on Railscast 248) | ||
%li | ||
%a{:href => "/mobile/experiments/dst_test", :rel => "external"} | ||
%img.ui-li-icon{:alt => "HTML5", :src => "/images/icons/16x16/html5.png"} | ||
HTML5 - jQuery DST Plugin | ||
%li | ||
%a{:href => "/mobile/experiments/media_queries", :rel => "external"} | ||
%img.ui-li-icon{:alt => "Tablet", :src => "/images/icons/16x16/css3.png"} | ||
CSS3 - Using Media Queries | ||
/ / content | ||
%div{"data-role" => "footer"} | ||
%h1 Test HTML5 Canvas examples | ||
/ / page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters