PageSourceSearch

https://www.zdorovieinfo.ru/wp-content/cache/wpfc-minified/k9dacp03/2p4ol.js

js zdorovieinfo.ru collected 2026-09-24 20:05:58 UTC 8,731 bytes, 279 lines download raw bytes

1(function(factory){
2if(typeof define==='function'&&define.amd){ define(['jquery'], factory); }
3else if(typeof exports==='object'){ factory(require('jquery')); }else{ factory(jQuery); }})(function($, undef){
4var dataKey='plugin_hideShowPassword',
5shorthandArgs=['show', 'innerToggle'],
6SPACE=32,
7ENTER=13;
8var canSetInputAttribute=function(){
9var body=document.body,
10input=document.createElement('input'),
11result=true;
12if(!body){
13body=document.createElement('body');
14}
15input=body.appendChild(input);
16try { input.setAttribute('type', 'text'); }
17catch (e){ result=false; }
18body.removeChild(input);
19return result;
20}();
21var defaults={
22show:'infer',
23innerToggle:false,
24enable:canSetInputAttribute,
25triggerOnToggle: false,
26className:'hideShowPassword-field',
27initEvent:'hideShowPasswordInit',
28changeEvent:'passwordVisibilityChange',
29props:{
30autocapitalize: 'off',
31autocomplete:'off',
32autocorrect:'off',
33spellcheck:'false' },
34toggle:{
35element:'<button type="button">',
36className:'hideShowPassword-toggle',
37touchSupport:typeof Modernizr==='undefined' ? false:Modernizr.touchevents,
38attachToEvent:'click.hideShowPassword',
39attachToTouchEvent: 'touchstart.hideShowPassword mousedown.hideShowPassword',
40attachToKeyEvent:'keyup',
41attachToKeyCodes:true,
42styles:{ position: 'absolute'},
43touchStyles:{ pointerEvents:'none' },
44position:'infer',
45verticalAlign:'middle',
46offset:0,
47attr: { role:'button',
48'aria-label': 'Show Password',
49title:'Show Password',
50tabIndex:0 }},
51wrapper:{
52element:'<div>',
53className:'hideShowPassword-wrapper',
54enforceWidth: true,
55styles: { position: 'relative' },
56inheritStyles: ['display', 'verticalAlign', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft'],
57innerElementStyles: {
58marginTop:0,
59marginRight:0,
60marginBottom: 0,
61marginLeft:0 }},
62states: {
63shown: {
64className:'hideShowPassword-shown',
65changeEvent:'passwordShown',
66props:{ type: 'text' },
67toggle:{
68className: 'hideShowPassword-toggle-hide',
69content: 'Hide',
70attr: { title:'Hide Password',
71'aria-pressed': 'true' }} },
72hidden:{
73className:'hideShowPassword-hidden',
74changeEvent:'passwordHidden',
75props:{ type:'password' },
76toggle:{
77className: 'hideShowPassword-toggle-show',
78content:'Show',
79attr:{ title:'Show Password',
80'aria-pressed':'false' }}
81}} };
82function HideShowPassword(element, options){
83this.element=$(element);
84this.wrapperElement=$();
85this.toggleElement=$();
86this.init(options);
87}
88HideShowPassword.prototype={
89init: function(options){
90if(this.update(options, defaults)){
91this.element.addClass(this.options.className);
92if(this.options.innerToggle){
93this.wrapElement(this.options.wrapper);
94this.initToggle(this.options.toggle);
95if(typeof this.options.innerToggle==='string'){
96this.toggleElement.hide();
97this.element.one(this.options.innerToggle,
98$.proxy(function(){ this.toggleElement.show(); },
99this)
100);
101}}
102this.element.trigger(this.options.initEvent, [this]);
103}},
104update:function(options, base){
105this.options=this.prepareOptions(options, base);
106if(this.updateElement()){
107this.element.trigger(this.options.changeEvent, [this]).trigger(this.state().changeEvent, [this]
108);
109}
110return this.options.enable;
111},
112toggle:function(showVal){
113showVal=showVal||'toggle';
114return this.update({ show:showVal });
115},
116prepareOptions:function(options, base){
117var original=options||{},
118keyCodes=[],
119testElement;
120base=base||this.options;
121options=$.extend(true, {}, base, options);
122if(original.hasOwnProperty('wrapper')&&original.wrapper.hasOwnProperty('inheritStyles')){ options.wrapper.inheritStyles=original.wrapper.inheritStyles; }
123if(options.enable){
124if(options.show==='toggle'){ options.show=this.isType('hidden', options.states); }
125else if(options.show==='infer'){ options.show=this.isType('shown', options.states); }
126if(options.toggle.position==='infer'){
127options.toggle.position=this.element.css('text-direction')==='rtl' ? 'left':'right';
128}
129if(! $.isArray(options.toggle.attachToKeyCodes)){
130if(options.toggle.attachToKeyCodes===true){
131testElement=$(options.toggle.element);
132switch (testElement.prop('tagName').toLowerCase()){
133case 'button':
134case 'input':
135break;
136case 'a':
137if(testElement.filter('[href]').length){
138keyCodes.push(SPACE);
139}
140break;
141default:
142keyCodes.push(SPACE, ENTER);
143break;
144}}
145options.toggle.attachToKeyCodes=keyCodes;
146}}
147return options;
148},
149updateElement: function(){
150if(! this.options.enable||this.isType()) return false;
151this.element.prop($.extend({}, this.options.props, this.state().props))
152.addClass(this.state().className)
153.removeClass(this.otherState().className);
154if(this.options.triggerOnToggle){
155this.element
156.trigger(this.options.triggerOnToggle, [this]);
157}
158this.updateToggle();
159return true;
160},
161isType: function(comparison, states){
162states=states||this.options.states;
163comparison=comparison||this.state(undef, undef, states).props.type;
164if(states[comparison]){
165comparison=states[comparison].props.type;
166}
167return this.element.prop('type')===comparison;
168},
169state:function(key, invert, states){
170states=states||this.options.states;
171if(key===undef){ key=this.options.show; }
172if(typeof key==='boolean'){ key=key ? 'shown':'hidden'; }
173if(invert){ key=key==='shown' ? 'hidden':'shown'; }
174return states[key];
175},
176otherState:function(key){
177return this.state(key, true);
178},
179wrapElement:function(options){
180var enforceWidth=options.enforceWidth,
181targetWidth;
182if(! this.wrapperElement.length){
183targetWidth=this.element.outerWidth();
184$.each(options.inheritStyles, $.proxy(function(index, prop){
185options.styles[prop]=this.element.css(prop);
186}, this));
187this.element.css(options.innerElementStyles).wrap($(options.element).addClass(options.className).css(options.styles));
188this.wrapperElement=this.element.parent();
189if(enforceWidth===true){ enforceWidth=this.wrapperElement.outerWidth()===targetWidth ? false:targetWidth; }
190if(enforceWidth!==false){ this.wrapperElement.css('width', enforceWidth); }}
191return this.wrapperElement;
192},
193initToggle: function(options){
194if(! this.toggleElement.length){
195this.toggleElement=$(options.element)
196.attr(options.attr)
197.css(options.styles)
198.addClass(options.className)
199.appendTo(this.wrapperElement);
200this.updateToggle();
201this.positionToggle(options.position,
202options.verticalAlign,
203options.offset);
204if(options.touchSupport){ this.toggleElement.css(options.touchStyles);
205this.element.on(options.attachToTouchEvent, $.proxy(this.toggleTouchEvent, this)); }else{ this.toggleElement.on(options.attachToEvent, $.proxy(this.toggleEvent, this)); }
206if(options.attachToKeyCodes.length){ this.toggleElement.on(options.attachToKeyEvent, $.proxy(this.toggleKeyEvent, this)); }}
207return this.toggleElement;
208},
209positionToggle:function(position, verticalAlign, offset){
210var styles={};
211styles[position]=offset;
212switch (verticalAlign){
213case 'top':
214case 'bottom':
215styles[verticalAlign]=offset;
216break;
217case 'middle':
218styles.top='50%';
219styles.marginTop=this.toggleElement.outerHeight() / -2;
220break;
221}
222return this.toggleElement.css(styles);
223},
224updateToggle:function(state, otherState){
225var paddingProp, targetPadding;
226if(this.toggleElement.length){
227paddingProp='padding-' + this.options.toggle.position;
228state=state||this.state().toggle;
229otherState=otherState||this.otherState().toggle;
230this.toggleElement.attr(state.attr).addClass(state.className).removeClass(otherState.className).html(state.content);
231targetPadding=this.toggleElement.outerWidth() + this.options.toggle.offset * 2;
232if(this.element.css(paddingProp)!==targetPadding){
233this.element.css(paddingProp, targetPadding);
234}}
235return this.toggleElement;
236},
237toggleEvent:function(event){
238event.preventDefault();
239this.toggle();
240},
241toggleKeyEvent:function(event){
242$.each(this.options.toggle.attachToKeyCodes,
243$.proxy(function(index, keyCode){
244if(event.which===keyCode){
245this.toggleEvent(event);
246return false; }}, this));
247},
248toggleTouchEvent:function(event){
249var toggleX=this.toggleElement.offset().left,
250eventX, lesser, greater;
251if(toggleX){
252eventX=event.pageX||event.originalEvent.pageX;
253if(this.options.toggle.position==='left'){
254toggleX +=this.toggleElement.outerWidth();
255lesser=eventX;
256greater=toggleX; }else{
257lesser=toggleX;
258greater=eventX; }
259if(greater >=lesser){ this.toggleEvent(event); }}
260}};
261$.fn.hideShowPassword=function(){
262var options={};
263$.each(arguments, function(index, value){
264var newOptions={};
265if(typeof value==='object'){ newOptions=value; }
266else if(shorthandArgs[index]){ newOptions[ shorthandArgs[index] ]=value; }else{ return false; }
267$.extend(true, options, newOptions);
268});
269return this.each(function(){
270var $this=$(this), data=$this.data(dataKey);
271if(data){ data.update(options); }else{ $this.data(dataKey, new HideShowPassword(this, options)); }});
272};
273$.each({ show:true,
274hide:false,
275toggle:'toggle' },
276function(verb, showVal){
277$.fn[ verb + 'Password' ]=function(innerToggle, options){
278return this.hideShowPassword(showVal, innerToggle, options); };});
279});

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.