From 8f55dc33a9c9bb0cd230830f890475593922b266 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Tue, 25 Aug 2015 19:49:10 -0700 Subject: [PATCH] fix should not submit on initial execute fix should call $.prototype.html function --- .../lib/coursewares/commonFrameWork_0.0.1.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/public/js/lib/coursewares/commonFrameWork_0.0.1.js b/public/js/lib/coursewares/commonFrameWork_0.0.1.js index e66e5dc975..fe5f790cf4 100644 --- a/public/js/lib/coursewares/commonFrameWork_0.0.1.js +++ b/public/js/lib/coursewares/commonFrameWork_0.0.1.js @@ -286,6 +286,7 @@ var testSuccess = function() { function showCompletion() { if (isInitRun) { + isInitRun = false; return; } var time = Math.floor(Date.now()) - started; @@ -479,7 +480,7 @@ var runTests = function(err, data) { } }; -function bonfireExecute(isInitRun) { +function bonfireExecute() { goodTests = 0; attempts++; ga('send', 'event', 'Challenge', 'ran-code', challenge_Name); @@ -566,18 +567,15 @@ $('#submitButton').on('click', function() { }); $(document).ready(function(){ + var $preview = $('#preview'); isInitRun = true; editorValue = (codeStorage.isAlive())? codeStorage.getEditorValue() : allSeeds; myCodeMirror.setValue(editorValue.replace(/fccss/gi, '")); - if(typeof $('#preview').html !== 'undefined'){ - $('#preview').load(function(){ - bonfireExecute(false); + if(typeof $preview.html() !== 'undefined') { + $preview.load(function(){ + bonfireExecute(); }); + } else{ + bonfireExecute(); } - else{ - bonfireExecute(false); - } - setTimeout(function() { - isInitRun = false; - }, 1000); });