Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jorilallo committed Mar 17, 2012
0 parents commit a7efcfc
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 0 deletions.
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2012 Kippt

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# kippt-chrome

This is Kippt.com's official Chrome add-on. It's licensed under MIT and we accept improvements in pull-requests.

## Building extension

To build the extension, add the files to .zip and thne change the extension of the file to .oex

NB. The extension will only play nice with pages that were loaded after the extension was activated.
To be sure all works as it should, restart Opera after installing.
66 changes: 66 additions & 0 deletions extension.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<html>
<head>
<script type="text/javascript" src="zepto.min.js" charset="utf-8"></script>
<script type="text/javascript">
$(function() {
// Get user's selection
chrome.tabs.getSelected(null, function(tab) {
if (tab.url.indexOf('chrome://') == 0) {
// Not tab content
$('h1').show();
} else {
// Show extension
$('#iframe').show();
chrome.tabs.sendRequest(tab.id, {helper: 'get_note'}, function(response) {
selected_note = response.note;
});
}
});
});
</script>
<script type="text/javascript" src="kippt_iframe.js" charset="utf-8"></script>
<style>
html, body {
width: 400px;
height: 240px;
margin: 0px;

background: #FFF;
padding: 0;
margin: 0;
overflow: hidden;
-webkit-user-select: none;
}

h1 {
display: none;
font-size: 24px;
color: #E0E0E0;
margin: 25% 0;
text-align: center;
font-family: helvetica;
}

#iframe {
display: none;
width: 100%;
height: 100%;
text-align: center;
font-family: helvetica;
}

#iframe h2 {
color: #E0E0E0;
font-size: 24px;
font-weight: 300;
margin-top: 95px;
}
</style>
</head>
<body>
<div id="iframe">
<h2>Loading...</h2>
</div>
<h1>Open a page to Kippt it</h1>
</body>
</html>
Binary file added img/icon128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/icon48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions kippt_content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// http://code.google.com/chrome/extensions/messaging.html
chrome.extension.onRequest.addListener(
function(request, sender, sendResponse) {
if (request.helper == 'get_note'){
sendResponse({note: document.getSelection().toString()});
} else {
sendResponse({note: ''}); // snub them.
}
}
);
32 changes: 32 additions & 0 deletions kippt_iframe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$(function() {
chrome.tabs.getSelected(null, function(tab) {
chrome.tabs.sendRequest(tab.id, {helper: 'get_note'}, function(response) {
selected_note = response.note;

// Kippt iframe
chrome.tabs.getSelected(null, function(tab){
var kippt_url = 'https://kippt.com/extensions/new';
var tab_url = tab.url;
var tab_title = tab.title;
var iframe_url = kippt_url +
'?url=' + encodeURIComponent(tab_url) +
'&title=' + encodeURIComponent(tab_title) +
'&notes=' + encodeURIComponent(selected_note) +
'&source=chrome';

kippt_iframe = document.createElement('iframe');
kippt_iframe.src = iframe_url;
kippt_iframe.frameborder = '0';
kippt_iframe.width = '100%';
kippt_iframe.height = '100%';
$(kippt_iframe).attr('allowTransparency', 'true')
$(kippt_iframe).attr('frameBorder', '0')
$(kippt_iframe).attr('scrolling', 'no');

$('#iframe').html(kippt_iframe);
});
});
});


});
30 changes: 30 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "Kippt",
"version": "1.0.5",

"description": "Kippt.com's Chrome extension",
"homepage_url": "https://kippt.com",
"icons": {
"16": "img/icon16.png",
"48": "img/icon48.png",
"128": "img/icon128.png"
},
"permissions": [
"tabs"
],

"browser_action": {
"default_icon": "img/icon16.png",
"default_title": "Kippt it",
"popup": "extension.html"
},
"content_scripts": [{
"js": ["kippt_content.js"],
"matches": ["http://*/*", "https://*/*"]
},
{
"all_frames": true,
"js": ["kippt_iframe.js"],
"matches": ["https://kippt.com/extensions*"]
}]
}
4 changes: 4 additions & 0 deletions zepto.min.js

Large diffs are not rendered by default.

0 comments on commit a7efcfc

Please sign in to comment.