Reaction Scroll Bar

Raccourcis (scroll bar) pour réaction

  1. // ==UserScript==
  2. // @name Reaction Scroll Bar
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Raccourcis (scroll bar) pour réaction
  6. // @author ArtesEveni
  7. // @match https://www.dreadcast.net/Main
  8. // @match https://www.dreadcast.eu/Main
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. // objet all reactions
  13. const optionElts = {
  14. "": "",
  15. "Ricane": "/me ricane",
  16. "Rit": "/me rit",
  17. "Se marre": "/me se marre",
  18. "Sourit": "/me sourit",
  19. "Ecoute": "/me ecoute",
  20. "Dors": "/me s'endort",
  21. "Incline la tête": "/me incline la tête de côté",
  22. "Regarder": "/me les regarde avec attention",
  23. "Ferme yeux": "/me ferme les yeux",
  24. "Lancer dés": "/roll"
  25. };
  26.  
  27.  
  28. (() => {
  29. 'use strict';
  30. ///////////////
  31. /* Variable */
  32. /////////////
  33. let formElt = $("#chatForm"),
  34. inputFormELt = $("form#chatForm input.text_chat"),
  35. selectElt = $('<select name="reaction" id="reaction" size="1" maxlength="1">');
  36.  
  37. // append the elements
  38. for (const property in optionElts) {
  39. selectElt.append($(`<option value="${optionElts[property]}">${property}</option>`));
  40. }
  41. formElt.prepend(selectElt);
  42. // add attribue selected on the first option
  43. $('#chatForm select option:first').attr("selected");
  44.  
  45. //////////
  46. /* CSS */
  47. ////////
  48. // set css of the form
  49. formElt.css({
  50. "padding": "0",
  51. });
  52. // set css of the select element
  53. $("#chatForm select").css({
  54. "width": "20px",
  55. "border": "1px solid #7ec8d8",
  56. "background-color": "#7ec8d8",
  57. "padding-bottom": "1px"
  58. });
  59. // hover select element
  60. $("#chatForm select").hover(
  61. function() {
  62. $(this).css({
  63. "background-color": "",
  64. "border": "1px solid #10426b",
  65. "color": "#7ec8d8"
  66. });
  67. },
  68. function() {
  69. $(this).css({
  70. "border": "1px solid #7ec8d8",
  71. "background-color": "#7ec8d8",
  72. "color": "#10426b"
  73. });
  74. }
  75. );
  76. //set css of the input (form)
  77. inputFormELt.css({
  78. "width": "210px"
  79. });
  80.  
  81. ////////////////
  82. /* Execution */
  83. //////////////
  84. // get the selected option value and set it in the input (form)
  85. selectElt.change( function() {
  86. inputFormELt.val(this.value);
  87. });
  88. console.log("Reaction Scroll Bar is loaded.");
  89. })();