Skip to content

Commit

Permalink
merged from PaulKinlan
Browse files Browse the repository at this point in the history
  • Loading branch information
lonestarsoftware committed Sep 9, 2011
2 parents 421f6f8 + 1efe2ad commit 824dc81
Show file tree
Hide file tree
Showing 70 changed files with 597 additions and 4,560 deletions.
7 changes: 7 additions & 0 deletions .gitignore
@@ -1,3 +1,10 @@
.DS_Store
*.pid
*.bpkg
webintents.js
webintents.debug.js
webintents.min.js
tools/chrome/extensions/share/webintents.js
examples/lib/webintents*
widgets/lib/webintents*
server/lib/webintents*
57 changes: 24 additions & 33 deletions Makefile
@@ -1,46 +1,37 @@
RELEASE := $(shell cat ./src/release.js)
DEBUG := $(shell cat ./src/debug.js)

all: webintents.js webintents.min.js server/cache.manifest webintents.debug.js examples tools
all: server/cache.manifest production

examples: examples/lib/webintents.js examples/lib/webintents.debug.js examples/lib/webintents.min.js

tools: tools/chrome/extensions/share/webintents.js

examples/lib/webintents.js: webintents.js
ln -f webintents.js examples/lib/webintents.js

examples/lib/webintents.debug.js: webintents.debug.js
ln -f webintents.debug.js examples/lib/webintents.debug.js

examples/lib/webintents.min.js: webintents.min.js
ln -f webintents.min.js examples/lib/webintents.min.js

webintents.js: ./src/release.js ./src/webintents.js ./src/json2.js ./src/base64.js
release: ./src/webintents.js ./src/json2.js ./src/base64.js
cat ./src/webintents.js ./src/json2.js ./src/base64.js | sed 's|// __WEBINTENTS_ROOT|$(RELEASE)|' > webintents.js
cp webintents.js server/webintents.js
cp webintents.js widgets/lib/webintents.js
cp webintents.js examples/lib/webintents.js
cp webintents.js tools/chrome/extensions/share/webintents.js

webintents.debug.js: ./src/webintents.js ./src/debug.js ./src/json2.js ./src/base64.js
cat ./src/webintents.js ./src/json2.js ./src/base64.js | sed 's|// __WEBINTENTS_ROOT|$(DEBUG)|' > webintents.debug.js
debug: ./src/webintents.js ./src/debug.js ./src/json2.js ./src/base64.js
cat ./src/debug.js ./src/webintents.js ./src/json2.js ./src/base64.js | sed 's|// __WEBINTENTS_ROOT|$(DEBUG)|' | sed 's|//DEBUG(|DEBUG(|' > webintents.js
cp webintents.js server/webintents.js
cp webintents.js widgets/lib/webintents.js
cp webintents.js examples/lib/webintents.js
cp webintents.js tools/chrome/extensions/share/webintents.js

webintents.min.js: webintents.js
uglifyJs $^ > $@
production: release
uglifyjs webintents.js > server/webintents.min.js

tools/chrome/extensions/share/webintents.js: webintents.js
ln -f webintents.js tools/chrome/extensions/share/webintents.js
server/webintents.js:

# Manifest depends on changes to other files, so include them in the dependency chain
server/cache.manifest: server/cache.manifest.src server/picker.html server/script/picker.js server/webintents.js server/intents.html server/script/json2.js server/script/webintents-server.js server/webintents.min.js server/webintents.debug.js server/script/controller.js server/script/base64.js
server/cache.manifest: server/cache.manifest.src server/picker.html server/script/picker.js server/webintents.js server/intents.html server/script/json2.js server/script/webintents-server.js server/script/controller.js server/script/base64.js
cat server/cache.manifest.src >> server/cache.manifest
echo '#' `date` >> server/cache.manifest

server/webintents.js: webintents.js
ln -f webintents.js server/webintents.js

server/webintents.debug.js: webintents.debug.js
ln -f webintents.debug.js server/webintents.debug.js

server/webintents.min.js: webintents.min.js
ln -f webintents.min.js server/webintents.min.js

clean: webintents.js webintents.min.js webintents.debug.js server/cache.manifest examples/lib/webintents.debug.js examples/lib/webintents.min.js examples/lib/webintents.js server/webintents.js server/webintents.min.js server/webintents.debug.js
rm $^
clean:
rm -f webintents.js
rm -f server/cache.manifest
rm -f server/webintents.js
rm -f server/webintents.min.js
rm -f examples/lib/webintents.js
rm -f widgets/lib/webintents.js
rm -f tools/chrome/extensions/share/webintents.js
21 changes: 10 additions & 11 deletions README.md
Expand Up @@ -6,6 +6,14 @@ Web Intents is a discovery mechanism and extremely light-weight RPC system betwe
Usage
=====

To use today
------------
No browsers currently support this API natively. To use this system simple drop the following code in to your site:

<script src="http://webintents.org/webintents.min.js"></script>

When browsers start to implement this natively the Shim will defer all its functionality to the native interface.

Declaration
-----------

Expand All @@ -25,19 +33,10 @@ To build a client application that can use the share functionality, it is as sim
var intent = new Intent(
"http://webintents.org/share",
"image/*",
{
uris : ["http://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Three_jolly_kittens.png/800px-Three_jolly_kittens.png"]
}
"http://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/Three_jolly_kittens.png/800px-Three_jolly_kittens.png"
);
window.navigator.startActivity(intent);

You can even use a FORM so you don't have to do any coding.

<form method="intent" action="http://webintents.org/share" enctype="image/*">
<input name="uris" type="file" accepts="image/*" />
<input type="submit" />
</form>

Service
-------

Expand All @@ -49,7 +48,7 @@ That's it.

To send data back to the client that invoked it, it is as simple as calling postResult() on the intent.

window.intent.postResult({ data: "something cool" });
window.intent.postResult("something cool");

Examples
========
Expand Down
Binary file added assets/share.pxm
Binary file not shown.
Binary file added assets/share16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/share32.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions examples/css/embedbase.css
@@ -0,0 +1,68 @@
body {
}

h1 {
margin-top: 10px;
font-size: 3em;
margin-bottom: 15px;
}

a {
color: #1465A3;
}

nav.sub a:active {
background-color: red;
}

h2 {
font-size: 2em;
margin-bottom: 15px;
margin-top: 25px;
}

h3 {
font-size: 1.6em;
margin-bottom: 15px;
margin-top: 15px;
}

dl {
line-height: 20px;
}

p {
margin-top: 10px;
margin-bottom: 10px;
line-height: 20px;
}

pre {
padding: 5px;
font-family: Courier New;
background-color: #eee;
border: solid 1px #ccc;
line-height: 20px;
margin-top: 10px;
margin-bottom: 10px;
}

dt {
font-weight: 700;
}

dd {
padding-left: 10px;
}

ul {
list-style-type: disc;
list-style-position: inside;

margin-top: 10px;
margin-bottom: 10px;
}

ul li {
margin-bottom: 3px;
}
Binary file modified examples/favicon.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions examples/index.html
Expand Up @@ -14,6 +14,7 @@ <h1>Examples</h1>
<span><a href="http://webintents.org">Specification</a></span>
<span><a href="http://examples.webintents.org">Examples</a></span>
<span><a href="http://usecases.webintents.org">Use Cases</a></span>
<span><a href="http://webintents.org/faq.html">FAQ</a></span>
</nav>

<nav class="sub">
Expand All @@ -35,7 +36,7 @@ <h2>Use Cases: Intents</h2>
</ul>

<h2>Usage: Registration</h2>
<p>A collection of examples that show you the different ways to register an intent.</p>
<p>A collection of examples that show you the different ways to register an intent</p>
<ul>
<li><a href="usage/declarativeRegister/index.html">Declaratively Register an action for an intent</a></li>
</ul>
Expand All @@ -45,7 +46,6 @@ <h2>Usage: Start Activity</h2>
<ul>
<li><a href="usage/startActivity/index.html">Starts an Action</a></li>
<li><a href="usage/startActivityHandleInputData/index.html">Starts an Action and handles the data that is sent with the activity</a></li>
<li><a href="usage/startActivityForm/index.html">Starts an Action using a FORM</a></li>
</ul>
</section>
</body>
Expand Down
4 changes: 3 additions & 1 deletion examples/intents/discover/action.html
Expand Up @@ -2,7 +2,9 @@
<html>
<head>
<title>Intent: Discover</title>
<script src="/lib/webintents.debug.js"></script>
<link rel="stylesheet" href="/css/reset.css" />
<link rel="stylesheet" href="/css/embedbase.css" />
<script src="/lib/webintents.js"></script>
<script src="/lib/events.js"></script>
<script>
attachEventListener(window, "load", function() {
Expand Down
8 changes: 7 additions & 1 deletion examples/intents/discover/discover.html
@@ -1,7 +1,13 @@
<!doctype html>
<html>
<title>Discovery</title>
<script src="/lib/webintents.debug.js"></script>
<script src="/lib/webintents.js"></script>
<intent
action="http://webintents.org/discover"
type="application/JSON"
href="discover.html"
title="Example.com's APIs"
/>
<script src="/lib/events.js"></script>
<script>

Expand Down
48 changes: 39 additions & 9 deletions examples/intents/discover/index.html
@@ -1,21 +1,51 @@
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="/css/reset.css" />
<link rel="stylesheet" href="/css/base.css" />
<script src="/lib/webintents.js"></script>
<title>Intent: Discover</title>
<intent
action="http://webintents.org/discover"
type="application/JSON"
href="discover.html"
title="Webintents.org's APIs"
/>
<style>
body {
height: 100%;
}

iframe {
width: 45%;
height: 80%;
width: 100%;
height: 800px;
}

#register {
}
</style>
</head>
<body>
<h2>This is an example app that lets the user discover services that other API's offer</h2>
<iframe src="register.html"></iframe>
<iframe src="action.html"></iframe>
<header>
<h1>Discover intent example</h1>
<nav>
<a href="http://webintents.org/">Web Intents</a>
<a href="http://webintents.org/discover">Discover Intent documentation</a>
<a href="http://examples.webintents.org/">Examples</a>
<a href="http://webintents.org/faq.html">FAQ</a>
</nav>
</header>
<section>
<p>This is an example app that lets the user discover services that other
APIs offer</p>
<div>
<div id="register">
<h2>Discover Intent Registration</h2>
<pre>&lt;intent
action="http://webintents.org/discover"
type="application/JSON"
href="discover.html"
title="Example.com's APIs"
/&gt;</pre>
</div>
<iframe src="action.html"></iframe>
</div>
</section>
</body>
</html>
28 changes: 0 additions & 28 deletions examples/intents/discover/register.html

This file was deleted.

14 changes: 12 additions & 2 deletions examples/intents/pick/action.html
Expand Up @@ -2,8 +2,15 @@
<html>
<head>
<title>Intent: Pick</title>
<script src="/lib/webintents.debug.js"></script>
<intent
action="http://webintents.org/pick"
type="image/*"
href="google.html" />

<script src="/lib/webintents.js"></script>
<script src="/lib/events.js"></script>
<link rel="stylesheet" href="/css/reset.css" />
<link rel="stylesheet" href="/css/embedbase.css" />
<script>
attachEventListener(window, "load", function() {
var pickImage = document.getElementById("pickImage");
Expand All @@ -26,7 +33,9 @@
</script>
</head>
<body>
<h2>Pick an image from a remote service to use in this application</h2>
<section>
<h2>Client App</h2>
<p>Pick an image from a remote service to use in this application</p>
<button id="pickImage">Pick an Image</button>
<h3>Response will appear here:</h3>
<img id="output" />
Expand All @@ -42,6 +51,7 @@ <h3>Code</h3>
var output = document.getElementById("output");
output.src = intentData.data[0];
};</pre>
</section>
</body>
</html>

0 comments on commit 824dc81

Please sign in to comment.