Good idea to give LT a kill switch on our greasemonkey scripts?
Únase a LibraryThing para publicar.
Este tema está marcado actualmente como "inactivo"—el último mensaje es de hace más de 90 días. Puedes reactivarlo escribiendo una respuesta.
It would give him the peace of mind that if anything went haywire and our scripts were messing things up, he could at last resort put in a piece of code that turns that script off without trying to get users to uninstall the script. And if we ever felt like this power was abused, we could just take the kill switch out of our scripts fairly easily.
So here's what I propose. Put this as the very first piece of code in your script:
if (typeof unsafeWindow.ltKillSwitch == 'function' &&
unsafeWindow.ltKillSwitch('Name of Your Script Goes Here'))
What that (hopefully) does is say "if there's a function called ltKillSwitch in the page and ltKillSwitch(my script) returned true, bail out and don't do anything else."
That way Tim can define the kill switch however he wants (global kill switch, kill switch per script, etc.) and we don't have to worry about the details. All you care is if it exists and it returns true on your script name.
What do you think? Totally crazy? A decent idea?
I guess here's my take on it:
1) If Greasemonkey usage with LibraryThing skyrockets, that should be a pretty clear indications of which areas of the interface that need work. Hopefully what will be done is something to address the concerns of that script, hence removing the need for it. (For example, I originally started researching this to try to find some way to have it so my "To Read" list didn't keep showing up with green checkmarks. That is an itch just got a lot less scratchy).
2) I know very, very few people who actually regularly use Greasemonkey. The idea of spending effort to take preventive measures against what I would guess is at most 1% of users seems silly when we don't know if there's a problem yet.
I can't see how using Greasemonkey could ever interfere with the site at all (?) and the LT staff knows to ask if it is in use before troubleshooting problems.
But, I don't know anything. :)
Second, it won't stop anything you said in point #1 (or post 3) from happening. For point #3, I don't mean intentionally abusive scripts. I mean ones where it has unintended consequences to the UI, especially after a code change altered the structure of what it used to manipulate.
Collectorator> Tim doesn't disapprove so much as he is leery of it, because of that past problem and the potential for repeats. As a programmer, I understand him. It's enough work for a small team to try to solve their own bugs and take responsibility for them. As far as how GM could ever interfere with the site - yes it definitely can. In some of the scripts I've written, it definitely did break the UI until I got the script totally right. Now, it wouldn't break the site for other people, but it would for the GM user.
Mainly, I do not think any of the scripting we're doing is going to cause a problem. Mainly I'm wanting to put Tim at ease so that he's more on our side of things. I want to be able to say "hey, you mind using id attributes on more stuff so it's easier to find the right element?" and have him say "sure thing, I'll try to use them" rather than "oh no, not another potential breakage." I'm hoping this will also get him more receptive of our scripts that work as a proof-of-concept for a code change we're requesting.
I'm going to do it. It's just three lines of code pasted into each script. The potential benefits far outweigh the trouble. I hope other people might follow suite but won't be bent out of shape if they don't. :)
I've written a proof-of-concept script that creates an iframe on one of the LT pages and loads it with the source from another LT page so I can get all the information on one page. In other words, I'm making it so one page load causes two. I'm also firing this by means of a timer loop, since I have to wait until a button is clicked on the form.
Now, image I fouled my code up such that it requested that load on ever run of the timer loop and never stopped. Especially imagine that this didn't happen originally but did happen when Tim changed the code for the page such that my previous condition to stop the timer now never happened.
And now imagine a couple dozen people install my script.
Basically, I've just implemented an accidental Denial of Service attack on LT using greasemonkey. I'm not sure how beefy their servers are, so I couldn't tell you at which point they'd actually start having problems. But it is a real possibility.
Note: I would never release a script such as that without explicitly getting Tim's okay on it.
What would be really nice is to have the Tim Stamp of Approval on GM scripts. Then we'd all be more comfortable. But we'd need another Tim to perform this quality control function.