diff --git a/pages/settings.mako b/pages/settings.mako index 23e33c5..aa6ea8c 100644 --- a/pages/settings.mako +++ b/pages/settings.mako @@ -40,9 +40,27 @@ .org - - Background: - + <% + background_options = [ + ("plain-brown", "Use a plain tiled background (brown version)."), + ("plain-blue", "Use a plain tiled background (blue version)."), + ("potd", 'Use the current Wikimedia Commons Picture of the Day, unfiltered. Certain POTDs may be unsuitable as backgrounds due to their aspect ratio or subject matter (generally portraits do not work well).'), + ("list", 'Randomly select from a subset of previous Commons Pictures of the Day that work well as widescreen backgrounds, refreshed daily (default).'), + ] + selected = cookies["EarwigBackground"].value if "EarwigBackground" in cookies else None + %> + % for i, (value, desc) in enumerate(background_options): + + % if i == 0: + Background: + % else: +   + % endif + + ${desc} + + + % endfor diff --git a/pages/support/footer.mako b/pages/support/footer.mako index 5add092..2caa50c 100644 --- a/pages/support/footer.mako +++ b/pages/support/footer.mako @@ -31,4 +31,4 @@ - + \ No newline at end of file diff --git a/pages/support/header.mako b/pages/support/header.mako index cb94f53..1d810cc 100644 --- a/pages/support/header.mako +++ b/pages/support/header.mako @@ -31,8 +31,8 @@ % if "EarwigBackground" in cookies: % if cookies["EarwigBackground"].value == "list": - % elif cookies["EarwigBackground"].value == "plain": - + % elif cookies["EarwigBackground"].value in ["plain-brown", "plain-blue"]: + % else % endif diff --git a/static/images/earwig-button.png b/static/images/earwig-button.png index 6eb786a..3c5c406 100644 Binary files a/static/images/earwig-button.png and b/static/images/earwig-button.png differ diff --git a/static/js/potd.js b/static/js/potd.js index 8276179..24e2770 100644 --- a/static/js/potd.js +++ b/static/js/potd.js @@ -87,7 +87,7 @@ function parse_list_file_name(data) { } var filenames = []; - while ((match = /\*\s*\[\[File:(.*?)\]\]/g.exec(content)) !== null) { + while ((match = /\*\s*\[\[:File:(.*?)\]\]/g.exec(content)) !== null) { filenames.push(match[1]); } var filename = filenames[Math.floor(Math.random() * filenames.length)]; diff --git a/toolserver/settings.py b/toolserver/settings.py index 22edf4e..fd7eb59 100644 --- a/toolserver/settings.py +++ b/toolserver/settings.py @@ -32,8 +32,13 @@ def _do_set(query, headers, cookies): if key not in cookies or cookies[key].value != query.project: set_cookie(headers, cookies, key, query.project, 365) changes.add("site") + if query.background: + key = "EarwigBackground" + if key not in cookies or cookies[key].value != query.background: + set_cookie(headers, cookies, key, query.background, 365) + changes.add("background") if changes: - changes = ", ".format(changes) + changes = ", ".format(sorted(list(changes))) return "Updated {0}.".format(changes) return None