mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Refactor hex colour preview Javascript
This commit improves the code that previews a hex colour when setting up or changing an email branding. Specifically it: - refactors the Javascript to conform to our patterns (module pattern, preprocessed with Gulp) - makes the code work when there are multiple colour previews on one page It also does some visual prettifying, because I couldn’t help myself…
This commit is contained in:
@@ -34,15 +34,5 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
function update_colour(element){
|
||||
colour_preview = document.getElementsByClassName("textbox-colour-preview")[0];
|
||||
if (element.value.match(/^#[0-9A-F]{6}$/i)) {
|
||||
colour_preview.style.background = element.value;
|
||||
} else {
|
||||
colour_preview.style.background = '#FFFFFF';
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user