Greasy Fork

Greasy Fork is available in English.

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

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

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

// ==UserScript==
// @name         暮光方块论坛-QQ音乐分享助手
// @name:zh-TW         暮光方块论坛-QQ音乐分享助手
// @namespace    https://bbs.tsfk.top
// @version      beta1.0
// @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 mgzhfx(){
        alert("如要分享此音乐,请复制这串字符到QQ音乐插入的BB代码:" + urlHtml() + "\n如不需要再显示此弹窗,请停用此插件。\n请随时关注暮光方块论坛上我们的更新。我们以后会在页内嵌入按钮来实现本功能。");}

//function myfun(){
 //$(".data__actions").append('<div><button class="777">分享到方块论坛</button></div>');}
    //window.onload = myfun;
    window.onload = mgzhfx;
    // Your code here...
})();