freifunkmanager/js/popup.js

35 lines
782 B
JavaScript
Raw Normal View History

2016-07-02 02:11:17 +02:00
define(function(){
return function(el,controller){
var main = document.createElement("div"),
text = document.createElement("span"),
link = document.createElement("a");
main.classList.add("popup");
main.classList.add("hidden");
main.appendChild(text);
link.textContent = "Edit";
main.appendChild(link);
el.appendChild(main);
var timer;
return {
storageNotifyNew: function(key,data){
main.classList.remove("hidden");
text.textContent = "New Node '"+key+"'!";
window.clearTimeout(timer);
timer = window.setTimeout(function(){
main.classList.add("hidden");
}, 5000);
link.onclick = function(){
window.location.href = "#map/"+key;
controller.render(key);
main.classList.add("hidden");
};
}
};
};
});