Added javascript screenshot generator
authorLuciano Montanaro <mikelima@cirulla.net>
Wed, 29 Jun 2011 23:07:43 +0000 (01:07 +0200)
committerLuciano Montanaro <mikelima@cirulla.net>
Wed, 29 Jun 2011 23:07:43 +0000 (01:07 +0200)
Forgot to add in latest commit

www/screenshot-generator.js [new file with mode: 0644]

diff --git a/www/screenshot-generator.js b/www/screenshot-generator.js
new file mode 100644 (file)
index 0000000..e647660
--- /dev/null
@@ -0,0 +1,34 @@
+var screenshots = {
+       "screenshot-stationlist.png" : "The Station List View",
+       "screenshot-stationview.png" : "The Station Departures View",
+};
+
+function generate_div(value, index, array)
+{
+       var screenshots = document.getElementById('screenshot-list');
+       var screenshotDiv = document.createElement('div');
+       screenshotDiv.setAttribute('class', 'screenshot');
+       
+       var p1Element = document.createElement('div');
+       var p2Element = p1Element.cloneNode(true);
+       
+       var imgElement = document.createElement('img');
+       imgElement.setAttribute('src', index);
+
+       var captionElement = document.createTextNode(value);
+
+       p1Element.appendChild(imgElement);
+       p2Element.appendChild(captionElement);
+
+       screenshotDiv.appendChild(p1Element);
+       screenshotDiv.appendChild(p2Element);
+       screenshots.appendChild(screenshotDiv);
+}
+
+function build_screenshot_list()
+{
+       for (var key in screenshots)
+               generate_div(screenshots[key], key, screenshots);
+}
+
+window.addEventListener('load', build_screenshot_list);