[Pyukiwiki-cvs 0010106] CVS update: PyukiWiki-Devel/skin

Zurück zum Archiv-Index

PyukiWiki CVS Commit pyuki****@lists*****
2012年 3月 22日 (木) 05:07:03 JST


Index: PyukiWiki-Devel/skin/twitter.js
diff -u PyukiWiki-Devel/skin/twitter.js:1.441 PyukiWiki-Devel/skin/twitter.js:1.442
--- PyukiWiki-Devel/skin/twitter.js:1.441	Wed Mar 21 17:35:08 2012
+++ PyukiWiki-Devel/skin/twitter.js	Thu Mar 22 05:07:03 2012
@@ -1,5 +1,5 @@
 /* "PyukiWiki" ver 0.2.0-p3-dev2 $$
- * $Id: twitter.js,v 1.441 2012/03/21 08:35:08 papu Exp $
+ * $Id: twitter.js,v 1.442 2012/03/21 20:07:03 papu Exp $
  */
 
-eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('y P,J=25,1h="27",1d="2m",1e="2e",17=13,18="2d",1A=13,19="#1j",1t=11,1N="#1j",1S=12,X="Z",N=0,2a=/@(\\w+)/x,2b=/\\#([^\\s]+)/x,2f=/((((1p|f){1}(1q:[/][/]){1})|((1r.){1}))[-a-1s-1z-9@:;%V\\+.~#?\\&\\/\\/=]+)/x,1l=/Z([0-3-4-f][0-3-4-f][0-3-4-f]|[0-3-4-f][0-3-4-f][0-3-4-f][0-3-4-f][0-3-4-f][0-3-4-f])/x;t 1m(h,l,k,m,c,j,d,e,g,b,a){y f;f=\'<S R="\'+b+\'" u="H-6:\'+5(d)+"; 14:  2g 2l "+5(m)+\';">\';f=f+\'<C><1k R="10%" u="H-6:\'+5(c)+"; 6:"+5(j)+\';">\'+l+"</1k></C>";f=f+\'<C><I R="10%" u="H-6:\'+5(d)+"; 6:"+5(e)+\';"><B 2j="v"></B></I></C>\';f=f+"</S>";f=f.z(1l,"#$1");J=k;8(a==1){N=1}8(h.Q(/^@/)){h=h.z(/^@/,"");1f(h)}Y{1i(h)}$("#1m").W(f)}t 1i(c,b,d,a){$.1g
 ("E://T.v.D/T.1n?29="+J+"&q="+1P(c)+"&1o=?",t(l){y q,m="",s=1h,g=1d,p=1e;8(b){s=b}8(d){g=d}8(a){p=a}1v(i=0;i<J;i++){1w{q=l.1Y[i];y r=q.L,k=q.1Z,o=q.1X,j=q.1x,h=q.1y,f=q.1u;m=m+U(k,o,j,r,s,g,p,h,f)}1c(n){}}$("#v").W(m)})}t 1f(c,b,d,a){$.1g("E://v.D/1W/1U/"+c+".1n?1o=?",t(j){y f="",g="",h="",l="";8(b){g=b}8(d){h=d}8(a){l=a}1v(i=0;i<J;i++){1w{f=f+U(j[i].F.2n,j[i].F.23,j[i].F.1x,j[i].L,g?g:j[i].F.24,h?h:j[i].F.2i,l?2o:j[i].F.2v,j[i].1y,j[i].1u)}1c(k){}}$("#v").W(f)})}t U(p,d,h,o,j,m,g,f,c){y b=/@(\\w+)/x,l=/\\#([A-2r-2q-9\\-\\V]+)/x,e=/\\#([^\\s]+)/x,a=/((((1p|f){1}(1q:[/][/]){1})|((1r.){1}))[-a-1s-1z-9@:;%V\\+.~#?\\&\\/\\/=]+)/x,n=/Z([0-3-4-f][0-3-4-f][0-3-4-f]|[0-3-4-f][0-3-4-f][0-3-4-f][0-3-4-f][0-3-4-f][0-3-4-f])/x;P=m;o=o.z(a,t(q){7 1F(q)});o=o.z(b,G("E://v.D/$1","@$1","@$1"));o=o.z(e,t(q){7 1R(q)});y k="<1T u=\'H-6:"+5(g)+"\';><S><C><I 1b=\'1a\' u=\'H-6:"+5(g)+"\';>"+G("E://v.D/"+p,d)+"<2p 14=\'0\' 2z=\'"+h+"\' /></a></I><I 1b=\'1a\' R=\'10%\' u=\'H-6:"+5(g)+"\';><16 u=\'M
 -O: "+17+"K; 6:"+5(18)+";\'>"+G("E://v.D/"+p,d,d)+"</a></16><B u=\'M-O: "+1A+"K; 6:"+5(19)+"\'>&15;@"+p+"&15;</B><B u=\'28: 2h; 2k: 2c; M O:"+1t+"K; 6:"+5(1N)+"\'>("+1M(f)+")</B><2w /><B u=\'M-O:"+1S+"K; 6:"+5(j)+"\'>"+o+"</I></C></S></1T>";k=k.z(n,"#$1");7 k}t 1R(a){7 G("E://v.D/T/"+1P(a),a,a)}t 1F(a){7 G(a,a,((a.2x>2s)?(a.2t(0,20)+"&2y;"):a))}t G(a,d,b){y e;8(N==1){e=\'<a 1E="1D" N="1G" 1B="\'+a+\'" 1C="7 1H(\\\'\'+a+"\',\'1G\');\\" 1I=\\""+d+\'" u="L-1Q:1O;6:\'+5(P)+\'";>\'}Y{e=\'<a 1E="1D" 1B="\'+a+\'" 1C="7 1H(\\\'\'+a+"\',\'2u\');\\" 1I=\\""+d+\'" u="L-1Q:1O;6:\'+5(P)+\'";>\'}8(b){7 e+b+"</a>"}7 e}t 5(a){8(26 a==="22"){7"21"}a=a.z(/#/,"");a=a.1V();8(a.Q(/^[0-3-4-f][0-3-4-f][0-3-4-f]/)){7 X+a}8(a.Q(/^......$/)){7 X+a}7 a}t 1M(a){8(a.Q(",")){a=1J 1K(a)}Y{a=a.z(/(\\d\\d:\\d\\d:\\d\\d)\\s\\+1L\\s(\\d\\d\\d\\d)$/,"$2 $1 +1L");a=1J 1K(a)}7 a};',62,160,'|||9A|Fa|mkcolor|color|return|if|||||||||||||||||||||function|style|twitter||gm|var|replace||span|tr|com|http|user|mklink|ba
 ckground|td|counts|px|text|font|target|size|lc|match|width|table|search|twitter_line|_|html|color_hash|else|____C____|100||||border|nbsp|strong|name_font_size|name_color|screen_name_color|top|valign|catch|default_profile_link_color|default_profile_sidebar_fill_color|getuser|getJSON|default_profile_text_color|getsearch|555|th|colortoRE|twitwindow|json|callback|ht|tp|www|zA|info_font_size|source|for|try|profile_image_url|created_at|Z0|screen_name_font_size|href|onclick|tlink|class|replaceUrl|_blank|ou|title|new|Date|0000|timeformat|info_color|none|encodeURIComponent|decoration|mkhash|text_font_size|div|user_timeline|toLowerCase|statuses|from_user_name|results|from_user||transport|undefined|name|profile_text_color|500|typeof|333333|position|rpp|twitterUsernameRE|twitterHashi18nRE|0px|black|e1e1e1|urlRE|1px|relative|profile_link_color|id|right|solid|307ace|screen_name|profile_sidebar_file_collor|img|z0|Za|34|substring|_self|profile_sidebar_fill_color|br|length|hellip|src'.split(
 '|'),0,{}))
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('4 L(h,l,k,m,c,j,e,f,g,b,a){3.L(h,l,k,m,c,j,e,f,g,b,a)}u d=25,w=2b;u 3={W:0,I:2s,21:"2l",1U:"2f",1W:"2c",1j:13,1l:"2k",1g:13,1e:"1I",1R:11,1Y:"1I",1P:12,16:"1N",P:0,F:"",z:"z://",3:"H.1w",15:"&29;",X:"2j",1c:0,18:"",17:/1N([6][6][6]|[6][6][6][6][6][6])/N,L:4(j,m,l,n,c,k,e,f,h,b,a){u g;g=\'<S R="\'+b+\'" v="G-t:\'+3.8(e)+"; 1d:26 2a "+3.8(n)+\';">\';g=g+\'<C><1K R="1b%" v="G-t:\'+3.8(c)+"; t:"+3.8(k)+\';">\'+m+"</1K></C>";g=g+\'<C><E R="1b%" v="G-t:\'+3.8(e)+"; t:"+3.8(f)+\';"><A 23="H"></A></E></C>\';g=g+"</S>";g=g.x(3.17,"#$1");I=l;5(a==1){P=1}5(j.V(/^@/)){j=j.x(/^@/,"");3.1x(j)}B{3.1Q(j)}$("#L").M(g)},1Z:4(b,e,c){u a=3.z+"T."+3.3+"/T.1B?2r="+I+3.15+"
 q="+1J(b);a=a+3.15+"1v=?";7 a},1Q:4(c,b,e,a){3.F=3.1Z(c);$.19(3.F,4(g){u f=3.10(g,b,e,a);$("#H").M(f)});3.1a("T")},10:4(j,g,m,l){u q,k="",n=3.21,c=3.1U,p=3.1W;5(g){n=g}5(m){c=m}5(l){p=l}1A(i=0;i<I;i++){q=j.2h[i];u r=q.K,h=q.2q,o=q.2i,f=q.1z,e=q.1p,b=q.1q;k=k+3.14(h,o,f,r,n,c,p,e,b)}7 k},1m:4(b,e,c){u a=3.z+3.3+"/2g/2d/"+b+".1B";a=a+"?1v=?";7 a},1x:4(c,b,e,a){3.F=3.1m(c);$.19(3.F,4(g){u f=3.Y(g,b,e,a);$("#H").M(f)});3.1a("y")},Y:4(c,b,h,g){u f="",j="",a="",l="";5(b){j=b}5(h){a=h}5(g){l=g}1A(i=0;i<I;i++){2p{f=f+3.14(c[i].y.2m,c[i].y.2n,c[i].y.1z,c[i].K,j?j:c[i].y.2o,a?a:c[i].y.2t,l?27:c[i].y.28,c[i].1p,c[i].1q)}24(k){}}7 f},1a:4(a){3.18=a;5(Z w.1s!=3.X){w.1s("22",3.J)}B{5(Z d.1r!==3.X){d.1r("2e",3.J,2x)}B{d.2T(2W(\'%2U 1f="\'+3.J+\'" 2R="K/2Q"%1n%2M/2P%1n\'))}}},J:4(){2O(3.J,2N);5(3.1c==0){3.1c=1}B{$.19(3.F,4(b){u a;5(3.18=="y"){a=3.Y(b)}B{a=3.10(b)}$("#H").M(a)})}},14:4(o,e,j,n,k,m,h,g,c){u b=/@(\\w+)/N,f=/\\#([^\\s]+)/N,a=/((((2S|f){1}(2V:[/][/]){1})|((2L.){1}))[-a-2J-2z-9@:
 ;%2K\\+.~#?\\&\\/\\/=]+)/N;3.W=m;n=n.x(a,4(p){7 3.1M(p)});n=n.x(b,3.D("3.z + 3.3 + /$1","@$1","@$1"));n=n.x(f,4(p){7 3.1E(p)});u l="<1F v=\'G-t:"+3.8(h)+"\';><S><C><E 1h=\'1k\' v=\'G-t:"+3.8(h)+"\';>"+3.D("z://H.1w/"+o,e)+"<2u 1d=\'0\' 1f=\'"+j+"\' /></a></E><E 1h=\'1k\' R=\'1b%\' v=\'G-t:"+3.8(h)+"\';><1C v=\'O-Q:"+3.1j+"U; t:"+3.8(3.1l)+";\'>"+3.D(3.z+3.3+"/"+o,e,e)+"</a></1C><A v=\'O-Q:"+3.1g+"U; t:"+3.8(3.1e)+"\'>&1y;@"+o+"&1y;</A><A v=\'2v:2w; 2B:2C; O Q:"+3.1R+"U; t:"+3.8(3.1Y)+"\'>("+3.1i(g)+")</A><2H /><A v=\'O-Q:"+3.1P+"U; t:"+3.8(k)+"\'>"+n+"</E></C></S></1F>";l=l.x(3.17,"#$1");7 l},1E:4(a){7 3.D(3.z+3.3+"/T/"+1J(a),a,a)},1M:4(a){7 3.D(a,a,((a.2F>2D)?(a.2E(0,20)+"&2G;"):a))},D:4(a,e,b){u f;5(P==1){f=\'<a 1H="1S" P="1G" 1X="\'+a+\'" 1T="7 1V(\\\'\'+a+"\',\'1G\');\\" 1D=\\""+e+\'" v="K-1O:1L;t:\'+3.8(3.W)+\'";>\'}B{f=\'<a 1H="1S" 1X="\'+a+\'" 1T="7 1V(\\\'\'+a+"\',\'2I\');\\" 1D=\\""+e+\'" v="K-1O:1L;t:\'+3.8(3.W)+\'";>\'}5(b){7 f+b+"</a>"}7 f},8:4(a){5(Z a===3.X){7"
 2y"}a=a.x(/#/,"");a=a.2A();5(a.V(/^[6][6][6]/)){7 3.16+a}5(a.V(/^[6][6][6][6][6][6]$/)){7 3.16+a}7 a},1i:4(a){5(a.V(",")){a=1t 1o(a)}B{a=a.x(/(\\d\\d:\\d\\d:\\d\\d)\\s\\+1u\\s(\\d\\d\\d\\d)$/,"$2 $1 +1u");a=1t 1o(a)}7 a}};',62,183,'|||tw|function|if|0123456789ABCDEFabcdef|return|mkclr|||||||||||||||||||||color|var|style||replace|user|http|span|else|tr|mklink|td|url|background|twitter|counts|update|text|twitwindow|html|gm|font|target|size|width|table|search|px|match|lc|un|getuserhtml|typeof|getsearchhtml||||twitter_line|am|ch|cRE|mode|getJSON|attach|100|flg|border|s_color|src|s_font|valign|timeformat|n_font|top|n_color|mkuserurl|3E|Date|created_at|source|addEventListener|attachEvent|new|0000|callback|com|getuser|nbsp|profile_image_url|for|json|strong|title|mkhash|div|_blank|class|555|encodeURIComponent|th|none|replaceUrl|__C__|decoration|t_font|getsearch|i_font|tlink|onclick|d_link_color|ou|d_back_color|href|i_color|mksearchurl||d_text_color|onload|id|catch|document|1px|profi
 le_sidebar_fill_collor|profile_sidebar_fill_color|amp|solid|window|e1e1e1|user_timeline|DOMContentLoaded|307ace|statuses|results|from_user_name|undefined|000|333|screen_name|name|p_text_color|try|from_user|rpp|500|profile_link_color|img|position|relative|false|transport|Z0|toLowerCase|right|0px|34|substring|length|hellip|br|_self|zA|_|www|3C|6000|setTimeout|script|javascript|type|ht|write|3Cscript|tp|unescape'.split('|'),0,{}))
Index: PyukiWiki-Devel/skin/twitter.js.src
diff -u PyukiWiki-Devel/skin/twitter.js.src:1.436 PyukiWiki-Devel/skin/twitter.js.src:1.437
--- PyukiWiki-Devel/skin/twitter.js.src:1.436	Wed Mar 21 17:35:08 2012
+++ PyukiWiki-Devel/skin/twitter.js.src	Thu Mar 22 05:07:03 2012
@@ -1,209 +1,302 @@
 // "PyukiWiki" ver 0.2.0-p3-dev2 $$
-// $Id: twitter.js.src,v 1.436 2012/03/21 08:35:08 papu Exp $
+// $Id: twitter.js.src,v 1.437 2012/03/21 20:07:03 papu Exp $
 
-var lc, counts=500,
-	default_profile_text_color="333333",
-	default_profile_link_color="307ace",
-	default_profile_sidebar_fill_color="e1e1e1",
-	name_font_size=13,
-	name_color="black",
-	screen_name_font_size=13,
-	screen_name_color="#555",
-	info_font_size=11,
-	info_color="#555",
-	text_font_size=12,
-	color_hash="____C____",
-	target=0,
-	twitterUsernameRE= /@(\w+)/gm,
-//	twitterHashRE= /\#([A-Za-z0-9\-\_]+)/gm,
-	twitterHashi18nRE= /\#([^\s]+)/gm,
-	urlRE= /((((ht|f){1}(tp:[/][/]){1})|((www.){1}))[-a-zA-Z0-9@:;%_\+.~#?\&\/\/=]+)/gm,
-	colortoRE= /____C____([0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]|[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f])/gm;
 
 function twitwindow(keyword, title, max, border_color, header_background, header_font_color, content_background_color, content_font_color, link_color, width, popup) {
-	var html;
-	html='<table width="' + width + '" style="background-color:' + mkcolor(content_background_color) + '; border:  1px solid ' + mkcolor(border_color) + ';">';
-	html=html+'<tr><th width="100%" style="background-color:' + mkcolor(header_background) + '; color:' + mkcolor(header_font_color) + ';">' + title + '</th></tr>';
-	html=html+'<tr><td width="100%" style="background-color:' + mkcolor(content_background_color) + '; color:' + mkcolor(content_font_color) + ';"><span id="twitter"></span></td></tr>';
-	html=html+'</table>';
-	html = html.replace(colortoRE, '#$1');
-	counts=max;
-	if(popup == 1) target=1;
-	if(keyword.match(/^@/)) {
-		keyword=keyword.replace(/^@/, '');
-		getuser(keyword);
-	} else {
-		getsearch(keyword);
-	}
-	$("#twitwindow").html(html);
+	tw.twitwindow(keyword, title, max, border_color, header_background, header_font_color, content_background_color, content_font_color, link_color, width, popup);
 }
 
-function getsearch(str, text_color, link_color, sidebar_color) {
+var d=document,
+	w=window;
 
-	$.getJSON("http://search.twitter.com/search.json?rpp=" + counts + "&q=" + encodeURIComponent(str) + "&callback=?", function(data) {
+var	tw = {
+	lc:0,
+//	id:0,
+	counts:500,
+	d_text_color:"333",
+	d_link_color:"307ace",
+	d_back_color:"e1e1e1",
+	n_font:13,
+	n_color:"000",
+	s_font:13,
+	s_color:"555",
+	i_font:11,
+	i_color:"555",
+	t_font:12,
+	ch:"__C__",
+	target:0,
+	url:'',
+	http:"http://",
+	tw:"twitter.com",
+	am:"&amp;",
+	un:"undefined",
+//	src:"twitter_call",
+//	updatestr:"callback",
+	flg:0,
+	mode:'',
+	cRE:/__C__([0123456789ABCDEFabcdef][0123456789ABCDEFabcdef][0123456789ABCDEFabcdef]|[0123456789ABCDEFabcdef][0123456789ABCDEFabcdef][0123456789ABCDEFabcdef][0123456789ABCDEFabcdef][0123456789ABCDEFabcdef][0123456789ABCDEFabcdef])/gm,
+
+	twitwindow: function(keyword, title, max, border_color, header_background, header_font_color, content_background_color, content_font_color, link_color, width, popup) {
+		var html;
+		html='<table width="' + width + '" style="background-color:' + tw.mkclr(content_background_color) + '; border:1px solid ' + tw.mkclr(border_color) + ';">';
+		html=html+'<tr><th width="100%" style="background-color:' + tw.mkclr(header_background) + '; color:' + tw.mkclr(header_font_color) + ';">' + title + '</th></tr>';
+		html=html+'<tr><td width="100%" style="background-color:' + tw.mkclr(content_background_color) + '; color:' + tw.mkclr(content_font_color) + ';"><span id="twitter"></span></td></tr>';
+		html=html+'</table>';
+		html = html.replace(tw.cRE, '#$1');
+		counts=max;
+		if(popup == 1) target=1;
+		if(keyword.match(/^@/)) {
+			keyword=keyword.replace(/^@/, '');
+			tw.getuser(keyword);
+		} else {
+			tw.getsearch(keyword);
+		}
+		$("#twitwindow").html(html);
+	},
+	mksearchurl: function(str, callback, id) {
+		var url=tw.http + "search." + tw.tw + "/search.json?rpp=" + counts + tw.am + "q=" + encodeURIComponent(str);
+//		if(typeof callback === tw.un) {
+			url = url + tw.am + "callback=?";
+//		} else if(typeof id !== tw.un) {
+//			url = url + tw.am + "callback=" + callback + tw.am + "since_id=" + id;
+//		} else {
+//			url = url + tw.am + "callback=" + tw.am + "since_id=" + id;
+//		}
+		return url;
+	},
+	getsearch: function(str, text_color, link_color, sidebar_color) {
+		tw.url=tw.mksearchurl(str);
+		$.getJSON(tw.url, function(data) {
+
+			var html=
+				tw.getsearchhtml(data, text_color, link_color, sidebar_color);
+			$("#twitter").html(html);
+//			tw.url=tw.mksearchurl(str, tw.updatestr, tw.id);
+		});
+		tw.attach("search");
+	},
+	getsearchhtml: function(data, text_color, link_color, sidebar_color) {
 		var a, html="",
-			profile_text_color=default_profile_text_color,
-			profile_link_color=default_profile_link_color,
-			profile_sidebar_fill_color=default_profile_sidebar_fill_color;
+			p_text_color=tw.d_text_color,
+			profile_link_color=tw.d_link_color,
+			profile_sidebar_fill_color=tw.d_back_color;
 
-		if(text_color) profile_text_color=text_color;
+		if(text_color) p_text_color=text_color;
 		if(link_color) profile_link_color=link_color;
 		if(sidebar_color) profile_sidebar_fill_color=sidebar_color;
 
 		for(i=0; i< counts;i++) {
-			try {
+//			if(i == 0) tw.id=data.results[0].id;
+//			try {
 				a=data.results[i];
-					var	text=a.text,
+				var	text=a.text,
 					user=a.from_user,
 					user_name=a.from_user_name,
 					image=a.profile_image_url,
 					time=a.created_at,
 					source=a.source;
 
-				html=html + twitter_line(
+				html=html + tw.twitter_line(
 					user, user_name, image, text,
-					profile_text_color,
+					p_text_color,
 					profile_link_color,
 					profile_sidebar_fill_color,
 					time,source
 				);
-			} catch (e) {}
+//			} catch (e) {}
 		}
-		$("#twitter").html(html);
-	});
-}
-
-function getuser(str, text_color, link_color, sidebar_color) {
-
-	$.getJSON("http://twitter.com/statuses/user_timeline/" + str + ".json?callback=?", function(data) {
+		return html;
+	},
+	mkuserurl: function(str, callback, id) {
+		var url=tw.http + tw.tw + "/statuses/user_timeline/" + str + ".json";
+//		if(typeof callback === tw.un) {
+			url = url + "?callback=?";
+//		} else if(typeof id !== tw.un) {
+//			url = url + "?callback=" + callback + tw.am + "since_id=" + id;
+//		} else {
+//			url = url + "?callback=" + tw.am + "since_id=" + id;
+//		}
+		return url;
+	},
+	getuser: function(str, text_color, link_color, sidebar_color) {
+		tw.url=tw.mkuserurl(str);
+		$.getJSON(tw.url, function(data) {
+//			tw.id=data[0].id;
+			var html=
+				tw.getuserhtml(data, text_color, link_color, sidebar_color);
+
+			$("#twitter").html(html);
+//			tw.url=tw.mkuserurl(str, tw.updatestr, tw.id);
+		});
+		tw.attach("user");
+	},
+	getuserhtml: function(data, text_color, link_color, sidebar_color) {
 		var html="",
-			profile_text_color="",
+			p_text_color="",
 			profile_link_color="",
 			profile_sidebar_fill_color="";
-		if(text_color) profile_text_color=text_color;
+		if(text_color) p_text_color=text_color;
 		if(link_color) profile_link_color=link_color;
 		if(sidebar_color) profile_sidebar_fill_color=sidebar_color;
 
 		for(i=0; i< counts;i++) {
 			try {
-				html=html + twitter_line(
+				html=html + tw.twitter_line(
 					data[i].user.screen_name,
 						data[i].user.name,
 					data[i].user.profile_image_url,
 					data[i].text,
-					profile_text_color ? profile_text_color : data[i].user.profile_text_color,
+					p_text_color ? p_text_color : data[i].user.p_text_color,
 					profile_link_color ? profile_link_color : data[i].user.profile_link_color,
-					profile_sidebar_fill_color ? profile_sidebar_file_collor : data[i].user.profile_sidebar_fill_color,
+					profile_sidebar_fill_color ? profile_sidebar_fill_collor : data[i].user.profile_sidebar_fill_color,
 					data[i].created_at,
 					data[i].source
 				);
 			} catch (e) {}
+
 		}
-		$("#twitter").html(html);
-	});
-}
+		return html;
+	},
+	attach: function(mode) {
+		tw.mode=mode;
+        if(typeof w.attachEvent != tw.un)
+			w.attachEvent('onload', tw.update);
+        else if(typeof d.addEventListener !== tw.un)
+			d.addEventListener("DOMContentLoaded", tw.update, false);
+        else d.write(unescape('%3Cscript src="' + tw.update + '" type="text/javascript"%3E%3C/script%3E'));
+
+	},
+	update: function() {
+//		if(d.all && d.getElementById(tw.src)) {
+//			d.getElementById(tw.src).src = tw.url;
+//		} else if(d.getElementById(tw.src)) {
+//			var lol = d.getElementById(tw.src);
+//			lol.parentNode.removeChild(lol);
+//		} else {
+//			var element = d.createElement("script");
+//			element.src=tw.url;
+//			element.id = tw.src;
+//			d.body.appendChild(element);
+//		}
+		setTimeout(tw.update, 6000);
+		if(tw.flg == 0) {
+			tw.flg=1;
+		} else {
+			$.getJSON(tw.url, function(data) {
+				var html;
+				if(tw.mode == "user") {
+					html=tw.getuserhtml(data);
+				} else {
+					html=tw.getsearchhtml(data);
+				}
+				$("#twitter").html(html);
+			});
+		}
+	},
 
-function twitter_line(screen_name, name, image, text
+	twitter_line: function(screen_name, name, image, text
 		    , text_color, link_color, sidebar_fill_color, time, source) {
-	var
-		twitterUsernameRE= /@(\w+)/gm,
-		twitterHashRE= /\#([A-Za-z0-9\-\_]+)/gm,
-		twitterHashi18nRE= /\#([^\s]+)/gm,
-		urlRE= /((((ht|f){1}(tp:[/][/]){1})|((www.){1}))[-a-zA-Z0-9@:;%_\+.~#?\&\/\/=]+)/gm,
-		colortoRE= /____C____([0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]|[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f])/gm;
-
-	lc=link_color;
-	text = text.replace(
-		urlRE, function(t) {
-			return replaceUrl(t);
-		}
-	);
-
-	text= text.replace(
-		twitterUsernameRE,
-			mklink("http://twitter.com/$1","@$1","@$1")
-	);
-
-	text= text.replace(
-		twitterHashi18nRE, function(t) {
-			return mkhash(t);
-		}
-	);
-	var html="<div style='background-color:" + mkcolor(sidebar_fill_color) + "';>" +
-		"<table><tr><td valign='top' style='background-color:" + mkcolor(sidebar_fill_color) + "';>" +
-		mklink(
-			"http://twitter.com/" + screen_name,
-			name) +
-		"<img border='0' src=\'" +
-		image +
-		"\' /></a>" +
-		"</td><td valign='top' width='100%' style='background-color:" + mkcolor(sidebar_fill_color) + "';>" +
-		"<strong style='font-size: " + name_font_size + "px; color:" + mkcolor(name_color) + ";'>" +
-		mklink(
-			"http://twitter.com/" + screen_name,
-			name, name) +
-		"</a></strong>" +
-		"<span style='font-size: " + screen_name_font_size + "px; color:" + mkcolor(screen_name_color) + "'>" +
-		"&nbsp;@" + screen_name +
-		"&nbsp;</span>" +
-		"<span style='position: relative; right: 0px; font size:" + info_font_size + "px; color:" + mkcolor(info_color) + "'>(" +
-//		"ƒ\[ƒXF" + data[i].source + "A" +
-//		"Žž:" +
-		timeformat(time) +
-//		new Date(time) +
-//		time +
-		")</span><br />" +
-		"<span style='font-size:" + text_font_size + "px; color:" + mkcolor(text_color) +"'>" +
-		text +
-		"</td></tr></table></div>";
-
-	html = html.replace(colortoRE, '#$1');
-	return html;
-}
-
-function mkhash(keyword) {
-	return mklink("http://twitter.com/search/" + encodeURIComponent(keyword) , keyword, keyword)
-
-}
-function replaceUrl(t) {
-	return mklink(t, t, ((t.length > 34) ? (t.substring(0, 20) + '&hellip;') : t));
-}
+		var
+			twitterUsernameRE= /@(\w+)/gm,
+//			twitterHashRE= /\#([A-Za-z0-9\-\_]+)/gm,
+			twitterHashi18nRE= /\#([^\s]+)/gm,
+			urlRE= /((((ht|f){1}(tp:[/][/]){1})|((www.){1}))[-a-zA-Z0-9@:;%_\+.~#?\&\/\/=]+)/gm;
+
+		tw.lc=link_color;
+		text = text.replace(
+			urlRE, function(t) {
+				return tw.replaceUrl(t);
+			}
+		);
+
+		text= text.replace(
+			twitterUsernameRE,
+//				tw.mklink("http://twitter.com/$1","@$1","@$1")
+				tw.mklink("tw.http + tw.tw + /$1","@$1","@$1")
+		);
+
+		text= text.replace(
+			twitterHashi18nRE, function(t) {
+				return tw.mkhash(t);
+			}
+		);
+		var html="<div style='background-color:" + tw.mkclr(sidebar_fill_color) + "';>" +
+			"<table><tr><td valign='top' style='background-color:" + tw.mkclr(sidebar_fill_color) + "';>" +
+			tw.mklink(
+				"http://twitter.com/" + screen_name,
+				name) +
+			"<img border='0' src=\'" +
+			image +
+			"\' /></a>" +
+			"</td><td valign='top' width='100%' style='background-color:" + tw.mkclr(sidebar_fill_color) + "';>" +
+			"<strong style='font-size:" + tw.n_font + "px; color:" + tw.mkclr(tw.n_color) + ";'>" +
+			tw.mklink(
+//				"http://twitter.com/" + screen_name, name, name) +
+				tw.http + tw.tw + "/" + screen_name, name, name) +
+			"</a></strong>" +
+			"<span style='font-size:" + tw.s_font + "px; color:" + tw.mkclr(tw.s_color) + "'>" +
+			"&nbsp;@" + screen_name +
+			"&nbsp;</span>" +
+			"<span style='position:relative; right:0px; font size:" + tw.i_font + "px; color:" + tw.mkclr(tw.i_color) + "'>(" +
+//			" on " + data[i].source + " , " +
+			tw.timeformat(time) +
+			")</span><br />" +
+			"<span style='font-size:" + tw.t_font + "px; color:" + tw.mkclr(text_color) +"'>" +
+			text +
+			"</td></tr></table></div>";
+
+		html = html.replace(tw.cRE, '#$1');
+		return html;
+	},
+
+	mkhash: function(keyword) {
+		return tw.mklink(
+//			"http://twitter.com/search/"
+			tw.http + tw.tw + "/search/"
+			 + encodeURIComponent(keyword) , keyword, keyword)
+	},
+
+	replaceUrl:function(t) {
+		return tw.mklink(t, t, ((t.length > 34) ? (t.substring(0, 20) + '&hellip;') : t));
+	},
+
+	mklink: function(url, title, title2) {
+		var c;
+		if(target == 1) {
+			c="<a class=\"tlink\" target=\"_blank\" href=\"" + url + "\" onclick=\"return ou(\'" + url + "\',\'_blank\');\" title=\"" + title + "\" style=\"text-decoration:none;color:" + tw.mkclr(tw.lc) + "\";>";
+		} else {
+			c="<a class=\"tlink\" href=\"" + url + "\" onclick=\"return ou(\'" + url + "\',\'_self\');\" title=\"" + title + "\" style=\"text-decoration:none;color:" + tw.mkclr(tw.lc) + "\";>";
+		}
 
-function mklink(url, title, title2) {
-	var c;
-	if(target == 1) {
-		c="<a class=\"tlink\" target=\"_blank\" href=\"" + url + "\" onclick=\"return ou(\'" + url + "\',\'_blank\');\" title=\"" + title + "\" style=\"text-decoration:none;color:" + mkcolor(lc) + "\";>";
-	} else {
-		c="<a class=\"tlink\" href=\"" + url + "\" onclick=\"return ou(\'" + url + "\',\'_self\');\" title=\"" + title + "\" style=\"text-decoration:none;color:" + mkcolor(lc) + "\";>";
-	}
+		if(title2) {
+			return c + title2 + "</a>";
+		}
+		return c;
+	},
 
-	if(title2) {
-		return c + title2 + "</a>";
-	}
-	return c;
-}
+	mkclr: function(t) {
+		if(typeof t === tw.un) return "transport";
+		t = t.replace(/#/, '');
+		t = t.toLowerCase()
 
-function mkcolor(color) {
-	if(typeof color === "undefined") return "transport";
-	color = color.replace(/#/, '');
-	color=color.toLowerCase()
+		if(t.match(/^[0123456789ABCDEFabcdef][0123456789ABCDEFabcdef][0123456789ABCDEFabcdef]/)) {
+	 		return tw.ch + t;
+		}
 
-	if(color.match(/^[0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]/)) {
- 		return color_hash + color;
-	}
-	if(color.match(/^......$/)) {
-		return color_hash + color;
-	}
-	return color;
-}
+		if(t.match(/^[0123456789ABCDEFabcdef][0123456789ABCDEFabcdef][0123456789ABCDEFabcdef][0123456789ABCDEFabcdef][0123456789ABCDEFabcdef][0123456789ABCDEFabcdef]$/)) {
+			return tw.ch + t;
+		}
+		return t;
+	},
 
-function timeformat(t) {
-	if(t.match(',')) {
-		t=new Date(t);
-
-	} else {
-		t=t.replace(/(\d\d:\d\d:\d\d)\s\+0000\s(\d\d\d\d)$/,"$2 $1 +0000");
-		t=new Date(t);
+	timeformat: function(t) {
+		if(t.match(',')) {
+			t=new Date(t);
+
+		} else {
+			t=t.replace(/(\d\d:\d\d:\d\d)\s\+0000\s(\d\d\d\d)$/,"$2 $1 +0000");
+			t=new Date(t);
+		}
+		return t;
 	}
-	return t;
 }



Pyukiwiki-cvs メーリングリストの案内
Zurück zum Archiv-Index