Prevent browser range selection

This commit is contained in:
Brad Fitzpatrick 2012-11-28 10:49:22 -08:00
parent af7cce81fb
commit ed67d8926a
1 changed files with 5 additions and 1 deletions

View File

@ -39,13 +39,17 @@ function divFromResult(searchRes, i) {
} }
}; };
selSetter[i] = setSelected; selSetter[i] = setSelected;
divperm.addEventListener("mousedown", function(e) {
if (e.shiftKey) {
e.preventDefault(); // prevent browser range selection
}
});
divperm.addEventListener("click", function(e) { divperm.addEventListener("click", function(e) {
if (e.ctrlKey) { if (e.ctrlKey) {
setSelected(!divperm.isSelected); setSelected(!divperm.isSelected);
return; return;
} }
if (e.shiftKey) { if (e.shiftKey) {
e.stopPropagation(); // doesn't work? text is still selected :(
if (lastSelIndex < 0) { if (lastSelIndex < 0) {
return; return;
} }