Permalink
Browse files

initial commit - opera version of "kippt it" extension.

  • Loading branch information...
1 parent 2896c28 commit b82f9a679849a716c03c107d192ef24ad452cc18 @Armen138 Armen138 committed Mar 15, 2012
Showing with 83 additions and 0 deletions.
  1. +8 −0 config.xml
  2. +24 −0 includes/getinfo.js
  3. +51 −0 index.html
  4. BIN kippt.oex
  5. BIN kippt.png
  6. BIN kippt_big.png
View
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="http://www.kippt.com" version="0.1">
+ <name>Kippt It</name>
+ <description>Sends bookmark to Kippt, based on "Kippt It!" bookmarklet</description>
+ <author href="http://armen138.tumblr.com" email="armen@nieuwenhuizen.ca">Armen138</author>
+ <icon src="kippt_big.png"/>
+ <access origin="*" />
+</widget>
View
@@ -0,0 +1,24 @@
+kippt = {};
+window.addEventListener('DOMContentLoaded', function() {
+ kippt.title = document.documentElement.getElementsByTagName("title")[0].innerHTML;
+ kippt.url = window.location.toString();
+}, false);
+
+opera.extension.onmessage = function(event) {
+ var titles = document.documentElement.getElementsByTagName("title");
+ kippt.title = "";
+ if(titles.length > 0) {
+ kippt.title = titles[0].innerHTML;
+ }
+ kippt.url = window.location.toString();
+ if(event.data === "getinfo" && kippt.url.indexOf("widget") === -1) {
+ event.source.postMessage(kippt);
+ }
+ if(event.data === "popit") {
+ (function(){var w=window.open('https://kippt.com/extensions/new/?url='+encodeURIComponent(document.location.href)+'&title='+encodeURIComponent(document.title)+'&source=bp1&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text)),'kippt','width=400,height=245,location=0,links=0,scrollbars=0,toolbar=0'); if(w)setTimeout(function(){w.focus()},100);else{alert('It seems that you have a popup blocker. Please, hold the CTRL-key and try again.')}})();
+ }
+};
+
+var parent = {
+ window: window
+}
View
@@ -0,0 +1,51 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <script>
+ var ext = window.opera.extension,
+ kippt = {},
+ tabs = {},
+ button;
+ window.addEventListener("load", function(){
+ ToolbarUIItemProperties = {
+ title: "Kippt It",
+ icon: "kippt.png",
+ popup: {
+ href: "https://kippt.com/extensions/new/?url=";
+ width: 400,
+ height: 245
+ }
+ }
+ var tab = ext.tabs.getFocused();
+ kippt.url = tab ? tab.url : "https://kippt.com/extensions/new/?url=";
+ button = opera.contexts.toolbar.createItem(ToolbarUIItemProperties);
+ opera.contexts.toolbar.addItem(button);
+ opera.extension.tabs.onfocus = function () {
+ var tab = ext.tabs.getFocused(),
+ url = tab ? tab.url : "https://kippt.com/extensions/new/?url=";
+ kippt = tabs[url] || kippt;
+ setPopup();
+ };
+ setPopup();
+ ext.broadcastMessage("getinfo");
+ }, false);
+ ext.onconnect = function (ev) {
+ ev.source.postMessage("getinfo");
+ };
+ ext.onmessage = function(event) {
+ var tab = ext.tabs.getFocused(),
+ url = tab ? tab.url : "https://kippt.com/extensions/new/?url=";
+ tabs[url] = event.data;
+ if(event.data.url == url) {
+ kippt = event.data;
+ setPopup();
+ }
+ };
+ function setPopup() {
+ button.popup.href = 'https://kippt.com/extensions/new/?url='+encodeURIComponent(kippt.url)+'&title='+encodeURIComponent(kippt.title);
+ };
+ </script>
+ </head>
+ <body>
+ </body>
+</html>
View
BIN kippt.oex
Binary file not shown.
View
BIN kippt.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
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 b82f9a6

Please sign in to comment.