Skip to content

Commit

Permalink
Correcting style sheet for the log
Browse files Browse the repository at this point in the history
  • Loading branch information
gg64du02 committed May 29, 2018
1 parent 1a54176 commit 87f124f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
trash/*
testingPayloads/*
testingPayloads/*
payloads/*
LOL_error.txt
4 changes: 3 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ is fine
# DONE: See the memory threshold when it happens.
use: https://stackoverflow.com/questions/4009756/how-to-count-string-occurrence-in-string

# TODO: add a score number to notify the user that his script is to long,
# DONE: add a score number to notify the user that his script is to long,
therefore not be able to run on the DigiSpark!!!
w/ proper stylesheet ?

# DONE: correcting style sheet in the error textarea and removing console message in the log area

# =============================================================

# DON'T/CAN'T DO IT: multiOS script on 7 would change back the keyboard layout settings to the primary one set in 7
Expand Down
21 changes: 11 additions & 10 deletions duckSpark.js_files/duckSpark.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,30 +122,30 @@ class Dckuinojs {
//How to count string occurrence in string?
var temp = "This is a string.";
var count = (temp.match(/is/g) || []).length;
console.log("count:"+count);
//console.log("count:"+count);


console.log("DigiKeyboard.h:"+"1");
console.log("setup:"+"1");
console.log("pinmode:"+"2");
// console.log("DigiKeyboard.h:"+"1");
// console.log("setup:"+"1");
// console.log("pinmode:"+"2");

var count_delay = (parsedDucky.match(/DigiKeyboard.delay/g) || []).length;
console.log("delay:"+count_delay);
//console.log("delay:"+count_delay);
var count_delay_corrected = count_delay+1;

var count_sendKeyStroke = (parsedDucky.match(/DigiKeyboard.sendKeyStroke/g) || []).length;
console.log("sendKeyStroke:"+count_sendKeyStroke);
// console.log("sendKeyStroke:"+count_sendKeyStroke);

var count_println = (parsedDucky.match(/DigiKeyboard.println/g) || []).length;
console.log("println:"+count_println);
// console.log("println:"+count_println);


console.log("numbers_of_character (println):"+numbers_of_character);
// console.log("numbers_of_character (println):"+numbers_of_character);

var test_RAM_used = 88 + 0 * count_delay_corrected + 0* count_sendKeyStroke;
//test_RAM_used += 2* count_println + 1* numbers_of_character;
test_RAM_used += 0* count_println + 1* numbers_of_character;
console.log("test_RAM_used:"+test_RAM_used)
// console.log("test_RAM_used:"+test_RAM_used)
this.numbers_of_character = test_RAM_used;


Expand Down Expand Up @@ -419,6 +419,7 @@ class Dckuinojs {

if (!commandKnown)
{
// console.error("\n" + "123" + "\n" + 'Error: Unknown command or key \'' + wordArray[0] + '\' at line: ' + (i + 1) + '.');
console.error('Error: Unknown command or key \'' + wordArray[0] + '\' at line: ' + (i + 1) + '.');
return;
}
Expand All @@ -430,7 +431,7 @@ class Dckuinojs {
var timerEnd = Date.now();
var timePassed = new Date(timerEnd - timerStart);

console.log('Done parsed ' + (lineArray.length) + ' lines in ' + timePassed.getMilliseconds() + 'ms');
console.log('Done parsed :' + (lineArray.length) + ' lines in ' + timePassed.getMilliseconds() + 'ms');
return parsedScript;
}
}
4 changes: 3 additions & 1 deletion duckSpark.js_files/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ jQuery(function() { // Wait for jQuery
console.log = function (message) {
$(".console").val(" ℹ - " + message + '\n');
$(".console").css("color", "#2b2b2b");
$(".console").css("padding-top","16px");
oldLog.apply(console, arguments);
};
var oldErrorLog = console.error;
console.error = function (message) {
$(".console").val(" ⚠ - " + message + '\n');
$(".console").css("color", "#ff3434");
$(".console").css("padding-top","16px");
oldErrorLog.apply(console, arguments);
};
})();
Expand All @@ -30,7 +32,7 @@ jQuery(function() { // Wait for jQuery
$(".compile-but").click(function(e) {
var duckOutput = Duck.toArduino($(".duckyscript").val());
var numbers_of_character_lol = Duck.numbers_of_character;
console.log("numbers_of_character_lol:"+numbers_of_character_lol);
//console.log("numbers_of_character_lol:"+numbers_of_character_lol);

//document.getElementById("dl-but").innerHTML = "Hello JavaScript!";
//document.getElementById("dl-but").innerHTML = "RAM used:" + numbers_of_character_lol + "bytes (about)";
Expand Down

0 comments on commit 87f124f

Please sign in to comment.