Changeset - fb6164926fd0
[Not reviewed]
0 3 0
Brett Smith (brett) - 3 years ago 2020-11-25 18:47:40
brett@sfconservancy.org
supporters: Dynamically construct "Read more" links in JS.

This provides better presentation to people without JavaScript,
and makes it easier to author the HTML.
3 files changed with 17 insertions and 21 deletions:
0 comments (0 inline, 0 general)
www/conservancy/static/css/conservancy.css
Show inline comments
...
 
@@ -20,2 +20,3 @@ a:hover { text-decoration: underline; color: #577632; }
 
a.read-more {
 
    cursor: pointer;
 
    font-style: italic;
www/conservancy/static/js/supporter-page.js
Show inline comments
...
 
@@ -114,16 +114,16 @@ $(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);
 
        }
www/conservancy/templates/supporter/index.html
Show inline comments
...
 
@@ -104,3 +104,3 @@ 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
...
 
@@ -114,6 +114,5 @@ 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
...
 
@@ -141,6 +140,5 @@ 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
...
 
@@ -161,6 +159,5 @@ 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>
...
 
@@ -168,6 +165,5 @@ just begun and they need your support and help to succeed.</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,
...
 
@@ -192,3 +188,2 @@ 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>
 

	
0 comments (0 inline, 0 general)