purpleslurple / PurpleSlurple

PurpleSlurple transcodes web pages to make them granularly accessible.
GNU General Public License v2.0
0 stars 0 forks source link

STTF Bookmarklet #88

Open purpleslurple opened 1 year ago

purpleslurple commented 1 year ago

javascript:(function() { var selectedText = window.getSelection().toString(); var currentURL = window.location.href; var encodedSelectedText = encodeURIComponent(selectedText); var formattedURL = currentURL + '#:~:text='%20+%20encodedSelectedText;%20%20%20%20%20%20var%20combinedText%20=%20selectedText%20+%20'\n'%20+%20formattedURL;%20%20%20%20%20%20var%20dummyInput%20=%20document.createElement('textarea');%20%20%20%20%20document.body.appendChild(dummyInput);%20%20%20%20%20dummyInput.value%20=%20combinedText;%20%20%20%20%20dummyInput.select();%20%20%20%20%20document.execCommand('copy');%20%20%20%20%20document.body.removeChild(dummyInput);%20})();

purpleslurple commented 1 year ago

The problem with STTF: https://github.com/WICG/scroll-to-text-fragment#:~:text=The%20exact%20details%20of%20what%20a%20browser%20should%20do%20once%20it%20finds%20a%20match%20are%20mostly%20beyond%20the%20scope%20of%20this%20proposal.%20Browsers%20are%20mostly%20free%20to%20choose%20what%20kind%20of%20UI%20to%20surface%2C%20whether%20or%20not%20to%20scroll%20the%20text%20into%20view%20on%20load%2C%20and%20how%20to%20visually%20emphasize%20it

purpleslurple commented 1 year ago

https://www.w3.org/TR/annotation-model/#text-quote-selector