Skip to content

Commit

Permalink
index.html: use mastodon timeline instead of twitter timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed Mar 2, 2024
1 parent 870b98a commit 2260d95
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
10 changes: 5 additions & 5 deletions _sass/pages/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -817,10 +817,10 @@ section {
}

///
// Twitter timeline
// Mastodon timeline
///
#twitter-timeline {
$twitter-blue: #1DA1F2;
#mastodon-timeline {
$mastodon-purple: #6364FF;

max-height: 450px;
overflow: hidden;
Expand All @@ -833,13 +833,13 @@ section {
}

.placeholder {
color: $twitter-blue;
color: $mastodon-purple;
width: 100%;
i {
font-size: 5rem;
}
a {
color: $twitter-blue;
color: $mastodon-purple;
}
}
}
Expand Down
25 changes: 11 additions & 14 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,28 +247,25 @@
});

/**
* Create a new 'script' element which sources Twitter widgets script
* Create an 'iframe' element which shows the mastofeed
*/
function loadTwitterScript() {
let script = document.createElement('script');
let timeline = $("#twitter-timeline");
let cb = () => {
// When the script is loaded we bind to the widget rendering event to display it
twttr.events.bind("rendered", (event) => {
timeline.addClass("rendered");
});
}
function loadMastodonTimeline() {
let iframe = document.createElement('iframe');
let timeline = $("#mastodon-timeline");

script.src = "https://platform.twitter.com/widgets.js"
script.onload = cb;
document.head.append(script);
iframe.src = "https://www.riot-os.org/mastofeed/apiv2/feed?replies=false&boosts=false&theme=light&size=90.9";
iframe.title = "@RIOT_OS mastodon feed";
iframe.width = "100%";
iframe.height = "100%";
timeline.children('.placeholder').remove()
timeline.append(iframe);
}

/**
* We need to wait until we know the user accepts using third party cookies
*/
$(window).on("cookiesAccepted", () => {
loadTwitterScript();
loadMastodonTimeline();
});

})()
7 changes: 3 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,13 @@ <h2>Get in touch</h2>
</div>

<div class="row">
<div class="col-12 col-md-8 col-lg-4 offset-md-2 offset-lg-0 border border-1 rounded-1" id="twitter-timeline">
<div class="col-12 col-md-8 col-lg-4 offset-md-2 offset-lg-0 p-1 border border-1 rounded-1" id="mastodon-timeline">
<div class="placeholder h-100">
<div class="col d-flex flex-column justify-content-center align-items-center h-100">
<i class="ri-twitter-line text-center align-text-bottom"></i>
<a href="https://twitter.com/RIOT_OS?ref_src=twsrc%5Etfw" target="_blank">Follow us on Twitter! @RIOT_OS</a>
<i class="ri-mastodon-fill text-center align-text-bottom"></i>
<a href="https://fosstodon.org/@RIOT_OS" target="_blank">Follow us on Mastodon! @RIOT_OS@fosstodon.org</a>
</div>
</div>
<a class="twitter-timeline" data-lang="en" data-dnt="true" data-theme="light" href="https://twitter.com/RIOT_OS?ref_src=twsrc%5Etfw">@RIOT_OS</a>
</div>
<hr class="d-block d-lg-none mt-5">
<div class="col-12 col-md-6 col-lg-4">
Expand Down

0 comments on commit 2260d95

Please sign in to comment.