New API
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
<?php | |
/* | |
**** Load jQuery from Google CDN if available, local fallback if not **** | |
** Place in your theme's functions.php or relevant file. Edit local jQuery path if needed. | |
** Works as-is with WordPress Bones Theme v1.2 https://github.com/eddiemachado/bones (replace wp_enqueue_script( 'jquery' ); on line 142 | |
** reference: http://wp.tutsplus.com/tutorials/load-jquery-from-google-cdn-with-local-fallback-for-wordpress/ | |
*/ |
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
/*! | |
* JavaScript preload() function | |
* Preload images, CSS and JavaScript files without executing them | |
* Script by Stoyan Stefanov – http://www.phpied.com/preload-cssjavascript-without-execution/ | |
* Slightly rewritten by Mathias Bynens – http://mathiasbynens.be/ | |
* Demo: http://mathiasbynens.be/demo/javascript-preload | |
*/ | |
function preload(arr) { | |
var i = arr.length, |
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
// Add a getElementsByClassName function if the browser doesn't have one | |
// Limitation: only works with one class name | |
// Copyright: Eike Send http://eike.se/nd | |
// License: MIT License | |
if (!document.getElementsByClassName) { | |
document.getElementsByClassName = function(search) { | |
var d = document, elements, pattern, i, results = []; | |
if (d.querySelectorAll) { // IE8 | |
return d.querySelectorAll("." + search); |
You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';
This is quite common and very helpful. Another option is to do:
name || (name = 'joe');