leetcod AC music feedback

LeetCode AC play music 《Good luck》

Stan na 20-11-2021. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         leetcod AC music feedback
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  LeetCode AC play music 《Good luck》
// @author       WangXiaowu
// @match        https://leetcode.com/*
// @icon         https://www.google.com/s2/favicons?domain=leetcode.com
// @require      http://code.jquery.com/jquery-latest.js
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    let netease_src = "https://m704.music.126.net/20211120101235/597d909fe47e4e1336d43ea96eda127e/jdyyaac/obj/w5rDlsOJwrLDjj7CmsOj/8837130090/e64d/e6e0/76ad/4b9e06388e5bf007db0a99c0170a662c.m4a?authSecret=0000017d3b07043f05c80aaba3b00328";
    let qq_src = "https://dl.stream.qqmusic.qq.com/C400000491MM0CyBv8.m4a?guid=3154030324&vkey=3159164EDCFFAD356C35F3258E781F1FEEB4AB9F2E9A942787D6AA4BC686CE5E239F09722BB8992203AD3DE25D44A80791EB877E0866C1F8&uin=&fromtag=66";
    var player = document.createElement('audio');
    player.src = qq_src;
    var observer = new MutationObserver(function (mutations, me) {
        // `mutations` is an array of mutations that occurred
        // `me` is the MutationObserver instance
        var button =  $("a[data-question-title-slug]").length;
        if (button) {
            if(!player.paused || player.currentTime){
                player.pause();
            }else{
                player.play();
            }
            //me.disconnect(); // stop observing
            return;
        }
    });

    // start observing
    observer.observe(document, {
        childList: true,
        subtree: true
    });


    // Your code here...
})();