Created
March 2, 2020 23:52
-
-
Save monyarm/6253bfb3bbe9c5b9d0337578d3f8bdc3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Save Conversation - spacebattles.com | |
| // @namespace Violentmonkey Scripts | |
| // @match https://forums.spacebattles.com/conversations/*/page-* | |
| // @grant none | |
| // @version 1.0 | |
| // @author - | |
| // @require http://cdn.jsdelivr.net/g/filesaver.js | |
| // @description 3/2/2020, 10:20:48 PM | |
| // ==/UserScript== | |
| var pageCount = $($('.pageNav-main')[0]).children().length; | |
| var pages = []; | |
| var text = ""; | |
| console.log(pages); | |
| var getText = $($('a.button--link')[0]).clone(); | |
| getText.children('span').html("Get Text"); | |
| getText.attr("href", ""); | |
| for (var i = 1; i <= pageCount; i++) { | |
| pages[i-1] = $('<div id="loaded-content" />').load("page-"+i+" .bbWrapper"); | |
| } | |
| getText.click(function () { | |
| pages.forEach(page => { | |
| page = $(page); | |
| page.children().each(function(index) { | |
| text += ($(this).text()); | |
| text +="\n"; | |
| }) | |
| }) | |
| console.log(text); | |
| var blob = new Blob([text], { type: "text/plain;charset=utf-8" }); | |
| saveAs(blob, "getText.txt"); | |
| }); | |
| getText.appendTo(".buttonGroup") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment