Greasy Fork 还支持 简体中文。

AlertChat

Son lorsque quelque chose se passe dans le chat

  1. // ==UserScript==
  2. // @name AlertChat
  3. // @namespace InGame
  4. // @author Odul
  5. // @date 11/03/2014
  6. // @version 1.032
  7. // @license WTF Public License; http://en.wikipedia.org/wiki/WTF_Public_License
  8. // @include http://www.dreadcast.net/Main
  9. // @include https://www.dreadcast.eu/Main
  10. // @compat Firefox, Chrome
  11. // @description Son lorsque quelque chose se passe dans le chat
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. var audio = document.createElement('audio');
  16. audio.id='checkchat';
  17. document.body.appendChild(audio);
  18. $('#checkchat').attr('src', 'http://s1download-universal-soundbank.com/wav/2062.wav');
  19. $("#checkchat").css("display","none");
  20.  
  21. var End = document.createElement('li');
  22. End.id='endAudiocheckchat';
  23. End.setAttribute("style", "height:30px;background-image:url('http://s3.noelshack.com/old/up/mute-5980e7fa83.png');background-repeat: no-repeat; z-index: 999999;");
  24. End.setAttribute("onclick", "document.getElementById('checkchat').volume = (document.getElementById('checkchat').volume==1) ? 0 : 1; document.getElementById('endAudiocheckchat').style.backgroundImage = (document.getElementById('checkchat').volume==1) ? 'url(http://s3.noelshack.com/old/up/unmute-bae5a6d548.png)' : 'url(http://s3.noelshack.com/old/up/mute-5980e7fa83.png)';");
  25. $('#bandeau ul')[0].insertBefore(End,$('#bandeau ul')[0].firstChild);
  26. $('#endAudiocheckchat').css('background-size','29px 20px').css("top","5px").addClass('link');
  27.  
  28. $("#endAudiocheckchat").text("CC").css("color","#999");
  29. document.getElementById('checkchat').volume = 0;
  30.  
  31. })();
  32.  
  33.  
  34. MenuChat.prototype.update = function(a) {
  35. if (!xml_result(a)) return !1;
  36. if ($(a).find("cydiving").length) return grid.readChat(a), !0;
  37. $(a).find("chat").each(function() {
  38. if ($(this).attr("key")) $("#" + $(this).attr("key")).html($(this).xml());
  39. else {
  40. var a = $.trim($(this).find("#chatContent").xml());
  41.  
  42. if(a != "")
  43. {
  44. var audio = document.getElementById('checkchat');
  45. audio.load();
  46. audio.play();
  47. }
  48. a && $("#chatContent").append(a)
  49. }
  50. }), $(a).find("connectes").length && $("#zone_chat .connectes").html($(a).find("connectes").xml());
  51. var b = parseInt($("#zone_chat .connectes").css("max-height"));
  52. $("#zone_chat .zone_infos").css("height", 325 - Math.min(b, $("#zone_chat .connectes > div").height())), $("#zone_chat .connectes > div").height() > b + 5 ? $("#zone_chat:not(.full)").addClass("full") : $("#zone_chat.full").removeClass("full"), $(a).find("chat").attr("time") && nav.getChat().setTimeCurrentRoom($(a).find("chat").attr("time")), $("#zone_chat .loader").hide()
  53. }