Userscripts Comments Fix

By sizzlemctwizzle Last update Apr 21, 2013 — Installed 14,732 times.

Great Script Thank you

in
Subscribe to Great Script Thank you 54 posts, 8 voices



congxz6688 Scriptwright

oh my god!
In the post window, "alt + B" can work smartly without openning the bookmark_menu!
And out of post windows "alt + B" would just open the bookmark_menu.
How do you achieve? I love you!

all the shortcut can work rightly now. thank you!

 
sizzlemctwizzle Script's Author

My listener is attached to the actual textarea and I used preventDefault to disable the native shortcuts when you are focused on the textarea. Works rather nicely. I should have used it before.

 
Tim Smart Scriptwright

I made one change to my script at line 100: case 80:this.value=before+"<pre>\n"+selected+"\n</pre>"+after;break;

If you don't add new line's between the code and the pre tag's, the code displays weird.

 
sizzlemctwizzle Script's Author

Tim Smart wrote:
I made one change to my script at line 100: case 80:this.value=before+"<pre>\n"+selected+"\n</pre>"+after;break;
If you don't add new line's between the code and the pre tag's, the code displays weird.

Yeah I noticed that. You get some strange indentation. I've been doing that manually. I'll add it to the script.

 
sizzlemctwizzle Script's Author

Added the one-click spam reporting feature from this script: http://userscripts.org/scripts/show/47097

 
DMaster Scriptwright

ok .. i know you've been through all this.. but maybe u can set it to SHIFT + ALT... that shourtcut is rarley used..

 
sizzlemctwizzle Script's Author

DMaster wrote:
ok .. i know you've been through all this.. but maybe u can set it to SHIFT + ALT... that shourtcut is rarley used..

I don't know... are you having problems with the current shortcuts?

 
Marti Scriptwright

sizzlemctwizzle wrote:
having problems with the current shortcuts?
Maybe having an issue with understanding how your script functions?... took me a while to figure out not to use the hot keys outside of the reply to topic box. This is why I made this:
  • Optionally open the reply to topic box
  • Optionally select text in the DOM body with mouse
  • Click Quote under the gravatar
  • Click to focus in the reply to topic box (if text cursor isn't there already)
  • Select text in the reply to topic box
  • Use "Hot keys" or click lettered links to the right to put the html tags around what is selected

 
sizzlemctwizzle Script's Author

Marti wrote:
took me a while to figure out not to use the hot keys outside of the reply to topic box.

why would you use the hot keys outside of the reply box?
Auto updater included triggers GM access violation by use of GM_getValue in unsafeWindow (Probably GM_setValue too)

I'm not accessing GM_getValue or GM_setValue with unsafeWindow.

 
Marti Scriptwright

sizzlemctwizzle wrote:
why would you use the hot keys outside of the reply box?
For Alt-Q with selection highlighting... that's what I initially thought your hot keys were, but they are local to the reply to topic and not the entire DOM.

sizzlemctwizzle wrote:
I'm not accessing GM_getValue or GM_setValue with unsafeWindow.
I can see that in your code, but I'm guessing that an event listener is in a different namespace and triggering it in the default namespace authority. This could be a Firefox related issue too. Your script is the only one I'm using that has unsafeWindow and the vast majority of time I selectively disable DOM JavaScript.

It is pretty intermittent so it's hard to pin down what triggers it here.

Present in Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.0.9) Gecko/2009040820 Firefox/3.0.9

 
sizzlemctwizzle Script's Author

Marti wrote:
I'm guessing that an event listener is in a different namespace and triggering it in the default namespace authority.

My update code isn't triggered by an event. I have this update code in another script that uses unsafeWindow and it has never produced that error either.
Marti wrote:
For Alt-Q with selection highlighting... that's what I initially thought your hot keys were, but they are local to the reply to topic and not the entire DOM.

Well I might actually be able to add that shortcut if you want.


Just uploaded my latest version. This version includes some UI changes, the dynamic page lengthening feature, and added a @namespace.

 
Marti Scriptwright

sizzlemctwizzle wrote:
I have this update code in another script that uses unsafeWindow and it has never produced that error either.
Well it triggered it yesterday and the day before I actually figured out a way to trigger it WITH a line number... Like I said it might be a Firefox issue... double checked to see if I had the latest and greatest FF, and I didn't, but now I do. This might correct it, but I'll have to rehack your script that I'm running to see.
Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.0.9) Gecko/2009040820 Firefox/3.0.9
sizzlemctwizzle wrote:
Well I might actually be able to add that shortcut if you want.
You might be running into some issues with KDE like we discussed on the forum but it's up to you. The way it stands now it's more compatible with uso integration. If you add a DOM wide hot key might be detrimental to that goal.

sizzlemctwizzle wrote:
This version includes some UI changes, the dynamic page lengthening feature, and added a @namespace
Kewl... I look forward to testing it. :)

 
sizzlemctwizzle Script's Author

Marti wrote:
If you add a DOM wide hot key might be detrimental to that goal.

Yeah, you're right. That could cause so many issue. I'd rather not mess with it.
Pressing Cancel on comment of reporting spam still sends message to spam post... Is this "by design"???

Yes that is by design. Pressing the cancel just means that you don't want to add a comment to the report.
Marti wrote:
I look forward to testing it.

And I look forward to you catching some of my mistakes lol. I've already caught two myself(hence why there is two previous uploads of this version).

 
Marti Scriptwright

sizzlemctwizzle wrote:
catching some
hehe I just corrected my script today too... been buggin me that I've had the errata since the day after I last posted it LOL but finally got around to tweaking it a bit.

Kewl CSS styling btw :) will load up a scums script and see if it works there too ;) *GRIN* Looks good for just yours... multiple pages were hiding the prev/next on prior install of your script with the static page lengthening... but appears to be well now. WOOT WOOT! :)

 
sizzlemctwizzle Script's Author

Marti wrote:
Kewl CSS styling btw

That took a lot of work lol. But the page lengthening was the most difficult.

 
Marti Scriptwright

You da man!!! Even works with a scum's script enabled too... here's Joe's script test too:

the wiki

OMG! I think you can all play nicely together now. hehe nice job! Now if I could just get Joe to change his script like I suggested him to.


sorta works with a scum's script but only when I use my full single screen rez... still MUCH better.

 
sizzlemctwizzle Script's Author

Marti wrote:
Even works with a scum's script enabled too... here's Joe's script test too

That's nice to know. I'd use Joe's script if there was some special syntax for replacements so I didn't have to type all the words exactly for them to be replaced.
Marti wrote:
sorta works with a scum's script

Can't win 'em all ;)

 
Marti Scriptwright

sizzlemctwizzle wrote:
so I didn't have to type all the words exactly for them to be replaced.
That was my suggestion to him... an alias or "shortcut" I'd like to type GMW for the wiki.

He's more or less currently using JSON structure... which is quite limited.

sizzlemctwizzle wrote:
Can't win 'em all ;)
LOL well I won't be using it very much unless I'm super coding here. (unlikely)
Resolver test:
<hi there>
bold bold strong underline italic underline ins strike del wussup gosubsubby http://example.com over thereexample dot org
bold bold strong underline italic underline ins strike del wussup gosubsubby http://example.com over thereexample dot org
Table test:

BBCode

HTML

Description

b
strong
bold
i
em
italic
s
del
strike
u
ins
underline

 
sizzlemctwizzle Script's Author

Marti wrote:
sizzlemctwizzle wrote:
so I didn't have to type all the words exactly for them to be replaced.
That was my suggestion to him... an alias or "shortcut" I'd like to type GMW for the GM wiki

You're lazy like me(or at least we have lazy hands) lol
Marti wrote:
LOL well I won't be using it very much unless I'm super coding here.

That's why I only include the most commonly used tags. My script is just for your average everyday sort of use.

 
Marti Scriptwright

sizzlemctwizzle wrote:
You're lazy like me lol
LOL sometimes.


I'm still getting the GM access violations on GM_getValue too... and a new one in the error console.

Error: document.evaluate("//a[@class='utility']/child::text()[.='Reply to topic']", document, null, 9, null).singleNodeValue is null
Source file: file:///~/.mozilla/firefox/{randomseed}.default/gm_scripts/userscripts_comments_fix/userscripts_comments_fix.user.js
Line: 241

 
sizzlemctwizzle Script's Author

Yeah I'm getting the same null error but still not the access violations. Fixed and uploaded. Going to bed now. Gotta get up early tomorrow.

 
Marti Scriptwright

sizzlemctwizzle wrote:
but still not the access violations
Get it constantly now with Reply to topic.

Error: Greasemonkey access violation: unsafeWindow cannot call GM_getValue.

No line number so it's out of GM's normal "scope"... which typically means it's the DOM or the browser.


wait a second...

this particular one isn't just your script...*thwaps someone* however lemme retest how I did it in your script and see if it's still present.

Can't reproduce the original access violation that had a line number a few days back... so I guess all is well with yours there. Thankie.

Scratch that... it only happens when Joe's script is enabled along with yours. He doesn't use unsafeWindow at all but does have event listeners. I'm going to try commenting out your autoupdater and see if it comes back.

When I comment out your autoupdater in this script, the Access Violation goes away... Steps to reproduce... have his script running and yours... click Reply to topic.... produces violation... disable his script... goes away... reenable his... comment out your updater... still stays away... but comes back when I reenable the code for the autoupdater.

If I comment out Joes two paraphrased lines:
...
pb.addEventListener("focus",    function(e){ fix(e); }, false);
...
epb.addEventListener("focus",    function(e){ fix(e); }, false);
...

then I don't get the Access Violation... but it still only shows up when I have your script enabled. I do see you use .focus() methods in One-click quoting.

If I comment out just your entire autoupdater code and leave Joe's untouched then I also don't get the Access Violation.

I would make a partial guess that your script is triggering his focus event listener where he set's GM_getValue and that trigger is where the Access Violation comes into play.

Any other ideas why it would be doing this?


Still present in 1.5.5
I'm de-minifying your script and normalizing it as we speak as well as looking for inconsistencies that may pertain, but this is going to take quite a bit of time. I already did Joe's yesterday and he's not doing anything unusual other than overkill on the event listeners ;)

 
sizzlemctwizzle Script's Author

No clue. That error has be completely puzzled. I installed Joe's script and I'm getting it too when I click "Reply to Topic".

 
Marti Scriptwright

sizzlemctwizzle wrote:
I installed Joe's script and I'm getting it too when I click "Reply to Topic".
Have some new information.

Modified GM to actually tell me the source of the violation (This should be in GM but I can only guess advertising the source of a violation hasn't been addressed? Ticket #254 entered)

The actual violation is coming from multiple locations depending on context.

Click Quote anchor with no selection highlighting OR Reply to topic anchor

Error: Greasemonkey access violation: unsafeWindow cannot call GM_getValue.
Source: http://static.userscripts.org/javascripts/all.js?1240391508

Select text to quote, then click Quote anchor

Error: Greasemonkey access violation: unsafeWindow cannot call GM_getValue.
Source: javascript:$("post_body").focus();

Some of this may pertain to this post in that topic about Prototype... but your script is definitely triggering it as well.

@sizzlemctwizzle Is there any way you can retool your portion of your code?


I've modified Joes script to test out the other non-API Leak checked functions and sure enough they run from the ProtoType scope as well as Joe's scope.

 
sizzlemctwizzle Script's Author

Marti wrote:
Is there any way you can retool your portion of your code?

Yes I could.