Userscripts.org - Preview Posts

By JoeSimmons Last update Aug 9, 2013 — Installed 572 times.

Error

in
Subscribe to Error 10 posts, 2 voices



sizzlemctwizzle Scriptwright

Edit one of your comments and then try to edit one of your other comments without refreshing the page. Result: preview button is gone. Have fun trying to fix this. Took me over an hour.

 
JoeSimmons Script's Author

It's not gone for me. Works fine. Have you updated to 1.0.8?

 
sizzlemctwizzle Scriptwright

I reinstalled, disabled all other scrips, and tried it again just now. Your button still doesn't show up when you go from editing one comment to editing another. It does show up when you edit the SAME comment, but not another. And btw, I've disabled all other scripts. I'll let you know why it happens. Your button is being added, it's just getting wiped out when the new comment loads. You have to wait for the new comment to load into the editbox before you can add your button.

 
JoeSimmons Script's Author

Try it now.

 
sizzlemctwizzle Scriptwright

Nope, still doesn't. What I do is before the setInterval I append an element to the editbox. Then in the interval I keep checking if that element exists. If it doesn't exist then the comment has been loaded and the preview button can be added.

 
JoeSimmons Script's Author

I did what you said about the appending elements. I'm going to release it after I shorten the element creation parts with create() that avg gave me a long time ago.

Off topic, your auto-update script has a small bug. When you have a newer version of the script than what's available, it will say you have an older version and ask you to update. It should be this.xv>this.v and have some handling with theirs being newer than the remote script. And it shouldn't ask if you want to turn off auto-updating if the local version is higher than the remote version.

 
sizzlemctwizzle Scriptwright

JoeSimmons wrote:
I did what you said about the appending elements. I'm going to release it after I shorten the element creation parts with create() that avg gave me a long time ago.

I use one I found on Greasespot.

JoeSimmons wrote:
It should be this.xv>this.v and have some handling with theirs being newer than the remote script.

I guess I always thought it was kind of pointless because usually the developer would be the only one with the newer version, but it's still a good idea. I changed it. Btw you have strip the periods in the version number to make the comparison work properly.

 
JoeSimmons Script's Author

sizzlemctwizzle wrote:
Btw you have strip the periods in the version number to make the comparison work properly.

Shouldn't you do that in your script? It would work fine.
Also, you don't need User-agent in the headers of the XHR.

 
sizzlemctwizzle Scriptwright

JoeSimmons wrote:
Shouldn't you do that in your script? It would work fine.

Yeah I do, but I noticed you modified the update code in your script and I didn't think you stripped the periods. Maybe I'm wrong.
JoeSimmons wrote:
Also, you don't need User-agent in the headers of the XHR.

Yeah, you're right. I forgot about that. Us.o doesn't browser sniff. I don't have to send any headers really.

 
JoeSimmons Script's Author

sizzlemctwizzle wrote:
I didn't think you stripped the periods

I did strip the periods. But I'm using your latest code now, thanks for updating it.

sizzlemctwizzle wrote:
Us.o doesn't browser sniff.

Doesn't matter anyways. The browser automatically sends the User-agent and all the rest of the headers whether you supply them or not. When you put them there, you're just changing them. I've tested this on my own.