Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 13
- Log:
Initial import of Typo 2.6.0 sources from a downloaded Tarball.
Typo is a Ruby On Rails based blog engine.
- Author:
- adh
- Date:
- Sat Jul 22 22:25:02 +0100 2006
- Size:
- 2665 Bytes
1 | function register_onload(func) { |
2 | var old_event = window.onload; |
3 | if (typeof window.onload != 'function') { window.onload = func; } |
4 | else { window.onload = function() { old_event(); func(); }; } |
5 | } |
6 | |
7 | function show_dates_as_local_time() { |
8 | var spans = document.getElementsByTagName('span'); |
9 | for (var i=0; i<spans.length; i++) { |
10 | if (spans[i].className.match(/\btypo_date\b/i)) { |
11 | spans[i].innerHTML = get_local_time_for_date(spans[i].title); |
12 | } |
13 | } |
14 | } |
15 | |
16 | function get_local_time_for_date(time) { |
17 | system_date = new Date(time); |
18 | user_date = new Date(); |
19 | delta_minutes = Math.floor((user_date - system_date) / (60 * 1000)); |
20 | if (Math.abs(delta_minutes) <= (8*7*24*60)) { // eight weeks... I'm lazy to count days for longer than that |
21 | distance = distance_of_time_in_words(delta_minutes); |
22 | if (delta_minutes < 0) { |
23 | return distance + ' from now'; |
24 | } else { |
25 | return distance + ' ago'; |
26 | } |
27 | } else { |
28 | return 'on ' + system_date.toLocaleDateString(); |
29 | } |
30 | } |
31 | |
32 | // a vague copy of rails' inbuilt function, |
33 | // but a bit more friendly with the hours. |
34 | function distance_of_time_in_words(minutes) { |
35 | if (minutes.isNaN) return ""; |
36 | minutes = Math.abs(minutes); |
37 | if (minutes < 1) return ('less than a minute'); |
38 | if (minutes < 50) return (minutes + ' minute' + (minutes == 1 ? '' : 's')); |
39 | if (minutes < 90) return ('about one hour'); |
40 | if (minutes < 1080) return (Math.round(minutes / 60) + ' hours'); |
41 | if (minutes < 1440) return ('one day'); |
42 | if (minutes < 2880) return ('about one day'); |
43 | else return (Math.round(minutes / 1440) + ' days') |
44 | } |
45 | |
46 | function commentAdded(request) { |
47 | new Effect.BlindDown($('commentList').lastChild); |
48 | $('commentform').elements[3].value = ''; |
49 | $('commentform').elements[3].focus(); |
50 | } |
51 | |
52 | function failure(request) { |
53 | $('errors').innerHTML = request.responseText; |
54 | new Effect.Highlight('errors'); |
55 | } |
56 | |
57 | function loading() { |
58 | $('form-submit-button').disabled = true; |
59 | Element.show('comment_loading'); |
60 | } |
61 | |
62 | function complete(request) { |
63 | Element.hide('comment_loading'); |
64 | Element.show('commentform'); |
65 | $('form-submit-button').disabled = false; |
66 | |
67 | if (request.status == 200) { commentAdded() }; |
68 | } |
69 | |
70 | register_onload(function() { |
71 | if ($('commentform')) { |
72 | $('commentform').elements['comment[author]'].value = getCookie('author'); |
73 | $('commentform').elements['comment[url]'].value = getCookie('url'); |
74 | |
75 | if ($('commentform').elements['comment[url]'].value != '' |
76 | || $('commentform').elements['comment[email]'].value != '') { |
77 | Element.show('guest_url'); Element.show('guest_email'); |
78 | } |
79 | } |
80 | }) |
81 | register_onload(function() { if ($('q')) {$('q').setAttribute('autocomplete', 'off');} }) |