• R/O
  • HTTP
  • SSH
  • HTTPS

website: Commit

HTML source code, style-sheets, scripts, and images for deployment on mingw.osdn.io


Commit MetaInfo

Revision003cc5a29d0cfabf8588b700a826b516d639a087 (tree)
Zeit2020-11-03 06:41:07
AutorKeith Marshall <keith@user...>
CommiterKeith Marshall

Log Message

Adapt index.html to serve arbitrarily specified content.

* index.html (onload): Delegate content retrieval to...
(load_page): ...this new javascript function, passing URL.
(page-title, page-subtitle): Rename place-holders, using...
(as-page-title, as-page-subtitle): ...these alternative names.

* site.js (load_page): New function; it consolidates...
(new_page, load_page_overlay, load_page_content): ...these, but
excluding "page-title" and "page-subtitle" assignment; do this...
(load_content): ...here, using repeated invocations of...
(update_page_content_header): ...this new function; it propagates any
"page-title" and "page-subtitle" values from the loaded page fragment,
to their corresponding "index.html" place-holders, calling...
(no_break): ...this new function, to substitute non-breaking hyphens
in place of any included ASCII hyphen characters.

* header.html (navbar): Use fully qualified "href" URL links on all
tabs, replacing "onclick" actions.

* about.html fdl.html terms.html (page-title, page-subtitle): Assign
them to hidden <dt> elements, (in <dl style="display: none"> blocks),
whence they may be propagated, via javascript executed on loading of
the page fragment, to their visible "index.html" place-holders.

* terms.html: Additionally, use a fully qualified "href" link, for
reference to "fdl.html".

* missing.html (page-title): Add hidden <dt> entry.

* site.css (dl.masthead): Define new style, to conceal the <dl>
assignments for "page-title", and "page-subtitle"; adjust top margin
spacing for any immediately following paragraph.

Ändern Zusammenfassung

Diff

--- a/about.html
+++ b/about.html
@@ -2,6 +2,9 @@
22 *
33 * about.html
44 *
5+ * Default landing page content for the MinGW.org web-site.
6+ *
7+ *
58 * $Id$
69 *
710 * Written by Keith Marshall <keith@users.osdn.me>
@@ -45,6 +48,16 @@
4548 * &#8221; right (closing) typographic double quote
4649 *
4750 -->
51+<dl class="masthead"><!-- hidden for masthead class -->
52+<!-- FIXME: is there a better way to do this? We need to propagate
53+ content to the "as-page-title" and "as-page-subtitle" place-holders,
54+ within the "page-content" div of "index.html"; our javascript page
55+ loader will explicitly look for these hidden elements, and copy
56+ their content into the corresponding visible place-holders.
57+-->
58+ <dt id="page-title">Welcome to MinGW.org</dt>
59+ <dt id="page-subtitle">Home of the MinGW and MSYS Projects</dt>
60+</dl><!-- masthead -->
4861 <p><strong>MinGW</strong>,
4962 a contraction of &#8220;Minimalist GNU for Windows&#8221;,
5063 is a minimalist development environment
--- a/fdl.html
+++ b/fdl.html
@@ -40,6 +40,16 @@
4040 * DAMAGE.
4141 *
4242 -->
43+<dl class="masthead"><!-- hidden for masthead class -->
44+<!-- FIXME: is there a better way to do this? We need to propagate
45+ content to the "as-page-title" and "as-page-subtitle" place-holders,
46+ within the "page-content" div of "index.html"; our javascript page
47+ loader will explicitly look for these hidden elements, and copy
48+ their content into the corresponding visible place-holders.
49+-->
50+ <dt id="page-title">MinGW.org Licensing</dt>
51+ <dt id="page-subtitle">The MinGW Free Documentation Licence</dt>
52+</dl><!-- masthead -->
4353 <p>Copyright &copy; 2020, MinGW.org Project
4454 </p>
4555 <p>Redistribution and use in source and 'compiled' forms (SGML, HTML,
--- a/header.html
+++ b/header.html
@@ -39,41 +39,16 @@
3939 * OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
4040 * DAMAGE.
4141 *
42- *
43- * Note: this page assumes browser support for the following numeric
44- * HTML entity codes:
45- *
46- * &#8209; non-breaking hyphen
47- * &#8217; typographic apostrophe
48- *
4942 -->
5043 <a href="index.html"><div id="logo"></div></a>
5144 <div class="text">
5245 <h1>Minimalist GNU for Windows</h1>
5346 <ul id="navbar">
54- <li><a href="index.html">Home</a></li>
55- <li><a onclick="load_page_overlay('download.html',
56- 'MinGW Downloads', 'MinGW.org File Release System')"
57- href="#"
58- >Downloads</a>
59- </li>
60- <li><a onclick="load_page_overlay('terms.html', 'MinGW Licensing',
61- 'Terms of Use for MinGW.org Products and Resources')"
62- href="#"
63- >Licensing</a>
64- </li>
65- <li><a onclick="load_page_overlay('docrefs.html',
66- 'MinGW Product Documentation',
67- 'Links to Documentation Resources for MinGW.org Products')"
68- href="#"
69- >Documentation</a>
70- </li>
71- <li><a onclick="load_page_overlay('contact.html',
72- 'Contacting MinGW.org',
73- 'When the Web&#8209;Site doesn&#8217;t Provide an Answer')"
74- href="#"
75- >Contact Us</a>
76- </li>
47+ <li><a href="index.html?page=about.html">Home</a></li>
48+ <li><a href="index.html?page=terms.html">Licensing</a></li>
49+ <li><a href="index.html?page=download.html">Downloads</a></li>
50+ <li><a href="index.html?page=docs.html">Documentation</a></li>
51+ <li><a href="index.html?page=contact.html">Contact Us</a></li>
7752 </ul>
7853 </div>
7954
--- a/index.html
+++ b/index.html
@@ -49,12 +49,12 @@
4949 <link rel="stylesheet" href="site.css" />
5050 <script src="site.js"></script>
5151 </head>
52- <body onload="new_page('about.html', 'Home of the MinGW and MSYS Projects')">
52+ <body onload="load_page(document.URL)">
5353 <div id="header"></div>
5454 <div class="page-view">
5555 <div class="masthead">
56- <h1 id="page-title"></h1>
57- <h2 id="page-subtitle"></h2>
56+ <h1 id="as-page-title"></h1>
57+ <h2 id="as-page-subtitle"></h2>
5858 </div><!-- masthead --><hr />
5959 <div id="page-content"></div>
6060 </div><!-- page-view -->
--- a/missing.html
+++ b/missing.html
@@ -47,6 +47,15 @@
4747 * &#8217; typographic apostrophe
4848 *
4949 -->
50+<dl class="masthead"><!-- hidden for masthead class -->
51+<!-- FIXME: is there a better way to do this? We need to propagate
52+ content to the "as-page-title" and "as-page-subtitle" place-holders,
53+ within the "page-content" div of "index.html"; our javascript page
54+ loader will explicitly look for these hidden elements, and copy
55+ their content into the corresponding visible place-holders.
56+-->
57+ <dt id="page-title">MinGW.org Server Error</dt>
58+</dl><!-- masthead -->
5059 <h2>Page Not Found</h2>
5160 <p>The MinGW.org web&#8209;site is undergoing an overhaul,
5261 whilst in the process of transferring to a new hosting provider.
--- a/site.css
+++ b/site.css
@@ -212,6 +212,23 @@ p+ul
212212 */
213213 margin: 0; padding-top: 1px; font-weight: normal;
214214 }
215+dl.masthead
216+{ /* On page overlays, we use a definition list to specify the
217+ * page title, and subtitle, which are to be propagated to the
218+ * masthead section within the page content; the content of the
219+ * definition list, itself, should not be directly visible.
220+ */
221+ display: none;
222+}
223+dl.masthead+p
224+{ /* The masthead section is separated from the remaining page
225+ * content, by a horizontal rule; to keep white space balanced,
226+ * above and below this rule, when it is immediately followed
227+ * by a paragraph, with no intervening heading, we need to
228+ * explicitly adjust the paragraph margin.
229+ */
230+ margin-top: 1.3em;
231+}
215232
216233 /* Supplementary formatting for sections with numbered headings
217234 * ============================================================
--- a/site.js
+++ b/site.js
@@ -39,6 +39,25 @@ function set_content( item, value )
3939 if( element ) element.innerHTML = value;
4040 }
4141
42+function no_break( text )
43+{ /* Helper function to replace all occurrences of ASCII hyphen-minus,
44+ * within "text", by substitution of HTML non-breaking hyphen.
45+ */
46+ return text.replace( /-/g, "&#8209;" );
47+}
48+
49+function update_page_content_header( tag )
50+{ /* Update the "page-title" and "page-subtitle" content-header text,
51+ * by substitution into the "as-page-title" and "as-page-subtitle"
52+ * place-holder elements, respectively.
53+ */
54+ var element = document.getElementById( "page-".concat( tag ));
55+ if( element )
56+ { if( tag == "title" ) document.title = element.innerHTML;
57+ set_content( "as-page-".concat( tag ), no_break( element.innerHTML ));
58+ }
59+}
60+
4261 function load_content( container, src )
4362 { /* Set the content of the specified HTML "container" element, by
4463 * injection of the entire contents of an external file which is
@@ -51,6 +70,8 @@ function load_content( container, src )
5170 switch( this.status )
5271 { case 200:
5372 set_content( container, this.responseText );
73+ update_page_content_header( "title" );
74+ update_page_content_header( "subtitle" );
5475 break;
5576 case 404:
5677 load_content( container, "missing.html" );
@@ -60,34 +81,19 @@ function load_content( container, src )
6081 request_handler.send();
6182 }
6283
63-function load_page_content( src, subtitle )
64-{ /* Propagate the HTML document title to the "masthead" display,
65- * update the displayed page subtitle, (which may be null), and
66- * load the page content from the specified "src" file.
67- */
68- set_content( "page-content", null );
69- set_content( "page-title", document.title );
70- set_content( "page-subtitle", subtitle );
71- load_content( "page-content", src );
72-}
73-
74-function load_page_overlay( src, title, subtitle )
75-{ /* Replace the existing page content from the specified overlay
76- * "src" file, updating the page title, and subtitle, as may be
77- * appropriate.
78- */
79- if( title ) document.title = title;
80- load_page_content( src, subtitle );
81-}
82-
83-function new_page( src, subtitle )
84-{ /* Create a new page display, starting from scratch; assign the
85- * displayed title from the HTML document title attribute, adding
86- * the specified subtitle, lay out the standard page header block,
87- * and load the page content from the "src" file.
84+function load_page( src )
85+{ /* Load page content from the HTML fragment file, as determined
86+ * from the specified "src" URL; if no alternative fragment name
87+ * is specified, fall back to loading "about.html".
8888 */
89+ const ref = "?page=";
90+ const div = "page-content";
91+ set_content( div, null );
8992 load_content( "header", "header.html" );
90- load_page_content( src, subtitle );
93+ if( src.includes( ref ) )
94+ src = src.substring( src.indexOf( ref ) + ref.length, src.length );
95+ else src = "about.html";
96+ load_content( div, src );
9197 }
9298
9399 /* $RCSfile$: end of file */
--- a/terms.html
+++ b/terms.html
@@ -49,6 +49,16 @@
4949 * &#8221; right (closing) typographic double quote
5050 *
5151 -->
52+<dl class="masthead"><!-- hidden for masthead class -->
53+<!-- FIXME: is there a better way to do this? We need to propagate
54+ content to the "as-page-title" and "as-page-subtitle" place-holders,
55+ within the "page-content" div of "index.html"; our javascript page
56+ loader will explicitly look for these hidden elements, and copy
57+ their content into the corresponding visible place-holders.
58+-->
59+ <dt id="page-title">MinGW.org Licensing</dt>
60+ <dt id="page-subtitle">Terms of Use for MinGW.org Products and Resources</dt>
61+</dl><!-- masthead -->
5262 <div class="h3-numbered">
5363 <p>Each of the various packages,
5464 which are distributed by MinGW.org,
@@ -60,9 +70,7 @@ are as follows:&mdash;
6070 <h3>MinGW.org Web&#8209;Site Content</h3>
6171 <p>Publication of the content of this MinGW.org web&#8209;site is
6272 subject to the terms of
63-<a href="#"
64-onclick="load_page_content('fdl.html','The MinGW Free Documentation Licence')"
65->this MinGW specific adaptation</a>
73+<a href="index.html?page=fdl.html">this MinGW specific adaptation</a>
6674 of the
6775 <a rel="noopener noreferrer" target="_blank"
6876 href="https://www.freebsd.org/copyright/freebsd-doc-license.html"
Show on old repository browser