Author: sebb
Date: Mon Jun  9 09:03:24 2025
New Revision: 1926273

URL: http://svn.apache.org/viewvc?rev=1926273&view=rev
Log:
Use ids to separate data from presentation

Modified:
    comdev/projects.apache.org/trunk/site/index.html
    comdev/projects.apache.org/trunk/site/js/projects.js

Modified: comdev/projects.apache.org/trunk/site/index.html
URL: 
http://svn.apache.org/viewvc/comdev/projects.apache.org/trunk/site/index.html?rev=1926273&r1=1926272&r2=1926273&view=diff
==============================================================================
--- comdev/projects.apache.org/trunk/site/index.html (original)
+++ comdev/projects.apache.org/trunk/site/index.html Mon Jun  9 09:03:24 2025
@@ -33,25 +33,28 @@
    <p>This site is a catalog of Apache Software Foundation <a 
href="projects.html">projects</a> and their <a 
href="committees.html">management committees</a>.
       It is designed to help you find specific projects that meet your 
interests and to gain a broader understanding of
       the wide variety of work currently underway in the Apache community.</p>
-   <!-- N.B. This text must agree with the 'obj.innerHTML' code in projects, 
which replaces it -->
+   <!-- N.B. This ids in this section must agree with the code in projects.js 
-->
    <div id="details">
-      <h3 style='text-align: center;'>There are currently <span style='color: 
#269;'>TBA</span> open source initiatives at the ASF:</h3>
+      <h3 style='text-align: center;'>There are currently <span 
id="initiatives" style='color: #269;'>TBA</span>+ open source initiatives at 
the ASF:</h3>
       <ul style='width: 400px; margin: 0 auto; font-size: 18px; color: #269; 
font-weight: bold;'>
-      <li>TBA <a href='committees.html'>committees</a> managing TBA <a 
href='projects.html'>projects</a></li>
-      <li>TBA incubating podlings</li>
+      <li><span id="committees">TBA</span> <a 
href='committees.html'>committees</a> managing <span id="projects">TBA</span> 
<a href='projects.html'>projects</a></li>
+      <li><span id="podlings">TBA</span> incubating podlings</li>
       </ul>
-   <p style="text-align: center;">
-      Loading data, please wait...<br/>
-      <img src="images/loader.gif"/>
-   </p>
-   <p id="progress" style="text-align: center;"></p>
-   <noscript>
-      <h2>Notice!</h2>
-      <p>
-         This site relies heavily on JavaScript.
-         Please enable it or get a browser that supports it.
-      </p>
-   </noscript>
+      <!-- This div is cleared when loading is complete -->
+      <div id="loading">
+         <p style="text-align: center;">
+            Loading data, please wait...<br/>
+            <img src="images/loader.gif"/>
+         </p>
+         <p id="progress" style="text-align: center;"></p>
+      </div>
+      <noscript>
+         <h2>Notice!</h2>
+         <p>
+            This site relies heavily on JavaScript.
+            Please enable it or get a browser that supports it.
+         </p>
+      </noscript>
    </div>
 </div>
 <div id="footer">

Modified: comdev/projects.apache.org/trunk/site/js/projects.js
URL: 
http://svn.apache.org/viewvc/comdev/projects.apache.org/trunk/site/js/projects.js?rev=1926273&r1=1926272&r2=1926273&view=diff
==============================================================================
--- comdev/projects.apache.org/trunk/site/js/projects.js (original)
+++ comdev/projects.apache.org/trunk/site/js/projects.js Mon Jun  9 09:03:24 
2025
@@ -1005,6 +1005,12 @@ function isCommittee(name) {
 
 // ------------ Front page rendering ------------\\
 
+function update_id(id, val) {
+    var obj = document.getElementById(id);
+    if (obj) {
+        obj.innerHTML = val;
+    }
+}
 function renderFrontPage() {
     var numcommittees = 0;
     var i;
@@ -1032,17 +1038,15 @@ function renderFrontPage() {
     var initiatives = numProjects + curPodlings; // both PMC and podlings
     initiatives -= initiatives % 50; // round down to nearest 50
     var obj = document.getElementById('details');
-    obj.innerHTML = ""
     if (urlErrors.length > 0) {
         obj.innerHTML += "<p><span style='color: red'><b>Warning: could not 
load: "+urlErrors.join(', ')+"</b></span></p>"
     }
-    // N.B. This text must agree with the 'details' div in index.html, which 
it replaces
-    obj.innerHTML
-        += "<h3 style='text-align: center;'>There are currently <span 
style='color: #269;'>" + initiatives + "+</span> open source initiatives at the 
ASF:</h3>"
-        + "<ul style='width: 400px; margin: 0 auto; font-size: 18px; color: 
#269; font-weight: bold;'>"
-        + "<li>" + numcommittees + " <a href='committees.html'>committees</a> 
managing " + numProjects + " <a href='projects.html'>projects</a></li>"
-        + "<li>" + curPodlings + " incubating podlings</li></ul>"
-
+    update_id('loading', ''); // clear the loading messages
+    // N.B. These ids must agree with the 'details' div in index.html
+    update_id('initiatives', initiatives);
+    update_id('committees', numcommittees);
+    update_id('projects', numProjects);
+    update_id('podlings', curPodlings);
     renderCommitteeEvolution();
     renderPodlingsEvolution();
     renderLanguageChart();


Reply via email to