SeatNext Ext Bookmarklet
by
yutacar
2010-10-24 [2010/10/24 09:43:50]
ATND, tweetviteからSeatNextへImportするBookmarklet
@@ -4,105 +4,8 @@
* @include http://atnd.org/*
* @include http://tweetvite.com/*
* @license MIT License
- * @require jquery
*/
-(
-function(){
- var url = location.href;
- var user = [];
- var mode = [];
- var form = {
- "tid" : "tidadd",
- "nick" : "nickadd",
- "label" : "labeladd"
- };
- if (url != "") {
- if (url.indexOf( "http://atnd.org/events/") > -1) {
- var event_id = url.replace("http://atnd.org/events/", "");
- $.ajax({
- url: "http://api.atnd.org/events/users/",
- dataType: "jsonp",
- data: {
- event_id: event_id,
- format: "jsonp"
- },
- success: function(json){
- var events = json.events;
- for (var i = 0; i < events.length; i++) {
- var event = events[i];
- // title
- //user.push(event.title);
- //mode.push("label");
- for (var j = 0; j < event.users.length; j++) {
- var u = event.users[j];
- if (u.status == 1) {
- if (u.twitter_id != null) {
- user.push(u.twitter_id);
- mode.push("tid");
- } else {
- user.push(u.nickname);
- mode.push("nick");
- }
- }
- }
- }
- openSeatNext(user, mode, form);
- },
- error: function(){
- alert('error');
- }
- }
- );
- } else if (url.indexOf( "http://tweetvite.com/event/") > -1) {
- var public_id = url.replace("http://tweetvite.com/event/", "");
- $.ajax({
- url: "http://pipes.yahoo.com/pipes/pipe.run",
- dataType: "jsonp",
- data: {
- _id: "028aa9b989f4cb07f0bd066ea4d615a9",
- public_id: public_id,
- _render: "json"
- },
- jsonp: "_callback",
- success: function(json){
- var guests = json.value.items[0].guests;
- // title
- //user.push("#" + public_id);
- //mode.push("label");
- for (var i = 0; i < guests.length; i++) {
- var guest = guests[i];
- if (guest.rsvp != "N") {
- if (guest.profile.service_type == "1") {
- user.push(guest.profile.display_name);
- mode.push("tid");
- } else {
- user.push(guest.profile.display_name);
- mode.push("nick");
- }
- }
- }
- openSeatNext(user, mode, form);
- },
- error: function(){
- alert('error');
- }
- });
- }
- }
- }
-)();
-function openSeatNext(user, mode, form) {
- var u = "";
- for (var i = 0; i < user.length; i++) {
- if (mode[i] == "tid" || mode[i] == "nick") {
- if (u != "") {
- u += "+";
- }
- if (mode[i] == "nick") {
- u += "$";
- }
- u += user[i];
- }
- }
- location.href = "http://www.seatnext.com/?import=" + u;
-}
+function addJs(a){var b=document.createElement("script");b.type="text/javascript";b.text=a;document.body.appendChild(b)}function jsop(a){var b=document.createElement("script");b.charset="UTF-8";b.src=a;document.body.appendChild(b)}
+(function(){var a=location.href;if(a!=""){addJs('function openSeatNext(d,c){for(var b="",a=0;a<d.length;a++)if(c[a]=="tid"||c[a]=="nick"){if(b!="")b+="+";if(c[a]=="nick")b+="$";b+=d[a]}location.href="http://www.seatnext.com/?import="+b};');if(a.indexOf("http://atnd.org/events/")>-1){a=a.replace("http://atnd.org/events/","");addJs('function atnd(a){var c=[],d=[];a=a.events;for(var e=0;e<a.length;e++)for(var g=a[e],f=0;f<g.users.length;f++){var b=g.users[f];if(b.status==1)if(b.twitter_id!=null){c.push(b.twitter_id);d.push("tid")}else{c.push(b.nickname);d.push("nick")}}openSeatNext(c,d)};');
+jsop("http://api.atnd.org/events/users/?event_id="+a+"&format=jsonp&callback=atnd")}else if(a.indexOf("http://tweetvite.com/event/")>-1){a=a.replace("http://tweetvite.com/event/","");addJs('function tweetvite(a){var c=[],d=[];a=a.value.items[0].guests;for(var e=0;e<a.length;e++){var b=a[e];if(b.rsvp!="N")if(b.profile.service_type=="1"){c.push(b.profile.display_name);d.push("tid")}else{c.push(b.profile.display_name);d.push("nick")}}openSeatNext(c,d)};');jsop("http://pipes.yahoo.com/pipes/pipe.run?_id=028aa9b989f4cb07f0bd066ea4d615a9&_render=json&public_id="+
+a+"&_callback=tweetvite")}}})();
/*
* @title SeatNext Ext Bookmarklet
* @description ATND, tweetviteからSeatNextへImportするBookmarklet
* @include http://atnd.org/*
* @include http://tweetvite.com/*
* @license MIT License
*/
function addJs(a){var b=document.createElement("script");b.type="text/javascript";b.text=a;document.body.appendChild(b)}function jsop(a){var b=document.createElement("script");b.charset="UTF-8";b.src=a;document.body.appendChild(b)}
(function(){var a=location.href;if(a!=""){addJs('function openSeatNext(d,c){for(var b="",a=0;a<d.length;a++)if(c[a]=="tid"||c[a]=="nick"){if(b!="")b+="+";if(c[a]=="nick")b+="$";b+=d[a]}location.href="http://www.seatnext.com/?import="+b};');if(a.indexOf("http://atnd.org/events/")>-1){a=a.replace("http://atnd.org/events/","");addJs('function atnd(a){var c=[],d=[];a=a.events;for(var e=0;e<a.length;e++)for(var g=a[e],f=0;f<g.users.length;f++){var b=g.users[f];if(b.status==1)if(b.twitter_id!=null){c.push(b.twitter_id);d.push("tid")}else{c.push(b.nickname);d.push("nick")}}openSeatNext(c,d)};');
jsop("http://api.atnd.org/events/users/?event_id="+a+"&format=jsonp&callback=atnd")}else if(a.indexOf("http://tweetvite.com/event/")>-1){a=a.replace("http://tweetvite.com/event/","");addJs('function tweetvite(a){var c=[],d=[];a=a.value.items[0].guests;for(var e=0;e<a.length;e++){var b=a[e];if(b.rsvp!="N")if(b.profile.service_type=="1"){c.push(b.profile.display_name);d.push("tid")}else{c.push(b.profile.display_name);d.push("nick")}}openSeatNext(c,d)};');jsop("http://pipes.yahoo.com/pipes/pipe.run?_id=028aa9b989f4cb07f0bd066ea4d615a9&_render=json&public_id="+
a+"&_callback=tweetvite")}}})();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。