[projects/pld-builder.new] move queue.html styles and script to standalone files
glen
glen at pld-linux.org
Sat Apr 20 17:56:48 CEST 2013
commit ed53f9817c83cf526e9e45d83472513f129d6d4b
Author: Elan Ruusamäe <glen at pld-linux.org>
Date: Sat Apr 20 18:55:48 2013 +0300
move queue.html styles and script to standalone files
PLD_Builder/request_handler_server.py | 107 ++++------------------------------
script.js | 20 +++++++
style.css | 69 ++++++++++++++++++++++
3 files changed, 101 insertions(+), 95 deletions(-)
---
diff --git a/PLD_Builder/request_handler_server.py b/PLD_Builder/request_handler_server.py
index 5c591f0..02220e9 100644
--- a/PLD_Builder/request_handler_server.py
+++ b/PLD_Builder/request_handler_server.py
@@ -53,116 +53,33 @@ class MyHandler(BaseHTTPRequestHandler):
pass
def write_css():
+ css_src = os.path.join(os.path.dirname(__file__), 'style.css')
css_file = path.www_dir + "/style.css"
# skip if file exists and code is not newer
- if os.path.exists(css_file) and os.stat(__file__).st_mtime < os.stat(css_file).st_mtime:
+ if os.path.exists(css_file) and os.stat(css_src).st_mtime < os.stat(css_file).st_mtime:
return
- # css from www.pld-linux.org wiki theme, using css usage firebug plugin to cleanup
- css = """
-html {
- background-color: white;
- color: #5e5e5e;
- font-family: Tahoma, Arial, Lucida Grande, sans-serif;
- font-size: 0.75em;
- line-height: 1.25em;
-}
-
-a {
- text-decoration: underline;
- color: #006;
-}
-
-a:hover {
- color: #006;
-}
-
-pre {
- background: #FFF8EB;
- border: 1pt solid #FFE2AB;
- font-family: courier, monospace;
- padding: 0.5em;
- white-space: pre-wrap;
- word-wrap: break-word;
-}
-
- at media screen, projection {
- html {
- background-color: #f3efe3;
- }
-
- body {
- position: relative;
- }
-
- div {
- background-color: white;
- margin: 10px 0px;
- padding: 2px;
- }
- div > a {
- font-weight: bold;
- color: #5e5e5e;
- }
- div > a:hover {
- color: #5e5e5e;
- }
- div.upgrade {
- background-color: #e4f1cf;
- }
- div:target {
- background-color: #ffffcc;
- color: black;
- }
-}
- at media print {
- a {
- background-color: inherit;
- color: inherit;
- }
-}
-
- at media projection {
- html { line-height: 1.8em; }
- body, b, a, p { font-size: 22pt; }
-}
-"""
old_umask = os.umask(0022)
+ r = open(css_src, 'r')
f = open(css_file, "w")
- f.write(css)
+ f.write(r.read())
f.close()
+ r.close()
os.umask(old_umask)
def write_js():
- js_file = path.www_dir + "/script.js"
+ js_src = os.path.join(os.path.dirname(__file__), 'script.js')
+ js_file = path.www_dir + '/script.js'
# skip if file exists and code is not newer
- if os.path.exists(js_file) and os.stat(__file__).st_mtime < os.stat(js_file).st_mtime:
+ if os.path.exists(js_file) and os.stat(js_src).st_mtime < os.stat(js_file).st_mtime:
return
- js = """
-// update date stamps to reflect viewers timezone
-function update_tz(t) {
- var el, off, dt,
- collection = document.getElementsByTagName('span');
- for (off in collection) {
- el = collection[off];
- if (el.id == 'tz') {
- dt = new Date(el.innerHTML).toString();
- // strip timezone name, it is usually wrong when not initialized
- // from TZ env, but reverse calculated from os data
- dt = dt.replace(/\s+\(.+\)/, "");
- // strip "GMT"
- dt = dt.replace(/GMT/, "");
- el.innerHTML = dt;
- }
- }
-}
-window.onload = update_tz;
-"""
old_umask = os.umask(0022)
- f = open(js_file, "w")
- f.write(js)
+ r = open(js_src, 'r')
+ f = open(js_file, 'w')
+ f.write(r.read())
f.close()
+ r.close()
os.umask(old_umask)
def main():
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..8c9c017
--- /dev/null
+++ b/script.js
@@ -0,0 +1,20 @@
+
+// update date stamps to reflect viewers timezone
+function update_tz(t) {
+ var el, off, dt,
+ collection = document.getElementsByTagName('span');
+ for (off in collection) {
+ el = collection[off];
+ if (el.id == 'tz') {
+ dt = new Date(el.innerHTML).toString();
+ // strip timezone name, it is usually wrong when not initialized
+ // from TZ env, but reverse calculated from os data
+ dt = dt.replace(/\s+\(.+\)/, "");
+ // strip "GMT"
+ dt = dt.replace(/GMT/, "");
+ el.innerHTML = dt;
+ }
+ }
+}
+
+window.onload = update_tz;
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..e0379a2
--- /dev/null
+++ b/style.css
@@ -0,0 +1,69 @@
+/*
+ * css from www.pld-linux.org (moinmoin) wiki theme, using css usage firebug plugin to cleanup
+ */
+html {
+ background-color: white;
+ color: #5e5e5e;
+ font-family: Tahoma, Arial, Lucida Grande, sans-serif;
+ font-size: 0.75em;
+ line-height: 1.25em;
+}
+
+a {
+ text-decoration: underline;
+ color: #006;
+}
+
+a:hover {
+ color: #006;
+}
+
+pre {
+ background: #FFF8EB;
+ border: 1pt solid #FFE2AB;
+ font-family: courier, monospace;
+ padding: 0.5em;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+}
+
+ at media screen, projection {
+ html {
+ background-color: #f3efe3;
+ }
+
+ body {
+ position: relative;
+ }
+
+ div {
+ background-color: white;
+ margin: 10px 0px;
+ padding: 2px;
+ }
+ div > a {
+ font-weight: bold;
+ color: #5e5e5e;
+ }
+ div > a:hover {
+ color: #5e5e5e;
+ }
+ div.upgrade {
+ background-color: #e4f1cf;
+ }
+ div:target {
+ background-color: #ffffcc;
+ color: black;
+ }
+}
+ at media print {
+ a {
+ background-color: inherit;
+ color: inherit;
+ }
+}
+
+ at media projection {
+ html { line-height: 1.8em; }
+ body, b, a, p { font-size: 22pt; }
+}
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/ed53f9817c83cf526e9e45d83472513f129d6d4b
More information about the pld-cvs-commit
mailing list