mirror of
https://github.com/Asraelite/littlebigcomputer.git
synced 2025-07-18 08:26:51 +00:00
Init commit
This commit is contained in:
commit
c45ad79440
48 changed files with 6786 additions and 0 deletions
25
assembler/ldt/lib/SelectHelper.js
Normal file
25
assembler/ldt/lib/SelectHelper.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* SelectHelper.js
|
||||
* written by Colin Kuebler 2012
|
||||
* Part of LDT, dual licensed under GPLv3 and MIT
|
||||
* Convenient utilities for cross browser textarea selection manipulation
|
||||
*/
|
||||
|
||||
var SelectHelper = {
|
||||
add: function( element ){
|
||||
element.insertAtCursor = element.createTextRange ?
|
||||
// IE version
|
||||
function(x){
|
||||
document.selection.createRange().text = x;
|
||||
} :
|
||||
// standards version
|
||||
function(x){
|
||||
var s = element.selectionStart,
|
||||
e = element.selectionEnd,
|
||||
v = element.value;
|
||||
element.value = v.substring(0, s) + x + v.substring(e);
|
||||
s += x.length;
|
||||
element.setSelectionRange(s, s);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue