From 3c708d9194ba09721736ae3e6bb885bdca8df43c Mon Sep 17 00:00:00 2001 From: nitishkmrk Date: Thu, 24 Aug 2017 13:05:31 +0530 Subject: [PATCH] Fixed Top Frame Navigation Bug --- bower.json | 2 +- scripts/script.js | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 5975001..8b5e920 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "coolhue", - "version": "1.4.0", + "version": "1.4.1", "homepage": "https://webkul.github.io/coolhue/", "authors": [ "Nitish Kumar " diff --git a/scripts/script.js b/scripts/script.js index 49a41a3..affa29e 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -27,12 +27,12 @@ document.addEventListener("DOMContentLoaded", function () { nodeGradient.style.backgroundImage = tempImage; var nodeActions = document.createElement("div"); nodeActions.classList.add("ch-actions"); - var nodeCode = document.createElement("span"); + var nodeCode = document.createElement("a"); nodeCode.classList.add("ch-code"); nodeCode.dataset.colorFrom = tempColorFrom; nodeCode.dataset.colorTo = tempColorTo; - var nodeGrab = document.createElement("span"); + var nodeGrab = document.createElement("a"); nodeGrab.classList.add("ch-grab"); nodeGrab.dataset.colorFrom = tempColorFrom; nodeGrab.dataset.colorTo = tempColorTo; @@ -121,7 +121,10 @@ document.addEventListener("DOMContentLoaded", function () { tempGradient.addColorStop(1, eventColorTo); ctx.fillStyle = tempGradient; ctx.fillRect(0, 0, 500, 500); - window.open(canvas.toDataURL()); + var dataURL = canvas.toDataURL(); + event.target.href = dataURL; + var fileName = "coolHue-" + eventColorFrom.slice(1, 7) + "-" + eventColorTo.slice(1, 7); + event.target.setAttribute("download", fileName); } }