Verified Commit 3d2dc2b8 authored by Thibaut Broggi's avatar Thibaut Broggi
Browse files

Update canvas depending on URL params

parent f12cfe3a
Pipeline #1358 passed with stage
in 36 seconds
......@@ -128,10 +128,32 @@ for (let i = 0; i < navButtons.length; ++i) {
}
window.onload = function() {
draw();
// Display correct tab
let hash = window.location.hash || '#step1';
document.querySelector('nav > a[href="#step3"]').click();
document.querySelector('nav > a[href="' + hash + '"]').click();
// Update inputs depending on URL params
let splitParams = window.location.search.split('?')[1].split('&');
let params = {};
for (let i in splitParams) {
params[splitParams[i].split('=')[0]] = decodeURIComponent(splitParams[i].split('=')[1]);
}
if (params['bg-color'])
document.querySelector('.colorpicker input[name="bg-color"][value="' + params['bg-color'] + '"]').checked = true;
if (params['fg-color'])
document.querySelector('.colorpicker input[name="fg-color"][value="' + params['fg-color'] + '"]').checked = true;
if (params['text'])
document.getElementById('step2value').value = document.getElementById('step2value').innerText = params['text'];
if (params['font'])
document.querySelector('input[name="font"][value="' + params['font'] + '"]').checked = true;
if (params['icon'])
document.querySelector('input[name="icon"][value="' + params['icon'] + '"]').checked = true;
if (params['signature'])
document.getElementById('signature').value = params['signature'];
// Update canvas
draw();
}
let randomElement = function(selector) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment