hotfix/add_color - wip

This commit is contained in:
Ovidiu Alexandru Toma 2018-10-09 15:31:11 +03:00
parent a9fa98b62c
commit 18a4b4f428
3 changed files with 16 additions and 3 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View file

@ -8,7 +8,14 @@ var getTemplateHtml = template => {
})
.then(function(html) {
document.getElementById('iframe').contentWindow.document.write(html);
console.log(document.getElementById('iframe').contentWindow.document)
// console.log(document.getElementById('iframe').contentWindow.document)
var elements = document.getElementById('iframe').contentWindow.document.querySelectorAll("body *");
var numElements = elements.length;
var i;
for (i = 0; i < numElements; i++) {
elements[i].addEventListener("click", addColorTrigger);
}
});
}
@ -18,6 +25,12 @@ var valueChange = value => {
iframehtml.innerHTML = val
}
var addColorTrigger = (e) => {
console.log("click");
console.log(e.currentTarget);
}
var downloadPage = () => {
var pageContents = new XMLSerializer().serializeToString(document.getElementById('iframe').contentWindow.document)
pageContents = pageContents.replace("rep_DEVNAME", document.getElementById("devname").value)

View file

@ -22,11 +22,11 @@
<button class="themebtn" id="material" onclick="getTemplateHtml('material')">Material</button>
</div>
<!-- Colour inputs -->
<!-- <div id="themeclrs">
<div id="themeclrs">
<h2>Colours</h2>
<input type="color" class="themeclr" id="primary">
<input type="color" class="themeclr" id="secondary">
</div> -->
</div>
<div id="inputs">
<h2>Values</h2>
<label for="sitename">Site name</label>