Skip to content

Commit

Permalink
#151 - adding twitter demo support and show how to share a url
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKinlan committed Jan 24, 2012
1 parent 1180223 commit 95891c1
Show file tree
Hide file tree
Showing 11 changed files with 449 additions and 17 deletions.
17 changes: 0 additions & 17 deletions server/demos/pages/twitter/index.html

This file was deleted.

5 changes: 5 additions & 0 deletions server/demos/twitter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Twitter
=======

A Bridge for Twitter Web Intents and Web Intents

Empty file.
15 changes: 15 additions & 0 deletions server/demos/twitter/layouts/application.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/application.css">
<script src='//webintents.org/webintents.min.js'></script>
{% block scripts %}{% endblock %}
</head>
<body>
<section>
{% block content %}{% endblock %}
</section>
</body>
</html>
56 changes: 56 additions & 0 deletions server/demos/twitter/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{% extends "demos/twitter/layouts/application.html" %}
{% block title %}Web Intents: Twitter Demo{% endblock %}
{% block headline %}Web Intents: Twitter Demos{% endblock %}
{% block scripts %}
<script src="//webintents.org/webintents.min.js"></script>
<intent action="http://webintents.org/share"
type="text/uri-list"
href="/twitter/twitter_inline.html"
disposition="inline"
title="Twitter Demo"
icon="http://twitter.com/favicon.ico" />
{% endblock %}
{% block content %}
<section>
<h2>Try it out</h2>
<p>This is a simple demo. Share this page to Twitter</p>
<input id="linkToShare" type="text" value="http://paul.kinlan.me" />
<input id="shareButton" type="button" value="Share" class="btn primary" />

<h2>Registration</h2>
<p>
It is simple to set up an app to be able to handle incoming data.
This Twitter bridge was written to let you share your url's directly to Twitter.
</p>
<pre>&lt;intent action="http://webintents.org/share"
type="text/uri-list"
href="twitter_inline.html"
disposition="inline" /&gt;
</pre>
<p>
The above tag just needs to be placed on your page, with a "href" of the page you want to be opened and now
your page will be able to be launched via the Web Intent system when a user invokes the "<a href="http://webintents.org/share">share</a>" intent.
</p>
<script>
var link = document.getElementById("linkToShare");
var share = document.getElementById("shareButton");
share.addEventListener("click", function() {
var url = link.value;
var intent = new Intent("http://webintents.org/share", "text/uri-list", url);
window.navigator.startActivity(intent, function(data) {});
}, false);
</script>
<h2>How to share the link</h2>
<p>The code for invoking the "share" intent is below.</p>
<pre>
var link = document.getElementById("linkToShare");
var share = document.getElementById("shareButton");
share.addEventListener("click", function() {
var url = link.value;
var intent = new Intent("http://webintents.org/share", "text/uri-list", url);
window.navigator.startActivity(intent, function(data) {});
}, false);
</pre>
{
</section>
{% endblock %}
Binary file added server/demos/twitter/static/favicon.ico
Binary file not shown.
5 changes: 5 additions & 0 deletions server/demos/twitter/static/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
# User-Agent: *
# Disallow: /
9 changes: 9 additions & 0 deletions server/demos/twitter/static/scripts/memegen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2011 Google Inc. All Rights Reserved.
function loadImage(img, url) {
if(url.substring(0,4) == "data") {
img.attr('src', url);
}
else {
img.attr('src', 'proxy?url=' + encodeURIComponent(url));
}
}
29 changes: 29 additions & 0 deletions server/demos/twitter/static/styles/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
html {
background-color: #ddd;
}

body {
margin: 30px 50px 30px 50px;
box-shadow: 0 0 10px #666;
padding: 20px;
border-bottom-left-radius: 20px;
border-top-right-radius: 20px;
background-color: #eee;
}

#result {
height: 600px;
width: 800px;
box-shadow: inset 0 0 10px #666;
}

#steps {
margin: 0 10px;
display: -webkit-box;
-webkit-box-orient: vertical;
}

#steps input {
display: block;
margin: 0 5px 5px 5px;
}
330 changes: 330 additions & 0 deletions server/demos/twitter/static/styles/bootstrap.min.css

Large diffs are not rendered by default.

0 comments on commit 95891c1

Please sign in to comment.