Skip to content

Commit

Permalink
Replacing the contents of the news section with TARDIS twitter feed (#…
Browse files Browse the repository at this point in the history
…1555)

* Replacing the contents of the news section with TARDIS twitter feed

* add css link

* removing two scrollbars

* [build docs]
  • Loading branch information
atharva-2001 authored Jun 4, 2021
1 parent 4b05af8 commit 267906d
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 17 deletions.
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ Mission Statement

zreferences

====
----
News
====
----

.. include:: news.rst
91 changes: 76 additions & 15 deletions docs/news.rst
Original file line number Diff line number Diff line change
@@ -1,26 +1,87 @@
.. raw:: html

<div class = "twitter-block" style = "width:100%; display: flex; justify-content: center;">
<a class="twitter-timeline" data-width="850" data-height="900" href="https://twitter.com/tardis_sn?ref_src=twsrc%5Etfw">Tweets by tardis_sn</a> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>

GSOC 2017
---------

.. image:: https://developers.google.com/open-source/gsoc/resources/downloads/GSoC-logo-horizontal.svg
:target: https://summerofcode.withgoogle.com/organizations/4793296782098432/
:width: 458 px

TARDIS participates in the Google Summer of Code 2017 program as part of the Python Software Foundation!
<script>
document.getElementsByClassName("twitter-block")[0].addEventListener(
"DOMSubtreeModified",
function (e) {
for (var target = e.target; target && target != this; target = target.parentNode) {
// loop parent nodes from the target to the delegation node
if (target.matches("#twitter-widget-0")) {
customizeTweetMedia();
}
}
},
false
);
var customizeTweetMedia = function () {
var iframe = document.getElementById("twitter-widget-0");
SOCIS 2016
----------
var cssLink = iframe.contentWindow.document.createElement("link");
cssLink.setAttribute("rel", "stylesheet");
cssLink.setAttribute("type", "text/css");
cssLink.setAttribute("href", "./_static/css/theme.css");
TARDIS is part of ESA's Summer of Code in Space 2016 program!
iframeHead = iframe.contentWindow.document.getElementsByTagName("head")[0];
GSOC 2016
---------
if (!iframeHead.contains(iframe.contentDocument.getElementById("sphinx-css"))) {
iframeHead.appendChild(cssLink);
}
.. image:: https://developers.google.com/open-source/gsoc/resources/downloads/GSoC-logo-horizontal.svg
:target: https://summerofcode.withgoogle.com/organizations/4793296782098432/
:width: 458 px
iframe.contentWindow.document.body.style.overflow = "hidden";
TARDIS has been selected as a mentoring organisation for the Google Summer of Code 2016 program!
var headerTitle = iframe.contentWindow.document.getElementsByClassName("timeline-Header-title")[0];
headerTitle.style.fontSize = "18px";
var headerTitleByInline = iframe.contentWindow.document.getElementsByClassName("timeline-Header-byline")[0];
headerTitleByInline.style.fontSize = "18.5px";
var tweetTextList = iframe.contentWindow.document.getElementsByClassName("timeline-Tweet-text");
var index;
for (let index = 0; index < tweetTextList.length; index++) {
tweetTextList[index].style.fontSize = "16px";
tweetTextList[index].style.fontFamily = "Lato, proxima-nova, Helvetica Neue, Arial, sans-serif";
tweetTextList[index].style.lineHeight = "1.1";
}
tweetList = iframe.contentWindow.document.getElementsByClassName("timeline-TweetList")[0];
tweetList.addEventListener(
"DOMSubtreeModified",
function () {
customizeTweetMedia();
},
false
);
};
// checks if the widget hasn't loaded and prints a message after 4 seconds
setTimeout(() => {
if (document.querySelector("#twitter-widget-0") == null) {
const fallbackDiv = document.createElement("div");
const linkSpan = document.createElement("span");
const link = document.createElement("a");
link.setAttribute("href", `https://twitter.com/tardis_sn`);
link.textContent = "TARDIS Tweets";
linkSpan.appendChild(link);
const messageP = document.createElement("P");
messageP.textContent =
"It seems Twitter Widget was not loaded. Please check your internet connection or consider disabling tracking protection if on Firefox. If the problem persists, please contact us.";
fallbackDiv.appendChild(linkSpan);
fallbackDiv.appendChild(messageP);
fallbackDiv.style.cssText = "font-family: Lato, sans-serif; text-align:center;";
document.querySelector(".twitter-timeline").replaceWith(fallbackDiv);
}
}, 4000);
</script>

0 comments on commit 267906d

Please sign in to comment.