Last active
March 4, 2017 16:52
-
-
Save lodi-g/58e86c550d45fc1c7884d525ce1f074b to your computer and use it in GitHub Desktop.
Just adds a link to EPITECH intranet from the Yammer social networking website.
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 Yammer2Intra | |
// @namespace lodi_g | |
// @include https://www.yammer.com/epitech.eu/* | |
// @version 0.1 | |
// @grant none | |
// ==/UserScript== | |
const debuggingEnabled = false; | |
const imageUrl = "https://intra.epitech.eu/favicon.ico"; | |
const intraBaseLink = "https://intra.epitech.eu/user/"; | |
function debug(log) { | |
if (debuggingEnabled) | |
console.log(log); | |
} | |
function checkForCards() { | |
debug("Checking for active cards..."); | |
document.querySelectorAll(".yj-hovercard-email").forEach(function(el) { | |
let login = el.innerHTML; | |
debug("Found one."); | |
if (el.querySelectorAll(".intralink").length == 0) | |
el.innerHTML += ` <a class='intralink' href='${intraBaseLink}${login}/' target='_blank'><img style='width: 15px; height: 15px; position: relative; top: 5px; left: 5px;' src='${imageUrl}'></img></a>`; | |
}); | |
debug("Done. Waiting 1.5s.") | |
} | |
var interval = setInterval(checkForCards, 1500); | |
console.log("Yammer2Intra"); | |
console.log(`To kill polling, run clearInterval(${interval})`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment