+ENVIAR - Menéame

Envia fácilmente a Menéame.

目前为 2025-01-06 提交的版本。查看 最新版本

// ==UserScript==
// @name         +ENVIAR - Menéame
// @namespace    http://tampermonkey.net/
// @version      2025-01-05.1
// @description  Envia fácilmente a Menéame.
// @author       Ergomnm
// @match        ://*/*
// @exclude      ://*meneame.net*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=meneame.net
// @grant        none
// @license      GNU GPLv3

// ==/UserScript==

 (function() {
'use strict';
// Crear el botón
let button = document.createElement('button');
button.innerText = 'ENVIAR';
button.style.position ='relative';
button.style.lineHeight= '16px';
button.style.left = '70px';
button.style.top = '-5px';
button.style.height = '18px';
button.style.transform = 'translateX(-50%)';
button.style.zIndex = '99999';
button.style.padding = '0px 7px 0px 15px';
button.style.backgroundColor = '#e35614';
button.style.color = '#ffffff';
button.style.border = 'none';
button.style.borderRadius = '10px';
button.style.cursor = 'pointer';
button.style.fontSize = '11px';
button.style.fontFamily = 'Open Sans';
button.style.fontWeight = 'bold';
button.style.boxShadow = '0px 4px 6px rgba(0, 0, 0, 0.1)';
 // Añadir una clase al botón
button.classList.add('enviarmnm');


// Agregar el botón al cuerpo de la página
let targetElement = document.querySelector("h1[class*=title],h2[class*=title]");
// Si no existe, intenta seleccionar el segundo elemento
if (!targetElement) {
    targetElement = document.querySelector("h1[class*=head],h2[class*=head]");
}
// Si se encontró un elemento, añade el botón
if (targetElement) {
    targetElement.appendChild(button);
}
else {
    document.querySelector("h1").appendChild(button);
}
// Función para abrir la URL de envío a Menéame
button.addEventListener('click', function() {
let currentUrl = encodeURIComponent(window.location.href);
let currentTitle = encodeURIComponent(document.title);
let meneameUrl = `https://www.meneame.net/submit?url=${currentUrl}&title=${currentTitle}`;
window.open(meneameUrl, '_blank');
});
})();