|
|
第119行: |
第119行: |
| x(); | | x(); |
| setInterval(x,20*60*1000); | | setInterval(x,20*60*1000); |
| </syntaxhighlight>
| |
|
| |
|
| |
| ==='''网易歌单JSON生成器'''===
| |
|
| |
|
| |
| 这个功能可以把网易云的歌单或是日推做成一个JSON串
| |
|
| |
| 配合下面的自动音乐播放器使用
| |
| <syntaxhighlight lang="javascript" line="1">
| |
| function time2(tim){
| |
| ti2 = tim.split(":");
| |
| ti3 = ti2[0]*60*1000+ti2[1]*1000;
| |
| return ti3;
| |
| }
| |
| ///////////////////////////////////////////////
| |
| function wyzfc(zfc){
| |
| var zfc_l = zfc.length;
| |
| var zfc2 = zfc.slice(30,zfc_l)
| |
| var zfc3 = "https://link.hhtjim.com/163/"+zfc2+".mp3";
| |
| return zfc3;
| |
| }
| |
| /////////////////////////////////
| |
| var obj1 = [];
| |
|
| |
| function nameurl(a_name,a_url,a_time,a_author){
| |
|
| |
| obj2 = {name:a_name , url:a_url , time:a_time , author:a_author}
| |
| obj1.push(obj2);
| |
|
| |
| }
| |
| ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
| |
| function wyy(){
| |
| x11 = 1;
| |
| var tbody = ".m-table >tbody"
| |
| var x_length = $(tbody).childNodes.length;
| |
| while(x11<=x_length){
| |
| tr_class= $(tbody+">:nth-child("+ x11 +")").className;
| |
| x1 = tbody + ">:nth-child("+ x11 +")> td:nth-child(2) > div > div > div > span > a";
| |
| x_url = wyzfc($(x1).href);
| |
| x_name = $(x1+">b").title;
| |
| x_time = time2( $(tbody+">:nth-child("+x11+")> td:nth-child(3)> span ").textContent );
| |
| x_author = $(tbody+">:nth-child("+x11+") > td:nth-child(4) > div").title;
| |
| //剔除无效链接👇
| |
| if (tr_class == 'even js-dis' || tr_class == " js-dis" ){
| |
|
| |
| x11 = x11+1;
| |
| }
| |
| else{
| |
| nameurl(x_name,x_url,x_time,x_author);
| |
| x11 = x11+1;
| |
| }
| |
| //剔除无效链接👆
| |
| }
| |
|
| |
| }
| |
| wyy();
| |
| obj1
| |
| </syntaxhighlight>
| |
|
| |
| ==='''自动音乐播放器'''===
| |
|
| |
|
| |
| 这个功能用来自动连播音乐。
| |
|
| |
| JSON输入栏用来输入JSON串。
| |
|
| |
| 循环按钮用来控制循环开启/关闭。
| |
|
| |
| 下一首按钮用来切歌/开始播放。<syntaxhighlight lang="javascript" line="1">
| |
| var drr = function drr(namee,url,author){
| |
| $.post("#",{message:"/share "+url+" "+namee+" - "+author})
| |
| }
| |
| ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
| |
| var a4 = function a4(){
| |
| //检查播放状态
| |
| var div_class = document.querySelector("body > div.sweet-alert.showSweetAlert.visible").className
| |
| setTimeout(function(){
| |
| if (div_class == "sweet-alert showSweetAlert visible"){
| |
| document.querySelector("body > div.sweet-alert.showSweetAlert.visible > div.sa-button-container > div > button").click();
| |
| zanting();
| |
| }
| |
| },2000);
| |
|
| |
| setTimeout(function(){
| |
| if($("#musicBox > div > div.progress-music").attr("class") == "progress-music"){
| |
| bofangqi();
| |
| }
| |
| },45000);
| |
| }
| |
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
| |
| var oon = $("#message> div.room-submit-wrap> input")
| |
| $("<button type='button' onclick='aaa();' id = 'aab'>循环:开启</button>").insertAfter(oon);
| |
| var fst = true;
| |
| var aaa = function aaa(){
| |
| if (fst == true){
| |
| var element=document.getElementById("aab");
| |
| element.innerHTML="循环:关闭";
| |
| fst = false;
| |
| }
| |
| else if(fst == false){
| |
| var element=document.getElementById("aab");
| |
| element.innerHTML="循环:开启";
| |
| fst = true;
| |
| }
| |
|
| |
| }
| |
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
| |
| $("<button type='button' onclick='lianbo();' id = 'aac'>连播:开启</button>").insertAfter(oon);
| |
| var lib = true;
| |
| var lianbo = function lianbo(){
| |
| if (lib == true){
| |
| var element=document.getElementById("aac");
| |
| element.innerHTML="连播:关闭";
| |
| lib = false;
| |
| }
| |
| else if(lib == false){
| |
| var element=document.getElementById("aac");
| |
| element.innerHTML="连播:开启";
| |
| lib = true;
| |
| }
| |
|
| |
| }
| |
| ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
| |
| bfq1 = 0;
| |
|
| |
| $("<button type='button' onclick='zanting();' id = 'a12'>下一首</button>").insertAfter(oon);
| |
| $("<button type='button' onclick='bbc24();' id = 'bbc'>清空列表</button>").insertAfter(oon);
| |
| $("<p>'JSON'<Textarea id = 'JSON' cols = '4' rows = '1' value = 'JSON' > </Textarea></p>").insertAfter(oon);
| |
| $("<p>间隔时间<Textarea id = 'TIMEE' cols = '4' rows = '1' value = 'TIMEEE' > </Textarea>毫秒</p>").insertAfter(oon);
| |
| $("#TIMEE").val("3000")
| |
| var bbc24 = function bbc24(){
| |
| $("#JSON").val("");
| |
| bfq1 = 0;
| |
| }
| |
|
| |
| setT = setTimeout(x345=1,3000);
| |
|
| |
| var bofangqi = function bofangqi(){
| |
|
| |
|
| |
| x2 = JSON.parse( $("#JSON").val() );
| |
| x2_length = x2.length-1;
| |
| musicbox = $("#musicBox > div > div.progress-music").attr("class");
| |
|
| |
| if ( bfq1<=x2_length && lib == true && musicbox =="progress-music" ){
| |
|
| |
| clearTimeout(setT);
| |
| js1 = x2[bfq1];
| |
| drr(js1.name,js1.url,js1.author)
| |
| bfq1 = bfq1+1;
| |
| setT = setTimeout(bofangqi,js1.time +parseInt($("#TIMEE").val()));
| |
|
| |
| }
| |
| else if ( bfq1 > x2_length , fst == true && lib == true && musicbox =="progress-music"){
| |
|
| |
| bfq1 = 0;
| |
| setT = setTimeout(bofangqi,0);
| |
|
| |
| }
| |
| else if(musicbox == "progress-music active"){
| |
| setT = setTimeout(bofangqi,15000);
| |
| }
| |
| else{
| |
| a4();
| |
| }
| |
|
| |
| }
| |
| var zanting = function zanting(){
| |
| document.querySelector("#play-or-pause").click();
| |
| setInterval(bofangqi(),3000)
| |
| }
| |
| ////////////////////////////////////////////////////////////////////////
| |
| var aab = function aab(){
| |
| if ($("#musicBox > div > div.progress-music.active").attr("aria-valuenow")=="NaN"){
| |
| a4();
| |
| }
| |
| else{}
| |
|
| |
| }
| |
| $('#talks').bind('DOMNodeInserted', function () {
| |
|
| |
| if ($("div#talks>:first-child").attr("class") == "talk music system select-text"){
| |
| setTimeout( function(){ aab()},2000);
| |
|
| |
| }
| |
| else{}
| |
|
| |
| });
| |
| $("body").append('<script>'+drr+a4+aaa+'fst = true;'+'lib = true;'+'setT = setTimeout(x345=1,3000);'+zanting+'bfq1 = 0;'+bbc24+bofangqi+aab+aaa+'</script>');
| |
| </syntaxhighlight> | | </syntaxhighlight> |
|
| |
|