PageSourceSearch

https://tix.cinefestoz.com/Scripts/bootstrap-show-password.js?v=1.9.25.46

js cinefestoz.com collected 2026-09-24 21:43:11 UTC 5,509 bytes, 198 lines download raw bytes

1/**
2 * @author zhixin wen <[email protected]>
3 * https://github.com/wenzhixin/bootstrap-show-password
4 * version: 1.0.1
5 * Edits by Ferve
6 */
7
8!function ($) {
9
10	'use strict';
11
12	// TOOLS DEFINITION
13	// ======================
14
15	// it only does '%s', and return '' when arguments are undefined
16	var sprintf = function (str) {
17		var args = arguments,
18            flag = true,
19            i = 1;
20
21		str = str.replace(/%s/g, function () {
22			var arg = args[i++];
23
24			if (typeof arg === 'undefined') {
25				flag = false;
26				return '';
27			}
28			return arg;
29		});
30		if (flag) {
31			return str;
32		}
33		return '';
34	};
35
36	// PASSWORD CLASS DEFINITION
37	// ======================
38
39	var Password = function (element, options) {
40		this.options = options;
41		this.$element = $(element);
42		this.isShown = false;
43
44		this.init();
45	};
46
47	Password.DEFAULTS = {
48		placement: 'after', // 'before' or 'after'
49		white: false, // v2
50		message: 'Click here to show/hide password',
51		eyeClass: 'glyphicon',
52		eyeOpenClass: 'glyphicon-eye-open',
53		eyeCloseClass: 'glyphicon-eye-close'
54	};
55
56	Password.prototype.init = function () {
57		var placementFuc,
58            inputClass; // v2 class
59
60		if (this.options.placement === 'before') {
61			placementFuc = 'insertBefore';
62			inputClass = 'input-prepend';
63		} else {
64			this.options.placement = 'after'; // default to after
65			placementFuc = 'insertAfter';
66			inputClass = 'input-append';
67		}
68
69		// Create the text, icon and assign
70		this.$element.wrap(sprintf('<div class="%s input-group" />', inputClass));
71
72		// Ferve this.$text = $('<input type="text" />')
73		this.$text = $('<input type="text" id="PasswordT" onfocus="ft_password(true)", onblur="ft_password(false)", oninput="ft_passwordStrength()" />')
74            [placementFuc](this.$element)
75            .attr('class', this.$element.attr('class'))
76            .attr('style', this.$element.attr('style'))
77            .attr('placeholder', this.$element.attr('placeholder'))
78            .css('display', this.$element.css('display'))
79            .val(this.$element.val()).hide();
80
81		// Copy readonly attribute if it's set
82		if (this.$element.prop('readonly'))
83			this.$text.prop('readonly', true);
84
85		this.$icon = $([
86            '<span tabindex="100" title="' + this.options.message + '" class="add-on input-group-addon">',
87            '<i class="icon-eye-open' + (this.options.white ? ' icon-white' : '') +
88                ' ' + this.options.eyeClass + ' ' + this.options.eyeOpenClass + '"></i>',
89            '</span>'
90		].join(''))[placementFuc](this.$text).css('cursor', 'pointer').css('outline', 'none');// Ferve outline
91
92		// events
93		this.$text.off('keyup').on('keyup', $.proxy(function () {
94			if (!this.isShown) return;
95			this.$element.val(this.$text.val()).trigger('change');
96		}, this));
97
98		this.$icon.off('click').on('click', $.proxy(function () {
99			this.$text.val(this.$element.val()).trigger('change');
100			this.toggle();
101		}, this));
102	};
103
104	Password.prototype.toggle = function (_relatedTarget) {
105		this[!this.isShown ? 'show' : 'hide'](_relatedTarget);
106	};
107
108	Password.prototype.show = function (_relatedTarget) {
109		var e = $.Event('show.bs.password', { relatedTarget: _relatedTarget });
110		this.$element.trigger(e);
111
112		this.isShown = true;
113		this.$element.hide();
114		this.$text.show();
115		this.$icon.find('i')
116            .removeClass('icon-eye-open ' + this.options.eyeOpenClass)
117            .addClass('icon-eye-close ' + this.options.eyeCloseClass);
118
119		// v3 input-group
120		this.$text[this.options.placement](this.$element);
121	};
122
123	Password.prototype.hide = function (_relatedTarget) {
124		var e = $.Event('hide.bs.password', { relatedTarget: _relatedTarget });
125		this.$element.trigger(e);
126
127		this.isShown = false;
128		this.$element.show();
129		this.$text.hide();
130		this.$icon.find('i')
131            .removeClass('icon-eye-close ' + this.options.eyeCloseClass)
132            .addClass('icon-eye-open ' + this.options.eyeOpenClass);
133
134		// v3 input-group
135		this.$element[this.options.placement](this.$text);
136	};
137
138	Password.prototype.val = function (value) {
139		if (typeof value === 'undefined') {
140			return this.$element.val();
141		} else {
142			this.$element.val(value).trigger('change');
143			this.$text.val(value);
144		}
145	};
146
147
148	// PASSWORD PLUGIN DEFINITION
149	// =======================
150
151	var old = $.fn.password;
152
153	$.fn.password = function () {
154		var option = arguments[0],
155            args = arguments,
156
157            value,
158            allowedMethods = ['show', 'hide', 'toggle', 'val']; // public function
159
160		this.each(function () {
161			var $this = $(this),
162                data = $this.data('bs.password'),
163                options = $.extend({}, Password.DEFAULTS, $this.data(), typeof option === 'object' && option);
164
165			if (typeof option === 'string') {
166				if ($.inArray(option, allowedMethods) < 0) {
167					throw "Unknown method: " + option;
168				}
169				value = data[option](args[1]);
170			} else {
171				if (!data) {
172					data = new Password($this, options);
173					$this.data('bs.password', data);
174				} else {
175					data.init(options);
176				}
177			}
178		});
179
180		return value ? value : this;
181	};
182
183	$.fn.password.Constructor = Password;
184
185
186	// PASSWORD NO CONFLICT
187	// =================
188
189	$.fn.password.noConflict = function () {
190		$.fn.password = old;
191		return this;
192	};
193
194	$(function () {
195		$('[data-toggle="password"]').password();
196	});
197
198}(window.jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.