您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Selectable lyrics and a button for copying all the lyrics
// ==UserScript== // @name Copy Lyrics from プチリリ, 歌詞タイム // @namespace https://greasyfork.org/users/179168 // @version 1.2.1 // @description Selectable lyrics and a button for copying all the lyrics // @author YellowPlus // @run-at document-start // @match *://petitlyrics.com/lyrics/* // @match *://www.kasi-time.com/* // @grant none // @require https://unpkg.com/ajax-hook/dist/ajaxhook.min.js // @require https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js // ==/UserScript== (function() { 'use strict'; if (document.location.href.match(/.*:\/\/petitlyrics.com\/lyrics\/.*/)) { var lyrics; $(document).ready(function(){ $("<button id='copy_button' class='pure-button'>Copy Lyrics</button>").click(()=>{ $("<textarea id='temp_lyrics'>"+lyrics+"</textarea>").insertAfter("#copy_button"); $("#temp_lyrics").select(); document.execCommand("Copy"); $("#temp_lyrics").remove(); }).insertBefore("#favorite-status"); $("<div id='lyrics2' style='font: 12px sans-serif'></div>").insertBefore("#lyrics"); $("#lyrics").hide(); }); // Intercept the data of lyrics hookAjax({ onreadystatechange:function(xhr){ if (xhr.xhr.responseURL == "https://petitlyrics.com/com/get_lyrics.ajax" && xhr.xhr.responseText !== "") { var array = eval(xhr.xhr.responseText); lyrics = ""; array.forEach((data)=>{ lyrics += Base64.decode(data.lyrics); lyrics += "\n"; }); $("#lyrics2").html(lyrics.replace(new RegExp("\n", "g"), "<br>")); } } }); } else if (document.location.href.match(/.*:\/\/www.kasi-time.com\/.*/)) { $(document).ready(function(){ $("<div class='lyrics_menu'><div class='fontsize'><ul><li style='width: auto; display: block;'>Copy Lyrics</li></ul></div></div>").click(()=>{ var lyrics = $('#lyrics').html().replace(new RegExp("<br>", "g"), "\n"); $("<textarea id='temp_lyrics'>"+lyrics+"</textarea>").insertAfter("#lyrics"); $("#temp_lyrics").select(); document.execCommand("Copy"); $("#temp_lyrics").remove(); }).insertBefore("#lyrics"); $('body').css('user-select', 'text'); $('body').css('-moz-user-select', 'text'); $('body').css('-webkit-user-select', 'text'); $('body').css('-ms-user-select', 'text'); $('body').on('copy contextmenu selectstart', (e)=>{ hi(); // Break the jQuery by an error }); }); } })();