Sha256: 85ace521b8d4e8bf3647ee14fb93fa6b018d0d823946ce1ce9dca9b8105a77f1
Contents?: true
Size: 1.28 KB
Versions: 62
Compression:
Stored size: 1.28 KB
Contents
/** * @namespace WORKAREA.revealPassword */ WORKAREA.registerModule('revealPassword', (function () { 'use strict'; var buttonTemplate = JST['workarea/core/templates/reveal_password_button'], toggleButton = function ($field, event) { var $button = $(event.currentTarget); $button.addClass('hidden'); $button.siblings('[data-reveal-password]').removeClass('hidden'); if ($button.data('revealPassword') === 'show') { $field.attr('type', 'text'); } else { $field.attr('type', 'password'); } }, bindButtonEvents = function ($field) { var $container = $field.closest('.property'); $('[data-reveal-password]', $container) .on('click', _.partial(toggleButton, $field)); }, injectButtons = function (index, field) { return $(field).after(buttonTemplate()); }, initRevealPassword = _.flow(injectButtons, bindButtonEvents), /** * @method * @name init * @memberof WORKAREA.revealPassword */ init = function ($scope) { $('input[type=password]', $scope).each(initRevealPassword); }; return { init: init }; }()));
Version data entries
62 entries across 62 versions & 1 rubygems