Last active
September 18, 2015 17:14
-
-
Save AmauryCarrade/be831ca2829ae156bdd9 to your computer and use it in GitHub Desktop.
Accès rapide à un mini-client IRC connecté au bon canal, depuis le forum de zCraft.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Chat intégré sur le forum | |
// @namespace eu.carrade.amaury.zcraft.chat | |
// @description Intégration d'un accès à IRC sur le forum | |
// @include https://forum.zcraft.fr/* | |
// @version 2 | |
// @grant none | |
// ==/UserScript== | |
var chat_url = "https://kiwiirc.com/client/irc.zcraft.fr/?&theme=mini#zcraft"; | |
var chat_window = undefined; | |
var style_normal = "display: block; position: fixed; right: 30px; border-width: 2px 2px 0px; border-style: solid solid none; border-color: rgb(68, 105, 156) rgb(68, 105, 156) ; border-radius: 4px; padding: 5px 8px 10px; bottom: -3px; cursor: pointer; background-color: rgb(40, 63, 93); color: white; font-family: helvetica,arial,sans-serif; font-size: 1em; width: 200px !important; text-align: center;"; | |
var style_hover = "background-color: #1b2a3e !important;"; | |
var css = "#zic_tab { " + style_normal + " } #zic_tab:hover { " + style_hover + " }"; | |
style=document.createElement('style'); | |
if (style.styleSheet) | |
style.styleSheet.cssText=css; | |
else | |
style.appendChild(document.createTextNode(css)); | |
document.getElementsByTagName('head')[0].appendChild(style); | |
document.body.insertAdjacentHTML("beforeend", "<div id='zic_tab'>Discussion instantanée</div>"); | |
var tab = document.getElementById("zic_tab"); | |
function alertOnZICTab(text, duration) | |
{ | |
tab.innerHTML = text; | |
setTimeout(function() { tab.innerHTML = "Discussion instantanée"; }, duration); | |
} | |
tab.onclick = function() | |
{ | |
if(!chat_window || chat_window.closed) | |
{ | |
alertOnZICTab("Ouverture...", 5000); | |
chat_window = window.open(chat_url, "zuc_irc_window", 'height=500,width=350,toolbar=0,menubar=0,location=0'); | |
} | |
else | |
{ | |
alertOnZICTab("Déjà ouvert !", 2000); | |
} | |
if (window.focus) | |
{ | |
setTimeout(function() { chat_window.focus(); }, 200); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment