|
var words = $('dd.words').text(); |
|
var length = 'under1'; |
|
|
|
if ( words > 999 ) { |
|
var kwords = Math.round(words / 1000); |
|
|
|
if (kwords >= 100) |
|
length = '100'; |
|
else if (kwords >= 50) |
|
length = '50to100'; |
|
else if (kwords >= 20) |
|
length = '20to50'; |
|
else if (kwords >= 10) |
|
length = '10to20'; |
|
else if (kwords >= 5) |
|
length = '5to10'; |
|
else if (kwords >= 1) |
|
length = '1to5'; |
|
} |
|
|
|
if ( words > 2000 ) |
|
words = kwords + 'K'; |
|
|
|
var fic = $('h2.title.heading').text(); |
|
var author = $('h3.byline.heading').html(); |
|
var authortag = $('h3.byline.heading').text(); |
|
var rating = $('dd.rating.tags a').text(); |
|
if (rating == 'Teen And Up Audiences') |
|
rating = 'Teen'; |
|
if (rating == 'General Audiences') |
|
rating = 'Gen'; |
|
var summary = $('div.summary.module blockquote').html(); |
|
var status = 'WIP'; |
|
var chapters = $('dd.chapters').text(); |
|
var done = chapters.split('/'); |
|
if ( done[0] == done[1] ) |
|
status = 'Complete'; |
|
var tags = authortag + ',' + status + ',' + length + ',' + rating; |
|
|
|
var d = document, |
|
w = window, |
|
e = w.getSelection, |
|
k = d.getSelection, |
|
x = d.selection, |
|
s = (e ? e() : (k) ? k() : (x ? x.createRange().text : 0)), |
|
f = 'http://www.tumblr.com/widgets/share/tool/', |
|
ficBody = '<p> |
|
<b>Author</b>: '+ author +'<br> |
|
<b>Rating</b>: '+ rating +'<br> |
|
<b>Status</b>: '+ status +'<br> |
|
<b>Length</b>: '+ words +'<br> |
|
</p> '+ summary, |
|
l = d.location, |
|
e = encodeURIComponent, |
|
p = '?url=' + e(l.href) + '&posttype=link&title=' + e(fic) + '&selection=' + e(ficBody) + '&tags=' + e(tags), |
|
u = f + p, |
|
sw = 0, |
|
sd; |
|
try { |
|
sd = d.createElement('div'); |
|
sd.style.height = '100px'; |
|
sd.style.width = '100px'; |
|
sd.style.overflow = 'scroll'; |
|
d.body.appendChild(sd); |
|
sw = sd.offsetWidth - sd.clientWidth; |
|
d.body.removeChild(sd); |
|
} catch (z) {}; |
|
try { |
|
if (!/^(.*\.)?tumblr[^.]*$/.test(l.host)) throw (0); |
|
tstbklt(); |
|
} catch (z) { |
|
a = function() { |
|
if (!w.open(u, '_blank', 'toolbar=0,resizable=0,status=1,scrollbars=1,width=' + (540 + sw) + ',height=600')) l.href = u; |
|
}; |
|
setTimeout(a, 10); |
|
} |
|
void(0) |