Skip to content

Instantly share code, notes, and snippets.

@bikerduweb
Last active February 13, 2024 08:03
Show Gist options
  • Save bikerduweb/217106795870ad8f09e9 to your computer and use it in GitHub Desktop.
Save bikerduweb/217106795870ad8f09e9 to your computer and use it in GitHub Desktop.
[Goodread] Here is a Javascript that you can enter into the console from the Books Read shelf and use it to set the value for 'date read' with the value that is in 'date added'. If 'date read' already has a value, it doesn't do anything. I recommend turning off Goodreads infinite scroll and just doing it for each page of 100 results in your shelf.
var a = jQuery('#booksBody tr');
var monthName2Int = new Array();
monthName2Int['Dec'] = 12;
monthName2Int['Nov'] = 11;
monthName2Int['Oct'] = 10;
monthName2Int['Sep'] = 9;
monthName2Int['Aug'] = 8;
monthName2Int['Jul'] = 7;
monthName2Int['Jun'] = 6;
monthName2Int['May'] = 5;
monthName2Int['Apr'] = 4;
monthName2Int['Mar'] = 3;
monthName2Int['Feb'] = 2;
monthName2Int['Jan'] = 1;
for(i=0; i < a.size(); i++) {
var b = document.getElementById(a[i].id);
var added = jQuery(b).find('td.date_added span')[0].title;
var year_added = added.match('[0-9]{4}')[0];
var month_added = added.match('[A-Z][a-z]{2}')[0];
month_added = monthName2Int[month_added];
var day_added = parseInt(added.match('[0-9]{2},')[0].replace(',',''));
jQuery(b).find('td.date_read a').click();
if(!jQuery('#review_read_at_1i')[0].value) jQuery('#review_read_at_1i')[0].value = year_added; // year
if(!jQuery('#review_read_at_2i')[0].value) jQuery('#review_read_at_2i')[0].value = month_added; // month
if(!jQuery('#review_read_at_3i')[0].value) jQuery('#review_read_at_3i')[0].value = day_added; // day
reviewEditor.save();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment