javascript:(function(){
var openURL = function(url) {
var host = "ws://grassboy.tw:5400";
var channel = "grassboy-own-channel";
var gWebSocket = window.MozWebSocket || window.WebSocket;
var CreateWebSocket = function(host, channel) {
var webSocket = new gWebSocket(['ws://grassboy.tw:5400/', channel, '/---/', encodeURIComponent(url)].join(''), 'gSyncURL-Push');
return webSocket;
};
CreateWebSocket(host, channel);
};
//openURL("http://tw.yahoo.com");
jQuery("#content").on("click", ".article-link", function(e) {
e.preventDefault();
$.ajax({
url: "http://query.yahooapis.com/v1/public/yql?q=select%20%20value%20from%20html%20where%20url%3D%22" + encodeURIComponent(this.href) + "%22%20and%20xpath%3D'%2F%2F*%2Fdiv%5B%40class%3D%22address-bar%22%5D%2Finput'&format=json",
dataType: "jsonp",
type: "get",
}).success(function(result, state) {
var real_url;
if (state == "success") {
if (result.query && result.query.results && result.query.results.input && (real_url = result.query.results.input.value)) {
openURL(real_url+"?syncURL");
}
}
});
});
})()