about summary refs log tree commit diff stats
path: root/js
diff options
context:
space:
mode:
authorCase Duckworth2015-03-02 21:10:36 -0700
committerCase Duckworth2015-03-02 21:10:36 -0700
commitd7aa1f175a09528e24bd56f719ea1403fc11a01f (patch)
treeb576072a401222236c62653e8e426ac09fe7ffb4 /js
parentFirst CSS styles: _common, verse, prose (diff)
downloadautocento-d7aa1f175a09528e24bd56f719ea1403fc11a01f.tar.gz
autocento-d7aa1f175a09528e24bd56f719ea1403fc11a01f.zip
Add random page (lozenge) functionality)
Diffstat (limited to 'js')
-rw-r--r--js/external.js5
-rw-r--r--js/lozenge.js150
2 files changed, 155 insertions, 0 deletions
diff --git a/js/external.js b/js/external.js new file mode 100644 index 0000000..ee425cd --- /dev/null +++ b/js/external.js
@@ -0,0 +1,5 @@
1/* External.js for Autocento of the breakfast table
2 * this gives external links the class "external."
3 */
4
5
diff --git a/js/lozenge.js b/js/lozenge.js new file mode 100644 index 0000000..0ba91e0 --- /dev/null +++ b/js/lozenge.js
@@ -0,0 +1,150 @@
1/* Lozenge.js for Autocento of the breakfast table
2 * Cause a#lozenge to link to random file in array
3 * TODO: manage to update array with filenames
4 * vim: fdm=marker
5 */
6
7function lozenge() {
8var lozenge = document.getElementById('lozenge');
9// array with all files {{{
10var files = [
11 '100-lines.html',
12 'about-the-author.html',
13 'amber-alert.html',
14 'and.html',
15 'angeltoabraham.html',
16 'apollo11.html',
17 'arspoetica.html',
18 'art.html',
19 'axe.html',
20 'big-dipper.html',
21 'boar.html',
22 'boy_bus.html',
23 'building.html',
24 'call-me-aural-pleasure.html',
25 'cereal.html',
26 'cold-wind.html',
27 'creation-myth.html',
28 'deadman.html',
29 'death-zone.html',
30 'deathstrumpet.html',
31 'dream.html',
32 'early.html',
33 'elegyforanalternateself.html',
34 'epigraph.html',
35 'ex-machina.html',
36 'exasperated.html',
37 'father.html',
38 'feedingtheraven.html',
39 'finding-the-lion.html',
40 'fire.html',
41 'found-typewriter-poem.html',
42 'hands.html',
43 'hard-game.html',
44 'hardware.html',
45 'howithappened.html',
46 'howtoread.html',
47 'hymnal.html',
48 'i-am.html',
49 'i-think-its-you.html',
50 'i-wanted-to-tell-you-something.html',
51 'in-bed.html',
52 'index.html',
53 'initial-conditions.html',
54 'ipsumlorem.html',
55 'january.html',
56 'joke.html',
57 'lappel-du-vide.html',
58 'largest-asteroid.html',
59 'last-bastion.html',
60 'last-passenger.html',
61 'leaf.html',
62 'leg.html',
63 'likingthings.html',
64 'listen.html',
65 'loremipsum.html',
66 'love-as-god.html',
67 'lovesong.html',
68 'man.html',
69 'moon-drowning.html',
70 'moongone.html',
71 'mountain.html',
72 'movingsideways.html',
73 'music-433.html',
74 'no-nothing.html',
75 'notes.html',
76 'nothing-is-ever-over.html',
77 'onformalpoetry.html',
78 'options.html',
79 'ouroboros_memory.html',
80 'paul.html',
81 'philosophy.html',
82 'phone.html',
83 'planks.html',
84 'plant.html',
85 'poetry-time.html',
86 'prelude.html',
87 'problems.html',
88 'proverbs.html',
89 'punch.html',
90 'purpose-dogs.html',
91 'question.html',
92 'real-writer.html',
93 'reports.html',
94 'riptide_memory.html',
95 'ronaldmcdonald.html',
96 'roughgloves.html',
97 'sapling.html',
98 'seasonal-affective-disorder.html',
99 'sense-of-it.html',
100 'serengeti.html',
101 'shed.html',
102 'shipwright.html',
103 'sixteenth-chapel.html',
104 'snow.html',
105 'something-simple.html',
106 'spittle.html',
107 'squirrel.html',
108 'stagnant.html',
109 'statements-frag.html',
110 'stayed-on-the-bus.html',
111 'stump.html',
112 'swansong-alt.html',
113 'swansong.html',
114 'swear.html',
115 'table_contents.html',
116 'tapestry.html',
117 'telemarketer.html',
118 'the-night-we-met.html',
119 'the-sea_the-beach.html',
120 'theoceanoverflowswithcamels.html',
121 'time-looks-up-to-the-sky.html',
122 'todaniel.html',
123 'toilet.html',
124 'toothpaste.html',
125 'treatise.html',
126 'underwear.html',
127 'wallpaper.html',
128 'weplayedthosegamestoo.html',
129 'when-im-sorry-i.html',
130 'window.html',
131 'words-meaning.html',
132 'worse-looking-over.html',
133 'writing.html',
134 'x-ray.html',
135 'yellow.html',
136] // }}}
137
138var index = Math.floor(Math.random() * files.length);
139
140var url = window.location.pathname;
141var current = url.substring(url.lastIndexOf('/')+1);
142
143if (current != files[index]) {
144 lozenge = lozenge.setAttribute("href", files[index]);
145}
146}
147
148window.onload = function () {
149 lozenge()
150};