Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index.html: use mastodon timeline instead of twitter timeline #121

Merged
merged 2 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
});

})()
12 changes: 0 additions & 12 deletions community.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,6 @@ <h2>Join us</h2>
</div>
</div>

<div id="socialmedia" class="col-12 col-md-4 mt-5">
<div class="card border-0 d-flex h-100">
<div class="card-header d-flex align-items-center justify-content-center h-100 border-0">
<a href="https://twitter.com/RIOT_OS" target="_blank"><img class="card-img-top" src="{{ "assets/img/twitter-logo-riotos.png" | relative_url }}" alt="Twitter logo"></a>
</div>
<div class="card-body px-0">
<!--<h4 class="card-title">Our forum for discussions.</h4>-->
<a href="https://twitter.com/RIOT_OS" class="btn btn-outline-primary w-100" target="_blank">Our news</a>
</div>
</div>
</div>

<div class="col-12 col-md-4 mt-5">
<div class="card border-0 d-flex h-100">
<div class="card-header d-flex align-items-center justify-content-center h-100 border-0">
Expand Down
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
Loading