Created
October 6, 2012 11:12
-
-
Save tomdavies/3844644 to your computer and use it in GitHub Desktop.
Yepnope / user scripting
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
function betaApp(){ | |
var app = this; | |
this.init = function(){ | |
app.injectYepnope('https://raw.github.com/cnkt/eksi-beta/master/ui/js/yepnope.js'); | |
}; | |
this.injectYepnope = function(url) { | |
var gp = document.createElement( 'script' ); | |
gp.type = 'text/javascript'; | |
gp.async = true; | |
gp.src = url; | |
gp.onload = app.yepnopeLoaded; | |
// Only for IE 6 and 7 | |
gp.onreadystatechange = function() | |
{ | |
if( this.readyState == 'complete' ) | |
{ | |
app.yepnopeLoaded(); | |
} | |
} | |
document.body.appendChild(gp); | |
}; | |
this.yepnopeLoaded = function() { | |
yepnope([ | |
{ | |
load: ['http//cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js', 'http://raw.github.com/andris9/jStorage/master/jstorage.js'], | |
complete: function() { | |
app.firstPartLoaded(); | |
} | |
}, | |
{ | |
load: [ | |
'http://code.jquery.com/jquery-1.8.2.min.js', | |
'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js', | |
'https://raw.github.com/Automattic/Iris/master/dist/iris.js', | |
'https://raw.github.com/cnkt/eksi-beta/master/ui/js/twitter-bootstrap/js/bootstrap-modal.js', | |
'https://raw.github.com/Automattic/Iris/master/src/iris.min.css' | |
], | |
complete: function() { | |
app.allJsLoaded(); | |
} | |
} | |
]); | |
}; | |
this.firstPartLoaded = function(){ | |
console.log('firstPartLoaded'); | |
}; | |
this.allJsLoaded = function(){ | |
console.log('done!'); | |
}; | |
}; | |
var app = new betaApp(); | |
app.init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment