크롬 stable채널 75.0.3770.90(공식 빌드) (64비트) 버전이 나오면서,
지난번 글자 사라지는 버그( https://www.clien.net/service/board/lecture/13577755CLIEN )가 해결되었으나
좀전에 써보니 새로운 버그가 또 생겼더군요. -_-
한글을 타이핑 한 후, 텍스트박스 안에서 마우스로 커서를 이동하고 타이핑을 다시 하면, 이전 커서 위치에서 타이핑이 이루어지는 버그
여튼 이것도 스크립트로 버그 해결하도록 지난번 스크립트 살짝 바꿨습니다.
적용은 지난번처럼 Tampermonkey에서 아래 스크립트를 붙여넣기 하세요.
https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
// ==UserScript== // @name 크롬 75 텍스트박스 마우스 커서 이동 씹히는 버그 수정 // @namespace http://tampermonkey.net/ // @version 0.2 // @description try to take over the world! // @author Myayu // @include *://* // @grant none // ==/UserScript== (function() { 'use strict'; let target, cursor; const filter = /^([a-z]|Process)$/; const sel = document.getSelection(); function cursorRestore(){ if(target){ let top, targetTop; const txtbox = document.createElement("input"), tc = target; txtbox.setAttribute("type", "text"); txtbox.setAttribute("class", "tempbox_QaZwSxEdCrFvTgByHn"); txtbox.setAttribute("style", "position: fixed; top: 0; opacity: 0;"); document.getElementsByTagName("html")[0].appendChild(txtbox); txtbox.focus(); if(cursor){ top = document.documentElement.scrollTop; targetTop = target.scrollTop; } target = null; setTimeout(()=>{ tc.focus(); txtbox.remove(); if(cursor){ sel.collapse(cursor[0], cursor[1]); document.documentElement.scrollTop = top; tc.scrollTop = targetTop; } },0); } } document.addEventListener("keyup", e=>{ if(!e.target.classList.contains("tempbox_QaZwSxEdCrFvTgByHn") && filter.exec(e.key) && (e.target.isContentEditable || e.target.nodeName === "TEXTAREA" || (e.target.nodeName === 'INPUT' && (e.target.type === "text" || e.target.type === "search" || e.target.type === "email" || e.target.type === "url")) )){ target = e.target; cursor = typeof target.value === "undefined" ? [ sel.focusNode, sel.focusOffset ] : null; } else{ target = cursor = null; } }); document.addEventListener("mousemove", cursorRestore); document.addEventListener("wheel", cursorRestore); })();
◆ v0.2 수정:
div상자에서 스크롤막대가 생길 정도로 내용을 길게 적은 후 마우스를 움직이면, 커서만 복원하고 스크롤은 최상단으로 이동하는 현상을 수정
div상자에서 스크롤막대가 생길 정도로 내용을 길게 적은 후 마우스를 움직이면, 커서만 복원하고 스크롤은 최상단으로 이동하는 현상을 수정
75.0.3770.142(공식 빌드) (64비트)
에서 버그가 해결된 것 같습니다.
이 스크립트 이제 사용 안하셔도 될 듯