Improved.

This commit is contained in:
Niels Serup 2011-07-08 15:32:28 +02:00
parent 1cc837afc7
commit 6997e7368a
9 changed files with 134 additions and 30 deletions

View File

@ -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) if (window.innerHeight)
return [window.innerHeight, window.innerWidth]; return [window.innerHeight, window.innerWidth];
else if (self.innerHeight) else if (self.innerHeight)
@ -8,17 +19,17 @@ function get_window_size() {
document.documentElement.clientWidth]; document.documentElement.clientWidth];
else if (document.body) else if (document.body)
return [document.body.clientHeight, document.body.clientWidth]; return [document.body.clientHeight, document.body.clientWidth];
} };
function is_screen_media() { is_screen_media = function() {
return (document.getElementsByTagName('link')[0].getAttribute('media').indexOf( return (document.getElementsByTagName('link')[0].getAttribute('media').indexOf(
'screen') != -1 || (document.styleSheets && 'screen') != -1 || (document.styleSheets &&
(document.styleSheets[0].media.mediaText.indexOf( (document.styleSheets[0].media.mediaText.indexOf(
'screen') != -1 || document.styleSheets[0].media.indexOf( 'screen') != -1 || document.styleSheets[0].media.indexOf(
'screen') != -1))); 'screen') != -1)));
} };
function set_min_height() { set_min_height = function() {
if (!is_screen_media()) if (!is_screen_media())
return; return;
var ws, wh, ww, h var ws, wh, ww, h
@ -34,7 +45,7 @@ function set_min_height() {
h = wh - h - menudiv.offsetHeight - 145 h = wh - h - menudiv.offsetHeight - 145
bodydiv.style.minHeight = h + 'px' bodydiv.style.minHeight = h + 'px'
} };
window.addEventListener('load', function(event){ window.addEventListener('load', function(event){
menudiv = document.getElementById('menu'); menudiv = document.getElementById('menu');

42
prestatic/extra.js Normal file
View File

@ -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'));
};

View File

@ -1,15 +1,13 @@
/*@preval /*@prexec
page_bg = '#e8efef' page_bg = '#e8efef'
*/ @*/
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
body { body {
/*@preval /*@preval 'background-color: ' + page_bg + ';\n'@*/
print(' background-color: ' + page_bg + ';')
*/
font-family: 'Dejavu Sans', 'Nimbus Sans', Helvetica, Arial, Verdana, sans-serif; font-family: 'Dejavu Sans', 'Nimbus Sans', Helvetica, Arial, Verdana, sans-serif;
font-size: 12px; font-size: 12px;
color: #000; color: #000;
@ -32,9 +30,7 @@ print(' background-color: ' + page_bg + ';')
} }
#menulinks { #menulinks {
/*@preval /*@preval 'background-color: ' + page_bg + ';\n'@*/
print(' background-color: ' + page_bg + ';')
*/
display: inline-block; display: inline-block;
padding: 2px 0 2px 16px; padding: 2px 0 2px 16px;
font-size: 18px; font-size: 18px;
@ -100,10 +96,8 @@ print(' background-color: ' + page_bg + ';')
padding-top: 14px; padding-top: 14px;
width: 750px; width: 750px;
height: 91px; height: 91px;
/*@preval /*@preval 'background: ' + page_bg + \
print(' background: ' + page_bg + " url('/static/metanohi-logo.png') no-repeat center;\n"@*/
" url('/static/metanohi-logo.png') no-repeat center;")
*/
} }
a { a {

View File

@ -8,8 +8,7 @@
xsi:schemaLocation='http://www.w3.org/1999/xhtml xsi:schemaLocation='http://www.w3.org/1999/xhtml
http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd'> http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd'>
<head> <head>
<title>metanohi: <!--@eval <title>metanohi: <!--@eval page.title@--></title>
print(page.title, end='')--></title>
<meta name='author' content='Niels Serup' /> <meta name='author' content='Niels Serup' />
<meta name='description' <meta name='description'
content='This is the personal website of Niels Serup. It hosts content='This is the personal website of Niels Serup. It hosts
@ -35,15 +34,15 @@ print(page.title, end='')--></title>
<meta name='DCTERMS.modified' content='{modified}' /> <meta name='DCTERMS.modified' content='{modified}' />
<meta name='DCTERMS.language' content='en' /> <meta name='DCTERMS.language' content='en' />
<meta name='DCTERMS.isPartOf' content='http://metanohi.org/' /> <meta name='DCTERMS.isPartOf' content='http://metanohi.org/' />
<meta name='DCTERMS.isVersionOf' content='<!--@eval print(page.core_url, end='')-->' /> <meta name='DCTERMS.isVersionOf' content='<!--@eval page.core_url@-->' />
<meta name='DCTERMS.audience' content='software developers' /> <meta name='DCTERMS.audience' content='software developers' />
<meta name='DCTERMS.audience' content='hackers' /> <meta name='DCTERMS.audience' content='hackers' />
<meta name='DCTERMS.audience' content='individuals' /> <meta name='DCTERMS.audience' content='individuals' />
<!--@eval <!--@exec
if page.licenses: if page.licenses:
for x in page.licenses: for x in page.licenses:
print("""<link rel='copyright' href='{x.url}' /> print("""<link rel='copyright' href='{x.url}' />
<meta name='DCTERMS.license' content='{x.url}' />""").format(x=x)--> <meta name='DCTERMS.license' content='{x.url}' />""").format(x=x)@-->
<meta name='robots' content='ALL' /> <meta name='robots' content='ALL' />
<link rel='icon' type='image/png' href='/favicon.png' /> <link rel='icon' type='image/png' href='/favicon.png' />
<!-- <!--
@ -51,21 +50,21 @@ if page.licenses:
it for aesthetic reasons only. Not loading it will not make this website it for aesthetic reasons only. Not loading it will not make this website
less functional. less functional.
--> -->
<script type='text/javascript' src='/static/basics.js'></script> <script type='text/javascript' src='/static/aesthetics.js'></script>
</head> </head>
<body> <body>
<a id='minilogo' href='/'></a> <a id='minilogo' href='/'></a>
<div id='menu'> <div id='menu'>
<ul id='menulinks'> <ul id='menulinks'>
<!--@preval <!--@prexec
for x in('projects', 'writings', 'films', 'about'): for x in('projects', 'writings', 'films', 'about'):
print(' ' * 14 + "<li><a href='/{x}/'>{x}</a></li>".format(x=x))--> print(' ' * 14 + "<li><a href='/{x}/'>{x}</a></li>".format(x=x))@-->
</ul> </ul>
</div> </div>
<div id='body'<!--@eval if page.fullpage: print(" class='full'", end='')-->> <div id='body'<!--@exec if page.fullpage: print(" class='full'", end='')@-->>
<!--@eval print(page.body)--> <!--@eval page.body@-->
<div id='metadata'> <div id='metadata'>
<!--@eval print(page.metadata_info)--> <!--@eval page.metadata_info@-->
</div> </div>
</div> </div>
<div id='logo'> <div id='logo'>

View File

@ -2,7 +2,7 @@ wsgi nohi.wsgi
title metanohi title metanohi
url http://metanohi.org/ url http://metanohi.org/
description 'This feed contains the newest pages on metanohi description 'This feed contains the newest pages on metanohi'
author Niels\ Serup author Niels\ Serup
email ns@metanohi.org email ns@metanohi.org
aboutauthorurl http://metanohi.org/about/niels/ aboutauthorurl http://metanohi.org/about/niels/

View File

@ -1,4 +1,45 @@
#+title: Home #+title: Home
#+startup: showall
#++load
#+BEGIN_SRC javascript
window.addEventListener('load', function(event){add_fsf_widget(8085);});
#+END_SRC
* This is metanohi * This is metanohi
#++show
#+BEGIN_SRC html
<p style='margin: 0 auto; width: 400px'>
<a href="http://windows7sins.org/"
style='display: block; float: left'>
<img src="http://windows7sins.org/i/widget.png"
alt="Windows 7 Sins" style='width: 200px; height: 200px' />
</a>
<a href="http://www.fsf.org/campaigns/opendocument/"
style='display: block; float: left'>
<img src="http://static.fsf.org/nosvn/opendocument/medium/odf.png"
alt="Use ODF!" style='width: 200px; height: 200px' />
</a>
</p>
<p style='background-color: #ff0000; padding: 10px; display: block;
width: 380px; margin: 0 auto 10px auto' class='large'>
<a href='http://petition.stopsoftwarepatents.eu/' class='center'>
STOP SOFTWARE PATENTS
</a>
</p>
<p class='center'>
<a href="http://www.fsf.org/facebook/mark-zuckerberg-is-time-magazines-person-of-the-year-wheres-the-dislike-button/">
<img src="http://static.fsf.org/nosvn/dislike200.png"
alt="Don't use Facebook!" title="Don't use Facebook!" style='width: 200px; height: 105px' />
</a>
<a
href="http://wikimediafoundation.org/wiki/Support_Wikipedia/en"><img
border="0" alt="Support Wikipedia" title="Support Wikipedia"
src="http://upload.wikimedia.org/wikipedia/commons/4/4b/Fundraising_2009-square-treasure-en.png" /></a>
</p>
<div style='margin: 0 auto; width: 260px' id='fsfextern'></div>
#+END_SRC

3
sitespecial/listdir.org Normal file
View File

@ -0,0 +1,3 @@
#+title: Directory listing: <@eval page.core_url>
<@eval page.dirlist>

7
sitespecial/notfound.org Normal file
View File

@ -0,0 +1,7 @@
#+title: Error: Page not found
The page <@exec print(repr(page.core_url))> does not exist. The error was:
#\block
<@eval page.error>
#@

View File

@ -0,0 +1,7 @@
#+title: Server error
There was an error, most likely due to sloppy programming:
#\block
<@eval page.error>
#@