Greasy Fork is available in English.
A button is added to copy the lyrics to your clipboard
当前为
// ==UserScript==
// @name Copy Lyrics from プチリリ
// @name:zh-TW 複制歌詞自プチリリ
// @name:ja-JP プチリリの歌詞をコピーする
// @version 1.0
// @description A button is added to copy the lyrics to your clipboard
// @description:zh-TW 新增一個按鈕複制歌詞到剪貼簿
// @description:ja-JP 歌詞をクリップボードにコピーできるボタンを追加
// @author YellowPlus
// @run-at document-start
// @match *://petitlyrics.com/lyrics/*
// @grant none
// @require https://unpkg.com/ajax-hook/dist/ajaxhook.min.js
// @require https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js
// @namespace http://greasyfork.icu/users/179168
// ==/UserScript==
(function() {
'use strict';
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");
});
hookAjax({
onreadystatechange:function(xhr){
// console.log("onreadystatechange called: %O",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";
});
// console.log(lyrics);
}
}
});
})();