Skip to content

Instantly share code, notes, and snippets.

@plateaukao
Created November 3, 2023 14:44
Show Gist options
  • Save plateaukao/239297b3c2d7a502b5326032c2e3e566 to your computer and use it in GitHub Desktop.
Save plateaukao/239297b3c2d7a502b5326032c2e3e566 to your computer and use it in GitHub Desktop.
selectLinkText
fun selectLinkText(point: Point) {
evaluateJavascript(
"""
javascript:(function() {
var tt = w._touchTarget;
if(tt){
var hrefAttr = tt.getAttribute("href");
tt.removeAttribute("href");
w._hrefAttr = hrefAttr;
var sel = w.getSelection();
sel.removeAllRanges();
}
})()
""".trimIndent()
) {
postDelayed({ simulateLongClick(point) }, 0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment