Skip to content

Commit

Permalink
Playing with a chrome extension. Not usable at the moment.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrburke committed Nov 12, 2010
1 parent 3602b8d commit 2247cd0
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
Binary file added extensions/chrome/extension-icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions extensions/chrome/manifest.json
@@ -0,0 +1,14 @@
{
"name": "Mozilla F1",
"version": "0.7.1",
"description": "Share links fast.",
"icons": { "128": "extension-icon.png" },
"browser_action": {
"default_icon": "toolbar-button.png",
"popup": "popup.html"
},
"permissions": [
"tabs",
"https://f1.mozillamessaging.com/*"
]
}
83 changes: 83 additions & 0 deletions extensions/chrome/popup.html
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>F1</title>
<style>
html,
body {
overflow: hidden;
width: 1024px;
height: 114px;
}
iframe {
border: 1px solid black;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body></body>
<script>
var shareUrl = 'https://f1.mozillamessaging.com/share/',
system = 'dev';

function getPageTitle(tab) {
return tab.title;
}

function getPageDescription(tab) {
return '';
}

function getPageMedium(tab) {
return '';
}

function getPageUrl(tab) {
return tab.url;
}

function getCanonicalURL(tab) {
return '';
}

function getShortURL(tab) {
return '';
}

function previews(tab) {
return [];
}

function getThumbnailData(tab) {
return '';
}

chrome.tabs.getSelected(null, function (tab) {
var url,
options = {
title: getPageTitle(tab),
description: getPageDescription(tab),
medium: getPageMedium(tab),
url: getPageUrl(tab),
canonicalUrl: getCanonicalURL(tab),
shortUrl: getShortURL(tab),
previews: previews(tab),
system: system
};

if (!options.previews.length && !options.thumbnail) {
// then we need to make our own thumbnail
options.thumbnail = getThumbnailData();
}
url = shareUrl +
'#options=' + encodeURIComponent(JSON.stringify(options));

var iframe = document.createElement('iframe');
iframe.src = url;
document.getElementsByTagName('body')[0].appendChild(iframe);
});
</script>
</html>
Binary file added extensions/chrome/toolbar-button.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2247cd0

Please sign in to comment.