130 IriSP.__guidCounter += 1; |
130 IriSP.__guidCounter += 1; |
131 return prefix + IriSP.__guidCounter; |
131 return prefix + IriSP.__guidCounter; |
132 }; |
132 }; |
133 |
133 |
134 /** returns an url to share on facebook */ |
134 /** returns an url to share on facebook */ |
135 IriSP.mkFbUrl = function(url) { |
135 IriSP.mkFbUrl = function(url, text) { |
136 return "http://www.facebook.com/share.php?u=" + "I'm watching " + url; |
136 if (typeof(text) === "undefined") |
|
137 text = "I'm watching "; |
|
138 |
|
139 return "http://www.facebook.com/share.php?u=" + IriSP.encodeURI(text) + IriSP.shorten_url(url); |
137 }; |
140 }; |
138 |
141 |
139 /** returns an url to share on twitter */ |
142 /** returns an url to share on twitter */ |
140 IriSP.mkTweetUrl = function(url) { |
143 IriSP.mkTweetUrl = function(url, text) { |
141 return "http://twitter.com/home?status=" + "I'm sharing " + url; |
144 if (typeof(text) === "undefined") |
|
145 text = "I'm watching "; |
|
146 |
|
147 return "http://twitter.com/home?status=" + IriSP.encodeURI(text) + IriSP.shorten_url(url); |
142 }; |
148 }; |
143 |
149 |
144 /** returns an url to share on google + */ |
150 /** returns an url to share on google + */ |
145 IriSP.mkGplusUrl = function(url) { |
151 IriSP.mkGplusUrl = function(url, text) { |
146 return ""; |
152 return ""; |
147 }; |
153 }; |
148 |
154 |
149 /** test if a value is null or undefined */ |
155 /** test if a value is null or undefined */ |
150 IriSP.null_or_undefined = function(val) { |
156 IriSP.null_or_undefined = function(val) { |
151 return (typeof(val) === "undefined" || val === null); |
157 return (typeof(val) === "undefined" || val === null); |
152 } |
158 }; |
|
159 |
|
160 /** issue a call to an url shortener and return the shortened url */ |
|
161 IriSP.shorten_url = function(url) { |
|
162 if (IriSP.config.shortener.hasOwnProperty("shortening_function")) |
|
163 return IriSP.config.shortener.shortening_function(url); |
|
164 |
|
165 return url; |
|
166 }; |
|
167 |
153 /* for ie compatibility |
168 /* for ie compatibility |
154 if (Object.prototype.__defineGetter__&&!Object.defineProperty) { |
169 if (Object.prototype.__defineGetter__&&!Object.defineProperty) { |
155 Object.defineProperty=function(obj,prop,desc) { |
170 Object.defineProperty=function(obj,prop,desc) { |
156 if ("get" in desc) obj.__defineGetter__(prop,desc.get); |
171 if ("get" in desc) obj.__defineGetter__(prop,desc.get); |
157 if ("set" in desc) obj.__defineSetter__(prop,desc.set); |
172 if ("set" in desc) obj.__defineSetter__(prop,desc.set); |