Userscripts Comments Fix

By sizzlemctwizzle Last update Mar 15, 2014 — Installed 14,776 times.

SUGGESTIONS

in
Subscribe to SUGGESTIONS 387 posts, 18 voices



Marti Scriptwright

USO told me that there's a max of 6000 characters in a review, so moving this here
... perhaps a request or few if possible:

Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0
  • ANSWERED What browsers and user.js engines with minimum versions does this script support officially?
  • COMPLETE Inline reply and quoting seems broken from site update
  • REMINDER ≅ html special character doesn't resolve to approximately equals to in code tags... I can only assume more don't too
  • REMINDER Occasionally text selection doesn't Quote what's selected and puts more of the original message in.
  • REMINDER Dynamic page lengthening to allow selection of hidden text.
  • REMINDER Notate on your about page that you have a GM_registerMenuCommand for script updating as well as periodical self update.
    (This is important for security considerations as well as to indicate if someone wants to disable it and how to do that)
  • REMINDER Clean up warnings: Could you clean up warnings in the error console as best as possible please?
  • REVISIT Logged out users shouldn't be shown Quote and Report Spam anchors And also shouldn't continue execution of the primary script.
  • PARTIAL Work in article comments.
  • REVOKED Work with send message even if it's just making the text box bigger... SOOPER DOOPER PLEASE :)
  • REVOKED Implement some sort of itemized macro capabilities. See here, here and here
  • REVOKED Your script no longer is compatible with Userscripts comment helper
  • REVOKED Since "Report Spam" is a shared contribution, might want to put an id attribute in on both scripts and have one defer to the other if both are installed.
    (You suggested not using both however other author may be a few steps different than yours.)
  • COMPLETE onsubmit for forms appears to be using Prototype.Ajax instead of jQuery.ajax test
  • COMPLETE Deleting multiple spam reports without closing causes persistent storage to become out of sync.
  • COMPLETE When linking selected text on USO (Alt+l)... would you be willing to strip out http://userscripts.org if present at the beginning?
  • COMPLETE Some nested "BBCode" commands don't all work
  • COMPLETE Implement missing [u] pairing for [ins] in pre/code tags
    Implement [s] and matching pairing for [del], and [sup], [sub] in code/pre tags (they do work)
    ("LAZY" HINT: The regular expression for testing these is not ordered correctly and missing some values)
    Implement [url]http://example.org[/url] and [url=http://example.com]Example[/url] for pre/code tags (they do work)
  • COMPLETE In order to support uso - Anchor Bookmarks in code blocks I need the pre and code tags to accept null values... e.g. [url][/url] TIA
  • COMPLETE Would you be willing to add something along the lines of links to each vcard?
  • COMPLETE Work with guide creation/edit... comments in guides are secondary imho since they are so small in width.
  • COMPLETE Whenever possible change uso related .href links to .pathname plus (optionally).search
  • COMPLETE Would you be willing to add a minute amount of white space into your code for better word wrapping?
  • COMPLETE Report spam doesn't work
  • COMPLETE Vanity URI is returned on blockquoting... If a user changes their mind... username wrote anchor will not reflect original author. See here
  • COMPLETE Update your DOM injected embedded CSS for pre/code tags via GM_addStyle
  • COMPLETE When your script and then Joe's script is enabled and nothing else, and in that order... something breaks his preview.
    Could you please take a look and see what's what? Thanks
  • COMPLETE When another user edits their own script meta data, Description textarea is shrunk. See here
  • COMPLETE Implement big and small []'s in code and pre tags... super please :)
  • COMPLETE Something triggers GM access violation by use of GM_getValue in unsafeWindow (Probably GM_setValue too) See here
  • COMPLETE Tiny bit of improvement on how to use it in your about... took me a bit to get on your page of thinking.
  • COMPLETE Pressing Cancel on comment of reporting spam still sends message to spam post... Is this "by design"??? Remarked as by design
  • COMPLETE Add @namespace
  • COMPLETE Full URI in "wrote"?... explained here
  • COMPLETE On the Discussion tab of a script, picked a topic, opened edit post and then clicked Quote on someone elses reply... created a new reply
  • COMPLETE "Red X" missing in reply to topic. Author remarked as redundant
  • COMPLETE Delete post missing in reply to topic.
  • COMPLETE Report spam appears to not give confirmation under Linux.
  • COMPLETE Allow quotation of selected mouse text?
  • COMPLETE Allow me to quote myself too?
  • COMPLETE Some way of temporarily disabling "transformations" with [] resolving... either with a checkbox or some sort of escape sequence (string literal??) like [[b] or \[b]
    (escape the escape char maybe??... bolding isn't sticking after 2nd edit)
  • COMPLETE Consider migrating tags/BBCode u, b, s and i to their HTML equivalents for HTML 5 compatibility.
    (Yes I know it's still in flux but the longer tags aren't so far.)

See also beginning forum discussion at http://userscripts.org/topics/25242

 
sizzlemctwizzle Script's Author

Marti wrote:
Some way of temporarily disabling "transformations" with [] resolving... either with a checkbox or some sort of escape sequence (string literal??) like [[b] or \[b]

Just took care of that. Use a backslash.
Marti wrote:
If document.getElementById("reply") is null probably assume the user is logged out... and should remove Quote and Report Spam anchors

Done.
 
Marti Scriptwright

sizzlemctwizzle wrote:
Marti wrote:
Some way of temporarily disabling "transformations" with [] resolving... either with a checkbox or some sort of escape sequence (string literal??) like [[b] or \[b]
Just took care of that. Use a backslash.
Almost ;) I don't think it should show the escape character though.

Escape tests:

[b]hello[/b]


[b]hello[/b]
 
sizzlemctwizzle Script's Author

[b]stuff[/b] Mine doesn't show.

 
Marti Scriptwright

sizzlemctwizzle wrote:
Mine doesn't show.
OOPS! Sorry put a pre at the beginning and a /code at the end LOL

Nice job.
 
sizzlemctwizzle Script's Author

Marti wrote:
sizzlemctwizzle wrote:
Mine doesn't show.
OOPS! Sorry put a pre at the beginning and a /code at the end LOL

You almost gave me a heart attack Marti. Getting that to escape was so frustrating lol.
Edit: The code one isn't working. Give me a sec.
Edit again: Okay the escape escaping works in the code block now. Notice that when you edit your comment the backslash reappears.
 
Marti Scriptwright

sizzlemctwizzle wrote:
Okay the escape escaping works in the code block now.
Hmmm

Escaping escape tests (double backslashes)
\[b]this should be bold[/b]
\[b]this should be bold[/b]

If you are using regular expressions to do this, you'll be an expert by the time I get done with requests *GRIN* LOL
 
sizzlemctwizzle Script's Author

Marti wrote:
Escaping escape tests (double backslashes)

Was wondering what you were doing there, but yes, if you put two backslashes you end up with one.
Marti wrote:
If you are using regular expressions to do this, you'll be an expert by the time I get done with requests *GRIN* LOL

I am using regular expressions lol. What I have learned from all this is that I really dislike using only the replace function(back references are nasty).

btw. I added your quoting guide to the about page.
Marti wrote:
Notate on your about page that you have a GM_registerMenuCommand for script updating as well as periodical self update.

I don't think this is too important since my script checks for an update every two day. If they disable automatic update checking it tells them the can re-active it from the "User Scripts Commands..." submenu.
Marti wrote:
Something triggers GM access violation by use of GM_getValue in unsafeWindow (Probably GM_setValue too) See here

I actually don't need to call page functions anymore so I can probably get rid of that error.
 
Marti Scriptwright

Hmmm I must be on drugz here... I went to go strikeout and small one of the requests and with your script it "double spaces" my list entries. :\ ... lemme regather my thoughts and double check my html.

 
sizzlemctwizzle Script's Author

Marti wrote:
Hmmm I must be on drugz here... I went to go strikeout and small one of the requests and with your script it "double spaces" my list entries. :\ ... lemme regather my thoughts and double check my html.

I'm converting newlines to <br /> tags now, so put your list on one line.
 
Marti Scriptwright

sizzlemctwizzle wrote:
I'm converting newlines to
tags now, so put your list on one line.
I'd rather not have that done... makes for one heck of a long line to edit and is against w3 standards.

Time for that checkbox with an altered purpose now? ;)
 
sizzlemctwizzle Script's Author

Marti wrote:
sizzlemctwizzle wrote:
I'm converting newlines to
tags now, so put your list on one line.
I'd rather not have that done... makes for one heck of a long line to edit and is against w3 standards.

Time for that checkbox with an altered purpose now? ;)

Yeah. You're probably right. Give me some time though. I'm cleaning up the script(which could take awhile).
Marti wrote:
against w3 standards

really? I had no clue. why?
 
Marti Scriptwright

sizzlemctwizzle wrote:
why?
<html>
  <head></head>
  <body>
    This line
    and this line< br />as compared to this line (had to put a space in the br tag btw... uso is doing something too)
  </body>
</html>

Should always render as:
Thislineand this line
as compared to this line (had to put a space in the br tag btw... uso is doing something too)

To give you some background... I edit my html outside of this Reply to Topic box... and I'd rather not have to run it through sed or tr to remove the \n characters.

 
sizzlemctwizzle Script's Author

Sure a browser shouldn't render a newline as a visible newline, but we're talking about text entered in a textarea so its a little more complicated. Anyway, I'm going to only covert newlines to <br /> outside of us.o whitelisted tags. btw I managed to get rid of that GM access violation.

 
Marti Scriptwright

Well it is your script... however I'll need to make a mod locally to remove that feature because it slows down my replying when I don't get what I expect. My current method with current release is to disable your script, refresh the page and lose all capabilities... the alternative is to run my text through a filter first, then post it... if that is the case, I'd rather not use this script at all. So out of the 3 choices I have I'd rather alter the script, but that doesn't help anyone else. Catch my drift?

 
sizzlemctwizzle Script's Author

I admit the way I'm doing it in the current version is terrible. I'm finishing up my next version. As long as the replacement doesn't happen inside tags then why would it matter? Could you please clarify? I don't see the disadvantage of this shortcut. If I have to I'll let you disable it from the GM commands menu.

 
Marti Scriptwright

sizzlemctwizzle wrote:
clarify
It already is happening outside of the whitelist.

sizzlemctwizzle wrote:
clarify

That's why these two blockquotes look different. If you think you can handle every possible logic case then go for it.


I'm sure I'll comment if I find one that is missed ;) I've already removed the feature on my local copy too. Technically you could end up modifying the original post text. So far, with this one exception, every time I load up the edit anchor, it's exactly how I typed it.


Just out of curiousity too... why did you choose to encode the image in Alt+X ??

Yours:

data:image/png,%89PNG%0D...

Base64: (yours recoded and smaller)

data:image/png;base64,iVBORw0KG...
(btw won't be keeping these strings in here for later reference)
Sorta figured this one out already...innerHTML... gotta love it.

 
sizzlemctwizzle Script's Author

Gave up.

 
Marti Scriptwright

sizzlemctwizzle wrote:
Here is a test:
Refresh your page too ... you will see it still increased the list spacing.

plus it added a trailing br tag when I reedited... reverting to this version for now with local edit.
 
sizzlemctwizzle Script's Author

I know. I'm debugging right now. It's getting quite messy. Yeah it's probably better if you revert. I'll let you know if I get this figured out.

 
Marti Scriptwright

sizzlemctwizzle wrote:
quite messy.
;)

Marti wrote:
If you think you can handle every possible logic case then go for it.
*whistles* ;)

You are a very competent and adaptable coder... I rarely see this in other dev's... so don't ever knock your abilities.

 
sizzlemctwizzle Script's Author

thanks for the vote of confidence.

 
sizzlemctwizzle Script's Author

The code that I came up with worked, but would freeze the browser if the post contained too much text, so sadly, we'll just have to keep typing our <br> tags. If you're curious:

var replacer3=function(str,open,inner,close) {return '<'+open+'>'+inner.replace(/\u0900/g, '\n')+'</'+close+'>';}
var textarea1.value=textarea1.value.replace(/\n/g, '\u0900');
tags=['p','code','pre','div','span','ul','ol','li'];
for (var i=0,len=tags.length; i < len; i++) {
    textarea1.value = textarea1.value.replace(new RegExp("<("+tags[i]+"[^>]*)>((?:.|\s)*?)<\/("+tags[i]+")>", "gmi"), replacer3);
}
textarea1.value=textarea1.value.replace(/\u0900/g, '<br />');

 
Marti Scriptwright

sizzlemctwizzle wrote:
we'll just have to keep typing our <br> tags.
hehe sounds good
Current release test
First round edit [b]this should be bold[/b] Second round edit this should be bold
 
Marti Scriptwright

K... balls in your court... changed some wording around in request because I'm "stuck" too... as far as I can tell I'm SOL on 2nd edit and need to go fix it manually *GRIN* but maybe you have another idea...

Looks like [url=http://example.com ]example[/url] is broken too... on in and out. If it comes down to escaping the escape versus a url... go with the url... and I'll just revoke my request :)

... going to move onto other thoughts. Thanks again for your time and efforts.