--- a/integration/js/social.js Thu Nov 29 17:54:48 2012 +0100
+++ b/integration/js/social.js Thu Nov 29 19:28:10 2012 +0100
@@ -1,15 +1,21 @@
-IriSP.social = function(sel, url) {
+IriSP.social = function(opts) {
+
+ var opts = opts || {};
+ opts.sel = opts.sel || $(".Ldt-Social");
+ opts.url = opts.url || document.location.href;
- var sel = sel || $(".Ldt-Social"),
- url = url || document.location.href,
- text = sel.find("title").text(),
+ if (opts.swf) {
+ ZeroClipboard.setMoviePath(opts.swf);
+ }
+
+ var text = opts.sel.find("title").text(),
clipId = IriSP.Model.getUID(),
clip;
- sel.find(".Ldt-Social-CopyBtn").attr("id", this.clipId);
+ opts.sel.find(".Ldt-Social-CopyBtn").attr("id", clipId);
- sel.find(".Ldt-Social-Url").click(function() {
- var _pop = sel.find(".Ldt-Social-UrlPop");
+ opts.sel.find(".Ldt-Social-Url").click(function() {
+ var _pop = opts.sel.find(".Ldt-Social-UrlPop");
_pop.toggle();
if (_pop.is(":visible")) {
if (typeof clip == "undefined") {
@@ -23,28 +29,28 @@
});
}
clip.show();
- clip.setText( url );
- sel.find(".Ldt-Social-Input").val(url).focus();
+ clip.setText( opts.url );
+ opts.sel.find(".Ldt-Social-Input").val(opts.url).focus();
} else {
clip.hide();
}
return false;
});
- sel.find(".Ldt-Social-Input").focus(function() {
+ opts.sel.find(".Ldt-Social-Input").focus(function() {
this.select();
});
- sel.find(".Ldt-Social-Ext").click(function() {
+ opts.sel.find(".Ldt-Social-Ext").click(function() {
window.open(
- sel.find(this).attr("href"),
+ opts.sel.find(this).attr("href"),
"_blank",
"height=300,width=450,left=100,top=100,toolbar=0,menubar=0,status=0,location=0");
return false;
});
- sel.find(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + $.param({ u: url, t: text }));
- sel.find(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + $.param({ url: url, text: text }));
- sel.find(".Ldt-Social-Gplus").attr("href", "https://plus.google.com/share?" + $.param({ url: url, title: text }));
- sel.find(".Ldt-Social-Mail").attr("href", "mailto:?" + $.param({ subject: text, body: text + ": " + url }));
+ opts.sel.find(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + $.param({ u: opts.url, t: text }));
+ opts.sel.find(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + $.param({ url: opts.url, text: text }));
+ opts.sel.find(".Ldt-Social-Gplus").attr("href", "https://plus.google.com/share?" + $.param({ url: opts.url, title: text }));
+ opts.sel.find(".Ldt-Social-Mail").attr("href", "mailto:?" + $.param({ subject: text, body: text + ": " + opts.url }));
}
/* END social.js */