Ellililunch AO3 Bookmark Maker

Modified from "Bairdel AO3 Bookmarking Records" this for automatically add title, author, and summary to the bookmark desciption. This should help with record keeping especially with deleted fics. So I can stop going insane. Also adds read date.

目前為 2023-01-21 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Ellililunch AO3 Bookmark Maker
// @namespace    Ellililunch AO3 Bookmark Maker
// @description  Modified from "Bairdel AO3 Bookmarking Records" this for automatically add title, author, and summary to the bookmark desciption. This should help with record keeping especially with deleted fics. So I can stop going insane. Also adds read date.
// @version      0.1
// @author       Ellililunch
// @match     *archiveofourown.org/works/*
// @match     *archiveofourown.org/series/*
// @license     GNU GPLv3
// ==/UserScript==

// new users - scroll right to the bottom

(function() {

    const divider = "Last Read: "; // the bit at the start of the automatically added text. this can be anything, but will need to follow bookmarkNotes in newBookmarkNotes down at the bottom

    // automatically checks the Private Bookmark checkbox. Set to false if you don't want this.
    document.getElementById("bookmark_private").checked = true;

    // keeps any bookmark notes you've made previously. Must be above the "Last Read: ".
    // this updates the date you last read the fic each time.
    var bookmarkNotes = (document.getElementById("bookmark_notes").innerHTML).split(divider)[0];


    ////////////////////////// customisations ///////////////////////////////// DO NOT WORRY ABOUT


    // get the current date. should be in local time. you could add HH:MM if you wanted.
    var currdate = new Date();
    var dd = String(currdate.getDate()).padStart(2, '0');
    var mm = String(currdate.getMonth() + 1).padStart(2, '0'); //January is 0
    var yyyy = currdate.getFullYear();
    var hh = String(currdate.getHours()).padStart(2, '0');
    var mins = String(currdate.getMinutes()).padStart(2, '0');

    // change to preferred date format
    var date;
    //date = dd + '/' + mm + '/' + yyyy + " " + hh + ":" + mins;
    date = mm + '/' + dd + '/' + yyyy; //this is the USA standard date format
    console.log(date);

    var author;
    var words;
    var status;
    var title;
    var summary;
    var lastChapter;

    // checks if series
    var seriesTrue = document.getElementsByClassName("current")[0];
    if (seriesTrue != undefined) {
        // options for series bookmark notes

        var lastPart = "Part " + document.getElementsByClassName("stats")[2].getElementsByTagName("dd")[1].textContent;
        lastChapter = lastPart + " Chapter " + document.getElementsByClassName("work blurb group")[document.getElementsByClassName("work blurb group").length -1].getElementsByClassName("chapters")[1].textContent.split("/")[0];
        title = document.getElementsByTagName("h2")[0].innerHTML.trim();
        words = document.getElementsByClassName("stats")[2].getElementsByTagName("dd")[0].textContent;
        author = document.querySelectorAll('[rel="author"]')[0].innerHTML.trim(); // fic author

        var complete = document.getElementsByClassName("stats")[2].getElementsByTagName("dd")[2].textContent;
        var updated = document.getElementsByClassName("series meta group")[0].getElementsByTagName("dd")[2].textContent
        // var status
        if (complete == "No") {
            status = "Updated: " + updated;
        } else if (complete == "Yes") {
            status = "Completed: " + updated;
        }


    } else {
        // options for fics
        lastChapter = "Chapter " + document.getElementsByClassName("chapters")[1].innerHTML.split("/")[0];
        title = document.getElementsByClassName("title heading")[0].innerHTML.trim(); // fic name
        words = document.getElementsByClassName("words")[1].innerHTML; // fic wordcount
        author = document.querySelectorAll('[rel="author"]')[0].innerHTML.trim(); // fic author
        summary = document.getElementsByClassName("summary")[0].innerHTML; // summary attempt


        // status i.e. Completed: 2020-08-23, Updated: 2022-05-08, Published: 2015-06-29
        if (document.getElementsByClassName("status").length != 0) {
            // for multichapters
            status = document.getElementsByClassName("status")[0].innerHTML + " " + document.getElementsByClassName("status")[1].innerHTML;
        } else{
            // for single chapter fics
            status = document.getElementsByClassName("published")[0].innerHTML + " " + document.getElementsByClassName("published")[1].innerHTML;
        }

    }




    //////////////////// THIS IS THE BIT FOR YOU TO LOOK AT /////////////////////////////////////////////////////////////////////////////////////

    // puts it all together. feel free to change this format to whatever you like.
    // first part must always be the divider or a new date will be added each time.
    // <br> puts the next text on a new line
    // options for variables are:
// current date
// current time
// current chapter count of fic / current number of parts in series
// title of fic
// author of fic
// word count of fic
// status of fic i.e. Completed: 2020-08-23, Updated: 2022-05-08, Published: 2015-06-29


    /////// examples //////////
    //    bookmarkNotes = bookmarkNotes + "<br>Last Read: " + date + "<br>Chapter " + lastChapter;
    //    bookmarkNotes = bookmarkNotes + "<br>Last Read: " + date + "<br>Chapter " + lastChapter + "<br><br>" + title + " by " + author;
    //    bookmarkNotes + "<br>Last Read: " + date + "<br>" + lastChapter + "<br><br>" + title + " by " + author + "<br>" + status;
    //    newBookmarkNotes = bookmarkNotes +"<br><br>" + title + " by " + author + "<br>" + summary + "<br>Read: " + date;
    var newBookmarkNotes = bookmarkNotes +"<br><br>" + title + " by " + author + "<br>" + summary + "<br>Read: " + date;




    // fills in the bookmark notes box.
    document.getElementById("bookmark_notes").innerHTML = newBookmarkNotes;
})();