// ==UserScript== // @name 游侠 下载免跳转 // @namespace http://tampermonkey.net/ // @version 0.3 // @description 跳转来跳转去的,有意思吗? // @author cw2012 // @match https://down.ali213.net/pcgame/* // @match https://patch.ali213.net/showpatch/* // @match https://dl.3dmgame.com/pc/* // @icon https://down.ali213.net/favicon.ico // @grant none // @run-at document-end // @downloadURL none // ==/UserScript== (function() { 'use strict'; let url, id,btnQueryStrArray,eleToHideQueryStrArray, hotNewsQueryStrArray; let btnStyle; switch(location.href.split('/')[2]){ case 'patch.ali213.net': downloadPatch(); break; case 'down.ali213.net': downloadSoft(); break; case 'dl.3dmgame.com': download3dm(); break; } function downloadPatch(){ id = location.href.match(/[\d]+/g)[1]; url = `https://patch.soft128.com/down/${id}.html`; btnQueryStrArray=['a.normalDownContainer']; eleToHideQueryStrArray=['div.box518', 'div.downAddressContainer.paddingStyle']; hotNewsQueryStrArray =['a.ali-kx']; updateUI(); } function downloadSoft(){ hotNewsQueryStrArray =['a.ali-kx']; if(typeof(downID)=='undefined'){ let timer = setInterval(()=>{ if(downId){ id = downId; btnQueryStrArray=['a#xz', '.detail_body_left_nav ul>li:nth-child(5)']; url = `http://www.soft5566.com/down/${id}-1.html`; eleToHideQueryStrArray=['#down_load']; clearInterval(timer); updateUI(); } },1000); }else{ updateUI(); } } function download3dm(){ // https://dl.3dmgame.com/pc/133836.html id = location.href.split('/')[4].split('.')[0]; url = `https://box.hyds360.com:4433/down/${id}-1.html`; btnQueryStrArray = ['div.Gmaeinfobtn > div > a.tab','a.tab.tab1.downl22.downwn']; eleToHideQueryStrArray=['div.Gmaeinfobtn > div > a.tab', 'div.GmL_5','a.tab.tab1.downl22.downwn>div>p>span']; btnStyle='background: linear-gradient(to right, rgb(64, 205, 111) 0%, rgb(64, 205, 111) 100%);'; updateUI(); } function hideHotNews(){ if(hotNewsQueryStrArray){ let hotNews; hotNews = setInterval(()=>{ let ele = document.querySelector(hotNewsQueryStrArray[0]); if(ele){ clearInterval(hotNews); hotNewsQueryStrArray.forEach(item =>{ item.style.display='none'; }); } },500); } } function updateUI(){ let jump= ()=>{window.open(url);}; btnQueryStrArray.forEach(item=>{ let btn = document.querySelector(item); btn.onclick = null; btn.addEventListener('click',jump); if(typeof btnStyle !='undefined'){ btn.style = btnStyle; } }) eleToHideQueryStrArray.forEach(item=>{ let ele = document.querySelector(item); if(ele){ ele.style.display='none'; ele.innerText='' } }) hideHotNews(); } })();