Skip to content

Instantly share code, notes, and snippets.

@ahallora
Last active March 10, 2022 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahallora/1e2346ee458c37817bf7f6e645aebd15 to your computer and use it in GitHub Desktop.
Save ahallora/1e2346ee458c37817bf7f6e645aebd15 to your computer and use it in GitHub Desktop.
FCK Grid
/*
1. Go to a liveScore.com match page showing a FC København game
2. Run this script in the browser console
3. Enjoy FCKKøbenhavnLIVE tweets, liveScore updates and FCK fan banter live chatting
4. Good game.
Disclaimer: Use at own discretion.
*/
(()=>{
const renderGrid = ()=>{
// Sidelinien
const sidelinien = document.createElement("iframe");
sidelinien.className = "sidelinien";
sidelinien.src = "https://d3iw0alor8imgp.cloudfront.net";
sidelinien.frameBorder = 0;
document.body.append(sidelinien);
// Twitter
const twdiv = document.createElement("div");
twdiv.className = "twitter-scroll-wrapper";
const twa = document.createElement("a");
twa.href = "https://twitter.com/FCKobenhavnLIVE?ref_src=twsrc%5Etfw";
twa.className = "twitter-timeline";
twa.setAttribute("data-theme", "dark");
twa.setAttribute("data-chrome", "transparent");
twa.innerHTML = "Tweets by FCKobenhavnLIVE";
twdiv.appendChild(twa);
const tws = document.createElement("script");
tws.src = "https://platform.twitter.com/widgets.js";
twdiv.appendChild(tws);
document.body.appendChild(twdiv);
// style overrides
const stylesheetOverrides = document.createElement("style");
stylesheetOverrides.innerHTML = `
/*
html,
.sidelinien,
.twitter-scroll-wrapper,
#matchStatisticsWidget,
div#content-center img,
div#content-center svg,
*/
.sidelinien {
filter: invert(1);
}
#__livescore:before {
display: none !important;
}
div#content-center {
min-height: inherit;
width: 33vw;
margin-left: 8vw;
}
#layout-columns-container > div:nth-child(1),
#layout-columns-container > div:nth-child(3),
#footer-wrapper,
#top-menu-holder,
#horizontal-navigation-container,
#tab-content-Info iframe,
div#content-center iframe {
display: none;
}
.sidelinien {
width: 33vw;
height: 100vh;
position: fixed;
top: 0;
right: 0;
border-left: 1px solid #ddd;
}
.twitter-scroll-wrapper {
width: 30vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
overflow: auto;
border-right: 1px solid #ddd;
}
`;
document.body.append(stylesheetOverrides);
// click the tracker
document.getElementById("trackerIcon").click();
}
const isOnFCKMatchPage = ()=>{
const isFCK = (id)=>{
const x = document.querySelector(id);
const text = x?.innerText?.toLowerCase();
const fck = text?.replace(/[^a-zøØ]*/gi, "");
return ["fccopenhagen", "fckøbenhavn"].includes(fck);
}
const isFCKaway = isFCK("#match-detail__team-name__away");
const isFCKhome = isFCK("#match-detail__team-name__home");
return isFCKaway || isFCKhome;
}
if (isOnFCKMatchPage()) {
renderGrid();
} else {
alert("You need to be on a Livescore Match page showing a FC Copenhagen game.");
}
}
)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment