Skip to content

Commit 85e4413

Browse files
committed
Minified version to match full
1 parent c1cd349 commit 85e4413

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

lib/ice-coder.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4054,15 +4054,32 @@ var ICEcoder = {
40544054
// Reset the auto-logout timer
40554055
top.ICEcoder.resetAutoLogoutTimer();
40564056

4057-
// Detect if we type s,n,a,k,e keys, if so start snake game
4057+
// Detect if we type s,n,a,k,e keys with content saved, if so start snake game
40584058
if (!top.ICEcoder.last5Keys) {top.ICEcoder.last5Keys = [];}
40594059
top.ICEcoder.last5Keys.push(key);
40604060
if (top.ICEcoder.last5Keys.length == 6) {
40614061
top.ICEcoder.last5Keys.shift();
40624062
}
40634063
if (top.ICEcoder.last5Keys.join() == "83,78,65,75,69") {
40644064
setTimeout(function() {
4065-
top.ICEcoder.startSnake();
4065+
// Undo back to pre 'snake' word
4066+
cM = ICEcoder.getcMInstance();
4067+
var undoCounts = 0;
4068+
var startCG = cM.changeGeneration();
4069+
while (cM.changeGeneration() > startCG-5) {
4070+
cM.undo();
4071+
undoCounts++;
4072+
}
4073+
// If we have content saved
4074+
if (top.ICEcoder.savedPoints[top.ICEcoder.selectedTab-1] == cM.changeGeneration()) {
4075+
// Start snake game
4076+
top.ICEcoder.startSnake();
4077+
// If we don't, redo snake word
4078+
} else {
4079+
for (var i=1; i<=undoCounts; i++) {
4080+
cM.redo();
4081+
}
4082+
}
40664083
},0);
40674084
}
40684085

0 commit comments

Comments
 (0)