// ==UserScript== // @name GetRec'd: AO3 // @namespace http://archiveofourown.org // @description adds recommendations to archiveofourown.org // @include http://archiveofourown.org/works/* // @exclude http://archiveofourown.org/works/search* // @version 1.0 // @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js // @grant none // @downloadURL none // ==/UserScript== /***** A note on privacy: This script sends data about the AO3 work you are veiwing to a web server where it is stored in a database. This process is anoymous and no information about you or your habits are collected. Project blog: get-recd.tumblr.com *****/ (function() { 'use strict'; $(document).ready(function(){ var usersAll = []; var users; $('#workskin') .append('
No recs yet! More users need to leave kudos on this work.
'); } else { var title = $('#workskin .preface h2.title').text(); var category = []; $('.meta .fandom ul li a.tag').each(function () { category.push($(this).text()); }); if (usersAll.length > 5000) { users = usersAll.slice(0, 5000); } else { users = usersAll; } var workData = { users: users, name: title, category: category }; $.post('https://intense-reef-64978.herokuapp.com/', workData).done(function(res) { var data = JSON.parse(res); console.log('loaded'); console.log('res',res); console.log('data', data); var message = data.fail; if (data.fail && !message) { $('#rec-box') .append('Oops! Something went wrong :(
Oops! ' + message + '