NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name BGM TV Bug Fixer // @version 0.1.2 // @description Fix some bugs on BGM.TV // @author ChengChung // @match http*://bgm.tv/* // @match http*://bangumi.tv/* // @grant none // @updateURL https://openuserjs.org/meta/joshu/BGM_TV_Bug_Fixer.meta.js // ==/UserScript== var prgInitPanel_func =function(){ var $infoPanel = $('#cloumnSubjectInfo'), $categoryTab = $('#prgCatrgoryFilter'), $cur_tab = $categoryTab.find('a.focus'), $type_id = $cur_tab.attr('subject_type'); if ($('#prgManagerMain').hasClass('tinyModeWrapper') == true) { if ($type_id == 1) { $infoPanel.find('div.infoWrapper_tv').hide(); $infoPanel.find('div.infoWrapper_book').removeClass('hidden'); } else { $infoPanel.find('div.infoWrapper_tv').show(); $infoPanel.find('div.infoWrapper_book').addClass('hidden'); //fix:在TinyMode模式下,prgCatrgoryFilter只区分书籍和非书籍,不区分动画和三次元 $infos = $infoPanel.find('div.infoWrapper_tv'); $infos.find('div.infoWrapper').hide(); $infos.find('div.infoWrapper').removeClass('odd'); $infos.find('div.infoWrapper').removeClass('even'); if ($type_id == 0) { $infos.find('div.infoWrapper:odd').addClass('even'); $infos.find('div.infoWrapper:even').addClass('odd'); $infos.find('div.infoWrapper').show(); } else { $infos.find('div.infoWrapper[subject_type=' + $type_id + ']:odd').addClass('even'); $infos.find('div.infoWrapper[subject_type=' + $type_id + ']:even').addClass('odd'); $infos.find('div.infoWrapper[subject_type=' + $type_id + ']').show(); } } } else { $infoPanel.find('div.infoWrapper_tv').show(); $infoPanel.find('div.infoWrapper_book').addClass('hidden'); //fix:从TinyMode返回BlockMode时,原有infoPanel存在style="display:block"属性而导致在prgSubjectList选择元素却不响应 $infoPanel.find('div.infoWrapper').removeAttr('style'); } }; // 当访问/music/browser/airtime/YYYY或/music/browser/airtime/YYYY-MM时,底部的页码跳转链接不正确 var MusicPageLinkCorrector = function(i,val) { const PAGE_IN_LINK_PATTERN = /^.*\?.*(page=(\d+).*)$/; var URL_PATH = window.location.pathname; var URL_SEARCH = window.location.search.substr(1).split('&'); for (var i=0;i<URL_SEARCH.length; i++) { if (URL_SEARCH[i].split('=')[0]=='page'||URL_SEARCH[i].split('=')[0]=='') { URL_SEARCH.splice(i, 1); } } var ModifyPageLink = function(i,val) { if($(this).is(".p")) { $(this).attr("href", function(i,val) { if (val.match(PAGE_IN_LINK_PATTERN)) if (URL_SEARCH.length==0) { return (URL_PATH + '?' + val.match(PAGE_IN_LINK_PATTERN)[1]); } else { return (URL_PATH + '?' + URL_SEARCH.join('&') + '&' + val.match(PAGE_IN_LINK_PATTERN)[1]); } }); } }; $( "#columnSubjectBrowserA > div.section > div > div > a" ).each(ModifyPageLink); }; (function() { 'use strict'; const MUSIC_BROWSER_LINK = /^\/music\/browser\/airtime.*$/i; chiiLib.home.prgInitPanel = prgInitPanel_func; if (window.location.pathname.match(MUSIC_BROWSER_LINK).length!=0) { MusicPageLinkCorrector(); } })();