// ==UserScript== // @name itingwa_download // @version 0.7 // @namespace [url=mailto:wt@qkzy.net]mailto:wt@qkzy.net[/url] // @match https://www.itingwa.com/listen/* // @match https://www.itingwa.com/article/* // @match https://www.itingwa.com/radio/* // @match https://www.itingwa.com/?c=player* // @grant none // @description 显示听哇网站文件的url以便快速下载。 // @downloadURL none // ==/UserScript== (function () { let util = { itingwa_add_src() { var newNode_div = document.createElement("div"); var itingwa_src = $("#jp_audio_0").get(0).src; var newNode = document.createElement("a"); newNode.setAttribute("href", itingwa_src); newNode.innerHTML = "右键另存本歌曲"; var url = /^https:\/\/www.itingwa.com\/article\/*/; console.log(window.location.href); if (url.test(window.location.href)) { $('.top_15.font_14.color2').append(newNode_div); $('.top_15.font_14.color2 div').append(newNode); } else { var object = listen_channel.appendChild(newNode); } }, top_select() { var new_click_li = document.createElement("li"); var new_click_a = document.createElement("a"); new_click_a.setAttribute("name", "player_nav"); new_click_a.setAttribute("href", "javascript:void(0)"); new_click_a.innerHTML = "获取此歌地址"; $("a:contains(播放列表)").parent().parent().append(new_click_li); $("#player_music_list > div.wrap_960 > div.music_wrap.clearfix > ul > li:last ").append(new_click_a); }, width_ui_fix() { var content_width = document.body.clientWidth - (document.body.clientWidth * 0.2) var url = /^https:\/\/www.itingwa.com\/listen\/*/; if (content_width > 960 && url.test(window.location.href)) { var content_sum = (content_width - 100) * 0.8 + (content_width - 100) * 0.2; $("body > div.frame1").css("width", content_width); $("body > div.frame1 > div.lt_frame").css("width", (content_width - 100) * 0.8); $("body > div.frame1 > div.rt_frame").css("width", (content_width - 100) * 0.2); $("div.clearfix").eq(0).css("width", (content_width - 100) * 0.8) $("body > div.frame1 > div.lt_frame > div:nth-child(1) > div.right.top_10.module_event").eq(0).removeAttr("width"); $("div:contains(扫码,手机听)").eq(0).css("margin-left", document.body.clientWidth * 0.8 / 2); $("#back_to_top").css("left", (document.body.clientWidth - content_sum) / 2 + content_sum); } } } let main = { init() { util.width_ui_fix(); $(window).resize(function () { util.width_ui_fix(); }); }, start(){ this.init(); var player_zj = /^https:\/\/www.itingwa.com\/\?c=player*/; if (player_zj.test(window.location.href) === true) { util.top_select(); var show_download_src = $("#player_music_list > div.wrap_960 > div.music_wrap.clearfix > ul > li:last > a"); show_download_src.bind('click', function (e) { var test_node = /右键另存本歌曲/; if (test_node.test($("#listen_channel > a:last").get(0).innerHTML) === false) { util.itingwa_add_src(); } }); } else { util.itingwa_add_src(); }} } main.start(); })();