Skip to content

Instantly share code, notes, and snippets.

@joeauty
Created July 15, 2011 20:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save joeauty/1085498 to your computer and use it in GitHub Desktop.
webkitinit.js
// for controlling YUI lazy loading caching
var moduleRevision = 1;
var configObj = {
modules: {
'webkit': {
fullpath: '/nm_webkit/libs/webkit.js?wk=' + moduleRevision
},
'prototype': {
fullpath: 'https://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js?wk=' + moduleRevision
},
'scriptaculous': {
fullpath: 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/effects.js?wk=' + moduleRevision
},
'modalbox': {
requires: ['modalboxcss'],
fullpath: '/nm_webkit/libs/modalbox/modalbox.js?wk=' + moduleRevision
},
'modalboxcss': {
fullpath: '/nm_webkit/libs/modalbox/modalbox.css?wk=' + moduleRevision,
type: 'css'
},
'storenew_css': {
fullpath: '/nm_webkit/CSS/store_defaultsnew.css?wk=' + moduleRevision,
type: 'css'
},
'storenew': {
fullpath: '/nm_webkit/libs/storenew.js?wk=' + moduleRevision,
requires: ['storenew_css']
},
'jplayer': {
fullpath: '/nm_webkit/libs/jplayer/jquery.jplayer.min.js?wk=' + moduleRevision,
requires: ['jquery', 'soundclips-mobile']
},
'jquery': {
fullpath: 'https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js?wk=' + moduleRevision
},
'soundclips-mobile': {
fullpath: ('/nm_webkit/libs/soundclips.js?wk=' + moduleRevision)
},
'lightwindow': {
requires: ['lightwindowcss'],
fullpath: ('/nm_webkit/libs/lightwindow/javascript/lightwindow.js?wk=' + moduleRevision)
},
'lightwindowcss': {
fullpath: ('/nm_webkit/libs/lightwindow/css/lightwindow.css?wk=' + moduleRevision),
type: 'css'
},
'localjs': {
fullpath: '/js/main.js?wk=' + moduleRevision
}
}
}
YUI().use('event-custom', 'node', function(Y) {
// subscribe to webkit init event
Y.Global.on('webkitevent:init', function() {
Y.log('webkit inited');
YUI(configObj).use('localjs', function() {
// all stuff that requires the DOM to be loaded should be invoked locally
Y.log('localjs loaded');
webkit.localjsloaded = true;
webkit.customevent.fire('localjs:init');
});
});
configObj.loadModules = ['prototype', 'scriptaculous', 'webkit', 'modalbox'];
var depends = document.getElementsByName('nmdepend');
for (i=0; i < depends.length; i++) {
Y.log('add ' + depends[i].content + ' to webkit core');
configObj.loadModules.push(depends[i].content);
}
YUI.use.apply(YUI(configObj), configObj.loadModules, function(Y) {
Y.log('webkit core loaded');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment