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

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'
*/
@*/
* {
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 {

View File

@ -8,8 +8,7 @@
xsi:schemaLocation='http://www.w3.org/1999/xhtml
http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd'>
<head>
<title>metanohi: <!--@eval
print(page.title, end='')--></title>
<title>metanohi: <!--@eval page.title@--></title>
<meta name='author' content='Niels Serup' />
<meta name='description'
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.language' content='en' />
<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='hackers' />
<meta name='DCTERMS.audience' content='individuals' />
<!--@eval
<!--@exec
if page.licenses:
for x in page.licenses:
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' />
<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
less functional.
-->
<script type='text/javascript' src='/static/basics.js'></script>
<script type='text/javascript' src='/static/aesthetics.js'></script>
</head>
<body>
<a id='minilogo' href='/'></a>
<div id='menu'>
<ul id='menulinks'>
<!--@preval
<!--@prexec
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>
</div>
<div id='body'<!--@eval if page.fullpage: print(" class='full'", end='')-->>
<!--@eval print(page.body)-->
<div id='body'<!--@exec if page.fullpage: print(" class='full'", end='')@-->>
<!--@eval page.body@-->
<div id='metadata'>
<!--@eval print(page.metadata_info)-->
<!--@eval page.metadata_info@-->
</div>
</div>
<div id='logo'>

View File

@ -2,7 +2,7 @@ wsgi nohi.wsgi
title metanohi
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
email ns@metanohi.org
aboutauthorurl http://metanohi.org/about/niels/

View File

@ -1,4 +1,45 @@
#+title: Home
#+startup: showall
#++load
#+BEGIN_SRC javascript
window.addEventListener('load', function(event){add_fsf_widget(8085);});
#+END_SRC
* 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>
#@