-
Notifications
You must be signed in to change notification settings - Fork 0
/
w.js
17 lines (17 loc) · 8.32 KB
/
w.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var WS=function(ma,W){function X(){var a=na.value,c=I(oa),d=I(pa),m=I(qa),r=I(ra),j,h;j=!0===s.checked?s.value:!0===B.checked?B.value:!0===C.checked?C.value:D.value;h=!0===Y.selected?Y.value:!0===Z.selected?Z.value:!0===$.selected?$.value:sa.value;aa={};A=(new Date).getTime();E=J=0;ta.innerHTML="0/0";ba.innerHTML=Ca;e=b("e");e.style.display="block";ua.className="n";K&&(k("query",a),k("atonly",c),k("lionly",d),k("strict",m),k("nonstop",r),k("range",j),k("period",h));if(""!==h){var y=Da;switch(h){case "w":y*=
7;break;case "m":y*=30}h=A-y}if(a){y="ig";m&&(y="g");for(var a=a.replace(/\u3000/g," ").replace(/^\s+|\s+$/g," ").split(" "),f=0,g=a.length;f<g;f++)a[f]=RegExp("("+L(a[f]).replace(/([\\|\(|\)|\{|\}|\[|\]|\.|\^|\||\+|\*|\?|\$])/g,"\\$1")+")",y)}a={ec:0,sc:0,bc:0,atonly:c,lionly:d,strict:m,nonstop:r,range:j,period:h,word:a,q:M[j],qid:A};"star"!==j?N(a,!1):(j=(j=t("star"))?x.parse(j):{},Ea(j,a,Math.floor(A/1E3)));return!1}function va(a,c){if(A===c.qid){var d="",m="",r="",j=c.word,h=0,g,f,w,e,u,n,k,z,
i,p,v,l,q;for(g in a){f=a[g];i=f.user;w=L(f.message);n={};k=z="";p=!0;f.attachment&&(n=f.attachment,k=L(n.name),z=L(n.description),e=n.media);i&&(m=i.name,r=i.profile_url);if(1==c.atonly&&!k&&!z&&!e||1==c.lionly&&f.likes&&!f.likes.user_likes||c.period>1E3*f.created_time)p=!1;else if(""!==j[0]){u=w+k+z;i&&i.name&&(u+=i.name);if(f.comments){i=f.comments.comment_list;l="";v=0;for(q=i.length;v<q;v++)l+=" "+i[v].text;u+=l}v=0;for(q=j.length;v<q;v++)if(i=j[v],u.match(i))w=w.replace(i,G),k=k.replace(i,G),
z=z.replace(i,G),l=l.replace(i,G),m=m.replace(i,G);else{p=!1;break}}if(p){aa[f.post_id]=f;u=p="";v=i=f.permalink;n&&n.properties&&(e[0]?(e=e[0],i=e.href,u=F[0]+i+F[1]+e.src+F[2]+i+F[3]+k+F[4]+z+F[5]):(i=f.attachment.href,u=O[0]+i+O[1]+k+O[2]+z+O[3]));"star"!==c.range&&(p=ca[0]+f.post_id+ca[1],p=f.likes.user_likes?p+P:p+S,p+=ca[2]);n=new Date(1E3*f.created_time);d+=o[0]+f.actor_id+o[1]+r+o[2]+m+o[3]+w+o[4]+u+o[5]+l+o[6]+n.getFullYear()+"/"+H(n.getMonth()+1)+"/"+H(n.getDate())+" "+H(n.getHours())+":"+
H(n.getMinutes())+":"+H(n.getSeconds())+o[7]+v+o[8]+i+o[9]+p+o[10];if(da){if(w=t("star"))w=x.parse(w),w[f.post_id]&&(d+=" o");d+=o[11]+f.post_id+o[12]}h++}}J+=a.length;if(d){E+=h;var m=c.range+E,r=W.createElement("div"),s;r.id=m;r.className="wc";r.innerHTML=d;ba.insertBefore(r,ba.lastChild);s=b(m);ea(s,function(){s.style.height="auto"})}ta.innerHTML=E+"/"+J;c.sc=E;return g}}function Ea(a,c){var d=0,m=[],b;for(b in a)m[d]=a[b],d++;m.sort(function(a,c){return a.created_time<c.created_time?1:-1});setTimeout(function(){va(m,
c);fa()},100)}function N(a,c){if(A===a.qid){var d=a.q;c&&(d+=" AND created_time<"+c);FB.api({method:"fql.multiquery",queries:{q1:d,q2:"select uid,name,profile_url from user where uid IN(select actor_id from #q1)"}},function(d){if(d.error_msg)return!1;if(A===a.qid){var b=d[0].fql_result_set;if(b.length){var j=d[1].fql_result_set,d={},h,e;h=0;for(e=b.length;h<e;h++)g[a.range][b[h].post_id]=b[h];h=0;for(e=j.length;h<e;h++)d[j[h].uid]=j[h];da&&x.parse(x.stringify(g[a.range]));for(h in b)j=b[h],j.user=
d[j.actor_id];var f=va(b,a);a.ec=0;!a.nonstop&&10<=a.sc-a.bc?(a.bc=a.sc,a.last_time=b[f].created_time,fa(a)):setTimeout(function(){N(a,b[f].created_time)},500)}else 5>a.ec?(a.ec++,setTimeout(function(){N(a,c)},500)):fa()}})}}function fa(a){e.style.display="block";e.className="";e.innerHTML=wa;ua.className="";a&&a.last_time?e.onclick=function(){var c=a.last_time;delete a.last_time;N(a,c);delete e.onclick;e.className="n";e.innerHTML=xa}:(e.innerHTML=ya,e.className="e")}function t(a){return K["wallsearch-"+
a]}function k(a,c){K["wallsearch-"+a]=c}function H(a){return 10>1*a?"0"+a:a}function L(a){return a?a.replace(/<|>/g,function(a){return{"<":"<",">":">"}[a]}):""}function I(a){return!0===a.checked?a.value:""}function b(a){return W.getElementById(a)}function ea(a,c){a.style.height="auto";var d=a.scrollHeight;a.style.height="0";za(a,"height",d,0,c)}function za(a,c,d,b,e){var g=1*new Date,h=a.style,k=setInterval(function(){var a=new Date-g,l=d*a/70+b;70<a&&(clearInterval(k),l=b+d,e&&setTimeout(function(){e()},
10));h[c]=l+"px"},10)}(function(a){var c=a.createElement("script");c.id="facebook-jssdk";c.async=!0;c.src="//connect.facebook.net/en_US/all.js";a.getElementsByTagName("head")[0].appendChild(c)})(W);ma.fbAsyncInit=function(){FB.init({appId:"168589393194273",channelUrl:"//atms.sakura.ne.jp/amidawars/index.php",status:!0,cookie:!0,xfbml:!0});var a=b("s");ea(a,function(){a.style.overflow="visible"});Q&&X()};var ba=b("w"),ta=b("o"),na=b("q"),ua=b("b"),T=b("d"),s=b("rm"),B=b("rf"),C=b("ra"),D=b("rs"),ga=
b("lm"),ha=b("lf"),ia=b("la"),ja=b("ls"),l=ga,Y=b("pn"),Z=b("ph"),$=b("pw"),sa=b("pm"),oa=b("ao"),pa=b("lo"),qa=b("os"),ra=b("ns"),e,wa="\u3082\u3063\u3068\u691c\u7d22\u3059\u308b",ya="\u691c\u7d22\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f",S="\u3044\u3044\u306d\uff01",P="\u3044\u3044\u306d\u3092\u53d6\u308a\u6d88\u3059",Aa="\u3044\u3044\u306d\uff01\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\u6642\u9593\u3092\u7f6e\u3044\u3066\u3082\u3046\u4e00\u5ea6\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002",
E,J,A,aa,g={me:{},friends:{},all:{}},o='<article><img src="https://graph.facebook.com/,/picture" class="i" /><div><h2><a href="," target="_blank">,</a></h2><p>,</p>,<aside>,</aside><time>,</time><nav>\u00b7 <a href="," target="_blank" class="u">\u3082\u3063\u3068\u898b\u308b</a>\u00b7 <a href="http://www.facebook.com/sharer.php?u=," target="_blank" class="u">\u30b7\u30a7\u30a2</a>,</nav></div><a class="s," title="\u661f" name="," onclick="WS.star(this)">\u2605</a></article>'.split(","),ca=['\u00b7 <a href="javascript:void(0);" onclick="WS.like(\'',
"',this);\">","</a>"],F='<blockquote><a href="," target="_blank" class="h"><img src="," /></a><div><h3><a href="," target="_blank">,</a></h3><p>,</p></div></blockquote>'.split(","),O=['<blockquote><h2><a href="','" target="_blank">',"</a></h2><p>","</p></blockquote>"],G="<mark>$1</mark>",xa='<span class="a c"><span class="a1"></span><span class="a2"></span><span class="a3"></span></span>',Ca='<p id="e">'+xa+"</p>",Ba={"delete":S,post:P},M={me:'=me() AND permalink!=""',friends:"in(SELECT target_id FROM connection WHERE source_id=me())AND source_id!=me()",
all:"in(SELECT target_id FROM connection WHERE source_id=me())"},q,Da=864E5,da=!0,x=JSON,K=ma.localStorage,ka=!1;"ja_JP"!==LA&&(wa="More",ya="Search Exit.",S="Like",P="unlike",Aa="Like Failed. Please try again at intervals.",Ba={"delete":S,post:P});for(q in M)M[q]="SELECT post_id,actor_id,message,created_time,permalink,attachment,comments,likes FROM stream WHERE source_id "+M[q]+" AND is_hidden=0";if(K&&"object"===typeof x&&x.stringify&&x.parse){q=t("query");var U=t("range"),la=t("period");Q&&(q=
Q);R&&(U=R);q&&(na.value=q);if(U&&"me"!==U)switch(s.checked=!1,U){case "friends":B.checked=!0;l=ha;break;case "all":C.checked=!0;l=ia;break;default:D.checked=!0,l=ja}l.className="v";if(la&&""!==la)switch(Y.selected=!1,la){case "h":Z.selected=!0;break;case "w":$.selected=!0;break;default:sa.selected=!0}1==t("atonly")&&(oa.checked=!0);1==t("lionly")&&(pa.checked=!0);1==t("strict")&&(qa.checked=!0);1==t("nonstop")&&(ra.checked=!0)}else da=!1,D.disabled=!0,o[10]="</div></div></div></li>";b("y").onclick=
function(){X();return false};var V=function(a,c){s.checked=B.checked=C.checked=D.checked=false;c.checked=true;X();l.className="";l=a;l.className="v";return false};s.onclick=ga.onclick=function(){return V(ga,s)};B.onclick=ha.onclick=function(){return V(ha,B)};C.onclick=ia.onclick=function(){return V(ia,C)};D.onclick=ja.onclick=function(){return V(ja,D)};b("v").onclick=function(){if(ka===false){ka=true;ea(T)}else{ka=false;za(T,"height",-T.scrollHeight,T.scrollHeight,void 0)}};(function(a){if(a)a.onclick=
function(){location.hash=a.href;location.hash="";return false}})(b("pt"));return{like:function(a,c,b){c.disabled=true;if(g.me[a])b=g.me[a].likes.user_likes;else if(g.friends[a])b=g.friends[a].likes.user_likes;else if(g.all[a])b=g.all[a].likes.user_likes;b=b===true?"delete":"post";FB.api("/"+a+"/likes",b,function(e){if(e&&!e.error){c.innerHTML=Ba[b];if(g.me[a])g.me[a].likes.user_likes=!g.me[a].likes.user_likes;if(g.friends[a])g.friends[a].likes.user_likes=!g.friends[a].likes.user_likes;if(g.all[a])g.all[a].likes.user_likes=
!g.all[a].likes.user_likes}else alert(Aa);c.disabled=false});return false},star:function(a){var b=t("star"),d=a.name,b=b?x.parse(b):{};if(a.className==="s"){a.className="s o";b[d]=aa[d]}else{a.className="s";delete b[d]}k("star",x.stringify(b))}}}(window,document);