|
Помогите добавить кнопку Мне нравится через JS 13 г., 9 мес. назад
|
Репутация: 0
|
есть код в который необходимо добавить генерацию кнопки Мне нравится от вконтакте.
помогите пожалуйста.
Предупреждение: Помехи!| Код: |
(function (f) {
var e = {};
f.fn.socialButtons = function (a) {
a = f.extend({
wrapper: '<div class="socialbuttons clearfix" />'
}, a);
if (!a.twitter && !a.plusone && !a.facebook) return this;
a.twitter && !e.twitter && (e.twitter = f.getScript("//platform.twitter.com/widgets.js"));
a.plusone && !e.plusone && (e.plusone = f.getScript("//apis.google.com/js/plusone.js"));
if (!window.FB && a.facebook && !e.facebook) f("body").append('<div id="fb-root"></div>'),
function (a, b, d) {
var g = a.getElementsByTagName(b)[0];
if (!a.getElementById(d)) a = a.createElement(b),
a.id = d, a.src = "//connect.facebook.net/en_US/all.js#xfbml=1", g.parentNode.insertBefore(a, g)
}(document, "script", "facebook-jssdk"), e.facebook = true;
return this.each(function () {
var c = f(this).data("permalink"),
b = f(a.wrapper).appendTo(this);
a.twitter && b.append('<div><a href="http://twitter.com/share" class="twitter-share-button" data-url="' + c + '" data-count="none">Tweet</a></div>');
a.plusone && b.append('<div><div class="g-plusone" data-size="medium" data-annotation="none" data-href="' + c + '"></div></div>');
a.facebook && b.append('<div><div class="fb-like" data-href="' + c + '" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div></div>')
})
};
f.fn.matchHeight = function (a) {
var c = 0,
b = [];
this.each(function () {
var c = a ? f(this).find(a + ":first") : f(this);
b.push(c);
c.css("min-height", "")
});
this.each(function () {
c = Math.max(c, f(this).outerHeight())
});
return this.each(function (a) {
var g = f(this),
a = b[a],
g = a.height() + (c - g.outerHeight());
a.css("min-height", g + "px")
})
};
f.fn.matchWidth = function (a) {
return this.each(function () {
var c = f(this),
b = c.children(a),
d = 0;
b.width(function (a, e) {
return a < b.length - 1 ? (d += e, e) : c.width() - d
})
})
};
f.fn.smoothScroller = function (a) {
a = f.extend({
duration: 1E3,
transition: "easeOutExpo"
}, a);
return this.each(function () {
f(this).bind("click", function () {
var c = this.hash,
b = f(this.hash).offset().top,
d = window.location.href.replace(window.location.hash, ""),
g = f.browser.opera ? "html:not(:animated)" : "html:not(:animated),body:not(:animated)";
if (d + c == this) return f(g).animate({
scrollTop: b
}, a.duration, a.transition, function () {
window.location.hash = c.replace("#", "")
}), false
})
})
}
})(jQuery);
(function (f) {
f.easing.jswing = f.easing.swing;
f.extend(f.easing, {
def: "easeOutQuad",
swing: function (e, a, c, b, d) {
return f.easing[f.easing.def](e, a, c, b, d)
},
easeInQuad: function (e, a, c, b, d) {
return b * (a /= d) * a + c
},
easeOutQuad: function (e, a, c, b, d) {
return -b * (a /= d) * (a - 2) + c
},
easeInOutQuad: function (e, a, c, b, d) {
return (a /= d / 2) < 1 ? b / 2 * a * a + c : -b / 2 * (--a * (a - 2) - 1) + c
},
easeInCubic: function (e, a, c, b, d) {
return b * (a /= d) * a * a + c
},
easeOutCubic: function (e, a, c, b, d) {
return b * ((a = a / d - 1) * a * a + 1) + c
},
easeInOutCubic: function (e, a, c, b, d) {
return (a /= d / 2) < 1 ? b / 2 * a * a * a + c : b / 2 * ((a -= 2) * a * a + 2) + c
},
easeInQuart: function (e, a, c, b, d) {
return b * (a /= d) * a * a * a + c
},
easeOutQuart: function (e, a, c, b, d) {
return -b * ((a = a / d - 1) * a * a * a - 1) + c
},
easeInOutQuart: function (e, a, c, b, d) {
return (a /= d / 2) < 1 ? b / 2 * a * a * a * a + c : -b / 2 * ((a -= 2) * a * a * a - 2) + c
},
easeInQuint: function (e, a, c, b, d) {
return b * (a /= d) * a * a * a * a + c
},
easeOutQuint: function (e, a, c, b, d) {
return b * ((a = a / d - 1) * a * a * a * a + 1) + c
},
easeInOutQuint: function (e, a, c, b, d) {
return (a /= d / 2) < 1 ? b / 2 * a * a * a * a * a + c : b / 2 * ((a -= 2) * a * a * a * a + 2) + c
},
easeInSine: function (e, a, c, b,
d) {
return -b * Math.cos(a / d * (Math.PI / 2)) + b + c
},
easeOutSine: function (e, a, c, b, d) {
return b * Math.sin(a / d * (Math.PI / 2)) + c
},
easeInOutSine: function (e, a, c, b, d) {
return -b / 2 * (Math.cos(Math.PI * a / d) - 1) + c
},
easeInExpo: function (e, a, c, b, d) {
return a == 0 ? c : b * Math.pow(2, 10 * (a / d - 1)) + c
},
easeOutExpo: function (e, a, c, b, d) {
return a == d ? c + b : b * (-Math.pow(2, - 10 * a / d) + 1) + c
},
easeInOutExpo: function (e, a, c, b, d) {
return a == 0 ? c : a == d ? c + b : (a /= d / 2) < 1 ? b / 2 * Math.pow(2, 10 * (a - 1)) + c : b / 2 * (-Math.pow(2, - 10 * --a) + 2) + c
},
easeInCirc: function (e, a, c, b, d) {
return -b * (Math.sqrt(1 - (a /= d) * a) - 1) + c
},
easeOutCirc: function (e, a, c, b, d) {
return b * Math.sqrt(1 - (a = a / d - 1) * a) + c
},
easeInOutCirc: function (e, a, c, b, d) {
return (a /= d / 2) < 1 ? -b / 2 * (Math.sqrt(1 - a * a) - 1) + c : b / 2 * (Math.sqrt(1 - (a -= 2) * a) + 1) + c
},
easeInElastic: function (e, a, c, b, d) {
var e = 1.70158,
g = 0,
f = b;
if (a == 0) return c;
if ((a /= d) == 1) return c + b;
g || (g = d * 0.3);
f < Math.abs(b) ? (f = b, e = g / 4) : e = g / (2 * Math.PI) * Math.asin(b / f);
return -(f * Math.pow(2, 10 * (a -= 1)) * Math.sin((a * d - e) * 2 * Math.PI / g)) + c
},
easeOutElastic: function (e, a, c, b, d) {
var e = 1.70158,
g = 0,
f = b;
if (a == 0) return c;
if ((a /= d) == 1) return c + b;
g || (g = d * 0.3);
f < Math.abs(b) ? (f = b, e = g / 4) : e = g / (2 * Math.PI) * Math.asin(b / f);
return f * Math.pow(2, - 10 * a) * Math.sin((a * d - e) * 2 * Math.PI / g) + b + c
},
easeInOutElastic: function (e, a, c, b, d) {
var e = 1.70158,
g = 0,
f = b;
if (a == 0) return c;
if ((a /= d / 2) == 2) return c + b;
g || (g = d * 0.3 * 1.5);
f < Math.abs(b) ? (f = b, e = g / 4) : e = g / (2 * Math.PI) * Math.asin(b / f);
return a < 1 ? -0.5 * f * Math.pow(2, 10 * (a -= 1)) * Math.sin((a * d - e) * 2 * Math.PI / g) + c : f * Math.pow(2, - 10 * (a -= 1)) * Math.sin((a * d - e) * 2 * Math.PI / g) * 0.5 + b + c
},
easeInBack: function (e,
a, c, b, d, g) {
g == void 0 && (g = 1.70158);
return b * (a /= d) * a * ((g + 1) * a - g) + c
},
easeOutBack: function (e, a, c, b, d, g) {
g == void 0 && (g = 1.70158);
return b * ((a = a / d - 1) * a * ((g + 1) * a + g) + 1) + c
},
easeInOutBack: function (e, a, c, b, d, g) {
g == void 0 && (g = 1.70158);
return (a /= d / 2) < 1 ? b / 2 * a * a * (((g *= 1.525) + 1) * a - g) + c : b / 2 * ((a -= 2) * a * (((g *= 1.525) + 1) * a + g) + 2) + c
},
easeInBounce: function (e, a, c, b, d) {
return b - f.easing.easeOutBounce(e, d - a, 0, b, d) + c
},
easeOutBounce: function (e, a, c, b, d) {
return (a /= d) < 1 / 2.75 ? b * 7.5625 * a * a + c : a < 2 / 2.75 ? b * (7.5625 * (a -= 1.5 / 2.75) * a + 0.75) + c : a < 2.5 / 2.75 ? b * (7.5625 * (a -= 2.25 / 2.75) * a + 0.9375) + c : b * (7.5625 * (a -= 2.625 / 2.75) * a + 0.984375)
+ c
},
easeInOutBounce: function (e, a, c, b, d) {
return a < d / 2 ? f.easing.easeInBounce(e, a * 2, 0, b, d) * 0.5 + c : f.easing.easeOutBounce(e, a * 2 - d, 0, b, d) * 0.5 + b * 0.5 + c
}
})
})(jQuery);
(function (f) {
function e(a) {
var b = {}, c = /^jQuery\d+$/;
f.each(a.attributes, function (a, d) {
if (d.specified && !c.test(d.name)) b[d.name] = d.value
});
return b
}
function a() {
var a = f(this);
a.val() === a.attr("placeholder") && a.hasClass("placeholder") && (a.data("placeholder-password") ? a.hide().next().show().focus() : a.val("").removeClass("placeholder"))
}
function c() {
var b, c = f(this);
if (c.val() === "" || c.val() === c.attr("placeholder")) {
if (c.is(":password")) {
if (!c.data("placeholder-textinput")) {
try {
b = c.clone().attr({
type: "text"
})
} catch (d) {
b = f("<input>").attr(f.extend(e(c[0]), {
type: "text"
}))
}
b.removeAttr("name").data("placeholder-password", true).bind("focus.placeholder", a);
c.data("placeholder-textinput", b).before(b)
}
c = c.hide().prev().show()
}
c.addClass("placeholder").val(c.attr("placeholder"))
} else c.removeClass("placeholder")
}
var b = "placeholder" in document.createElement("input"),
d = "placeholder" in document.createElement("textarea");
f.fn.placeholder = b && d ? function () {
return this
} : function () {
return this.filter((b ? "textarea" : ":input") + "[placeholder]").bind("focus.placeholder",
a).bind("blur.placeholder", c).trigger("blur.placeholder").end()
};
f(function () {
f("form").bind("submit.placeholder", function () {
var b = f(".placeholder", this).each(a);
setTimeout(function () {
b.each(c)
}, 10)
})
});
f(window).bind("unload.placeholder", function () {
f(".placeholder").val("")
})
})(jQuery);
|
|
|
|
|
|
|
|
Помогите добавить кнопку Мне нравится через JS 13 г., 9 мес. назад
|
Репутация: 1
|
Есть модуль, кнопки, который можно разместить на удобной позиции, на нужных страницах.
|
|
|
|
|
|
|