OSDN Git Service

Add generic page overlay to report missing content.
authorKeith Marshall <keith@users.osdn.me>
Fri, 9 Oct 2020 14:12:25 +0000 (15:12 +0100)
committerKeith Marshall <keith@users.osdn.me>
Fri, 9 Oct 2020 14:12:25 +0000 (15:12 +0100)
* missing.html: New file.
* site.js (load_content) [status 404]: Use it.
(load_page_content): Initially, clear previous content.

* header.html (Downloads, Documentation, Contact Us): Add "onclick"
tab references; defer provision of content, raising 404 status.

header.html
missing.html [new file with mode: 0644]
site.js

index 666d78f..7d0c8ac 100644 (file)
  * OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  *
  * OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  *
+ *
+ * Note: this page assumes browser support for the following numeric
+ * HTML entity codes:
+ *
+ *    &#8209;  non-breaking hyphen
+ *    &#8217;  typographic apostrophe
+ *
 -->
 <a href="index.html"><div id="logo"></div></a>
 <div class="text">
   <h1>Minimalist GNU for Windows</h1>
   <ul id="navbar">
     <li><a href="index.html">Home</a></li>
 -->
 <a href="index.html"><div id="logo"></div></a>
 <div class="text">
   <h1>Minimalist GNU for Windows</h1>
   <ul id="navbar">
     <li><a href="index.html">Home</a></li>
-    <li><a href="#">Downloads</a></li>
+    <li><a onclick="load_page_overlay('download.html',
+          'MinGW Downloads', 'MinGW.org File Release System')"
+        href="#"
+       >Downloads</a>
+    </li>
     <li><a onclick="load_page_overlay('terms.html', 'MinGW Licensing',
           'Terms of Use for MinGW.org Products and Resources')"
           href="#"
        >Licensing</a>
     </li>
     <li><a onclick="load_page_overlay('terms.html', 'MinGW Licensing',
           'Terms of Use for MinGW.org Products and Resources')"
           href="#"
        >Licensing</a>
     </li>
-    <li><a href="#">Documentation</a></li>
-    <li><a href="#">Contact Us</a></li>
+    <li><a onclick="load_page_overlay('docrefs.html',
+          'MinGW Product Documentation',
+          'Links to Documentation Resources for MinGW.org Products')"
+        href="#"
+       >Documentation</a>
+    </li>
+    <li><a onclick="load_page_overlay('contact.html',
+          'Contacting MinGW.org',
+          'When the Web&#8209;Site doesn&#8217;t Provide an Answer')"
+        href="#"
+       >Contact Us</a>
+    </li>
   </ul>
 </div>
 
   </ul>
 </div>
 
diff --git a/missing.html b/missing.html
new file mode 100644 (file)
index 0000000..49a11fd
--- /dev/null
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML><!--
+ *
+ * missing.html
+ *
+ * Generic page overlay, to display when any requested page overlay
+ * is unresolved.
+ *
+ *
+ * $Id$
+ *
+ * Written by Keith Marshall <keith@users.osdn.me>
+ * Copyright (C) 2020, MinGW.org Project
+ *
+ *
+ * Redistribution and use in source and 'compiled' forms (SGML, HTML,
+ * PDF, PostScript, RTF, etc) with or without modification, are permitted
+ * provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer as
+ *    the first lines of this file, unmodified.
+ *
+ * 2. Redistributions in compiled form (transformed to other DTDs,
+ *    converted to PDF, PostScript, RTF and other formats) must
+ *    reproduce the above copyright notice, this list of conditions
+ *    and the following disclaimer in the documentation and/or other
+ *    materials provided with the distribution.
+ *
+ * THIS DOCUMENTATION IS PROVIDED BY THE MINGW.ORG PROJECT "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE MINGW.ORG PROJECT, OR
+ * ITS CONTRIBUTORS, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ *
+ * Note: this page assumes browser support for the following numeric
+ * HTML entity codes:
+ *
+ *    &#8209;  non-breaking hyphen
+ *    &#8217;  typographic apostrophe
+ *
+-->
+<h2>Page Not Found</h2>
+<p>The MinGW.org web&#8209;site is undergoing an overhaul,
+whilst in the process of transferring to a new hosting provider.
+During this transitional phase,
+some pages may be temporarily unavailable.
+</p>
+<p>If you see this page,
+it is likely that the content you are trying to access
+has not yet been transferred;
+please check back later.
+</p>
+
+<!-- $RCSfile$: end of file -->
diff --git a/site.js b/site.js
index f2da66d..c625c21 100644 (file)
--- a/site.js
+++ b/site.js
@@ -47,8 +47,14 @@ function load_content( container, src )
    */
   var request_handler = new XMLHttpRequest();
   request_handler.onreadystatechange = function()
    */
   var request_handler = new XMLHttpRequest();
   request_handler.onreadystatechange = function()
-  { if( (this.readyState == this.DONE) && (this.status == 200) )
-      set_content( container, this.responseText );
+  { if( this.readyState == this.DONE )
+      switch( this.status )
+      { case 200:
+         set_content( container, this.responseText );
+         break;
+       case 404:
+         load_content( container, "missing.html" );
+      }
   }
   request_handler.open( "GET", src, true );
   request_handler.send();
   }
   request_handler.open( "GET", src, true );
   request_handler.send();
@@ -59,6 +65,7 @@ function load_page_content( src, subtitle )
    * update the displayed page subtitle, (which may be null), and
    * load the page content from the specified "src" file.
    */
    * update the displayed page subtitle, (which may be null), and
    * load the page content from the specified "src" file.
    */
+  set_content( "page-content", null );
   set_content( "page-title", document.title );
   set_content( "page-subtitle", subtitle );
   load_content( "page-content", src );
   set_content( "page-title", document.title );
   set_content( "page-subtitle", subtitle );
   load_content( "page-content", src );