// ==UserScript== // @name 我的bilibili排行榜脚本 // @version 1.2 // @description 1、排行榜过滤已阅视频 2、封面图片显示原图 // @author Zz_子于子乐 // @include http://www.bilibili.com/ranking* // @grant none // @require http://code.jquery.com/jquery-1.11.0.min.js // @namespace https://greasyfork.org/users/9579 // @downloadURL none // ==/UserScript== ///////////////////// ///<<脚本初始化>>/// /////////////////// var MyRankZz = '' + '
' + '' + '' + '
'; $(MyRankZz).insertBefore("#rank_tips"); //在页面插入控件 var MyRankCheck = localStorage.getItem("MyRankCheck"); //获取过滤参数 if(MyRankCheck && MyRankCheck==1){ $("#MyRankCheck").attr("checked",true); //设置选项 } var d = new Date(); var dMon = d.getMonth() + 1; if(!MyRankCheck && MyRanking!=0){ localStorage.setItem("MyRankCheck",0); //初始化参数 localStorage.setItem("MyRanking"+dMon,""); //初始化存储 alert("排行榜脚本初始化成功!\n——bilibili排行榜脚本 by Zz"); location.reload(); //刷新页面 } var MyRanking = localStorage.getItem("MyRanking"+dMon); //获取存储排行 if(!MyRanking && MyRanking!=""){ localStorage.setItem("MyRanking"+dMon,""); //添加新一月存储 alert("又是新的一个月!——bilibili排行榜脚本"); } /////////////////////////////// //==函数递归等待排行榜加载==// ///////////////////////////// function loadStart(){ if($(".dyn_list").html() == '
  • loading...
  • '){ //console.info("网速慢……只能等"); setTimeout(function(){ loadStart(); },100); }else{ imgShow(); //启动显示封面大图 rankShow(0); //启动排行比较过滤 } } ///////////////////////// //==浮动显示封面大图==// /////////////////////// function imgShow(){ var imgItem = ""; $(imgItem).insertAfter(".preview img"); $(".preview img").mousemove(function(){ var theImage = new Image(); theImage.src = $(this).attr("src"); $(this).next().attr("src",$(this).attr("src")) .css("max-width",theImage.width) .css("height",theImage.height) .css("display","block"); var scroll = (document.body.scrollTop) ? document.body.scrollTop : document.documentElement.scrollTop; //兼容Firefox var imgNum = parseInt((scroll - $('#rank_list').offset().top)/112); var imgX = $(this).offset().top - $(".preview:eq("+imgNum+") img").offset().top; if(imgX > 112*3-20 || imgX < 0){ $(this).next().css("top",102-20-theImage.height); //当前图片定位为北则向上展示 }else{ $(this).next().css("top",10); } }); $(".preview img").mouseout(function(){ $(this).next().css("display","none"); }); } /////////////////////////////// //==排行榜比较·过滤·添加==// ///////////////////////////// function rankShow(a){ var rankList = MyRanking.split("|"); //存储排行分割后存放 var rankItem = new Array(100); //当前页面排行 $("#rank_list .title").each(function(i){ rankItem[i] = $(this).html(); }); //--开始循环比较页面排行与存储排行--// for(var n=0;n<100;n++){ var unRead = 1; //已阅否? for(var m=0;m>// /////////////////// loadStart();