mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-10-02 17:00:45 +00:00
Bail out earlier when displaying a modal for a non-existent tiddler
This commit is contained in:
parent
ff0b93886b
commit
e034f28091
@ -27,10 +27,12 @@ Options include:
|
|||||||
Modal.prototype.display = function(title,options) {
|
Modal.prototype.display = function(title,options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var self = this,
|
var self = this,
|
||||||
duration = $tw.utils.getAnimationDuration();
|
duration = $tw.utils.getAnimationDuration(),
|
||||||
// Up the modal count and adjust the body class
|
tiddler = this.wiki.getTiddler(title);
|
||||||
this.modalCount++;
|
// Don't do anything if the tiddler doesn't exist
|
||||||
this.adjustPageClass();
|
if(!tiddler) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Create the wrapper divs
|
// Create the wrapper divs
|
||||||
var wrapper = document.createElement("div"),
|
var wrapper = document.createElement("div"),
|
||||||
modalBackdrop = document.createElement("div"),
|
modalBackdrop = document.createElement("div"),
|
||||||
@ -41,12 +43,10 @@ Modal.prototype.display = function(title,options) {
|
|||||||
modalLink = document.createElement("a"),
|
modalLink = document.createElement("a"),
|
||||||
modalFooter = document.createElement("div"),
|
modalFooter = document.createElement("div"),
|
||||||
modalFooterHelp = document.createElement("span"),
|
modalFooterHelp = document.createElement("span"),
|
||||||
modalFooterButtons = document.createElement("span"),
|
modalFooterButtons = document.createElement("span");
|
||||||
tiddler = this.wiki.getTiddler(title);
|
// Up the modal count and adjust the body class
|
||||||
// Don't do anything if the tiddler doesn't exist
|
this.modalCount++;
|
||||||
if(!tiddler) {
|
this.adjustPageClass();
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Add classes
|
// Add classes
|
||||||
$tw.utils.addClass(wrapper,"modal-wrapper");
|
$tw.utils.addClass(wrapper,"modal-wrapper");
|
||||||
$tw.utils.addClass(modalBackdrop,"modal-backdrop");
|
$tw.utils.addClass(modalBackdrop,"modal-backdrop");
|
||||||
|
Loading…
Reference in New Issue
Block a user