// ==UserScript== // @name E(X)Hentai Helper // @description Links between E-Hentai and ExHentai page, and also links user to ExHentai automatically if gallery is "removed" and adds "view later" function // @namespace org.e(x)hentai.helper // @version 4.10 // @icon https://e-hentai.org/favicon.ico // @resource exCSS http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css // @resource jqueryui https://code.jquery.com/ui/1.12.0/jquery-ui.min.js // @include https://upload.e-hentai.org/* // @include http*://e-hentai.org/* // @include http*://exhentai.org/* // @exclude https://e-hentai.org/archive* // @exclude https://e-hentai.org/gallery* // @exclude https://exhentai.org/archive* // @exclude https://exhentai.org/gallery* // @require https://code.jquery.com/jquery-3.1.1.min.js // @require https://code.jquery.com/ui/1.12.1/jquery-ui.min.js // @require https://cdn.jsdelivr.net/npm/datatables.net@1.10.16/js/jquery.dataTables.js // @require https://raw.githubusercontent.com/eligrey/FileSaver.js/master/dist/FileSaver.min.js // @author Resuha // @grant GM_addStyle // @grant GM_getValue // @grant GM_setValue // @grant GM_getResourceText // ==/UserScript== //Credit to developer of https://github.com/js-cookie/js-cookie //Ver 4.10 changed deleted imgur pics by span tags with unicode emojis //Ver 4.00 changed "view/read later" layout //Ver 3.00 added "view/read later" functionality //Ver 2.00 added redirector and cookie remover var targetWebsite = ""; var theme = ""; var readLaterList = []; var lastHovered; var currentPageLink = window.location.href; var dataTable; var cssTxt = GM_getResourceText("exCSS"); GM_addStyle(cssTxt); var jqueryui = GM_getResourceText("jqueryui"); GM_addStyle(jqueryui); var extraCSS = document.createElement("style"); extraCSS.textContent = ` .link, .option { cursor: pointer; text-decoration: underline; } .option, #placeholderText{font-size: 125%} .readLaterItem{font-size: 125%} .readLaterItem > .option{font-size: 100%} .divHeader{ font-size: 160%; font-weight: bold; } #fixedDiv.dark, #readLaterDiv.dark,#successDiv.dark,#previewDiv.dark,#addDiv.dark{ background-color:rgba(64, 64, 0, 1); border: 1px solid rgba(255, 255, 0, 1); } .link.dark{color:yellow} .option.dark{color:plum} #mpvAddon.dark{background-color:rgba(64, 64, 0, 0.4)} #fixedDiv.light, #readLaterDiv.light,#successDiv.light,#previewDiv.light,#addDiv.light{ background-color:rgba(255, 255, 0, 1); border: 1px solid rgba(64, 64, 0, 1); } .link.light{color:blue} .option.light{color:Red} #mpvAddon.light{background-color:rgba(255, 255, 0, 0.4)} #successDiv{ font-size: 125%; position: absolute; transform: translate(-100%, -50%); z-index:10; padding: 8px 8px; } #linker{font-size: 160%} #fixedDiv{ text-align: left !important; position: fixed; top: 12px; right: 12px; align: left; padding: 8px 8px; z-index:10; } #fixedDivPeek{ text-align: left !important; position: fixed; top: 0px; right: 0px; width: 10px; height: 10px; background-color:rgba(255, 255, 0, 1); align: left; padding: 8px 8px; z-index:10; } #readLaterDiv{ text-align: left !important; position:fixed; bottom: 4%;left: 2%; align: left; z-index:10; padding: 8px 8px; } #i1 > #mpvAddon{ float:right; padding:0px 10px 5px 10px; cursor: pointer; } #optionDivUL, #readLaterOptionDivUL{ margin: 0; padding: 0px 0px 0px 20px; } .topRightDivButton{ float:right; cursor: pointer; padding: 0px 4px 2px 3px; border: 1px solid; font-size: 80%; } #previewDiv{ position:fixed; z-index:10; padding:4px; } #previewDiv.showLeft{transform: translate(-110%, -105%)} #previewDiv.showRight{transform: translate(10%, -105%)} #addDiv{ position:absolute; z-index:10; padding:4px; font-size:125%; cursor: pointer; } .readLaterItem.hoverPopup.odd.light{background:rgba(240, 240, 0, 1)} .readLaterItem.hoverPopup.odd.dark{background:rgba(48, 48, 0, 1)} #readLaterTable.light{border:2px rgba(64, 64, 0, 1) solid} #readLaterTable.dark{border:2px rgba(255, 255, 0, 1) solid} .highlighted{font-weight: bold !important;} .highlighted.light{color: red} .highlighted.dark{color: lightblue} `; document.head.appendChild(extraCSS); var fixedDiv = `'





'`; $('body').append(fixedDiv); fixedDiv = $('#fixedDiv'); linkerDiv = $('#linkerDiv'); optionDiv = $('#optionDiv'); optionDiv.hide(); document.getElementById('minmaxFixedDivButton').addEventListener("click", function () { if ($('#scriptTitleHeader').is(":visible")) { hideFixedDivContent(); } else { showFixedDivContent(); } }); var readLaterDiv = `'
'`; $('body').append(readLaterDiv); document.getElementById('closeReadLaterButton').addEventListener("click", function () { hide_rlList(); }); readLaterDiv = $('#readLaterDiv'); readLaterDiv.hide(); var previewDiv = `'
'`; $('body').append(previewDiv); document.getElementById('closeReadLaterButton').addEventListener("click", function () { hide_rlList(); }); previewDiv = $('#previewDiv'); previewDiv.hide(); var addDiv = '
'; $('body').append(addDiv); addDiv = $('#addDiv'); addDiv.hide(); $("#addDiv").click(function () { var title = lastHovered.getElementsByClassName("id2")[0].childNodes[0].innerHTML; var link = parse_gallery_identifier(lastHovered.getElementsByClassName("id2")[0].childNodes[0].href); var thumbnailLink = lastHovered.getElementsByClassName("id3")[0].childNodes[0].childNodes[0].src.replace("exhentai.org", "ehgt.org"); if (thumbnailLink.indexOf("blank.gif") > -1) { //if there is no thumbnail, do AJAX call $(document).ajaxComplete(function (event, xhr, settings) { var data = xhr.responseText; var divStyle = $("#gd1", data).children('div').attr("style").split(" "); if (divStyle[3].startsWith("url")) { thumbnailLink = divStyle[3].substring(divStyle[3].indexOf("(") + 1, divStyle[3].indexOf(")")); } else { for (i = 0; i < stuff.length; i++) { if (divStyle[i].startsWith("url")) { thumbnailLink = divStyle[i].substring(divStyle[i].indexOf("(") + 1, divStyle[i].indexOf(")")); break; } } } thumbnailLink = thumbnailLink.replace("exhentai.org", "ehgt.org"); add_rlEntry(title, link, thumbnailLink); populate_rlDiv(); }); $.ajax(link); } else { add_rlEntry(title, link, thumbnailLink); populate_rlDiv(); } }); if (document.location.href.indexOf('exhentai') !== - 1) { link = 'https://e-hentai.org' + parse_gallery_identifier(); targetWebsite = 'E-Hentai'; theme = "dark"; } else { link = 'https://exhentai.org' + parse_gallery_identifier(); targetWebsite = 'ExHentai'; theme = "light"; } // Determine if the current page is E-Hentai or ExHentai readLaterDiv.resizable({ handles: "n,e,ne", stop: function (event, ui) { $('th')[0].click(); } }); fixedDiv.addClass("light"); readLaterDiv.addClass("light"); previewDiv.addClass("light"); addDiv.addClass("light"); $('#readLaterTable').addClass("light"); redoTheme(); window.addEventListener('focus', populate_rlDiv); $(document).ready(function () { populate_rlDiv(); if (document.title == 'Gallery Not Available - E-Hentai Galleries') { // Gallery is expunged in e-hentai document.location.href = 'https://exhentai.org' + parse_gallery_identifier(); } else if (document.title == "exhentai.org (260×260)") { // Got sadpanda var bYes = '