Greasy Fork

Greasy Fork is available in English.

Mananelo/Mangakakalot Bookmarks Export

Writes Mangakakalot or Manganelo Bookmarks (name and visited number) to "manga_bookmarks.txt" on "Export Bookmarks" button click

当前为 2019-09-24 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Mananelo/Mangakakalot Bookmarks Export
// @namespace    http://smoondev.com/
// @version      1
// @description  Writes Mangakakalot or Manganelo Bookmarks (name and visited number) to "manga_bookmarks.txt" on "Export Bookmarks" button click
// @author       Shawn Moon
// @include      https://mangakakalot.com/bookmark*
// @include      https://manganelo.com/bookmark*
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.min.js
// @grant        GM_addStyle
// ==/UserScript==

GM_addStyle (`
#export_container {
color: #000;
cursor: pointer;
float: right;
margin-right: 10px;
}

#export_button:hover {
background-color: #b6e4e3;
color: #000;
cursor: pointer;
}

#export_button {
padding: 4px 8px;
border-radius: 5px;
text-decoration: none;
color: #fff;
background-color: #76cdcb;
border: none;
font-weight: 600;
}

#temp_data {
position: absolute; top: -9999px;
left: -9999px;
}
`);

(function() {
    'use strict';
    let pageCount = parseInt($('.group_page a').last().text().replace(/\D+/g, ''))
    let domain = window.location.hostname

    const deleteTemp = () => {
        // delete temp container
        $('#temp_data').remove()
    }

    const saveFile = saveData => {
        // save file
        const fileData = new Blob([saveData], {type:"application/octet-stream"})
        saveAs(fileData, "manga_bookmarks.txt")
    }

    function getBookmarks() {
        // main function generate file
        deleteTemp()

        $('body').append("<div id='temp_data'>")
        let pageSuccess = 0;
        let bookmarkedTitles = `===========================\n${domain} Bookmarks\n===========================\n`

        for(var i = 0; i < pageCount; i++) {
            $("#temp_data").append(`<div id='page${i+1}'>`)
            $(`#page${i+1}`).load(`https://${domain}/bookmark?page=${i+1} .bookmark_item`, (resp,status,xhr) => {
                if(status == "success") { pageSuccess++ }
                if(pageSuccess == pageCount) {
                    let bmItem = $('#temp_data .bookmark_item')

                    for(var j = 0; j < bmItem.length; j++) {
                        bookmarkedTitles += $(bmItem[j]).find('.bookmark_title').text() + `  ||  Viewed: ${$(bmItem[j]).find('.bookmark_chap a')[0].text} \n`
                    }

                    saveFile(bookmarkedTitles)
                    deleteTemp()
                }
            })
        }
    }

    $(".breadcrumbs p").append("<div id='export_container'><button id='export_button'>Export Bookmarks</button></div>")
    $(document).on('click', '#export_button', function() {
        getBookmarks()
    })
})();