LT Sort Author Works

CharlasHacking LibraryThing

Únete a LibraryThing para publicar.

LT Sort Author Works

Este tema está marcado actualmente como "inactivo"—el último mensaje es de hace más de 90 días. Puedes reactivarlo escribiendo una respuesta.

1brightcopy
Editado: Feb 3, 2013, 12:54 am

http://userscripts.org/scripts/show/158254

Adds "sort by copies" and "sort by title" links to the works headers on author pages. These let you resort the works on the fly.

Note that if you're on an author page where some works are hidden behind a "show all" link, it will only sort the visible works. Click on the "show all" link and then sort.



2benuathanasia
Feb 2, 2013, 11:49 pm

...how does it work?
What are the steps?

I clicked the install button, but it just showed me your script...

3brightcopy
Feb 3, 2013, 12:09 am

Here's a good starting point:
http://www.librarything.com/wiki/index.php/Hacking_LibraryThing#Hacking_LibraryT...

Let me know if it still leaves some questions unanswered.

4benuathanasia
Feb 3, 2013, 12:42 am

Ok, I installed Greasemonkey, installed the script, and went to an author's page. Greasemonkey shows a little "check" next to the LibraryThing script, but I don't see anything that allows me to sort works by popularity or title. Where should I be looking for it?

5brightcopy
Feb 3, 2013, 12:55 am

I added a couple of screenshots to the initial post.

6Collectorator
Feb 3, 2013, 3:52 am

Este miembro ha sido suspendido del sitio.

7Collectorator
Editado: Feb 3, 2013, 5:16 am

Este miembro ha sido suspendido del sitio.

8henkl
Feb 3, 2013, 8:22 am

Brightcopy, thank you. Works perfectly.

9benuathanasia
Feb 3, 2013, 1:58 pm

Doesn't look like that on mine. It still looks like it used to look. Greasemonkey says the script is running.

10brightcopy
Feb 3, 2013, 6:19 pm

For those having problems - give me an example author url. Also, try
http://www.librarything.com/author/kingstephen
and
http://www.librarything.com/author/kingstephen&all=1
and tell me if it works on one, both or neither.

11eromsted
Feb 3, 2013, 6:34 pm

It works for me on some author pages but not others. I do not see the sorting links on either of the Stephen King pages. I do see them on the William Shakespeare pages:
http://www.librarything.com/author/shakespearewilliam
http://www.librarything.com/author/shakespearewilliam&all=1

I can find other examples of working and not working if that would be useful.

12benuathanasia
Editado: Feb 3, 2013, 7:01 pm

Works on both King pages, neither Shakespeare pages. Edit: It showed up on the Shakespeare pages if I let the page sit a minute or so.
Other pages I tried it on and saw it didn't work:
http://www.librarything.com/author/dumasalexandre-1
http://www.librarything.com/author/twainmark

Pages I tried where it does work:
http://www.librarything.com/author/dickenscharles
http://www.librarything.com/author/austenjane
http://www.librarything.com/author/brontecharlotte
http://www.librarything.com/author/lowrylois
http://www.librarything.com/author/lewiscs
http://www.librarything.com/author/remarqueerichmaria
http://www.librarything.com/author/leeharper
http://www.librarything.com/author/steinbeckjohn
http://www.librarything.com/author/bradburyray
http://www.librarything.com/author/hugovictor
http://www.librarything.com/author/rowlingjk

Edit: Something I noticed...all the author pages work fine if I go to them from my library (I look in my library and select their name from there). They do NOT work if I do a "search site" of the author's name and look at it from there.

13brightcopy
Feb 4, 2013, 1:59 am

I think I see some of the problems. Thanks, everyone, I''ll upload a fix when I get a chance.

14brightcopy
Feb 6, 2013, 10:28 pm

Okay, I think that does the trick. The main problem was between authors that are in your catalog versus those you have no works from.

Update your script and test it out and let me know how it goes. For those new to the whole thing, you can just go to the script page at the very top and click the green Install button.

(But not the stupid green "Download" button.)

15Collectorator
Feb 7, 2013, 4:30 pm

Este miembro ha sido suspendido del sitio.

16.Monkey.
Feb 7, 2013, 4:45 pm

I do so love you and your scripts. hahaha. I never even bother trying to look at stuff on author pages because it's ridiculous, you can't find anything with prolific authors! This is awesome.

17brightcopy
Editado: Feb 8, 2013, 9:15 am

Glad to help! For whatever reason, this one piqued my interest.

One oddity is that it'll promote weird "No title" works to the top. Like this one (please don't "fix" it, though - I'm going to file a bug report):
http://www.librarything.com/author/shakespearewilliam&all=1

Sort by title and the first one is "No title". This is a side effect of the title being blank even though the link text is "No title". I sort by the link's title.

The odd part is that it should have a title. That book is this one:
http://www.librarything.com/work/9595012/book/72244836

Weird, huh? Like I said, time for a bug report. I posted about a similar one when fixing an entry like this on Stephen King (see the All Hail King Stephen thread in Talk About LibraryThing).

18.Monkey.
Editado: Feb 8, 2013, 9:44 am

Aww, I just discovered for some reason the script doesn't work on my laptop, boooo. :( lol.

(also I have no idea what's up with that title. I tried looking for others that have only copies of the work title in Greek text, but they seem to be fine, so I'm out of ideas lol)

19brightcopy
Feb 8, 2013, 10:02 am

Is your laptop running the same browser and the same version? And which would that be?

20.Monkey.
Feb 8, 2013, 12:05 pm

No, it's old, lol. I'm on a super outdated Ubuntu, running Fx 3.6.11 haha. But all your other scripts work fine! heh

21brightcopy
Feb 8, 2013, 3:11 pm

Ah, that'd be .outerHTML()s doing, I'm afraid. I could code around it if you need to, but it was the easiest way and only requires FF 11. Can't you update? Lots of security holes there, I'm sure.

22.Monkey.
Feb 9, 2013, 6:43 am

Not really, due to the super outdated Ubuntu, lol. That's okay though, it works on my desktop, and eventually I'll update/upgrade the laptop to a new (and current lol) flavor of Linux. :P

23Collectorator
Mar 14, 2013, 4:30 pm

Este miembro ha sido suspendido del sitio.

24jjmcgaffey
Mar 14, 2013, 5:20 pm

It's actually harder to mix capitalized and non-capitalized - in straight ASCII and most codes based on/related to it, all the capitals come first and then all the non-capitals, so an ASCII-order sort (which is the simplest one) will do that separation.

Don't know if it would be possible to do an LT-style sort - there's a lot of code in there for ignoring A and The and the like.

25lorax
Mar 14, 2013, 9:20 pm

24>

Well, adding the -i flag or using tolower() isn't exactly hard. But yeah, it's not as though omitting it is at all mystifying.

Just excluding leading "The, A, An" would be easy enough to do - that's a one-line regexp. LT's proper sorting is harder.

26brightcopy
Mar 14, 2013, 9:40 pm

It would be fairly easy to do a case-insensitive search. All I'd have to do is do a lowercase() of the two values when I compare them. It doesn't affect the value, just the comparison basis.

I thought about doing some more fancy, and yeah the A/An/The would be low-hanging fruit. I also found that there's a locale-sensitive lowercase that might be nice for people using other languages. But of course it won't do any good if you have some books from several languages.

27brightcopy
Abr 8, 2013, 11:05 pm

Finally got a chance to look at this again now that my cover nav script is finished. I think I got all the requests and more:

Sort by title will use a locale-sensitive sort (meaning it takes the language of your computer into account - though not necessarily the language of the individual books).

Sorting will also attempt to intelligently sort numbers so "Abc 99 Def" comes before "Abc 1000 Def".

By default, the sort will ignore the first word if it is "a", "an" or "the". You can edit this list of words by choosing "Leading title words to ignore" from the script menu.

Just use your browser's built in updating if it has it (in google there is a "check for userscript updates" option, in Firefox you have to find the script under Tools->Addons->User scripts, right-click on it and choose "Find updates"). If it doesn't or that doesn't work, just go to the script page at the top of message #1 and click the green Install button at the top right of the page (beware of advertisements that have "download" or "install" buttons that aren't at the top right).

28jjwilson61
Abr 9, 2013, 11:13 am

By default, the sort will ignore the first word if it is "a", "an" or "the". You can edit this list of words by choosing "Leading title words to ignore" from the script menu.

This will cause A is for Alibi to sort to the wrong location and there may be some mixed language libraries for which this won't work well. But you probably knew that already.

29brightcopy
Abr 9, 2013, 11:16 am

#28 by jjwilson61> Yep. Until we get some sort of real artificial intelligence, you can't have it both ways.

30r.orrison
Abr 9, 2013, 11:27 am

LibraryThing uses || to indicate the sort point in a title, e.g. "||A is for Alibi" should sort with the As. Whether that shows up in the data you're looking at I don't know. I also don't know how well known it is, or how often it's used. I'm not sure what I do know, sometimes.

31LolaWalser
Abr 9, 2013, 11:30 am

brightcopy, this is GREAT. How many times did I wish for this while doing some of my 22K combinations!

Thanks!

32brightcopy
Editado: Abr 9, 2013, 11:36 am

#30 by r.orrison> Nope. :) What you see is what I get.

#31 by LolaWalser> You're quite welcome!

I have more scripts up my sleeve. Hopefully now that I'm done with the giant cover navigation one I can get a few more smaller ones banged out.