您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Userscript to add images from links, auto-reload, auto-noko and a handy scroll up and down shortcut div to 8chan.co. More features may be included later.
当前为
// ==UserScript== // @name Waifuist 8chan Enhancer // @include https://8chan.co/*res* // @description Userscript to add images from links, auto-reload, auto-noko and a handy scroll up and down shortcut div to 8chan.co. More features may be included later. // @version 0.0.3 // @namespace https://greasyfork.org/users/2657 // ==/UserScript== function makeid() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for( var i=0; i < 10; i++ ) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; }; $nofill = 'no'; $(".post_no").click(function(){ $nofill = 'yes'; }); function checkandffill(){ $("#body").each(function() { if($(this).val() === "") var number = 12345678 + Math.floor(Math.random() * 6); $("#body").text(makeid()); });}; $("input[name='post']").click(function(){ if($nofill === "no"){ window.onload=checkandffill(); }; }); function quotador(id){ $("textarea[id*='body']")[0].value += '>>' + id + '\n'; reply_id = 'reply_' + id; $('.postboxy').insertAfter("#" + reply_id); $(".QR").css("display","none"); $(".QR2").css("display","inline"); }; function genreply(){ $("iframe").removeAttr('style'); if(window.location.href.indexOf("res") > -1) { $('.quotes').remove(); $( "div[id^='reply_']" ).each(function() { var replyid = $(this).attr("id") replyid = replyid.replace("reply_", ""); $(this).append('<div class="quotes" id="'+ replyid +'" style=" float: right; clear: both; background-color: #FF6600; border: 1px solid; margin: 3px; padding: 3px; cursor: pointer; cursor: hand;">Reply</div>'); })}; }; function linkimg(){ $('a[href$=".png"][rel="nofollow"], a[href$=".jpg"][rel="nofollow"], a[href$=".gif"][rel="nofollow"]').each(function(){ $(this).replaceWith('<div class="linkedimg2" style="width:100px;display:inline-block;"><img class="linkedimg2" style="max-width: 100%;" src="' + $(this).attr('href') + '" /></div>'); }); $(document).on('click', ".linkedimg2", function() { $(this).css('width', 'auto'); $(this).attr('class', 'clicked'); }); $(document).on('click', ".clicked", function() { $(this).css('width', '100px'); $(this).attr('class', 'linkedimg2'); }); }; function noko(){ document.getElementsByName("email", "input")[0].value = "noko"; }; window.onload=noko(); var div = document.createElement("div"); div.style.width = "47px"; div.style.height = "auto"; div.style.position = "fixed"; div.style.right = "10%"; div.style.top = "50%"; div.style.color = "white"; div.className = "scriptbox"; div.innerHTML = "<center><font size='30'><a alt='Scroll Up' style='text-decoration: none' href='javascript:window.scrollTo(0,0);'>▲</a><br><a style='text-decoration: none' href='javascript:window.scrollTo(0,900000000);'>▼</a><br><a style='text-decoration: none' class='QR'><img src='https://8chan.co/waifuist/src/1409873244023.png'></a><a style='text-decoration:none;display:none;' class='QR2'>X</a><br></font></center><textarea rows='2'' cols='4' id='code'>"; document.body.appendChild(div); $( "#code" ).keyup(function() { localStorage.setItem('code2',$('#code').val()); }); $data = 'CSS' $(document).ready(function () { genreply(); $("h1").css("display","none"); $("textarea[id^='body']").attr('cols', '0'); $("input[name^='embed']").attr('size', '0'); $("#file_url").attr('size', '0'); /*$(".lin").attr("style", "display: block; height: 100%; width: 100%; text-decoration: none;"); $("#file_url").attr('size', '25');*/ /*$("div[id^='reply_']").css("position","relative");*/ $('form:first-of-type').addClass( "postboxy" ); $data = localStorage.getItem('code2'); $("#code").val($data); $css = '<style>' + $data + '</style>' $( $css ).appendTo( "head" ); }); $('body').on('click', 'div.quotes', function() { var currentId = $(this).attr('id'); $("table:first-of-type").removeAttr('style'); quotador(currentId); }); //$('.quotes').click(function(){ //var currentId = $(this).attr('id'); //$("table:first-of-type").removeAttr('style'); // quotador(currentId); //}); $('.QR').click(function(){ $("table:first-of-type").css("background-color","#D1D1D1"); $("table:first-of-type").css("position","fixed"); $("table:first-of-type").css("top","100px"); $("table:first-of-type").css("right","100px"); $(".QR").css("display","none"); $(".QR2").css("display","inline"); imagelinks(); }); $('.QR2').click(function(){ $("table:first-of-type").removeAttr('style'); $('.postboxy').insertAfter('.banner'); $(".QR").css("display","inline"); $(".QR2").css("display","none"); }); $(document).ready(function(){ linkimg(); $('#favicon').remove(); $('head').append('<link href="https://8chan.co/waifuist/src/1393161837220.png" id="favicon" rel="shortcut icon">'); }); var count = 0; var title_regex = /^\(\d+\) (.*)$/; var original_title = document.title; var match = title_regex.exec(document.title); if (match != null) { original_title = match[1]; }; var onVisibilityChange = function (args) { var state = document["visibilityState"]; if (state == "visible") { document.title = original_title; count = 0; $('#favicon').remove(); $('head').append('<link href="https://8chan.co/waifuist/src/1393161837220.png" id="favicon" rel="shortcut icon">'); } }; document.addEventListener("visibilitychange", onVisibilityChange, false); setInterval(function() { $.ajax({ url: document.location, success: function(data) { $(data).find('div.post.reply').each(function() { var id = $(this).attr('id'); if($('#' + id).length == 0) { $(this).insertAfter($('div.post:last').next()).after('<br class="clear">'); $(document).trigger('new_post', this); count++; linkimg(); genreply(); } }); } }); var state2 = document["visibilityState"]; if (state2 == "visible"){count = 0;}; if (count > 0 && state2 == "hidden") { document.title = '('+count+') '+original_title; $('#favicon').remove(); $('head').append('<link href="https://8chan.co/waifuist/thumb/1393161986195.png" id="favicon" rel="shortcut icon">'); }; }, 10000);