NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Elhacker.net Enhancer
// @namespace Net.ElHacker.Ikillnukes
// @version 0.1
// @description Algunas utilidades para el foro...
// @author Ikillnukes
// @match http://*.elhacker.net/*
// @grant none
// @require http://code.jquery.com/jquery-3.1.1.min.js
// @updateURL https://openuserjs.org/meta/Ikillnukes/Elhacker.net_Enhancer.meta.js
// ==/UserScript==
var unsaved = false;
function getNick()
{
var nick = $("tr.windowbg2 b").text();
return nick + (nick == "Visitante" ? (Math.floor((Math.random() * 10000) + 1)).toString() : "");
}
function chat()
{
var url = "https://webchat.freenode.net/?channels=ircehn",
chat = $('<center>').append($("<iframe>").attr("id", "ircehn").attr("frameborder", "0").css("height", "500px").css("margin-top", "20px"));
if(window.location.hostname == "foro.elhacker.net")
{
$('table.windowbg2').after($("<br>")).after(chat);
$("#ircehn").attr("src", url + "&nick=" + getNick()).css("width", "50%");
}
else
{
$(".Post").prepend(chat);
$("#ircehn").attr("src", url).css("width", "90%");
}
}
function unloadPage()
{
if(unsaved)
return "Tienes cambios sin guardar en esta página. ¿Deseas salir sin guardarlos?";
}
function postAlert()
{
if(window.location.pathname.indexOf("/post.html") > -1 || window.location.pathname.indexOf("/pm.html;sa=send") > -1)
{
$(":input").change(function() {
unsaved = true;
});
window.onbeforeunload = unloadPage;
}
}
(function() {
'use strict';
chat();
postAlert();
})();