您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Добавляет кнопку отключения уведомлений из диалога
当前为
// ==UserScript== // @name LZTConversationsMute // @namespace Melonium/LZT // @version 1.7 // @description Добавляет кнопку отключения уведомлений из диалога // @author MeloniuM // @license MIT // @match *://zelenka.guru/* // @match *://lzt.market/* // @match *://lolz.guru/* // @match *://lolz.live/* // @icon https://www.google.com/s2/favicons?sz=64&domain=zelenka.guru // @grant none // ==/UserScript== (function() { 'use strict'; var muted = localStorage.getItem('conversationsMuted')? localStorage.getItem('conversationsMuted').split(',').map(Number) : []; function addIcon($target){ //выбор иконки let id = $target.attr('data-cid'); const i = $(`<i class="${(!muted.includes(Number(id)))? 'fa fa-volume conversationMute': 'fa fa-volume-mute conversationMute'}" style="margin-right: 5px; float: right;"></i>`); i.on('click', function(event) { event.stopPropagation(); let id = $(event.target).closest('.conversationItem').attr('data-cid') muteToggle(id, $(event.target)); }); // Добавляем кнопку в элемент ConversationListItems if (!$target.find('.title .conversationMute').length) $target.find('.title').append(i); } function muteToggle(id, icon){ let muted = localStorage.getItem('conversationsMuted')? localStorage.getItem('conversationsMuted').split(',').map(Number) : []; if (!muted.includes(Number(id))){ muted.push(Number(id)) icon.attr('class', 'fa fa-volume-mute conversationMute') localStorage.setItem('conversationsMuted', muted.join(',')) }else{ muted.splice(muted.indexOf(Number(id)),1) icon.attr('class', 'fa fa-volume conversationMute') localStorage.setItem('conversationsMuted', muted.join(','));//удаляем айди беседы } } if (window.location.pathname.startsWith('/conversations')){ $(document).on('XenForoActivate','.conversationItem:not(:has(.conversationMute))', function(e){ const $target = $(e.target); addIcon($(e.target)); }); $('#ConversationListItems').find('.conversationItem:not(:has(.conversationMute))').each(function(index){ addIcon($(this)); }); }else{ $(window).on('load', function(){ let s; const m = (s = window).Im || (s.Im = {}); const notification = $('html').data('Im.Notification'); notification.displayNotification_old = notification.displayNotification; notification.displayNotification = (data) => { if (muted.includes(data.conversation_id) && !location.pathname.startsWith('/conversations')){ notification.handledNotifications.add(data.message.message_id); if (!m.newMessageCache[data.conversationId]) { m.newMessageCache.push(data.conversationId); } var popup = $("#ConversationsMenu.Menu").data("XenForo.PopupMenu"); if (popup) popup.reload();//Обновление счетчика сообщений в меню в шапке сайта return; } return notification.displayNotification_old(data); } }); }; })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址