Commits

Anonymous committed 2c0d10f

Added some defaults for the services twitter.com and identi.ca. Some minor changes and bugfixes.

Comments (0)

Files changed (1)

         return this.replace(/(https?:\/\/\S+)/gi,'<a href="$1">$1</a>').replace(/(^|\s)@(\w+)/g,'$1<a href="http://twitter.com/$2">@$2</a>').replace(/(^|\s)#(\w+)/g,'$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
 	},
     dentify: function(server) {
-		return this.replace(/(https?:\/\/\S+)/gi,'<a href="$1">$1</a>').replace(/(^|\s)@(\w+)/g,'$1<a href="'+server+'/$2">@$2</a>').replace(/(^|\s)#(\w+)/g,'$1<a href="'+server+'/search/notice?q=%23$2&search=Search">#$2</a>').replace(/(^|\s)!(\w+)/g,'$1<a href="'+server+'/search/group?q=$2&search=Search">!$2</a>');
+		return this.replace(/(https?:\/\/\S+)/gi,'<a href="$1">$1</a>').replace(/(^|\s)@(\w+)/g,'$1<a href="'+server+'/$2">@$2</a>').replace(/(^|\s)#(\w+)/g,'$1<a href="'+server+'/search/notice?q=%23$2&search=Search">#$2</a>').replace(/(^|\s)!(\w+)/g,'$1<a href="'+server+'/group/$2">!$2</a>');
 	}
 });
 
 	    avatar: "top",
 	    avatar_size: "50",
 	    container: $("identica_widget"),
-	    twitter_mode: "0"
+	    service: "identi.ca"	//supported services: "identi.ca", "twitter.com", "status.net"(options.server required)
 	},
 	initialize: function(options){
+		if(options.service == "twitter") {
+			options.follow_text = (options.follow_text == null) ? "Follow me on twitter.com" : options.follow_text ;
+			options.server = (options.server == null) ? "http://twitter.com" : options.server ;
+			options.api_path = (options.api_path == null) ? "" : options.api_path ;
+		} else if(options.service == "identi.ca") {
+			options.follow_text = (options.follow_text == null) ? "Follow me on identi.ca" : options.follow_text ;
+			options.server = (options.server == null) ? "http://identi.ca" : options.server ;
+			options.api_path = (options.api_path == null) ? "api/" : options.api_path ;
+		} else {
+			//custom status.net instance
+			//please set server and api_path manually
+		}
 	    this.setOptions(options);
 	    TwAPIReq = new Request.JSONP({
 	        url: this.options.server+'/'+this.options.api_path+"/statuses/"+this.options.timeline+".json?screen_name="+this.options.user_name+"&count="+this.options.msg_count,
 	            }
 	            link.inject(this.options.container, 'top');
 	            data.each(function(status){
-	                if(this.options.twitter_mode == 1){
+	                if(this.options.service == "twitter"){
 	                    html_to_inject = status.text.tweetify();
 	                } else {
 	                    html_to_inject = status.text.dentify(this.options.server);