mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-27 02:20:28 +00:00
40 lines
831 B
JavaScript
40 lines
831 B
JavaScript
/*\
|
|
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);
|
|
event.stopPropagation();
|
|
return false;
|
|
},false);
|
|
document.body.appendChild(wrapper);
|
|
};
|
|
|
|
exports.Modal = Modal;
|
|
|
|
})();
|