Created
October 18, 2013 04:24
-
-
Save Gaubee/7036476 to your computer and use it in GitHub Desktop.
百度音乐去除广告,并成为VIP的Tampermonkey插件脚本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Ad Screening Program in Baidu music 百度音乐广告屏蔽程序 | |
| // @namespace http://github.com/gaubee/blog | |
| // @version 0.1 | |
| // @run-at document-start | |
| // @description 用于屏蔽百度音乐中的难听的广告声音,还有相关的广告画面 | |
| // @match http://play.baidu.com/ | |
| // @copyright 2013+, You | |
| // ==/UserScript== | |
| ;(function(){ | |
| var noAdTimer = setInterval(function(){ | |
| try{ | |
| audioAd.adOpt.url = "/"; | |
| audioAd.adOpt.maxShowTimes = .1; | |
| console.log("Ad config changed!") | |
| clearInterval(noAdTimer); | |
| }catch(e){ | |
| console.log("witing Ad config!") | |
| } | |
| },200) | |
| var noAdStyle = 'audioAd.adOpt.url = "/";\ | |
| audioAd.adOpt.maxShowTimes = .1;\ | |
| \ | |
| .mb-layout-bd.column4{\ | |
| display:none;\ | |
| width: 0px;\ | |
| }\ | |
| .mb-layout-bd.column3{\ | |
| right:0px;\ | |
| }\ | |
| .mb-layout-bd.column2{\ | |
| right: 250px;\ | |
| }\ | |
| .pause-ad{\ | |
| width:0px;\ | |
| height:0px;\ | |
| overflow:hidden;\ | |
| }\ | |
| .audioAd_res{\ | |
| display:none;\ | |
| }'; | |
| var noAdStyleDOM = document.createElement("style"); | |
| noAdStyleDOM.id = "noAdStyle"; | |
| noAdStyleDOM.innerHTML = noAdStyle; | |
| document.body.appendChild(noAdStyleDOM); | |
| /* | |
| var _open = XMLHttpRequest.prototype.open; | |
| XMLHttpRequest.prototype.open = function(method,url){ | |
| console.log(method," : ",url) | |
| _open.apply(this,[].slice.call(arguments)) | |
| } | |
| */ | |
| var $Timer = setInterval(function(){ | |
| try{ | |
| var _ajax = $.ajax; | |
| console.log("jquery load!") | |
| $.ajax = function(config){ | |
| if(config.dataType==="json"){ | |
| if(config.url === "/data/user/info"){ | |
| var _success = config.success; | |
| config.success = function(data){ | |
| console.log(data.data.vip) | |
| data.data.vip = true; | |
| console.log(arguments[0].data.vip) | |
| _success.apply(this,[].slice.call(arguments)) | |
| } | |
| } | |
| } | |
| _ajax.apply(this,[].slice.call(arguments)) | |
| } | |
| clearInterval($Timer); | |
| }catch(e){ | |
| console.log("witing jQuery"); | |
| } | |
| }) | |
| //console.log(new UserModel()) | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment