This file contains 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
{# | |
# USAGE: | |
# (transform can either be an object, or an array of objects, aka srcset) | |
# | |
# {{ macro.regular(entry.image.one(), { width: 50, height: 50 }, 'class="block"') }} | |
# ➡️ <img src="..." width="50" height="50" alt="..." class="block" /> | |
# | |
# {{ macro.url(entry.image.one(), { width: 50, height: 50 }) }} | |
# ➡️ /uploads_c/../{...}.jpg | |
# |
This file contains 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
alert("Expected: true or false\n" + | |
cached(big_img) | |
+ "\n\nExpected: false (cache-busting enabled)\n" + | |
cached(big_img + "?" + new Date().getTime())); | |
function cached(url){ | |
var test = document.createElement("img"); | |
test.src = url; | |
return test.complete || test.width+test.height > 0; | |
} |
This file contains 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
$.ajaxSetup({"error":function(XMLHttpRequest,textStatus, errorThrown) { | |
alert(textStatus); | |
alert(errorThrown); | |
alert(XMLHttpRequest.responseText); | |
}}); |
This file contains 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
var c= String.fromCharCode(event.keyCode); | |
var isWordcharacter = c.match(/\w/); |
This file contains 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
$.fn.capitalize = function () { | |
$.each(this, function () { | |
var caps = this.value; | |
caps = caps.charAt(0).toUpperCase() + caps.slice(1); | |
this.value = caps; | |
}); | |
return this; | |
}; |
This file contains 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
// Init addthis | |
if (addThisFirstLoad) { | |
var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1'; | |
if (window.addthis){ | |
window.addthis = null; | |
} | |
$.getScript( script, function(){ addthis.init(); } ); | |
addThisFirstLoad = false; | |
} else { | |
// Update the buttons (and dont download the script twice) |
This file contains 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
$("a[href^='http:']:not([href*='" + window.location.host + "'])").each(function() { | |
if( !$(this).hasClass('fancybox') ) | |
{ | |
$(this).click(function() | |
{ | |
window.open(this.href); // pop a new window | |
return false; // return false to keep the actual link click from actuating | |
}); | |
} | |
}); |