mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Restore password widget
Hence allowing TiddlySpot integration to work again
This commit is contained in:
parent
ce6c632274
commit
79bb082b92
45
core/modules/widgets/password.js
Normal file
45
core/modules/widgets/password.js
Normal file
@ -0,0 +1,45 @@
|
||||
/*\
|
||||
title: $:/core/modules/widget/password.js
|
||||
type: application/javascript
|
||||
module-type: widget
|
||||
|
||||
Implements the password widget.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var PasswordWidget = function(renderer) {
|
||||
// Save state
|
||||
this.renderer = renderer;
|
||||
// Generate child nodes
|
||||
this.generate();
|
||||
};
|
||||
|
||||
PasswordWidget.prototype.generate = function() {
|
||||
// Get the parameters from the attributes
|
||||
this.name = this.renderer.getAttribute("name");
|
||||
// Get the current password
|
||||
var password = $tw.browser ? $tw.utils.getPassword(this.name) : "";
|
||||
// Generate our element
|
||||
this.tag = "input";
|
||||
this.attributes = {
|
||||
type: "password",
|
||||
value: password
|
||||
};
|
||||
this.events = [
|
||||
{name: "keyup", handlerObject: this},
|
||||
{name: "input", handlerObject: this}];
|
||||
};
|
||||
|
||||
PasswordWidget.prototype.handleEvent = function(event) {
|
||||
var password = this.renderer.domNode.value;
|
||||
return $tw.utils.savePassword(this.name,password);
|
||||
};
|
||||
|
||||
exports.password = PasswordWidget;
|
||||
|
||||
})();
|
Loading…
Reference in New Issue
Block a user