1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-07-03 10:32:50 +00:00
Mario Pietsch 8aa558eb2c
Remove module function wrapper and add matching configurations for dprint and eslint (#7596)
* remove blks first try

* dprint.json seems to be OK, some forgotten functions

* add some more space-after-keyword settings

* server remove blks

* add **/files to dprint exclude

* dprint.js fixes a typo

* add boot.js and bootprefix.js to dprint exclude

* dprint change dprint.json

* add dprint fmt as script

* remove jslint comments

* fix whitespace

* fix whitespace

* remove function-wrapper from geospatial plugin

* fix whitespace

* add function wrapper to dyannotate-startup

* remove dpring.json
2025-03-21 17:22:57 +00:00

62 lines
1.4 KiB
JavaScript

/*\
title: $:/core/modules/widgets/qualify.js
type: application/javascript
module-type: widget
Qualify text to a variable
\*/
"use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
var QualifyWidget = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
};
/*
Inherit from the base widget class
*/
QualifyWidget.prototype = new Widget();
/*
Render this widget into the DOM
*/
QualifyWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent;
this.computeAttributes();
this.execute();
this.renderChildren(parent,nextSibling);
};
/*
Compute the internal state of the widget
*/
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());
}
// Construct the child widgets
this.makeChildWidgets();
};
/*
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
*/
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;