mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2026-03-11 17:21:56 -07:00
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
/*\
|
|
title: $:/core/modules/widgets/qualify.js
|
|
type: application/javascript
|
|
module-type: widget
|
|
\*/
|
|
|
|
"use strict";
|
|
|
|
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
|
|
|
var QualifyWidget = function(parseTreeNode,options) {
|
|
this.initialise(parseTreeNode,options);
|
|
};
|
|
|
|
QualifyWidget.prototype = new Widget();
|
|
|
|
QualifyWidget.prototype.render = function(parent,nextSibling) {
|
|
this.parentDomNode = parent;
|
|
this.computeAttributes();
|
|
this.execute();
|
|
this.renderChildren(parent,nextSibling);
|
|
};
|
|
|
|
QualifyWidget.prototype.execute = function() {
|
|
// Get our parameters
|
|
this.qualifyName = this.getAttribute("name");
|
|
this.qualifyTitle = this.getAttribute("title");
|
|
// Set context variable
|
|
if(this.qualifyName) {
|
|
this.setVariable(this.qualifyName,this.qualifyTitle + "-" + this.getStateQualifier());
|
|
}
|
|
|
|
this.makeChildWidgets();
|
|
};
|
|
|
|
QualifyWidget.prototype.refresh = function(changedTiddlers) {
|
|
var changedAttributes = this.computeAttributes();
|
|
if(changedAttributes.name || changedAttributes.title) {
|
|
this.refreshSelf();
|
|
return true;
|
|
} else {
|
|
return this.refreshChildren(changedTiddlers);
|
|
}
|
|
};
|
|
|
|
exports.qualify = QualifyWidget;
|