1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-27 18:40:28 +00:00
TiddlyWiki5/core/modules/utils/dom/modal.js

40 lines
831 B
JavaScript
Raw Normal View History

/*\
title: $:/core/modules/utils/dom/modal.js
type: application/javascript
module-type: utils
Modal message mechanism
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var Modal = function(wiki) {
this.wiki = wiki;
};
Modal.prototype.display = function(title) {
var wrapper = document.createElement("div"),
template,renderer;
template = "$:/templates/ModalMessage";
renderer = $tw.wiki.parseTiddler(template);
renderer.execute([],title);
renderer.renderInDom(wrapper);
$tw.wiki.addEventListener("",function(changes) {
renderer.refreshInDom(changes);
});
wrapper.addEventListener("tw-close",function(event) {
document.body.removeChild(wrapper);
2012-07-15 22:07:07 +00:00
event.stopPropagation();
return false;
},false);
document.body.appendChild(wrapper);
};
exports.Modal = Modal;
})();