| @@ -33,8 +33,11 @@ $(function() { | |||||
| // Switch style immediately without reloading the page: | // Switch style immediately without reloading the page: | ||||
| $("#style-options form").submit(function() { | $("#style-options form").submit(function() { | ||||
| var style = $(this).find('input[type="submit"]').prop("value"); | |||||
| var style = $(this).find('input[type="submit"]').data("style"); | |||||
| var stylesheet = "/static/styles/" + style + ".css"; | var stylesheet = "/static/styles/" + style + ".css"; | ||||
| $("#user-style").prop("href", stylesheet); | $("#user-style").prop("href", stylesheet); | ||||
| $("#style-options .cur").removeClass("cur").find(":submit") | |||||
| .prop("disabled", false); | |||||
| $(this).addClass("cur").find(":submit").prop("disabled", true); | |||||
| }); | }); | ||||
| }); | }); | ||||
| @@ -15,15 +15,10 @@ | |||||
| stitle = style.title() | stitle = style.title() | ||||
| url = url_for('staticv', filename='images/style/{}.png'.format(style)) | url = url_for('staticv', filename='images/style/{}.png'.format(style)) | ||||
| %> | %> | ||||
| % if style == cur_style: | |||||
| <div class="cur"> | |||||
| <div style="background-image: url('${url}')">${stitle}</div> | |||||
| </div> | |||||
| % else: | |||||
| <form action="${url_for('set_style', style=style)}" method="post"> | |||||
| <input type="submit" title="${stitle}" value="${stitle}" style="background-image: url('${url}')"> | |||||
| </form> | |||||
| % endif | |||||
| <form action="${url_for('set_style', style=style)}" method="post"${' class="cur"' if style == cur_style else ''}> | |||||
| <input type="submit" title="${stitle}" value="${stitle}" data-style="${style}"${' disabled' if style == cur_style else ''} | |||||
| style="background-image: url('${url}')"> | |||||
| </form> | |||||
| % endfor | % endfor | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||