This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var to_parse = '{{ media_item.title | strip_newlines }}'; | |
var URL_RE = /(?:(?=[\s`!()\[\]{};:'".,<>?«»“”‘’])|\b)((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/|[a-z0-9.\-]+[.](?:com|org|net))(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))*(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]|\b))/gi; | |
var parsed_url = to_parse.match(URL_RE); | |
document.write('<a id="magic_button" href="' + parsed_url + '" target="_blank">View Blog Post »</a>'); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).load(function () { | |
var button_w = $('#button img').height(); | |
var button_h = $('#button img').width(); | |
var margin_left = button_w / 2 * -1; | |
var margin_top = button_h / 2 * -1; | |
$('#button').css('marginLeft', margin_left); | |
$('#button').css('marginTop', margin_top); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mockAjax() { | |
// The element containing a number of items, some of which you want to hide at first | |
var cont = $('#deal_cnt'); | |
// Hide all but the first 5. | |
$("div.deal:gt(4)", cont).hide(); | |
// On-click, load up to 5 more unless there are not left, then hide the button. | |
$('#load_more_deals').show().live('click', function() { | |
var hidden_divs = $("div.deal:hidden", cont); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function like_count(args) { | |
function addCommas(nStr) { | |
nStr += ''; | |
x = nStr.split('.'); | |
x1 = x[0]; | |
x2 = x.length > 1 ? '.' + x[1] : ''; | |
var rgx = /(\d+)(\d{3})/; | |
while (rgx.test(x1)) { | |
x1 = x1.replace(rgx, '$1' + ',' + '$2'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Sample of usage | |
$(document).bind('FB.ready',function(){ | |
console.log('FB is ready'); | |
FB.api('/me',function(response){ | |
console.log(response); | |
}); | |
}); | |
// Init Detector | |
var _FB = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(window).load( function () { | |
{% plugin rawtext submit_button_text %} | |
$('.engagements_submit').val('{{ submit_button_text }}'); | |
}); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// YouTube iFrame Creator | |
function getVideo(id, height, width) { | |
var output = ''; | |
var youtube_id = id; | |
output = '<iframe width="' + width + '" height="' + height + '" src="http://www.youtube.com/embed/' + youtube_id + '?rel=0&autoplay=1" frameBorder="0" allowfullscreen>'; | |
return output; | |
} | |
// Usage | |
var width = 418; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).load( function () { | |
$('.tweet a').each( function () { | |
$(this).attr('target', '_top'); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(typeof String.prototype.trim !== 'function') { | |
String.prototype.trim = function() { | |
return this.replace(/^\s+|\s+$/g, ''); | |
} | |
} |