您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
// ==UserScript== // @name 蜜柑动画新番快速定位 // @namespace pks // @version 0.18 // @description try to take over the world! // @author You // @include /^https?://mikanani\.me/?$/ // @grant none // ==/UserScript== $(function () { (function(){ var css = '.highlight::after {content:" ";height: 56px;}', head = document.head || document.getElementsByTagName('head')[0], style = document.createElement('style'); style.type = 'text/css'; if (style.styleSheet){ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } head.appendChild(style); })(); function scrollToElement(ele) { var eleTop = $(ele).offset().top; $(window).animate({scrollTop: !!document.querySelector('#sk-data-nav.stick')?eleTop - 80:eleTop - 141}); $(ele).find('.an-info-group a.an-text').addClass('highlight'); setTimeout($(ele).find('.an-info-group a.an-text').addClass('highlight'),5000); } function submitFilter() { var dropDownList = []; bangumis.forEach(function(item,index,arr){ if (item.name.toLowerCase().indexOf($('#filter').val().toLowerCase()) !== -1 && dropDownList.length <= 5) { dropDownList.push(index); } }); if (dropDownList.length > 0) { scrollToElement(bangumis[dropDownList[0]].element); } $('#filter').val(''); $('#filter').css('display', 'none').blur(); } $('.main-content').on('click','span.js-expand_bangumi',function(e){ setTimeout(function(){ scrollToElement(e.target); },1500); }); var bangumis = []; $('.an-info a').each(function(index,element){ var obj = {}; obj.name = element.title; obj.element = $(element).closest('li')[0]; bangumis.push(obj); }); $('<input id="filter" placeholder="新番快速查找 ( Enter键提交 )">') .css({ 'width': '350px', 'height': '64px', 'position': 'fixed', 'top': 0, 'right': 0, 'bottom': 0, 'left': 0, 'margin': 'auto', 'fontSize': '24px', 'opacity': '0.7', 'textAlign': 'center', 'display':'none' }).appendTo('body'); $('#filter').on('keydown', function (e) { if (e.keyCode === 27 && !!$(this).val()) { $(this).wrap('<form></form>'); $(this).parent()[0].reset(); $(this).unwrap(); $(this).focus(); } else if (/^(13|8|27)$/.test(e.keyCode) && $(this).val()==='') { $(this).css('display', 'none').blur(); } else if (e.keyCode === 13 && !!$(this).val() ) { submitFilter(); } }); var callFilter = function (e) { if (e.target.nodeName !== 'INPUT' && e.target.nodeName !== 'TEXTAREA' && /^(70|83)$/.test(e.keyCode) && $(window).width() >=992) { $('#filter').css('display', 'block').focus(); } }; $(document).on('keyup.wideScreenOnly', callFilter); $(window).on('resize', function (e) { if ($(window).width() <= 991) { $('#filter').css('display', 'none').blur(); $(document).off('.wideScreenOnly'); } else { $(document).on('keyup.wideScreenOnly', callFilter); } }); $(document).on('click', function (e) { if (e.target.id !== 'filter' && $('#filter').css('display') === 'block') { $('#filter').css('display', 'none').blur(); } }); });