MediaWiki:Gadget-SelectionCounter.js:修订间差异
MediaWiki界面页面
更多操作
删除的内容 添加的内容
Maintenance script(留言 | 贡献) 记录最近选区并延迟显示 |
Maintenance script(留言 | 贡献) 拖选时实时更新并增强触发 |
||
| 第25行: | 第25行: | ||
var lastText = ''; |
var lastText = ''; |
||
var lastTime = 0; |
var lastTime = 0; |
||
var isSelecting = false; |
|||
function getSelectionText() { |
function getSelectionText() { |
||
| 第90行: | 第91行: | ||
window.clearInterval(pollTimer); |
window.clearInterval(pollTimer); |
||
pollTimer = null; |
pollTimer = null; |
||
} |
|||
function onSelectMove() { |
|||
if (!isSelecting) { |
|||
return; |
|||
} |
|||
scheduleUpdate(); |
|||
} |
} |
||
| 第101行: | 第109行: | ||
}); |
}); |
||
document.addEventListener('mousedown', function () { |
document.addEventListener('mousedown', function () { |
||
isSelecting = true; |
|||
}, true); |
|||
| ⚫ | |||
isSelecting = false; |
|||
scheduleUpdateDelayed(); |
|||
}, true); |
}, true); |
||
document.addEventListener(' |
document.addEventListener('mousemove', onSelectMove, true); |
||
document.addEventListener(' |
document.addEventListener('touchstart', function () { |
||
isSelecting = true; |
|||
| ⚫ | |||
document.addEventListener('touchmove', onSelectMove, { passive: true, capture: true }); |
|||
document.addEventListener('touchend', function () { |
|||
isSelecting = false; |
|||
scheduleUpdateDelayed(); |
|||
}, { passive: true, capture: true }); |
|||
document.addEventListener('keyup', scheduleUpdate); |
document.addEventListener('keyup', scheduleUpdate); |
||
| ⚫ | |||
| ⚫ | |||
window.addEventListener('focus', startPolling); |
window.addEventListener('focus', startPolling); |
||
window.addEventListener('blur', stopPolling); |
window.addEventListener('blur', stopPolling); |
||