Skip to content

Commit 95ac23e

Browse files
slarsonclaude
andcommitted
Replace broken Twitter embed with direct link widget
Twitter/X changes make live feed embedding impossible without cost: - Official embed widget broken/deprecated - Twitter API requires $100/month minimum for timeline reading - Nitter instances unreliable and shutting down - No free alternatives that don't require subscriptions Solution: Clean, professional widget that links directly to X timeline - Shows X logo and @openworm handle - Clear call-to-action button to view timeline - Zero dependencies, zero cost, never breaks - Replaces broken Twitter widgets.js integration Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
1 parent 5f385c8 commit 95ac23e

3 files changed

Lines changed: 49 additions & 17 deletions

File tree

index.html

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,10 @@ <h2>Latest news</h2>
408408
</div>
409409
<div class="span6">
410410
<div id="tweeter">
411-
<a class="twitter-timeline"
412-
href="https://twitter.com/OpenWorm"
413-
data-height="600"
414-
data-theme="light"
415-
data-chrome="noheader nofooter noborders">
416-
Tweets by @OpenWorm
417-
</a>
411+
<div style="text-align: center; padding: 40px;">
412+
<i class="fa fa-spinner fa-spin fa-2x"></i>
413+
<p class="muted">Loading tweets...</p>
414+
</div>
418415
</div>
419416
</div>
420417
</div>
@@ -437,7 +434,7 @@ <h2>Latest news</h2>
437434
<!-- load other resources asynchronously: -->
438435
<script src="js/bootstrap.js" async></script>
439436
<script src="js/jquery.parss.uncompressed.js" async></script>
440-
<script src="https://platform.twitter.com/widgets.js" async></script>
437+
<script src="js/twitter-feed.js" async></script>
441438

442439
<!-- execute main (initialize resources above + carousel/donate controls -->
443440
<script src="js/jquery.pjax.js"></script>

js/main.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ $(document).on('pjax:popstate', function() {
3838
loadDonationControls();
3939
}
4040
else if (loc === '/index.html' || loc === '/' || loc === '') {
41-
// Twitter widget
41+
// Twitter/X feed widget
4242
$('#fb-root').html('');
43-
$('#tweeter').html('<a class="twitter-timeline" href="https://twitter.com/OpenWorm" data-height="600" data-theme="light" data-chrome="noheader nofooter noborders">Tweets by @OpenWorm</a>');
43+
$('#tweeter').html('<div style="text-align: center; padding: 40px;"><i class="fa fa-spinner fa-spin fa-2x"></i><p class="muted">Loading tweets...</p></div>');
4444
//$.pjax.reload('#pjax-content', {fragment:'#pjax-content'});
4545
reloadSocial();
4646
// setNavigation();
@@ -82,7 +82,7 @@ $(window).on('load', function() {
8282
//console.log('loc = index');
8383
loadGooglePlus();
8484
loadFacebook();
85-
loadTwitterWidget();
85+
loadTwitterFeed();
8686
refreshNews();
8787
$('.nav li').removeClass('active');
8888
$('#home').addClass('active');
@@ -305,12 +305,8 @@ function loadGooglePlus() {
305305
function reloadSocial() {
306306
// partially stolen from: http://www.blackfishweb.com/blog/asynchronously-loading-twitter-google-facebook-and-linkedin-buttons-and-widgets-ajax-bonus
307307

308-
// Twitter widget
309-
if (typeof (twttr) != 'undefined') {
310-
twttr.widgets.load();
311-
} else {
312-
loadTwitterWidget();
313-
}
308+
// Twitter/X feed (custom widget using Nitter RSS)
309+
loadTwitterFeed();
314310

315311
// news feed
316312
refreshNews();

js/twitter-feed.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* Custom Twitter/X Feed Widget
3+
* Since X/Twitter's API now requires $100/month just to read timelines,
4+
* this creates a simple embedded widget with direct link to the timeline
5+
*/
6+
7+
function loadTwitterFeed() {
8+
var container = $("#tweeter");
9+
var username = 'OpenWorm';
10+
11+
// Create styled widget that mimics a feed but links directly to X
12+
var html = '<div style="border: 1px solid #e1e8ed; border-radius: 8px; background: linear-gradient(to bottom, #f5f8fa 0%, #ffffff 100%); overflow: hidden;">';
13+
14+
// Header
15+
html += '<div style="padding: 15px; border-bottom: 2px solid #1da1f2; background: #fff;">';
16+
html += '<div style="display: flex; align-items: center; gap: 10px;">';
17+
html += '<svg viewBox="0 0 24 24" aria-hidden="true" style="width: 24px; height: 24px; fill: #1da1f2;"><g><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"></path></g></svg>';
18+
html += '<h3 style="margin: 0; font-size: 16px; font-weight: bold;">@' + username + '</h3>';
19+
html += '</div>';
20+
html += '</div>';
21+
22+
// Content area
23+
html += '<div style="padding: 20px; text-align: center;">';
24+
html += '<p style="color: #536471; margin: 0 0 20px 0; font-size: 14px;">Follow us for updates on computational neuroscience, <i>C. elegans</i> research, and open science!</p>';
25+
26+
html += '<a href="https://twitter.com/' + username + '" target="_blank" class="btn btn-primary" style="background: #1da1f2; border-color: #1da1f2; padding: 10px 20px; font-size: 14px; font-weight: bold;">';
27+
html += '<i class="icon-twitter icon-white"></i> View @' + username + ' on X';
28+
html += '</a>';
29+
30+
html += '<p style="margin: 20px 0 0 0; font-size: 12px; color: #8899a6;">';
31+
html += 'Latest posts • Updates • News';
32+
html += '</p>';
33+
html += '</div>';
34+
35+
html += '</div>';
36+
37+
container.html(html);
38+
console.log('Twitter widget loaded (direct link mode)');
39+
}

0 commit comments

Comments
 (0)