How to set your icon with LibraryThing MyIcon

DiscussãoHacking LibraryThing

Aderi ao LibraryThing para poder publicar.

How to set your icon with LibraryThing MyIcon

Este tópico está presentemente marcado como "adormecido"—a última mensagem tem mais de 90 dias. Pode acordar o tópico publicando uma resposta.

1brightcopy
Jan 16, 2010, 1:34pm

Collectorator asked how to set the icon for aethercowboy's LibraryThing MyIcon script. All you need to do is enter a URL when first prompted by the script. For example, I saved your user icon, resized it to 16x16 and uploaded it to imageshack. So when it prompts you for your icon, enter:

http://img5.imageshack.us/img5/9890/collectoratorc.jpg

Hey aethercowboy - You should put in a submenu that causes the prompt to come up again. Right now there's no good way for someone to change their icon. I'm sure you didn't do it before because it was mainly for you and you know how to use about:config. :)

2brightcopy
Jan 16, 2010, 2:17pm

Oh, and btw aethercowboy, you got bit by the same "feature" I did. You need to add "http://www.librarything.com/talktopic*" to the Included Pages for any script that modifies talk pages. When you click on the link, you go to a page with the URL form "http://www.librarything.com/topic/*". But when you click in the cell near a link but not actually on it, you get a URL of the form "http://www.librarything.com/talktopic*". Probably just some cruft LT has never noticed or cared enough to change.

3Collectorator
Jan 16, 2010, 2:29pm

My poor little shrunken mule! What I was really asking though,was whether it had to be an .ico file, or if it could be a .gif file. You've made a .jpg, so now I guess I can use anything?

To change it, I think I'll just turn it off and then turn it back on.

4Collectorator
Jan 16, 2010, 2:30pm

Nope. That doesn't work. Will have to wait for the cowboy.

5brightcopy
Jan 16, 2010, 3:09pm

You can use anything that would normally display in your browser. Most browser can display gifs and jpgs. Most newer ones png, too. Ico is less common. When in doubt, just try to open it in the browser.

If you want to change it right now without him adding the option, enter about:config in your browser url bar. Then type
myicon.favicon
in the search bar. That should bring up one result. You can right click on it and edit it right there, or choose reset and the script will prompt you next time.

6brightcopy
Jan 16, 2010, 4:24pm

aethercowboy:

Just for fun (and as part of learning the GM menu command api), I went ahead and whipped up a function. All you need to do is stick it somewhere after you've defined xFavicon.

GM_registerMenuCommand('Reset Favicon', function() {
GM_deleteValue(xFavicon);
window.location.reload();
});

7Collectorator
Jan 16, 2010, 5:12pm

All right, I edited through about:config. But my image is distorted. I need to change the pixel size in the code. I wonder where dat is.

Oh, and a question I had from earlier is must I upload the image to the web, then provide that path to the script? That's what I've been doing, because there isn't a browse yer files button.

8brightcopy
Jan 16, 2010, 7:39pm

You to edit the image using some image editing software (if you're on Windows, you should at least have something called Paintbrush somewhere if you search for it).

You don't have to upload it. But the syntax is a little trickier for files on your local machine.

If you had a file that was at:
C:\temp\thing.gif

You would need to enter:
file:///C:/temp/thing.gif

There's no great way for his script to let you browse for a local file using Greasemonkey scripts. You can do it, but it's a whole lot of trouble.

9Collectorator
Jan 16, 2010, 7:48pm

I know how to edit an image, I just don't know what size the script wants.

It's no problem uploading to the web.

10brightcopy
Jan 16, 2010, 7:54pm

16x16

11Collectorator
Jan 16, 2010, 7:55pm

But how do you know that?

12Collectorator
Jan 16, 2010, 8:00pm

ewww. Animated ones are bad.

13brightcopy
Jan 16, 2010, 8:05pm

I know it because I looked at the script code. ;)

var xSize = 16;
image.setAttribute("height", xSize);
image.setAttribute("width", xSize);

If you wanted to learn some mad skillz, you could actually increase that value in the code to give yourself a bigger icon. Just choose Manage Scripts under the monkey icon. Find the LT MyIcon script in the list on the left, then click the Edit button below that. It should open the script in a text editor. Edit it and save it. Then reload the LT page and your results (for better or worse!) should have taken effect.

Good luck!

14Collectorator
Jan 16, 2010, 8:14pm

Ahhh. Ok. I'm all set. I left it at 16 because that's good. Now I have a nice colored box. (silly smile)

Thanks for all your help, jpierce!

15aethercowboy
Jan 18, 2010, 9:52am

Bugs noted. I'll roll out an update soon!

16aethercowboy
Editado: Jan 18, 2010, 9:57am

Do my updates work? I ask myself before I deploy?

Still testing....

17aethercowboy
Jan 18, 2010, 10:01am

Fixed, I think.

http://sites.google.com/site/jacobsilvia/code/ltmyicon.user.js

Let me know of any more bugs/problems/feature requests. Or you can do it yourself (it IS in the CC :)).

Sorry for the long delay. I don't normally visit LT on the weekends. Playing Spore...

To reset the image (thanks to jpierce):

Tools > Greasemonkey > User Script Commands > Reset Favicon