Prevented user-created dependency loops when setting effects as calclations

This commit is contained in:
Thaum
2014-11-20 12:55:42 +00:00
parent ca7a625534
commit 252d0f989b
7 changed files with 146 additions and 111 deletions

View File

@@ -24,7 +24,7 @@ evaluate = function(charId, string){
} catch(e){
console.log(e)
return string;
}
}
}
//takes a string with {calculations} and returns it with the results

View File

@@ -0,0 +1,18 @@
placeCaretAtEnd = function(el) {
el = el.get(0); //jquery element -> DOM element
el.focus();
if (typeof window.getSelection != "undefined"
&& typeof document.createRange != "undefined") {
var range = document.createRange();
range.selectNodeContents(el);
range.collapse(false);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
} else if (typeof document.body.createTextRange != "undefined") {
var textRange = document.body.createTextRange();
textRange.moveToElementText(el);
textRange.collapse(false);
textRange.select();
}
}