Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var timerID = null
- document.addEventListener('dblclick', function() {
- console.log('double click!');
- if (timerID) {
- clearTimeout(timerID);
- timerID = null;
- }
- document.onselectstart = function() {
- return false;
- };
- if (window.getSelection) {
- if (window.getSelection().empty) { // Chrome
- window.getSelection().empty();
- } else if (window.getSelection().removeAllRanges) { // Firefox
- window.getSelection().removeAllRanges();
- }
- } else if (document.selection) { // IE?
- document.selection.empty();
- }
- timerID = setTimeout(function() {
- document.onselectstart = function() {
- return true;
- };
- }, 500);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement