Last active
April 21, 2018 12:22
-
-
Save jacksonhoose/737d5a7a0a8d3db68cf1 to your computer and use it in GitHub Desktop.
Paul Irish's Markup-based Unobtrusive Comprehensive DOM-ready Execution
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 ODPHP = {}; | |
ODPHP.common = { | |
init: function() { | |
// common code running on all pages | |
} | |
}; | |
ODPHP.objective_search = { | |
init: function() { | |
// objective search initi | |
} | |
}; | |
var UTIL = { | |
fire: function(func, funcname, args) { | |
var namespace = ODPHP; | |
funcname = (funcname === undefined) ? 'init' : funcname; | |
if (func !== '' && namespace[func] && typeof namespace[func][funcname] === 'function') { | |
namespace[func][funcname](args); | |
} | |
}, | |
loadEvents: function() { | |
UTIL.fire('common'); | |
$.each(document.body.className.replace(/-/g, '_').split(/\s+/),function(i,classnm) { | |
UTIL.fire(classnm); | |
}); | |
UTIL.fire('common', 'finalize'); | |
} | |
}; | |
jQuery(function($){ | |
$(document).ready(UTIL.loadEvents); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment