Userscripts comment helper

By alien_scum Last update Jun 23, 2007 — Installed 772 times.

Archived Comments (locked)

in
Subscribe to Archived Comments 23 posts, 11 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
Avindra V.G. Scriptwright

hey alien_scum, i fixed your script for "edit" links and added an "automatic" escaping option and some other stuff

here's the link

 
Avindra V.G. Scriptwright

didn't notice this script here... much better than mine haha
I have only one suggestion right now:

in your function $(xpath)

Change the one line where it returns to:

return document.evaluate(xpath,document,null,9,null).singleNodeValue

According to the logic, this should be much faster, and W3C confirms it. the basic idea is instead of finding all the results, then returning the first, the XPathResult.FIRST_ORDERED_NODE_TYPE (or 9) makes the engine stop immediately after finding the first result.

Also actually, you might consider adding this from mine:

.replace(/<(?!\/?(pre|code|a|div|img|strong|em|ins|h1|h2|h3|span|p|li|ul|ol|blockquote|br)\/?>)/gi,"&lt;")

Basically, it will only automatically escape everything that isn't one of the whitelisted html tags. I didn't bother making it escape >'s because if at least one (< or >) is escaped, the browser will know what to do.

 
JoeSimmons Scriptwright

Oh thank you so much znerp lol I didn't read the other comments before.

 
znerp Scriptwright

@JoeSimmons: Check my post 2 before yours...

 
JoeSimmons Scriptwright

I love this. I wish it worked on an edit post/comment box.

 
jerone Scriptwright

lol, I just totally missed that part. I almost wrote the same part a few lines up and totally not reading the rest of the document. The only thing that I missed was the wait-part, which I totally needed to get it working.

Anyways, thanks for the more simple solution.

 
znerp Scriptwright

@jerone, dob: This can be easily fixed. Line number 123 checks for links with ;edit in their href which worked fine until there were some changes on us.o and this could simply be changed to /edit to fix that problem. Since editing comments has been introduced, this script also doesn't work when perfomring this, so I've personally fixed this by changing that line of code to search for the word 'edit' in the textcontent of links on the page, ie. I've changed line 123 to the following;

edits=document.evaluate('//a[contains(text(),"Edit")]',document,null,null,null)

 
jerone Scriptwright

Just as dob said, support for editing would be great too.
As a scriptwriter myself I tried to fix this, but that wasn't that easy and after a hour I gave up.
Hopefully the scriptwriter (or someone else) comes up with a solution some day.

 
dob Scriptwright

Awesome script, but support for editing post would be great, too. I really miss that.

 
Sean Watson Scriptwright

Any chance of making one similar to this for MySpace comments/bulletins?

 
vOidSenses Scriptwright

just notice the update, really good, i like the new buttons

once again thx ;]

 
vOidSenses Scriptwright

i have a suggestion, what about adding at the begging of the comments the same button "Add a comment" to do exactly the same thing? it kind happens often to have to scroll a lot to the end just to click in the button and then scroll back up to answer something in the beginning of the comments

cheers, btw either adding or not what i suggested i've faved your script, it's very useful to me X]

 
vOidSenses Scriptwright

testing... 1.. 2.. yep, it's working

thank you

 
alien_scum Script's Author

Comment posting fixed thanks vOidSenses.

 
vOidSenses Scriptwright

hi, the script is constantly failing to Post the comment in the script pages, i click "Post comment" and nothing happens, thought i might wanna know ^^

 
vOidSenses Scriptwright

installed and working like a charm, thank you, very useful :)

btw, are you going to implement the remaining tags?

 
Lior Zur Scriptwright

Another instant hit from alien_scum! This script is simply fantastic. Great idea; elegant execution. Keep this up.

 
vOidSenses Scriptwright

one thing though, u used the href="#" in the links so every time i click in one the page goes up

honestly i don't remember how to take that way, but i know it's possible, or u can always use buttons instead of links

 
vOidSenses Scriptwright

since you can run malicious code in input areas one thing that normally every forum system has is to escape certain characters or to simply delete them, since we are sharing code snippets isn't very cool to see your code deleted, so the escape function of this script

 
znerp Scriptwright

Awesome script, although I'm not sure if underlining works on us.o; pretty sure I've tried it in my script metadata and it didn't work.

 
Timothy Scriptwright

My bad, this script is amazing though.\\

 
Timothy Scriptwright

Escape?

Not sure what the escape part is.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel