/
global.js
22 lines (19 loc) · 851 Bytes
/
global.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Generated by CoffeeScript 1.6.2
(function() {
safari.application.addEventListener("validate", function(event) {
if (event.command === "flipIt") {
return event.target.disabled = safari.application.activeBrowserWindow.activeTab.url == null;
}
});
safari.application.addEventListener("command", function(event) {
var activeBrowserWindow, currentTime, shareUrl, title, url;
if (event.command === "flipIt") {
activeBrowserWindow = safari.application.activeBrowserWindow;
url = activeBrowserWindow.activeTab.url;
title = activeBrowserWindow.activeTab.title;
currentTime = new Date().getTime();
shareUrl = "https://share.flipboard.com/flipit/load?v=1.0&url=" + url + "&title=" + title + "&t=" + currentTime;
return activeBrowserWindow.openTab().url = shareUrl;
}
});
}).call(this);