supporters: Dynamically construct "Read more" links in JS.

This provides better presentation to people without JavaScript,
and makes it easier to author the HTML.
This commit is contained in:
Brett Smith 2020-11-25 13:47:40 -05:00
parent 8ca60f8b07
commit fb6164926f
3 changed files with 17 additions and 21 deletions

View file

@ -18,6 +18,7 @@ body {
a { text-decoration: none; color: #557733; }
a:hover { text-decoration: underline; color: #577632; }
a.read-more {
cursor: pointer;
font-style: italic;
}

View file

@ -112,20 +112,20 @@ $(document).ready(function() {
}
var want_id = window.location.hash.substr(1) || "do not match any id";
$('a.read-more').each(function(index, readmore) {
$('div[data-read-more]').each(function(index, readmore) {
var $readmore = $(readmore)
var $content = $(readmore.hash);
var $header = $content.prev('h3');
if (($header.length && $header[0].id === want_id) || readmore.id === want_id) {
$readmore.hide();
var $header = $readmore.prev('h3');
if ($header.length && $header[0].id === want_id) {
// Do nothing, leave it alone
} else {
$content.hide();
$readmore.on('click', function(event) {
$readmore.fadeOut('fast', function() {
$readmore.replaceWith($content);
$content.fadeIn('fast');
});
var $linkpara = $('<p><a class="read-more"></a></p>');
var $readlink = $linkpara.children('a');
$readlink.append($readmore.data('read-more'));
$readlink.on('click', function(event) {
$linkpara.replaceWith($readmore);
$readmore.fadeIn('fast');
});
$readmore.hide().replaceWith($linkpara);
}
});
});

View file

@ -102,7 +102,7 @@ freedom can be in the service of human freedom.</p>
even in the face of so many obstacles.</p>
<h3 id="StayingConnected">Staying Connected</h3>
<div id="ConnectedContent">
<div data-read-more="Read more about staying connected">
<p>We helped folks stay connected, even when travel
and in-person meetings could not happen. We gathered digitally every
Thursday with all who wanted to join since early March to discuss
@ -112,10 +112,9 @@ presentations concerting copyleft to how to dismantle systemic racism in free so
important software freedom policy issues like standing up to fight the
DMCA.</p>
</div>
<p><a class="read-more" href="#ConnectedContent">Read more about staying connected</a></p>
<h3 id="PayingPeople">Paying People to Work on Software Freedom</h3>
<div id="PayingContent">
<div data-read-more="Read more about paying people to work on software freedom">
<p>Our Outreachy internship program became even more essential during this
difficult time. Everyone needs remote work now, <em>and</em> to learn how
to effectively work remotely. This year, we achieved the most internships in
@ -139,10 +138,9 @@ benefit their profit motive and self-interest. We fund FOSS development that be
only fund software development that completely respects your software freedom and
rights.</p>
</div>
<p><a class="read-more" href="#PayingContent">Read more about paying people to work on software freedom</a></p>
<h3 id="Policy">Policy</h3>
<div id="PolicyContent">
<div data-read-more="Read more about our policy work this year">
<p>This year, we expanded our plans and involvement on key issues of software
freedom policy. We are known throughout the FOSS community as the
organization that knows the details of FOSS policy — from project governance, to licensing to Codes of
@ -159,17 +157,15 @@ that are now ubiquitous and used by everyone. While we can only <a href="/blog/
year our <a href="/copyleft-compliance/enforcement-strategy.html">Strategic GPL Enforcement Plan</a>, and our companion <a href="/copyleft-compliance/firmware-liberation.html">Firmware Liberation Project</a>. These two new initiatives have
just begun and they need your support and help to succeed.</p>
</div>
<p><a class="read-more" href="#PolicyContent">Read more about our policy work this year</a></p>
<h3 id="NewMembers">New Member Projects and New Board Member</h3>
<div id="NewContent">
<div data-read-more="Read more about our new member projects and board member">
<p>In 2020, Conservancy welcomed two important new projects. The <a href="/news/2020/jul/21/ICRjoins/">Institute for Computing in Research</a> runs a mentoring program designed to bridge inequities in tech by training teenage students to do rigorous scientific research using free software. <a href="/news/2020/sep/10/openwrt-joins/">OpenWrt</a> is a critical FOSS wireless router project that demonstrates the long lasting positive results of strategic GPL enforcement. We also recognize that communities change over time. In addition to adding new projects, we took the time this past year to sunset some of our projects that no longer had a charitable focus.</p>
<p>We were also pleased to welcome <a href="/news/2020/jan/03/arandal/">Allison Randal</a>, a steadfast advocate of software freedom, to our Board of Directors.</p>
</div>
<p><a class="read-more" href="#NewContent">Read more about our new member projects and board member</a></p>
<h3 id="Events">Events and Conferences</h3>
<div id="EventsContent">
<div data-read-more="Read more about our events and conferences">
<p>FOSS events and conferences have always been an essential component of FOSS,
but this year, the pandemic thwarted our usual event system an infrastructure.
Conservancy has been at the center of transitioning events to online formats for
@ -190,7 +186,6 @@ as we look hopefully forward to an in-person Copyleft Conf 2022.</p>
<p>We also remain ready to continue our work of helping to sponsor travel for our member projects and their events when travel becomes safe again. Before we ceased our conferences and travel, we funded over $60,000 worth of travel to important events, on pace for what could have been one of our biggest travel sponsorship years. We invested remaining travel funds into improving online infrastructure and planning
for how to keep FOSS engaged without these essential in-person events.</p>
</div>
<p><a class="read-more" href="#EventsContent">Read more about our events and conferences</a></p>
<h3 id="HelpUs">Help Us Continue our Mission</h3>
<p>We know this year brought unforeseen financial challenges. Some of you have