您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Provides infinite scroll and larger thumbnails for gallery browsing.
当前为
// ==UserScript== // @name EX Better Thumbnails // @description Provides infinite scroll and larger thumbnails for gallery browsing. // @version 0.4 // @match http://exhentai.org/g/* // @grant none // @namespace https://greasyfork.org/users/13871 // ==/UserScript== var thisURL = document.createElement("a"); thisURL.href = document.URL; var i = 0; var URLGen = new URLGenerator(); var fileCount; var len = 0; var gdata; (function() { var js = document.createElement("script"); js.type = "text/javascript"; js.src = "https://code.jquery.com/jquery-1.11.3.min.js"; js.onload = function() { changeLayout(); request(gid, token); main(); }; document.head.appendChild(js); })(); function request(gid, token) { var api = "http://exhentai.org/api.php"; var data = { method: "gdata", gidlist: [ [gid, token] ] }; data = JSON.stringify(data); var r = $.ajax({ url: api, data: data, dataType: "JSON", type: "POST", contentType: "application/json", success: function(res, error) { gdata = res; fileCount = Number(gdata["gmetadata"][0]["filecount"]); console.log("File count: " + fileCount); } }); } function* URLGenerator() { var base = thisURL.protocol + "//" + thisURL.hostname + thisURL.pathname + "?inline_set=ts_l"; while (true) { yield base + "&" + "p=" + i; i += 1; } }; function insert(URL) { $.get(URL, function(data) { var DOM = $.parseHTML(data); $(DOM).find(".gdtl").each(function() { $("#gdt > .c").before(this); $(this).hide().fadeIn(); }); }) }; function call() { var url = URLGen.next().value; console.log(url); insert(url); }; function changeLayout() { $("#asm, #gdo, .gtb, #frontpage").remove(); var thumbnails = document.getElementById("gdt"); document.body.insertBefore(thumbnails, document.body.lastChild); $(".gdtm, .gdtl").each(function() { $(this).remove() }) }; function main() { if (len == 0) { call(); } $(window).scroll(function() { len = $(".gdtl").length; if (len < fileCount && $(window).scrollTop() + $(window).height() == $(document).height()) { call(); } }) };