diff --git a/prestatic/basics.js b/prestatic/aesthetics.js similarity index 72% rename from prestatic/basics.js rename to prestatic/aesthetics.js index 7670617..410fcb5 100644 --- a/prestatic/basics.js +++ b/prestatic/aesthetics.js @@ -1,4 +1,15 @@ -function get_window_size() { +/* + To the extent possible under law, Niels Serup has waived all copyright and + related or neighboring rights to this file. This file is available under the + Creative Commons Zero 1.0 license, see + http://creativecommons.org/publicdomain/zero/1.0/ + + This JavaScript file contains trivial code. It is required for aesthetic + reasons only. Not loading it will not make a website depending on it less + functional. +*/ + +get_window_size = function() { if (window.innerHeight) return [window.innerHeight, window.innerWidth]; else if (self.innerHeight) @@ -8,17 +19,17 @@ function get_window_size() { document.documentElement.clientWidth]; else if (document.body) return [document.body.clientHeight, document.body.clientWidth]; -} +}; -function is_screen_media() { +is_screen_media = function() { return (document.getElementsByTagName('link')[0].getAttribute('media').indexOf( 'screen') != -1 || (document.styleSheets && (document.styleSheets[0].media.mediaText.indexOf( 'screen') != -1 || document.styleSheets[0].media.indexOf( 'screen') != -1))); -} +}; -function set_min_height() { +set_min_height = function() { if (!is_screen_media()) return; var ws, wh, ww, h @@ -34,7 +45,7 @@ function set_min_height() { h = wh - h - menudiv.offsetHeight - 145 bodydiv.style.minHeight = h + 'px' -} +}; window.addEventListener('load', function(event){ menudiv = document.getElementById('menu'); diff --git a/prestatic/extra.js b/prestatic/extra.js new file mode 100644 index 0000000..966ba7b --- /dev/null +++ b/prestatic/extra.js @@ -0,0 +1,42 @@ +/* + To the extent possible under law, Niels Serup has waived all copyright and + related or neighboring rights to this file. This file is available under the + Creative Commons Zero 1.0 license, see + http://creativecommons.org/publicdomain/zero/1.0/ + + This JavaScript file contains misc. code snippets designed to add extra + features to a website. Not loading it will not make a website depending on it + stop working. +*/ + +add_external_document_writing_script = function(url, elem) { + document.orig_write = document.write + var content = '' + document.write = function(msg) { + content += msg + '\n'; + } + + var done = function() { + document.write = document.orig_write; + elem.innerHTML = content; + } + + ns = document.createElement('script'); + ns.type = 'text/javascript'; + ns.src = url; + ns.onload = function() { + done(); + } + ns.onreadystatechange= function() { + if (this.readyState == 'complete') + done(); + } + document.body.appendChild(ns); +}; + +add_fsf_widget = function(associate_id) { + fsf_widget_size = 'normal'; + fsf_associate_id = associate_id + ''; + add_external_script('http://www.fsf.org/graphics/widget/global/widget.js', + document.getElementById('fsfextern')); +}; diff --git a/prestatic/screen.css b/prestatic/screen.css index 7647c20..a11d03d 100644 --- a/prestatic/screen.css +++ b/prestatic/screen.css @@ -1,15 +1,13 @@ -/*@preval +/*@prexec page_bg = '#e8efef' -*/ +@*/ * { margin: 0; padding: 0; } body { -/*@preval -print(' background-color: ' + page_bg + ';') -*/ + /*@preval 'background-color: ' + page_bg + ';\n'@*/ font-family: 'Dejavu Sans', 'Nimbus Sans', Helvetica, Arial, Verdana, sans-serif; font-size: 12px; color: #000; @@ -32,9 +30,7 @@ print(' background-color: ' + page_bg + ';') } #menulinks { -/*@preval -print(' background-color: ' + page_bg + ';') -*/ + /*@preval 'background-color: ' + page_bg + ';\n'@*/ display: inline-block; padding: 2px 0 2px 16px; font-size: 18px; @@ -100,10 +96,8 @@ print(' background-color: ' + page_bg + ';') padding-top: 14px; width: 750px; height: 91px; -/*@preval -print(' background: ' + page_bg + - " url('/static/metanohi-logo.png') no-repeat center;") -*/ + /*@preval 'background: ' + page_bg + \ + " url('/static/metanohi-logo.png') no-repeat center;\n"@*/ } a { diff --git a/prestatic/template.html b/prestatic/template.html index 79ad179..45d2448 100644 --- a/prestatic/template.html +++ b/prestatic/template.html @@ -8,8 +8,7 @@ xsi:schemaLocation='http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd'> - metanohi: <!--@eval -print(page.title, end='')--> + metanohi: <!--@eval page.title@--> - ' /> + - +""").format(x=x)@--> - + -
> - +
> +
- +