Last active
December 21, 2015 02:59
-
-
Save shivergard/6238838 to your computer and use it in GitHub Desktop.
YepNope App loading console
This file contains hidden or 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
| 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(); | |
| } | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
works only if app module is loaded