Greasy Fork

Greasy Fork is available in English.

暮光方块论坛-QQ音乐分享助手

更加方便获取QQ音乐ID然后在暮光方块论坛分享

当前为 2021-02-09 提交的版本,查看 最新版本

// ==UserScript==
// @name         暮光方块论坛-QQ音乐分享助手
// @name:zh-TW         暮光方块论坛-QQ音乐分享助手
// @namespace    https://bbs.tsfk.top
// @version      2.0.1
// @description  更加方便获取QQ音乐ID然后在暮光方块论坛分享
// @description:zh-tw  更加方便获取QQ音乐ID然后在暮光方块论坛分享
// @author       Karry
// @match        https://y.qq.com/n/yqq/song/*.html*
// @grant        none
// ==/UserScript==
(function() {
    'use strict';
function urlHtml(){
  //获取url地址
  var ts_href = window.location.href;
  var ts_mainText="";
    //获取地址最后一个“/”的下标
    var ts_indexof = ts_href.lastIndexOf("/");
    //获取地址“/”之后的的内容
    var ts_indexText = ts_href.substring(ts_indexof + 1);
    //获取地址“.html”的下标
    var ts_htmlBeforeText = ts_indexText.indexOf(".html");
    //获取 “/”到".html"之间的内容
    ts_mainText = ts_indexText.substring(0, ts_htmlBeforeText);

  return ts_mainText;
};
function myfun(){
 $(".data__singer").append('<font color="red">如果要将此音乐分享到暮光方块论坛,请复制此代码:</font><text id="code">[QMUSIC]</text>[/QMUSIC]');
 $("#code").append(document.innerText =(urlHtml()));
}
    window.onload = myfun;
    // Your code here...
})();