Teams Tag Comment [GTP]

Script permettant d'ajouter un tag sur chaque commentaire et de citer l'auteur de celui-ci.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Teams Tag Comment [GTP]
// @namespace    https://realitygaming.fr/
// @version      1.0
// @description  Script permettant d'ajouter un tag sur chaque commentaire et de citer l'auteur de celui-ci.
// @author       Rivals GTP
// @match        https://realitygaming.fr/conversations/*
// @grant        none
// ==/UserScript==

$(document).ready(function(){
    $("<style type='text/css'> .tagComment { color: #9e9e9e; } .tagComment:hover { -webkit-transform: rotate(400deg); -ms-transform: rotate(400deg); transform: rotate(400deg); -webkit-transform: rotate(400deg); -moz-transform: rotate(400deg); -ms-transform: rotate(400deg); -o-transform: rotate(400deg); transition: all 0.35s; -webkit-transition: all 0.35s; -moz-transition: all 0.35s; -ms-transition: all 0.35s; -o-transition: all 0.35s; cursor: pointer; color: #3C7C95; } </style>").appendTo("head");
    $('.messageContent .username[dir=auto]').before('<i class="fa fa-tag tagComment" aria-hidden="true"></i>');

    var tagComment = $('.tagComment');

    tagComment.click(function(){
      var authorCommentUsername = $(this).parent().children()[1].text;
      var postComment = $('textarea[placeholder="Poster un commentaire..."]');

      if(postComment.val() !== '') {
        postComment.val(postComment.val() + '@' + authorCommentUsername + ' ');
        postComment.focus();
      }

      else {
        postComment.val('@' + authorCommentUsername + ' ');
        postComment.focus();
      }
   });

});