您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
display image directly, add links that show a certain accout of floor
当前为
// ==UserScript== // @name Improve logsoku & 2ch // @description display image directly, add links that show a certain accout of floor // @include http://www.logsoku.com/* // @include http://sp.logsoku.com/* // @author yechenyin // @version 0.2 // @namespace https://gf.qytechs.cn/scripts/3497 // ==/UserScript== /**************************以下参数可自定义修改**************************/ //图片显示默认缩放比例 var percent = 0.5; //图片显示最大高度(像素) var image_max_height = 420; //图片显示最大宽度(像素) var image_max_width = 600; //图片显示最小高度(像素) var image_min_height = 240; //显示显示最小宽度(像素) var image_min_width = 320; //弹出图片的原图,要取消此功能请将true改为false var popup_enable = true; //点击图片后隐藏图片,要取消此功能请将true改为false var click_to_hide_image = true; // var phone_searched_links_contain_comments = 200; // var contain_floores = 250; // var pc_searched_links_contain_comments = 500; // var latest_floors = 150; /****************************************************/ if (location.href.match("http://sp.logsoku.com/search")) { $("a.search_thread_title").each(function() { this.href += "l" + phone_searched_links_contain_comments; var time = this.nextSibling.nextSibling.textContent; time = time.replace(/\d{4}-/, "").replace(/:\d{2}\s/, " "); time = time.replace(/\d{4}-/, "").replace(/:\d{2}\s$/, " "); this.nextSibling.nextSibling.textContent = time; $(this).parent().append($(this).parent().prev().prev()); var only_links = $("<a>", {text:"only links", href:this.href + "?only_links"}); only_links.css({right:2, position:"absolute"}); only_links.insertBefore($(this).parent().prev()); }); } if (location.href.match("http://sp.logsoku.com/r/")) { if (location.href.match("only_links")) { $("dd[id^=comment]").each(function() { if ($(this).find("a[href^='http://l.moapi.net/']").length === 0) { $(this).prev().hide(); $(this).hide(); } }); } $("dd>a").each(function() { if (this.href.match("http://l.moapi.net/")) { this.href = this.href.replace("http://l.moapi.net/", ""); if (this.href.match(/.\.(jpg|jepg|gif|png)$/)) $(this).replaceWith($("<img>", {src: this.href})); } }); $(".nem, .em").each( function() { this.parentNode.removeChild(this.nextSibling); this.parentNode.removeChild(this); }); } if (location.href.match("http://www.logsoku.com/search")) { var results = document.getElementById("search_result_threads"); if (results) { var titles = results.getElementsByClassName("title"); for (i=0; i<titles.length; i++) { var link = titles[i].children[0]; if (link) link.href = link.href + "l" + search_result_latest_floors; } } } if (location.href.match("http://www.logsoku.com/r/")) { var links = document.links; for (j=0; j<links.length; j++) { links[j].href = links[j].href.replace("http://l.moapi.net/", ""); if (links[j].innerHTML.match(/.\.(jpg|jpeg|gif|png|JPG|JPEG|GIF|PNG)$/)) { var img = document.createElement("img"); if (links[j].innerHTML.match(/\w*:?\/\//)) img.src = links[j].innerHTML.replace(/\w*:?\/\//, "http://"); else img.src = "http://" + links[j].innerHTML; img.onload = resize; if (click_to_hide_image) img.onclick = function() { this.style.display = "none"}; if (popup_enable) { var container = document.createElement("div"); container.style.display = "inline"; container.onmouseover = function() { this.children[0].style.display = "inline"}; container.onmouseout = function() { this.children[0].style.display = "none"}; container.appendChild(img); } links[j].parentNode.replaceChild(container, links[j]); j--; } } var nav = document.getElementsByClassName("thread-nav")[0].children[0]; if (nav) { var base = nav.children[2].href; nav.children[3].href = base + "l" + latest_floors; for (i=0; i<1000/contain_floores; i++) { var link = document.createElement("a"); var range = String(i*contain_floores+1) + "-" + String((i+1)*contain_floores); link.href= base + range; link.innerHTML = range; link.className = "nav-btn"; nav.appendChild(link); } } var hide_name = true; if (hide_name) { var names = document.querySelectorAll("span.nem, span.em"); for (i=0; i<names.length; i++) { names[i].style.display = "none"; names[i].nextSibling.replaceData(0, 3, ""); colon_pos = names[i].previousSibling.text.indexOf(":"); names[i].previousSibling.replaceData(colon_pos+1, 1, ""); } } var comments = document.getElementsByClassName("comment"); for (i=0; i<comments.length; i++) { var id = comments[i].previousSibling.previousSibling.text; if (localStorage.blacklist_ids.search(id) >= 0) { comments[i].parentNode.style.display = "none"; } console.log(localStorage.blacklist_ids); var hide_id = document.createElement("span"); hide_id.innerHTML = " (hide this ID'comemnts)"; hide_id.style.color = "#666"; hide_id.style.cursor = "pointer" hide_id.onclick = function () { localStorage.blacklist_ids += id + " "; this.parentNode.style.display = "none"; }; comments[i].parentNode.insertBefore(hide_id, comments[i]); } var search_box = document.getElementsByClassName("top-search-box").parentNode; var black_list = document.createElement("li"); var black_list_link = document.createElement("a"); black_list_link.onclick = function () { this.previousSibling.style.display = "inline"; }; var black_list_text = document.createElement("span"); black_list_text.innerHTML = "black list"; black_list_link.appendChild(black_list_text); search_box.appendChild(black_list_link); // draw black list configuration board var black_list_configuration = document.createElement("div"); black_list_configuration.style.textAlign = "center"; var close = document.createElement("a"); close.innerHTML = "✖×"; close.style.cssText = "float:right; padding:3px; border:1px #666 solid"; close.onclick = function () { this.parentNode.style.display = "inline"; }; black_list_configuration.appendChild(close); var text = document.createElement("span"); text.innerHTML = "IDs in the black list(seperate by space):"; black_list_configuration.appendChild(text); var textarea = document.createElement("textarea"); textarea.innerHTML = localStorage.blacklist_ids; textarea.id = "blacklist_ids"; black_list_configuration.appendChild(textarea); var text = document.createElement("span"); text.innerHTML = "Contents in the black list(seperate by new line):"; black_list_configuration.appendChild(text); var textarea = document.createElement("textarea"); textarea.innerHTML = localStorage.blacklist_contents; textarea.id = "blacklist_contents"; black_list_configuration.appendChild(textarea); var close = document.createElement("a"); close.innerHTML = "save"; close.style.cssText = "padding:3px; border:1px #666 solid"; close.onclick = function () { var input = document.getElementById("blacklist_ids"); localStorage.blacklist_ids = input.nodeValue; var input = document.getElementById("blacklist_contents"); localStorage.blacklist_contents = input.nodeValue; this.parentNode.style.display = "none"; }; black_list_configuration.appendChild(close); } function resize() { var w = this.naturalWidth; var h = this.naturalHeight; var width = this.naturalWidth * percent; var height = this.naturalHeight * percent; height = height > image_max_height ? image_max_height : height; height = height < image_min_height ? image_min_height : height; width = height * w/h; width = width > image_max_width ? image_max_width : width; width = width < image_min_width ? image_min_width : width; height = width * h/w; height = height > image_max_height ? image_max_height : height; height = height < image_min_height ? image_min_height : height; width = height * w/h; this.width = width; this.height = height; //insert popup image if (popup_enable) { var popup_img = document.createElement("img"); var width = w; var height = h; var clientWidth = document.body.clientWidth; var clientHeight = document.body.clientHeight; if (height > clientHeight) { heigth = clientHeight; width = clientHeight * w/h; } if (width > clientWidth) { width = clientWidth; height = clientWidth * h/w; if (height > clientHeight) { heigth = clientHeight; width = clientHeight * w/h; } } popup_img.heigth = height; popup_img.width = width; popup_img.src = this.src; popup_img.style.zIndex = 2; popup_img.style.position = "fixed"; popup_img.style.left = "0px"; popup_img.style.top = "0px"; popup_img.style.display = "none"; //popup_img.onmouseout = function() { this.style.display = "none"}; //var download = document.createElement("a"); //download.setAttribute("download", ""); //download.appendChild(popup_img); this.parentNode.insertBefore(popup_img, this); this.parentNode.heigth = height; this.parentNode.width = width; } }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址