您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Utilisation des notifications navigateur pour la réception d'un message sur Dreadcast.
当前为
// ==UserScript== // @name DC_notify // @namespace http://tampermonkey.net/ // @version 0.1 // @description Utilisation des notifications navigateur pour la réception d'un message sur Dreadcast. // @author John Doe // @match https://www.dreadcast.net/Main // @grant none // ==/UserScript== (function() { 'use strict'; var $msg_new,$msg_imgurl,$msg_title,$msg_author, response_xml, $response, $check_event; var msg_ids = []; var pending = false; if (!("Notification" in window)) { console.log('[DC_notify] Ce navigateur ne supporte pas les notifications'); } else if (Notification.permission === "granted") { console.log('[DC_notify] Notifications acceptées'); } else if (Notification.permission !== 'denied') { Notification.requestPermission(function (permission) { if(!('permission' in Notification)) { Notification.permission = permission; console.log('[DC_notify] Notifications refusées'); } if (permission === "granted") { console.log('[DC_notify] Notifications acceptées'); } }); } $(document).ajaxComplete(function (event, xhr, settings) { if(settings.url.endsWith("OpenFolder")){ if(pending){ $msg_new = $('.message.new'); for(let i=0;i<$msg_new.length;i++){ $msg_imgurl = $msg_new[i].find('img').prop('src'); $msg_title = $msg_new[i].find('.message_titre').text(); $msg_author = $msg_new[i].find('.message_auteur').text(); new Notification("Nouveau message de "+$msg_author, {icon:$msg_imgurl, body:'\nObjet : '+$msg_title,lang: 'fr-FR',dir: 'ltr'}); } pending = false; }else{ msg_ids = []; } } if (settings.url.endsWith("Check")) { response_xml = $.parseXML( xhr.responseText ); $response = $( response_xml ); $check_event = $response.find( "evenement" ); if($check_event.length>0){ if($check_event[0].innerHTML.indexOf('id_conversation')!==-1){ pending = true; } } } }); })();