NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name EOL Mention Expand // @namespace http://tampermonkey.net/ // @version 2024-01-08 // @description Mostrar el último mensaje del usuario mencionado // @author NeDark // @match https://www.elotrolado.net/hilo_* // @icon https://www.google.com/s2/favicons?sz=64&domain=elotrolado.net // @require http://code.jquery.com/jquery-latest.js // @grant none // @license MIT // ==/UserScript== (function($) { 'use strict'; $(`<div id="mentionOverlay" style="overflow-y: scroll;position: absolute; left: -9999px; top: -9999px; width: 650px; height: 250px; background: white; border: 2px solid black; border-radius: 20px; padding: 25px"></div>`).appendTo("body") $('a.mention').hover(function(event) { const ownId = parseInt($(this).closest('.row.post').attr('id').slice(1)) const nick = this.innerText.slice(1) let posts = [] let anchors = [] $('a.author > span > span').each(function() { if (this.innerText == nick) { const foundId = parseInt($(this).closest('.row.post').attr('id').slice(1)) if (foundId < ownId) { const $message = $(this).closest('.row.post').find('.message').clone() $message.find(".embed-wrap").each(function () { $(this).html("[Elemento embebido no soportado]").attr("class", "") }) posts.push($message.html()) anchors.push("p"+foundId) } } }) console.log(posts) if (!posts.length) { posts.push("No se encontró mensaje en esta página") } const rect = this.getBoundingClientRect() console.log(rect) $("#mentionOverlay").css({ "left": (rect.left+window.scrollX+10)+"px", "top": (rect.top+window.scrollY+20)+"px", "display": "block" // Make sure the iframe is visible }).html( posts[posts.length-1] ) if (anchors.length) { $(this).attr("href", "#"+anchors[anchors.length-1]) $(this).attr("title", "Clic para ir al mensaje") } console.log() }, function(event) { $("#mentionOverlay").css({ "display": "none" // Make sure the iframe is visible }) }) // Your code here... })(jQuery);