12 ms·
How does Trello access the user's clipboard?
- eksith 13y ago@DavidMurdoch you really gave the -1? I'm no fan of CoffeeScript either, but everyone should choose the tool [s]he is most productive with. – Boldewyn Jul 9 at 5:49 ` @Boldewyn, I did. My justifications for it were that a) The question is tagged JavaScript, and b) a down vote on a question that was on its way to 100+ up votes in less than a day isn't going to put a dent in anyone's day. I even thought about flagging it as off-topic, but figured that was going a little bit too far. :-) – David Murdoch Jul 9 at 13:49 ` The question was tagged Javascript, but the question is, "How does Trello do this". Seriously, you think it's appropriate to penalize the answerer for the fact that Trello didn't actually do it directly in Javascript? – Elchonon Edelson Jul 9 at 15:34 ` @DavidMurdoch Would you have preferred the compiled JavaScript?! – Mario Jul 9 at 17:35 ` @ElchononEdelson, yes, I realized this (the question is also tagged Trello). While its appropriateness is debatable, the answerer is the developer that wrote the code in CoffeeScript in the first place - and *that* may very well warrant a down vote in-and-of itself. (I'm kidding, mostly). – David Murdoch Jul 9 at 21:11 ` @Mario, yes. Although, I did compile it to JavaScript myself; it was equally hideous. – David Murdoch Jul 9 at 21:12 ` I don't think the appropriateness is debatable. I think the appropriateness is thoroughly and completely absent. – Elchonon Edelson Jul 9 at 21:22 ` Hm, well then maybe it is just my visceral loathing for CoffeeScript that made me do it. – David Murdoch Jul 9 at 21:52 ` So, in conclusion: haters gonna hate? – BoltClock♦ Jul 11 at 3:29 ... Welcome to Stack Overflow.
- BadassFractal 13y agoIt'd be even more Stack Overflow if the question got immediately closed for not fitting the format of the site.
- pavs 13y agoSeriously I absolutely hate asking questions on SO and some of their more active sub-sites. I feel like I am back to the 90s forum with admins abusing their power for the most mundane reasons, the only difference is that they are not 12 year olds anymore.
- BadassFractal 13y agoI hear you. FreeNode IRC has been pretty good to me, although occasionally you run into the angry God-complexed sysadmin who ruins your day, and reminds you why people sometimes really hate interacting with IT personnel.
- manojlds 13y agoDid you even read the comments? And there is even a mod there in the comments saying "haters gonna hate" in support of the answer. Do you have this comment saved in your system and paste it anywhere you want to complain about SO?
- chmullig 13y agoIt's so disappointing how every question worth reading gets flagged, downvoted, and closed for the most random, pedantic bullshit reasons.
- eieio 13y agoTo be fair this answer currently has 591 upvotes and 1 downvote, and the question has 0 close votes. It's not exactly in danger of disappearing because of the obnoxious pedantry of one user.
- recursive 13y agoSo you don't think this question is worth reading?
- jerrya 13y agoI assume SO analyzes their logs to determine how many google searches take people to close, versus open questions. I wonder what the results are. It might be fun to create a Chrome extension that created such a tally.
- graue 13y agoSeems to me it reflects quite well on Stack Overflow that every other commenter is disagreeing with that one obnoxious user.
- epidemian 13y agoWhat's up with all the unrelated hate towards SO in the other comments? Yeah, i don't like when interesting questions get closed for being off-topic either; but it's not what happened in this case. It's just a SO user who gets mad when someone responds in CoffeeScript a question with a JavaScript tag (or when a question tagged as JS is really a CS question). I'm pretty sure i recall him doing something similar (and using the same kind of "because it's ugly!" arguments) in at least another SO question.
- cruise02 13y agoI'm sure this sort of thing never happens anywhere else on the Internet.
- ceol 13y agoCertainly not on Hacker News, where people always vote based on how something relates to the discussion and not their own personal biases.
- dsyph3r 13y agoThis was posted only a few weeks ago
- gruseom 13y agoClever. They intercept the 'ctrl' keypress and make a textarea with the text they want to copy pre-selected, so if and when the user presses 'c', the browser will send the already-selected text to the clipboard. I assume this works even though the textarea is hidden? Is there really no better way to get at the clipboard from a web app?
- arsenerei 13y agoNot to my knowledge. Only flash gives you the ability to "click to copy." Javascript has no of copying text without user specifying the copy action. I don't know the justification, but it can be a security issue if your user isn't aware that they copied something. This is a really neat trick, and I needed it just yesterday, so I'll definitely be giving it a go today. Related to security issues, it reminds me of this issue: http://thejh.net/misc/website-terminal-copy-paste http://thejh.net/misc/website-terminal-copy-paste
- IneffablePigeon 13y agoI think the risk is that nefarious people might, for example, wait for you to copy a (legitimate) URL, then overwrite the clipboard with a slightly different URL, sending whoever follows what you just copied to somewhere else if you don't notice. Seems to me that this trick would be just as effective at doing that though.
- arsenerei 13y agoWell, yes, but at least you knew you copied something in this circumstance.
- duskwuff 13y agoThere are a bunch of web sites that use an annoying doodad from http://tynt.com http://tynt.com to inject advertising into copy/pasted content. I'm not sure if Tynt is using the exact same trick or not; whatever the case, though, the technique is known.
- jtchang 13y agoWeird does this work in Ubuntu using chrome?
- mcintyre1994 13y agoIt does yep, it doesn't on Firefox though.
- epidemian 13y agoIt did work for me on FF/Ubuntu.
- Mahn 13y agoClever idea, someone should turn this trick into a library.
- dhruvtv 13y ago(Copy-pasting my answer from the same Stackoverflow thread) I actually built a Chrome extension - https://chrome.google.com/webstore/search/copy%20link%20address https://chrome.google.com/webstore/search/copy%20link%20addr... that does exactly this, and for all web pages. GitHub source https://github.com/dhruvvemula/copylinkaddress/blob/master/copylinkaddress.js https://github.com/dhruvvemula/copylinkaddress/blob/master/c... I find three bugs with Trello's approach, which I know because I've faced them myself :) The copy doesn't work in these scenarios: 1. If you already have Ctrl pressed and then hover a link and hit C, the copy doesn't work. 2. If your cursor is in some other text field in the page, the copy doesn't work. 3. If your cursor is in the address bar, the copy doesn't work. I solved #1 by always having a hidden span, rather than creating one when user hits Ctrl/Cmd. I solved #2 by temporarily clearing the zero-length selection, saving caret position, doing the copy and restoring caret position. I haven't found a fix for #3 yet :) (For info, check the open issue in my Github project - https://github.com/dhruvvemula/copylinkaddress/issues/1 https://github.com/dhruvvemula/copylinkaddress/issues/1).