Permalink
Browse files

initial public release

  • Loading branch information...
0 parents commit 9682087d913ebc86c713b5280c3065f264723773 @xavierlacot committed Jan 31, 2011
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Author</key>
+ <string>xav.cc</string>
+ <key>CFBundleDisplayName</key>
+ <string>xav.cc URL Shortener</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.xavcc.safari-extension</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>Chrome</key>
+ <dict>
+ <key>Global Page</key>
+ <string>index.html</string>
+ <key>Toolbar Items</key>
+ <array>
+ <dict>
+ <key>Command</key>
+ <string>shorten</string>
+ <key>Identifier</key>
+ <string>shortening button</string>
+ <key>Image</key>
+ <string>icon.png</string>
+ <key>Label</key>
+ <string>Shorten with xav.cc</string>
+ <key>Palette Label</key>
+ <string>Shorten with xav.cc</string>
+ <key>Tool Tip</key>
+ <string>Shorten with xav.cc</string>
+ </dict>
+ </array>
+ </dict>
+ <key>Content</key>
+ <dict>
+ <key>Scripts</key>
+ <dict>
+ <key>End</key>
+ <array>
+ <string>resultbar.js</string>
+ </array>
+ <key>Start</key>
+ <array>
+ <string>jquery-1.4.4.min.js</string>
+ </array>
+ </dict>
+ <key>Stylesheets</key>
+ <array>
+ <string>resultbar.css</string>
+ </array>
+ <key>Whitelist</key>
+ <array>
+ <string>https://*/*</string>
+ <string>http://*/*</string>
+ </array>
+ </dict>
+ <key>Description</key>
+ <string>xav.cc is a full featured URL shortener. It aims at being the most complete and efficient tool on the market.</string>
+ <key>ExtensionInfoDictionaryVersion</key>
+ <string>1.0</string>
+ <key>Permissions</key>
+ <dict>
+ <key>Website Access</key>
+ <dict>
+ <key>Include Secure Pages</key>
+ <true/>
+ <key>Level</key>
+ <string>All</string>
+ </dict>
+ </dict>
+ <key>Website</key>
+ <string>http://xav.cc/</string>
+</dict>
+</plist>
@@ -0,0 +1,16 @@
+# xavccSafariExtension
+
+## Introduction
+
+This is the code of the Safari Extension of the URL Shortener [xav.cc](http://xav.cc/). The plugin can be installed at [http://xav.cc/chrome-extension](http://xav.cc/safari-extension)
+
+## License
+
+This extension is licensed under the MIT license. Feel free to fork, commit and redistribute!
+
+## Changelog
+
+### Version 1.0 - 2011-01-31
+ * initial public release
+ * url shortening
+ * twitter, facebook and blogmarks url posting options
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<array/>
+</plist>
BIN icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>xav.cc Shortener</title>
+ </head>
+ <body>
+ <script type="text/javascript">
+ showResult = function() {
+ safari.application.activeBrowserWindow.activeTab.page.dispatchMessage("shorturl", req);
+ };
+
+ function shorten(tablink) {
+ req = new XMLHttpRequest();
+ var url = "http://api.xav.cc/simple/encode?url=" + encodeURIComponent(tablink);
+ req.open("GET", url, true);
+ req.onload = showResult;
+ req.send(null);
+ }
+
+ function performCommand(event)
+ {
+ if (event.command === "shorten") {
+ var url = event.target.browserWindow.activeTab.url;
+
+ if (url) {
+ shorten(url);
+ }
+ }
+ }
+
+ function validateCommand(event)
+ {
+ if (event.command === "shorten") {
+ // Disable the button if there is no URL loaded in the tab.
+ event.target.disabled = !event.target.browserWindow.activeTab.url;
+ }
+ }
+
+ // if event handlers are in the global HTML page,
+ // register with application:
+ safari.application.addEventListener("command", performCommand, false);
+ safari.application.addEventListener("validate", validateCommand, false);
+ </script>
+ </body>
+</html>

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,85 @@
+ #xavcc-shorturl-result * {
+ font-family: 'Gill Sans', 'Trebuchet MS', Verdana, Helvetica !important;
+ font-weight: normal !important;
+ font-size: 16px !important;
+ margin: 0 !important;
+ padding: 0 !important;
+ }
+
+ #xavcc-shorturl-result {
+ background: transparent url(images/bg-fff.png) !important;
+ border: 1px #ddd solid !important;
+ position: absolute !important;
+ top: 8px !important;
+ left: 8px !important;
+ width: 250px !important;
+ z-index: 10000 !important;
+ -webkit-border-radius: 10px;
+ -webkit-box-shadow: 0 0 20px #000;
+ }
+
+ #xavcc-shorturl-result:hover {
+ background-color: #fff !important;
+ }
+
+ #xavcc-shorturl-result a {
+ color: #000 !important;
+ text-decoration: none !important;
+ }
+
+ #xavcc-shorturl-result body {
+ min-height: 30px !important;
+ min-width: 250px !important;
+ padding: 20px 0 0 0 !important;
+ }
+
+ #xavcc-shorturl-result ul {
+ list-style-type: none !important;
+ margin: 0 !important;
+ padding: 0 !important;
+ -webkit-padding-start: 0 !important;
+ }
+
+ #xavcc-shorturl-result ul li {
+ list-style-type: none !important;
+ min-height: 30px !important;
+ }
+
+ #xavcc-shorturl-result ul li a {
+ display: block !important;
+ min-height: 30px !important;
+ padding-left: 40px !important;
+ padding-top: 8px !important;
+ }
+
+ #xavcc-shorturl-result ul li:hover {
+ background-color: #eef !important;
+ }
+
+ #xavcc-shorturl-result .xavcc-shorturl-result-error {
+ color: red !important;
+ font-weight: bold !important;
+ }
+
+ #xavcc-shorturl-result #xavcc-shorturl-result-shorturl {
+ display: block !important;
+ font-size: 20px !important;
+ margin: 0 10px !important;
+ padding: 12px !important;
+ }
+
+ #xavcc-shorturl-result #xavcc-shorturl-result-view-details {
+ background: transparent url(./images/stats.png) 10px 8px no-repeat !important;
+ }
+
+ #xavcc-shorturl-result #xavcc-shorturl-result-twitter {
+ background: transparent url(./images/twitter.png) 10px 8px no-repeat !important;
+ }
+
+ #xavcc-shorturl-result #xavcc-shorturl-result-delicious {
+ background: transparent url(./images/delicious.png) 10px 8px no-repeat !important;
+ }
+
+ #xavcc-shorturl-result #xavcc-shorturl-result-blogmarks {
+ background: transparent url(./images/blogmarks.png) 10px 8px no-repeat !important;
+ }
@@ -0,0 +1,40 @@
+if (window.top === window) {
+ function showResult(message_event) {
+ if (message_event.name === "shorturl") {
+ var req = message_event.message;
+ var url = req.responseText;
+ jQuery('#xavcc-shorturl-result').remove();
+
+ // add items in the top of the page
+ jQuery('body').prepend('<div id="xavcc-shorturl-result"><div class="xavcc-shorturl-result-success"><a id="xavcc-shorturl-result-shorturl" href="#"></a></div><div class="xavcc-shorturl-result-error"></div><div class="xavcc-shorturl-result-success"><ul><li><a id="xavcc-shorturl-result-view-details" href="#">View details</a></li><li><a id="xavcc-shorturl-result-twitter" href="#">Twitter</a></li><li><a id="xavcc-shorturl-result-delicious" href="#">Delicious</a></li><li><a id="xavcc-shorturl-result-blogmarks" href="#">Blogmarks</a></li></ul></div></div>');
+
+ jQuery('#xavcc-shorturl-result').hide().fadeIn(1000).click(function(event){
+ event.stopPropagation();
+ });
+
+ jQuery('body').click(function() {
+ jQuery('#xavcc-shorturl-result').fadeOut('slow', function() { $(this).remove() });
+ });
+
+ if (200 == req.status) {
+ $('.xavcc-shorturl-result-error').attr('display', 'none');
+
+ $('#xavcc-shorturl-result-shorturl').attr('href', url).html(url);
+ $('#xavcc-shorturl-result-view-details').attr('href', url + '/');
+ var encoded_url = encodeURIComponent(url);
+ $('#xavcc-shorturl-result-twitter').attr('href', 'http://twitter.com/?status=' + encoded_url);
+ $('#xavcc-shorturl-result-delicious').attr('href', 'http://www.delicious.com/save?v=5&noui&jump=close&url=' + encoded_url);
+ $('#xavcc-shorturl-result-blogmarks').attr('href', 'http://blogmarks.net/my/new.php?mini=1&simple=1&url=' + tablink);
+
+ $('.xavcc-shorturl-result-success').attr('display', 'block').attr('height', 'auto');
+ } else {
+ $('.xavcc-shorturl-result-success').remove();
+ $('#xavcc-shorturl-result').attr('height', '50px');
+ $('.xavcc-shorturl-result-error').html(url);
+ $('.xavcc-shorturl-result-error').attr('border', '1px white solid');
+ }
+ }
+ }
+
+ safari.self.addEventListener("message", showResult, false);
+}

0 comments on commit 9682087

Please sign in to comment.