flamebyrd: (Default)
flamebyrd ([personal profile] flamebyrd) wrote in [community profile] ao3some2012-06-17 10:26 am
Entry tags:

Pinboard bookmarklet for AO3 works

I edited the default Pinboard bookmarklet (the button you put in your browser bookmarks to let you quickly add links to Pinboard) so that it will grab the tags and summary from AO3 and include those in the Pinboard tags/description.

Would anybody who uses Pinboard for their bookmarks rather than AO3 be interested in that if I posted it?

I made a generator for the bookmarklet to allow people to choose which tags to include and so on. http://random.fangirling.net/fun/ao3/bookmarklet.html

(I tried to do the same for Delicious but it doesn't look like I can pass tags to it.)
saekhwa: Asian woman with short black hair & arms outspread and text that reads: 'free' (still an awkward girl with cute shoes)

[personal profile] saekhwa 2012-06-17 05:39 pm (UTC)(link)
OMG YES PLEASE?

This would be so amazing and save on so much time. (I'm, um. A little too thorough with my tags, so to speak, and trying to capture that data has been a PITA in more ways than one.)
snakeling: Statue of the Minoan Snake Goddess (Default)

[personal profile] snakeling 2012-06-17 05:44 pm (UTC)(link)
Yes please! Also, would you consider making one that only grabs the summary and not the tags, because I prefer to use mine :)
lian: Klavier Gavin, golden boy (Default)

[personal profile] lian 2012-06-17 06:19 pm (UTC)(link)
*grabby hands* oooh that would be so, so useful!
azurelunatic: Vivid pink Alaskan wild rose. (Default)

[personal profile] azurelunatic 2012-06-17 08:46 pm (UTC)(link)
My particular setup uses If This Then That to glue Pinboard to Twitter, via the private tag ".twitter", which can be anywhere in my tags. I want to include that by default. I'm going to stare at the code for a bit to see how that should go in. :)
talimenios: (Default)

[personal profile] talimenios 2012-06-18 02:10 am (UTC)(link)
You are beyond awesome. Thank you so much.
stepps: stylised leaves and white flower on dark grey background (Default)

[personal profile] stepps 2012-06-18 12:24 pm (UTC)(link)
you = awesome!
southerly: (Default)

[personal profile] southerly 2012-06-18 06:24 pm (UTC)(link)
This is amazing, thanks so much!

Is there any way to also include the author as a tag?
Edited 2012-06-18 18:25 (UTC)
annchi: Xie Lian with soft expression. (Kitten/Squirrel)

[personal profile] annchi 2012-06-18 06:57 pm (UTC)(link)
This is so very useful! Thank you!
hermitsoul: Archive of Our Own pirate logo icon (* ao3: stultiloquentia)

[personal profile] hermitsoul 2012-06-19 04:25 am (UTC)(link)
This is very awesome! Do you mind if I add it to the Cool Stuff page on the FAQs?
azurelunatic: Vivid pink Alaskan wild rose. (Default)

[personal profile] azurelunatic 2012-12-31 04:50 am (UTC)(link)
I discovered an entertaining new failure mode. For a work like http://archiveofourown.org/works/575365/ (Jeeves & Wooster, tagged as if Bertie were doing the tagging himself, completely delightful and containing about a hundredweight of cucumbers), the valiant attempt to include all tags results in a woeful "Request URI is too long".

I'm planning to add a bookmarklet that does *not* attempt to pull in ALL THE TAGS, but if you can figure out how to make it cap the tags when it's going to overflow...
lezzerlee: Cat with glasses (Default)

[personal profile] lezzerlee 2013-12-09 07:42 am (UTC)(link)
This is perfect, almost exactly what I was looking for. The only thing that could be better is if it included tags. Or if bookmarking on AO3 automatically send it to your pinboard along w/your bookmark comment. But that's probably near impossible w/o it being a feature of AO3. This is the next best thing!
Edited 2013-12-09 07:46 (UTC)

[personal profile] exclamations 2020-09-15 04:59 am (UTC)(link)
I know it's been ages since you posted this tool, but I started playing with it last night because it was driving me crazy that the summary feature would lose line breaks on a lot of fic because of inconsistent html used in the blockquote. I ended up with the code below, after banging my head for awhile. I suspect I will need to add more replacements to the list as I encounter more paragraph formatting, but this currently gives me reliable line breaks in my fic summaries!

I also added some modifications so that I will always only get the Fic Title and Author in the title, and also strip out any extraneous parts of the url, since I only ever want to bookmark the base AO3 url.

Sorry if any of this is clumsily done - I've never played with javascript before, but I thought I'd share what I came up with anyway.

javascript:(function($){
var q=location.href;
var base = q.split("\/");
q = base[0] + "\/\/" + base[2] + "\/" + base[3] + "\/" + base[4];

var p=document.title; 
var parts = p.split("-");
if ( parts[1].startsWith(" Chapter")) {parts[1] = parts[2]}
p = parts[0] + "-" + parts[1];

var d="";
if(document.getSelection){ 
	d=document.getSelection();
}
if ( d=="" ) {
	d+=$(".summary blockquote.userstuff").html() ;
	d=d.replace(/<\/p><p>/g, '\n\n');
	d=d.replace(/<\/p>/g, '\n');
	d=d.replace(/<p>|<i>|<\/i>|<b>|<\/b>/g, '');
	d=$.trim( d );
}

var options = {"wordcount_format_text":"(%words% words)","series_include_format_text":"[%series%]"};
if ( d != '' ) { d += '\n' }
let series = $(".work.meta .series .position").map(function() { return $.trim($( this ).text()) }).get().join( ", " );
if ( series != '' ) {
	series = options.series_include_format_text.replace('%series%', series );
	d += '\n' + series; 
} 

var wc = options.wordcount_format_text.replace('%words%', $(".stats dd.words").text() );
if ( d != '' ) { d += '\n' }
d += wc; 

void(open("https://pinboard.in/add?url=" + encodeURIComponent(q) + "&description=" + encodeURIComponent(d) + "&title=" + encodeURIComponent(p), "Pinboard", "toolbar=no,width=700,height=350"));
})(jQuery);