// ==UserScript== // @name Literotica Downloader Improved // @description Single page HTML download for Literotica with improved readability // @namespace literotica_downloader // @include https://www.literotica.com/stories/memberpage.php* // @require https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js // @version 2.1 // @author Improved by a random redditor, originally by Patrick Kolodziejczyk // @grant GM_addStyle // @downloadURL https://update.sleazyfork.org/scripts/32033/Literotica%20Downloader%20Improved.user.js // @updateURL https://update.sleazyfork.org/scripts/32033/Literotica%20Downloader%20Improved.meta.js // ==/UserScript== $(document).ready(function () { // Creating style for a download icon GM_addStyle('.icon-download {background-image: url("https://marcoceppi.github.io/bootstrap-glyphicons/img/glyphicons-halflings.png"); background-position: -120px -24px;cursor: pointer;cursor: hand; background-repeat: no-repeat; display: inline-block; height: 14px; line-height: 14px; vertical-align: text-bottom; width: 14px;}' ); // Function used to return content as a file for the user. function saveTextAsFile(textToWrite, fileNameToSaveAs) { var textFileAsBlob = new Blob([textToWrite], { type: 'text/javascript' }); var downloadLink = document.createElement('a'); downloadLink.download = fileNameToSaveAs; downloadLink.innerHTML = 'Download File'; if (window.webkitURL !== null) { // Chrome allows the link to be clicked // without actually adding it to the DOM. downloadLink.href = window.webkitURL.createObjectURL(textFileAsBlob); } else { // Firefox requires the link to be added to the DOM // before it can be clicked. downloadLink.href = window.URL.createObjectURL(textFileAsBlob); //downloadLink.onclick = destroyClickedElement; downloadLink.style.display = 'none'; document.body.appendChild(downloadLink); } downloadLink.click(); } // Function parsing all pages to get the storie based function getContentOfStoie(baseURL) { var remote; $.ajax({ url: baseURL, type: 'GET', async: false, success: function (data) { if ($(data).find('.b-pager-next').size()) { remote = $(data).find('.b-story-body-x').html() + getContentOfStoie($(data).find('.b-pager-next') [0].href); } else { remote = $(data).find('.b-story-body-x').html(); } } }); return remote; } function getABookForSerieDiv(myDiv) { var title = $.trim(myDiv.text().split(':') [0]); var author = $('.contactheader').text(); alert("Starting building file for "+title +" of "+author+".\nPlease wait..."); var book = '\n
\n\n'; book += '