6 ms·
JavaScript modifying cut and paste can sometimes be a good thing in browsers
- NoZebra120vClip 3y agoAt work, I frequently modify specific URLs in a specific way. I sincerely wish that the process could be automated.
- ThrustVectoring 3y agoThis is a textbook use case for a Vim macro.
- NoZebra120vClip 3y agoWe don't use Vim at work.
- yonatan8070 3y agoWell it could make your life way easier, I'd recommend trying it
- NoZebra120vClip 3y agoLike I said, we don't use Vim at work.
- maest 3y agoIf you did, it could help you with this exact problem. It's installed by default on many operating systems (and easy to get hold of, otherwise)
- NoZebra120vClip 3y ago[flagged]
- ThrustVectoring 3y agoIt's installed by default on OSX, Ubuntu, and most non-windows operating systems.
- cookie_monsta 3y agoSounds like the sort of thing a userscript could probably handle
- crtasm 3y agoWould they let you install a userscript? Wouldn't be difficult to make one that adds a link on the page pointing to the modified URL. https://en.wikipedia.org/wiki/Userscript https://en.wikipedia.org/wiki/Userscript
- NoZebra120vClip 3y agoNo; we generally have limited access to Chrome extensions. Only those which are approved by the company are permitted. Arbitrary userscripts wouldn't be possible in that framework.
- housemusicfan 3y agoAllowing JavaScript to modify the clipboard contents is cancerous behavior and the developers that enabled this functionality should have their heads examined. Not once have I seen this function used in a non-abusive manner. More often then not it's either used to inject advertisements or copyright notices in the content copied to the clipboard. When you issue a copy command, what should appear on the clipboard is EXACTLY what is selected. I wish browser makers would stop adding useless new features and get down to brass tacks. It's 2023 and sites can still detect incognito mode which defeats the purpose.
- poniko 3y agoIn pixlr we copy and paste bitmap data and layers etc .. a feature that most users love .. and are pissed by the browsers that don't enable it. The problem is more about how the rights to access features is managed in browsers, it needs a total rewrite.
- hfkwer 3y agoWhy such hyperbole? Cancerous? Heads examined? That's ridiculous. Wikipedia allows you to copy math expressions as MathML rather than a rendered SVG. Is that "cancerous behavior"?!
- housemusicfan 3y agoI'm sure grenade launchers are great for hunting deer and other game but there's a reason they don't allow just anyone to buy one, despite there being an occasional positive use case.
- 8note 3y agoI don't really understand what response is here. Like still, how is cancer a relevant metaphor? What's the cancerous cell that is avoiding typical cell death and reproducing unexpectedly? How is it taking resources from the group of cells that would usually use them?
- blendergeek 3y ago
- guerrilla 3y agoOkay fine, that's a good use, but I still wish it wasn't even possible.
- moonlighter 3y agoAnother nuisance which really gets on my nerves is when sites specifically prevent me from pasting, typically fields where you need to put a bank account or routing number. Copy and pasting that info is WAY more accurate and error-proof than glancing at one screen and re-typing it in another. I then temporarily disable Javascript in the developer menu and re-enabled it afterwards, but that still sometimes causes issues down the line, as now the site "thinks" there isn't a value in the field because they didn't notice any typing events, etc..
- jtokoph 3y agoWhile I don’t agree with the implementation, I think this is usually done on forms that ask you to confirm the value a second time. The goal is not to prevent you from pasting from an accurate source; instead they are trying to prevent users from copying an incorrectly manually typed value from one field to the other. The end result just also blocks our use case…
- afiori 3y agosometimes websites forget to disable selection dragging, so you can paste in the first field and drag to the second field.
- the_pwner224 3y agoIt's easier to ctrl-shift-c to pick the element in the inspector, then paste into the value="" HTML in the developer tools. Also useful on treasurydirect.gov which has a ridiculous password entry field. They make an on-screen "keyboard" with a bunch of JS buttons, you have to click those buttons to enter your password. You can't type into the password field or paste into it.
- vezycash 3y ago>It's easier to ctrl-shift-c to pick the element in the inspector, then paste into the value="" HTML in the developer tools. I use "Happy Right-Click" firefox addon for this. Just click the addon icon located on the address bar and voila.
- janmarsal 3y agoI guess mosquitoes provide food for the birds...
- matheusmoreira 3y ago"Can sometimes be good" is not enough to override the numberless sites who abuse it to send me a scathing message about how I'm not supposed to copy paste their copyrighted content as if I cared.
- unlog 3y agoThis particular case doesn't use JavaScript at all. It is just CSS cropping the full URL in a way that when you select and copy it, copies text that it is hidden. edit to add an example: data:text/html,<div>123<b style="font-size:0">456</b>789</div>
- its-summertime 3y agoIts not implemented in javascript. <a href="URL"> <span class="invisible">https://</span> <span class="ellipsis">example.com/</span> <span class="invisible">the/rest/of/the/url</span> </a> With semi-obvious CSS rules
- lapcat 3y agoThe author's use case can be handled with CSS instead of JavaScript: overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
- proto_lambda 3y agoThat's exactly how it is handled, I don't know where they got the idea that it's done by JS.
- tedunangst 3y agoMastodon does this because they made a 500 character limit, but then you'd blow your whole budget on one link, so they made links not count, but then you need to shorten it somehow so it looks pretty because they don't support markdown or other means of posting links.
- DropInIn 3y ago[flagged]
- jenadine 3y agoI'm really annoyed by some of these new webapp running in the browser and highjacking the clipboard do that the X11 selection clipboard (select & middle click) no longer work as expected on these.
- krono 3y agoThe truncated part exists in the markup, it's simply being hidden with the help of some CSS. This same method is also used to trick people into executing nefarious shell commands of which an example can be seen here https://thejh.net/misc/website-terminal-copy-paste https://thejh.net/misc/website-terminal-copy-paste
- kevin_thibedeau 3y agoMiddle click paste to the rescue. Just have to combat sites that prevent text selection.