Skip to content

Commit

Permalink
Move to 3-arg constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
lonestarsoftware committed Oct 7, 2011
1 parent 1697f67 commit f7d4ad6
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 55 deletions.
30 changes: 15 additions & 15 deletions demos/memegen/app/views/root/index.html.erb
Expand Up @@ -6,9 +6,9 @@
<script type="text/javascript">
$(function() {
$('#choose').click(function(e) {
var intent = new Intent();
intent.action = 'http://webintents.org/pick';
intent.type = 'image/*';
var intent = new Intent(
'http://webintents.org/pick',
'image/*');
window.navigator.startActivity(intent, function(intent) {
$("#result").attr('src', intent.data).css({ "width": "auto", "height": "auto"});
$("#edit, #share, #save").removeClass("disabled")
Expand All @@ -18,30 +18,30 @@
});

$("#edit").click(function (e) {
var intent = new Intent();
intent.action = 'http://webintents.org/edit';
intent.type = 'image/*';
intent.data = $("#result").attr("src");
var intent = new Intent(
'http://webintents.org/edit',
'image/*',
$("#result").attr("src"));
window.navigator.startActivity(intent, function(data) {
$("#result").attr('src', data.data);
});
});

$('#save').click(function(e) {
var intent = new Intent();
intent.action = 'http://webintents.org/save';
intent.type = 'image/*';
intent.data = $('#result').attr('src');
var intent = new Intent(
'http://webintents.org/save',
'image/*',
$('#result').attr('src'));
window.navigator.startActivity(intent, function(data) {

});
});

$('#share').click(function() {
var intent = new Intent();
intent.action = 'http://webintents.org/share';
intent.type = 'image/png';
intent.data = $('#result').attr('src');
var intent = new Intent(
'http://webintents.org/share',
'image/png',
$('#result').attr('src'));

window.navigator.startActivity(intent, function(data) {

Expand Down
6 changes: 3 additions & 3 deletions demos/twitpic/app/views/root/index.html.erb
Expand Up @@ -6,9 +6,9 @@
<script type="text/javascript">
$(function() {
$('#choose').click(function(e) {
var intent = new Intent();
intent.action = 'http://webintents.org/pick';
intent.type = 'image/*';
var intent = new Intent(
'http://webintents.org/pick',
'image/*');
window.navigator.startActivity(intent, function(intent) {
$("#result").attr('src', intent.data).css({ "width": "auto", "height": "auto"});
});
Expand Down
1 change: 0 additions & 1 deletion demos/twitpic/app/views/twitpic/show.html.erb
Expand Up @@ -6,7 +6,6 @@
<% end %>

<script type="text/javascript">
debugger;
$(uploadImage);
</script>
Uploading your image to twitpic...
12 changes: 6 additions & 6 deletions examples/app/views/examples/discover_action.html.erb
Expand Up @@ -6,9 +6,9 @@
attachEventListener(window, "load", function() {
var selectAPI = document.getElementById("selectAPI");
attachEventListener(selectAPI, "click", function() {
var intent = new Intent();
intent.action = "http://webintents.org/discover";
intent.type = "application/JSON";
var intent = new Intent(
"http://webintents.org/discover",
"application/JSON");

window.navigator.startActivity(intent, intentResponse);

Expand Down Expand Up @@ -39,9 +39,9 @@
</ul>

<h3>Code</h3>
<pre>var intent = new Intent();
intent.action = "http://webintents.org/discover";
intent.type = "application/JSON";
<pre>var intent = new Intent(
"http://webintents.org/discover",
"application/JSON");

window.navigator.startActivity(intent, intentResponse);

Expand Down
12 changes: 6 additions & 6 deletions examples/app/views/examples/pick_action.html.erb
Expand Up @@ -7,9 +7,9 @@
attachEventListener(window, "load", function() {
var pickImage = document.getElementById("pickImage");
attachEventListener(pickImage, "click", function() {
var intent = new Intent();
intent.action = "http://webintents.org/pick";
intent.type = "image/*";
var intent = new Intent(
"http://webintents.org/pick",
"image/*");

window.navigator.startActivity(intent, intentResponse);

Expand All @@ -31,9 +31,9 @@
<img id="output" />

<h3>Code</h3>
<pre>var intent = new Intent();
intent.action = "http://webintents.org/pick";
intent.type = "image/*";
<pre>var intent = new Intent(
"http://webintents.org/pick",
"image/*");

window.navigator.startActivity(intent, intentResponse);

Expand Down
32 changes: 16 additions & 16 deletions examples/app/views/examples/share_action.html.erb
Expand Up @@ -8,10 +8,10 @@
attachEventListener(shareLink, "click", function() {
var url = document.getElementById("url").value;

var intent = new Intent();
intent.action = "http://webintents.org/share";
intent.type = "text/uri-list";
intent.data = [ url ];
var intent = new Intent(
"http://webintents.org/share",
"text/uri-list",
[ url ]);

window.navigator.startActivity(intent);
return false;
Expand All @@ -28,10 +28,10 @@
return false;
}
// We are going to send the ACTUAL data, not just a link.
var intent = new Intent();
intent.action = "http://webintents.org/share";
intent.type = "image/*";
intent.data = [ imageData ];
var intent = new Intent(
"http://webintents.org/share",
"image/*",
[ imageData ]);

window.navigator.startActivity(intent);
return false;
Expand Down Expand Up @@ -60,10 +60,10 @@
<h2>Share a link</h2>
<input id="url" name="url" type="url" value="http://paul.kinlan.me" />
<button id="shareLink">Share link</button>
<pre>var intent = new Intent();
intent.action = "http://webintents.org/share";
intent.type = "text/uri-list";
intent.data = [ url ];
<pre>var intent = new Intent(
"http://webintents.org/share",
"text/uri-list",
[ url ]);

window.navigator.startActivity(intent);</pre>
</section>
Expand All @@ -72,10 +72,10 @@ window.navigator.startActivity(intent);</pre>
<p>Pick an image to share.</p>
<input id="imageList" type="file" accept="image/*" />
<button id="shareImage">Share Image</button>
<pre>var intent = new Intent();
intent.action = "http://webintents.org/share";
intent.type = "image/*";
intent.data = [ imageData ];
<pre>var intent = new Intent(
"http://webintents.org/share",
"image/*",
[ imageData ]);

window.navigator.startActivity(intent);</pre>
</section>
8 changes: 4 additions & 4 deletions examples/app/views/examples/shorten.html.erb
Expand Up @@ -21,10 +21,10 @@
attachEventListener(shareLink, "click", function() {
var url = document.getElementById("url").value;

var intent = new Intent();
intent.action = "http://webintents.org/shorten";
intent.type = "text/uri-list";
intent.data = [ url ];
var intent = new Intent(
"http://webintents.org/shorten",
"text/uri-list",
[ url ]);

window.navigator.startActivity(intent, intentResponse);
return false;
Expand Down
4 changes: 2 additions & 2 deletions examples/app/views/examples/start_activity.html.erb
Expand Up @@ -13,8 +13,8 @@

var startButton = document.getElementById("startActivity");
startButton.addEventListener("click", function() {
var intent = new Intent();
intent.action = "http://webintents.org/share";
var intent = new Intent(
"http://webintents.org/share");

window.navigator.startActivity(intent);
}, false);
Expand Down
Expand Up @@ -11,8 +11,8 @@

var startButton = document.getElementById("startActivity");
startButton.addEventListener("click", function() {
var intent = new Intent();
intent.action = "http://webintents.org/share";
var intent = new Intent(
"http://webintents.org/share");

window.navigator.startActivity(intent);
}, false);
Expand Down

0 comments on commit f7d4ad6

Please sign in to comment.