Skip to content

Instantly share code, notes, and snippets.

@theoria24
Last active February 16, 2018 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theoria24/b1789db3657923e17345825e874e9b34 to your computer and use it in GitHub Desktop.
Save theoria24/b1789db3657923e17345825e874e9b34 to your computer and use it in GitHub Desktop.
mastodonでふぁぼったときに音を鳴らす
// ==UserScript==
// @name FavSound4Mstdn
// @namespace https://github.com/theoria24
// @version 0.2.2
// @description ふぁぼったときに音を鳴らすやつ
// @author theoria
// @match https://theboss.tech/*
// @grant none
// @require http://code.jquery.com/jquery-2.2.4.min.js
// @require https://cdn.jsdelivr.net/npm/ion-sound@3.0.7/js/ion.sound.min.js
// @license MIT License
// @downloadURL https://gist.github.com/theoria24/b1789db3657923e17345825e874e9b34/raw/FavSound4Mstdn.user.js
// ==/UserScript==
ion.sound({
sounds: [
{name: "button_tiny"},
],
path: "https://cdn.jsdelivr.net/npm/ion-sound@3.0.7/sounds/",
preload: true,
multiplay: true
});
(function() {
'use strict';
$(document).on("click", ".icon-button:has(.fa-star)", function(){
ion.sound.play("button_tiny");
});
})();
@theoria24
Copy link
Author

theoria24 commented Feb 16, 2018

Tampermonkeyなどのユーザースクリプトが実行できる環境が前提です。

// @match        https://theboss.tech/*

をお使いのインスタンスのアドレスに変更してください。複数指定もできます。// @matchをたくさん書く感じです。

解除時に鳴らないように.activeでフィルターしたかったんですけど知識がないので無理でした。
音声ファイルにもCDNを指定していますが、自分のサーバーとかに上げておくのが丸いです。
MITライセンスです。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment