Notes/docs/frontend_api/BasicWidget.html

1077 lines
12 KiB
HTML
Raw Permalink Normal View History

2023-08-21 04:17:16 -04:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: BasicWidget</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: BasicWidget</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>BasicWidget<span class="signature">()</span><span class="type-signature"></span></h2>
2023-09-06 09:25:00 +02:00
<div class="class-description">This is the base widget for all other widgets.
For information on using widgets, see the tutorial widget_basics.</div>
2023-08-21 04:17:16 -04:00
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="BasicWidget"><span class="type-signature"></span>new BasicWidget<span class="signature">()</span><span class="type-signature"></span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="widgets_basic_widget.js.html">widgets/basic_widget.js</a>, <a href="widgets_basic_widget.js.html#line11">line 11</a>
2023-08-21 04:17:16 -04:00
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="css"><span class="type-signature"></span>css<span class="signature">(name, value)</span><span class="type-signature"></span></h4>
<div class="description">
Sets the CSS attribute of the given name to the given value.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the name of the CSS attribute to set (e.g. `padding-left`).</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the value of the CSS attribute to set (e.g. `12px`).</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="widgets_basic_widget.js.html">widgets/basic_widget.js</a>, <a href="widgets_basic_widget.js.html#line75">line 75</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
self for chaining.
</div>
2023-08-21 04:17:16 -04:00
<h4 class="name" id="cssBlock"><span class="type-signature"></span>cssBlock<span class="signature">(block)</span><span class="type-signature"> &rarr; {this}</span></h4>
<div class="description">
Accepts a string of CSS to add with the widget.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>block</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="widgets_basic_widget.js.html">widgets/basic_widget.js</a>, <a href="widgets_basic_widget.js.html#line118">line 118</a>
2023-08-21 04:17:16 -04:00
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
for chaining
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">this</span>
</dd>
</dl>
2023-11-03 12:23:14 +01:00
<h4 class="name" id="doRender"><span class="type-signature"></span>doRender<span class="signature">()</span><span class="type-signature"></span></h4>
2023-08-21 04:17:16 -04:00
<div class="description">
2023-09-06 09:25:00 +02:00
Method used for rendering the widget.
Your class should override this method.
2023-11-03 12:23:14 +01:00
The method is expected to create a this.$widget containing jQuery object
2023-08-21 04:17:16 -04:00
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="widgets_basic_widget.js.html">widgets/basic_widget.js</a>, <a href="widgets_basic_widget.js.html#line209">line 209</a>
</li></ul></dd>
</dl>
<h4 class="name" id="isEnabled"><span class="type-signature"></span>isEnabled<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="widgets_basic_widget.js.html">widgets/basic_widget.js</a>, <a href="widgets_basic_widget.js.html#line199">line 199</a>
2023-08-21 04:17:16 -04:00
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
whether the widget is enabled.
</div>
<h4 class="name" id="optChild"><span class="type-signature"></span>optChild<span class="signature">(condition, &hellip;components)</span><span class="type-signature"></span></h4>
<div class="description">
Conditionally adds the given components as children to this component.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>condition</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
</td>
<td class="description last">whether to add the components.</td>
</tr>
<tr>
<td class="name"><code>components</code></td>
<td class="type">
<span class="param-type">any</span>
</td>
<td class="attributes">
&lt;repeatable><br>
</td>
<td class="description last">the components to be added as children to this component provided the condition is truthy.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="widgets_basic_widget.js.html">widgets/basic_widget.js</a>, <a href="widgets_basic_widget.js.html#line50">line 50</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
self for chaining.
</div>
<h4 class="name" id="optCss"><span class="type-signature"></span>optCss<span class="signature">(condition, name, value)</span><span class="type-signature"></span></h4>
<div class="description">
Sets the CSS attribute of the given name to the given value, but only if the condition provided is truthy.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>condition</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">`true` in order to apply the CSS, `false` to ignore it.</td>
</tr>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the name of the CSS attribute to set (e.g. `padding-left`).</td>
</tr>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">the value of the CSS attribute to set (e.g. `12px`).</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="widgets_basic_widget.js.html">widgets/basic_widget.js</a>, <a href="widgets_basic_widget.js.html#line88">line 88</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
self for chaining.
</div>
2023-08-21 04:17:16 -04:00
</article>
</section>
</div>
<nav>
2023-09-25 23:11:24 +02:00
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BasicWidget.html">BasicWidget</a></li><li><a href="FAttachment.html">FAttachment</a></li><li><a href="FAttribute.html">FAttribute</a></li><li><a href="FBranch.html">FBranch</a></li><li><a href="FNote.html">FNote</a></li><li><a href="FrontendScriptApi.html">FrontendScriptApi</a></li><li><a href="NoteContextAwareWidget.html">NoteContextAwareWidget</a></li><li><a href="RightPanelWidget.html">RightPanelWidget</a></li></ul><h3>Global</h3><ul><li><a href="global.html#api">api</a></li><li><a href="global.html#getJsonContent">getJsonContent</a></li><li><a href="global.html#getJsonContentSafely">getJsonContentSafely</a></li></ul>
2023-08-21 04:17:16 -04:00
</nav>
<br class="clear">
<footer>
2024-12-15 10:44:40 +02:00
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a>
2023-08-21 04:17:16 -04:00
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>