--- a/integration/js/social.js Thu Nov 22 18:45:06 2012 +0100
+++ b/integration/js/social.js Fri Nov 23 19:13:50 2012 +0100
@@ -1,14 +1,15 @@
-$(function() {
+IriSP.social = function(sel, url) {
- var url = document.location.href,
- text = $("title").text(),
+ var sel = sel || $(".Ldt-Social"),
+ url = url || document.location.href,
+ text = sel.find("title").text(),
clipId = IriSP.Model.getUID(),
clip;
- $(".Ldt-Social-CopyBtn").attr("id", this.clipId);
+ sel.find(".Ldt-Social-CopyBtn").attr("id", this.clipId);
- $(".Ldt-Social-Url").click(function() {
- var _pop = $(".Ldt-Social-UrlPop");
+ sel.find(".Ldt-Social-Url").click(function() {
+ var _pop = sel.find(".Ldt-Social-UrlPop");
_pop.toggle();
if (_pop.is(":visible")) {
if (typeof clip == "undefined") {
@@ -23,25 +24,25 @@
}
clip.show();
clip.setText( url );
- $(".Ldt-Social-Input").val(url).focus();
+ sel.find(".Ldt-Social-Input").val(url).focus();
} else {
clip.hide();
}
return false;
});
- $(".Ldt-Social-Input").focus(function() {
+ sel.find(".Ldt-Social-Input").focus(function() {
this.select();
});
- $(".Ldt-Social-Ext").click(function() {
+ sel.find(".Ldt-Social-Ext").click(function() {
window.open(
- $(this).attr("href"),
+ sel.find(this).attr("href"),
"_blank",
"height=300,width=450,left=100,top=100,toolbar=0,menubar=0,status=0,location=0");
return false;
});
- $(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + $.param({ u: url, t: text }));
- $(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + $.param({ url: url, text: text }));
- $(".Ldt-Social-Gplus").attr("href", "https://plus.google.com/share?" + $.param({ url: url, title: text }));
- $(".Ldt-Social-Mail").attr("href", "mailto:?" + $.param({ subject: text, body: text + ": " + url }));
-});
+ 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 }));
+}