forked from mozilla/f1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Playing with a chrome extension. Not usable at the moment.
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,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/*" | ||
] | ||
} |
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,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> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.