Skip to content

Instantly share code, notes, and snippets.

$(document).ready(function() {
/*####
Load in script only when a DOM element exists.
Use callback function to run
####*/
Modernizr.addTest('foo', $('.bar').length > 0);
Modernizr.load({
setTimeout(function(){
// tweet button
var tweeter = $('<a href="https://twitter.com/share" class="twitter-share-button">Tweet</a>');
// facebook 'like' button
var fbLike = $('<iframe class="fbLike" src="http://www.facebook.com/plugins/like.php?href=bestofconversion.com&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;font=arial&amp;action=like&amp;height=35&amp;colorscheme=light&amp;layout=button_count&amp;appId=2398652648"></iframe>');
$('.social').append(fbLike, tweeter);
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="http://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
window.getComputedStyle(fbLike[0]).getPropertyValue('top');
@simondahla
simondahla / vwo-jquery-noduplicate.js
Last active December 19, 2015 07:19
Workaround for VWO Duplicate content due to jQuery loop
if (!vwo_$('#newUniqeIdentifier').length) {
// Do your vwo_$ stuff here
// vwo_$('<h1>Foo</h1>').replaceWith( '<h1 id="newUniqeIdentifier">Bar</h1>' );
}
@simondahla
simondahla / eid-widget-fix.js
Last active December 18, 2015 09:49
discount code parser for eventbee widget
// Get discount code in Eventbee widget
var eventID = ''; //Set your event ID here
//Function to get the code from the browser url
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);