Skip to content

Instantly share code, notes, and snippets.

@shivergard
Last active December 21, 2015 02:59
Show Gist options
  • Select an option

  • Save shivergard/6238838 to your computer and use it in GitHub Desktop.

Select an option

Save shivergard/6238838 to your computer and use it in GitHub Desktop.
YepNope App loading console
yepnope({
test : typeof $.lightbox_me == 'undefined',
yep : 'http://buckwilson.me/lightboxme/jquery.lightbox_me.js',
complete: function () {
if ($('#ocnsole_inputs').length == 1){
$('#ocnsole_inputs').remove();
}
if ($('#ocnsole_inputs').length == 0){
$('<input>').attr('type','text').attr('id','ocnsole_inputs').attr('name','ocnsole_inputs').appendTo('body');
}
$('#ocnsole_inputs').lightbox_me({
centered: true,
onLoad: function() {
$('#ocnsole_inputs').focus();
$('#ocnsole_inputs').keypress(function (e) {
if (e.which == 13) {
$('#ocnsole_inputs').trigger('close');
appname = $('#ocnsole_inputs').val();
$('#ocnsole_inputs').val('');
console.log('apped ' + appname);
CNSApp = false;
yepnope({
test : true,
both : appbase + appname + '.app.js',
complete : function(){
function checkCNSApp (CNSInex){
if (typeof CNSInex == 'undefined'){
var CNSInex = 1;
}
if (typeof CNSApp != 'undefined' && CNSApp){
ns = new CNSApp();
cnsHoldr[appname] = ns;
console.log(ns.commandReturn(appname));
}else if (typeof cnsHoldr[appname] != 'undefined'){
response = cnsHoldr[appname].commandReturn(appname);
console.log(response);
}else if (CNSInex <= 10) {
console.log('Problems with APP');
CNSInex = CNSInex + 1;
setTimeout(function(){checkCNSApp(CNSInex);} ,50);
}else{
console.log('Dead Really , need to reload');
console.log(CNSApp);
}
}
checkCNSApp();
}
});
$('#ocnsole_inputs').val('');
}
});
setTimeout(function(){
$('#ocnsole_inputs').trigger('close');
$('#ocnsole_inputs').val('');
}, 3000);
}
});
e.preventDefault();
}
});
@shivergard
Copy link
Copy Markdown
Author

works only if app module is loaded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment