1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-10-29 22:53:00 +00:00

Add warning notification when viewing a document on a data: uri

The intent is to handhold the user through their first save+verification
This commit is contained in:
Jeremy Ruston
2012-07-15 17:37:03 +01:00
parent c9c26794af
commit 507460eb4e
4 changed files with 88 additions and 26 deletions

View File

@@ -0,0 +1,40 @@
/*\
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) {
console.log("Got tw-close event");
document.body.removeChild(wrapper);
event.stopPropogation();
return false;
},false);
document.body.appendChild(wrapper);
};
exports.Modal = Modal;
})();