Theme is now self-reliant
This commit is contained in:
parent
06968a57d2
commit
28b6bed925
@ -9,7 +9,8 @@ function Theme()
|
|||||||
{
|
{
|
||||||
this.load(localStorage.theme ? localStorage.theme : this.default);
|
this.load(localStorage.theme ? localStorage.theme : this.default);
|
||||||
document.head.appendChild(this.el)
|
document.head.appendChild(this.el)
|
||||||
window.addEventListener('drop', dotgrid.theme.drag);
|
window.addEventListener('dragover',this.drag_enter);
|
||||||
|
window.addEventListener('drop', this.drag);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.load = function(t)
|
this.load = function(t)
|
||||||
@ -41,11 +42,18 @@ function Theme()
|
|||||||
this.load(this.default);
|
this.load(this.default);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.drag_enter = function(e)
|
||||||
|
{
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
e.dataTransfer.dropEffect = 'copy';
|
||||||
|
}
|
||||||
|
|
||||||
this.drag = function(e)
|
this.drag = function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
var file = e.dataTransfer.files[0];
|
var file = e.dataTransfer.files[0];
|
||||||
|
|
||||||
if(!file.name || !file.name.indexOf(".thm") < 0){ console.log("Theme","Not a theme"); return; }
|
if(!file.name || !file.name.indexOf(".thm") < 0){ console.log("Theme","Not a theme"); return; }
|
||||||
|
Loading…
Reference in New Issue
Block a user