PageSourceSearch

https://moto-net.com/sites/default/files/js/js_kN0w74EYMNWFgwJdxV28Qqq9oVkLVUgoZO0HVS03P-A.js

js moto-net.com collected 2026-10-02 10:25:13 UTC 13,382 bytes, 432 lines download raw bytes

1(function ($) {
2
3/**
4 * Attach handlers to evaluate the strength of any password fields and to check
5 * that its confirmation is correct.
6 */
7Drupal.behaviors.password = {
8  attach: function (context, settings) {
9    var translate = settings.password;
10    $('input.password-field', context).once('password', function () {
11      var passwordInput = $(this);
12      var innerWrapper = $(this).parent();
13      var outerWrapper = $(this).parent().parent();
14
15      // Add identifying class to password element parent.
16      innerWrapper.addClass('password-parent');
17
18      // Add the password confirmation layer.
19      $('input.password-confirm', outerWrapper).parent().prepend('<div class="password-confirm">' + translate['confirmTitle'] + ' <span></span></div>').addClass('confirm-parent');
20      var confirmInput = $('input.password-confirm', outerWrapper);
21      var confirmResult = $('div.password-confirm', outerWrapper);
22      var confirmChild = $('span', confirmResult);
23
24      // Add the description box.
25      var passwordMeter = '<div class="password-strength"><div class="password-strength-text" aria-live="assertive"></div><div class="password-strength-title">' + translate['strengthTitle'] + '</div><div class="password-indicator"><div class="indicator"></div></div></div>';
26      $(confirmInput).parent().after('<div class="password-suggestions description"></div>');
27      $(innerWrapper).prepend(passwordMeter);
28      var passwordDescription = $('div.password-suggestions', outerWrapper).hide();
29
30      // Check the password strength.
31      var passwordCheck = function () {
32
33        // Evaluate the password strength.
34        var result = Drupal.evaluatePasswordStrength(passwordInput.val(), settings.password);
35
36        // Update the suggestions for how to improve the password.
37        if (passwordDescription.html() != result.message) {
38          passwordDescription.html(result.message);
39        }
40
41        // Only show the description box if there is a weakness in the password.
42        if (result.strength == 100) {
43          passwordDescription.hide();
44        }
45        else {
46          passwordDescription.show();
47        }
48
49        // Adjust the length of the strength indicator.
50        $(innerWrapper).find('.indicator').css('width', result.strength + '%');
51
52        // Update the strength indication text.
53        $(innerWrapper).find('.password-strength-text').html(result.indicatorText);
54
55        passwordCheckMatch();
56      };
57
58      // Check that password and confirmation inputs match.
59      var passwordCheckMatch = function () {
60
61        if (confirmInput.val()) {
62          var success = passwordInput.val() === confirmInput.val();
63
64          // Show the confirm result.
65          confirmResult.css({ visibility: 'visible' });
66
67          // Remove the previous styling if any exists.
68          if (this.confirmClass) {
69            confirmChild.removeClass(this.confirmClass);
70          }
71
72          // Fill in the success message and set the class accordingly.
73          var confirmClass = success ? 'ok' : 'error';
74          confirmChild.html(translate['confirm' + (success ? 'Success' : 'Failure')]).addClass(confirmClass);
75          this.confirmClass = confirmClass;
76        }
77        else {
78          confirmResult.css({ visibility: 'hidden' });
79        }
80      };
81
82      // Monitor keyup and blur events.
83      // Blur must be used because a mouse paste does not trigger keyup.
84      passwordInput.keyup(passwordCheck).focus(passwordCheck).blur(passwordCheck);
85      confirmInput.keyup(passwordCheckMatch).blur(passwordCheckMatch);
86    });
87  }
88};
89
90/**
91 * Evaluate the strength of a user's password.
92 *
93 * Returns the estimated strength and the relevant output message.
94 */
95Drupal.evaluatePasswordStrength = function (password, translate) {
96  password = $.trim(password);
97
98  var weaknesses = 0, strength = 100, msg = [];
99
100  var hasLowercase = /[a-z]+/.test(password);
101  var hasUppercase = /[A-Z]+/.test(password);
102  var hasNumbers = /[0-9]+/.test(password);
103  var hasPunctuation = /[^a-zA-Z0-9]+/.test(password);
104
105  // If there is a username edit box on the page, compare password to that, otherwise
106  // use value from the database.
107  var usernameBox = $('input.username');
108  var username = (usernameBox.length > 0) ? usernameBox.val() : translate.username;
109
110  // Lose 5 points for every character less than 6, plus a 30 point penalty.
111  if (password.length < 6) {
112    msg.push(translate.tooShort);
113    strength -= ((6 - password.length) * 5) + 30;
114  }
115
116  // Count weaknesses.
117  if (!hasLowercase) {
118    msg.push(translate.addLowerCase);
119    weaknesses++;
120  }
121  if (!hasUppercase) {
122    msg.push(translate.addUpperCase);
123    weaknesses++;
124  }
125  if (!hasNumbers) {
126    msg.push(translate.addNumbers);
127    weaknesses++;
128  }
129  if (!hasPunctuation) {
130    msg.push(translate.addPunctuation);
131    weaknesses++;
132  }
133
134  // Apply penalty for each weakness (balanced against length penalty).
135  switch (weaknesses) {
136    case 1:
137      strength -= 12.5;
138      break;
139
140    case 2:
141      strength -= 25;
142      break;
143
144    case 3:
145      strength -= 40;
146      break;
147
148    case 4:
149      strength -= 40;
150      break;
151  }
152
153  // Check if password is the same as the username.
154  if (password !== '' && password.toLowerCase() === username.toLowerCase()) {
155    msg.push(translate.sameAsUsername);
156    // Passwords the same as username are always very weak.
157    strength = 5;
158  }
159
160  // Based on the strength, work out what text should be shown by the password strength meter.
161  if (strength < 60) {
162    indicatorText = translate.weak;
163  } else if (strength < 70) {
164    indicatorText = translate.fair;
165  } else if (strength < 80) {
166    indicatorText = translate.good;
167  } else if (strength <= 100) {
168    indicatorText = translate.strong;
169  }
170
171  // Assemble the final message.
172  msg = translate.hasWeaknesses + '<ul><li>' + msg.join('</li><li>') + '</li></ul>';
173  return { strength: strength, message: msg, indicatorText: indicatorText };
174
175};
176
177/**
178 * Field instance settings screen: force the 'Display on registration form'
179 * checkbox checked whenever 'Required' is checked.
180 */
181Drupal.behaviors.fieldUserRegistration = {
182  attach: function (context, settings) {
183    var $checkbox = $('form#field-ui-field-edit-form input#edit-instance-settings-user-register-form');
184
185    if ($checkbox.length) {
186      $('input#edit-instance-required', context).once('user-register-form-checkbox', function () {
187        $(this).bind('change', function (e) {
188          if ($(this).attr('checked')) {
189            $checkbox.attr('checked', true);
190          }
191        });
192      });
193
194    }
195  }
196};
197
198})(jQuery);
199;
200(function($) {
201    
202  $(document).ready(function(){
203      // On rassemble tout ce dont on a besoin par la suite
204      var ctx = {
205        boutons: $("INPUT[name='option-pseudo']"),
206        nom: $('#edit-nom'),
207        prenom: $('#edit-prenom'),
208        libre: $('#edit-pseudo-libre'),    
209        pseudo: $('#edit-pseudo'),
210      };
211      ctx.bouton_prenom_nom = ctx.boutons.filter('.option-pseudo-prenom-nom');
212      ctx.bouton_prenom_n   = ctx.boutons.filter('.option-pseudo-prenom-n');
213      ctx.bouton_libre      = ctx.boutons.filter('.option-pseudo-libre');
214      ctx.label_prenom_nom  = ctx.bouton_prenom_nom.parent().find('LABEL');
215      ctx.label_prenom_n    = ctx.bouton_prenom_n.parent().find('LABEL');
216      ctx.checked           = ctx.boutons.filter("[checked='checked']"); // Ne marche qu'en initialisation
217
218      // Fonctions appelées sur événements
219      var fcp = function() { 
220        calculer_pseudos(ctx);
221//         montrer_pseudos(ctx);
222      }
223      var fck = function() { 
224        choisir_pseudo(ctx,$(this)); 
225      }
226      var flb = function() {
227        modifier_pseudo_libre(ctx);
228      }
229      
230      ctx.nom.blur(fcp).keyup(fcp).change(fcp);
231      ctx.prenom.blur(fcp).keyup(fcp).change(fcp);
232      ctx.libre.blur(flb).keyup(flb);
233      ctx.boutons.click(fck);
234      
235      // Valeurs initiales
236      calculer_pseudos(ctx);
237      modifier_pseudo_libre(ctx);
238      
239      // Choix forcé par l'attribute checked ?
240      var checked = ctx.boutons.filter("[forcechecked='checked']");
241      if (checked.length) {
242          ctx.boutons.filter("[checked='checked']").prop('checked',false);
243          checked.prop('checked',true);
244          choisir_pseudo(ctx,checked);
245      }
246  });
247  
248  function calculer_pseudos(ctx) {
249    var pseudo_prenom_nom = '';
250    var pseudo_prenom_n = '';
251
252    // Valeurs des prénom et nom, avec première majuscule    
253    var prenom = ctx.prenom.val();
254    prenom = prenom.charAt(0).toUpperCase()+prenom.substr(1);
255    
256    var nom = ctx.nom.val();
257    nom = nom.charAt(0).toUpperCase()+nom.substr(1);
258 
259    if (prenom != '') {
260      // Il n'y a peut être pas de nom, mais le prénom peut
261      // constituer un pseudo acceptable
262      pseudo_prenom_n = prenom;
263      // Prenom suivi d'un espace lorsqu'il est renseigné
264      // ainsi toujours accolable au nom sans se poser de questions
265      prenom += ' ';
266    }
267 
268    // On peut toujours calculer prenom_n, dès lors que le nom est présent
269    if (nom.length > 0) {
270      pseudo_prenom_n = prenom + nom[0] + '.';
271    }
272    
273    // prenom_nom est calculé lorsque le nom dépasse une lettre, sinon trop semblable à prenom_n
274    if (nom.length > 1) {
275      pseudo_prenom_nom = prenom + nom;
276    }
277
278    // Les pseudos sont reportés dans les labels et dans les boutons
279    ctx.label_prenom_nom.html(pseudo_prenom_nom); 
280    ctx.label_prenom_n.html(pseudo_prenom_n); 
281    ctx.bouton_prenom_nom.attr('valeur',pseudo_prenom_nom);
282    ctx.bouton_prenom_n.attr('valeur',pseudo_prenom_n);
283    
284    montrer_pseudos(ctx);
285    if (ctx.checked.is(ctx.bouton_prenom_nom) || ctx.checked.is(ctx.bouton_prenom_n)) {
286      reporter_pseudo(ctx);
287    }
288  }
289  
290  function modifier_pseudo_libre(ctx) {
291    // La saisie a changé, elle est reportée sur le bouton
292    ctx.bouton_libre.attr('valeur',ctx.libre.val());
293    if (ctx.checked.is(ctx.bouton_libre)) {
294      reporter_pseudo(ctx);
295    }
296  }
297  
298  function choisir_pseudo(ctx,bouton) {
299    ctx.checked = bouton;
300    reporter_pseudo(ctx);
301  }
302  
303  function reporter_pseudo(ctx) {
304    var bouton = ctx.checked;
305    if (bouton.length > 0) {
306      ctx.pseudo.val(bouton.attr('valeur'));
307    }
308  }
309  
310  function montrer_pseudos(ctx) {
311    if (ctx.bouton_prenom_nom.attr('valeur')=='') {
312      ctx.bouton_prenom_nom.parent().hide();
313    }
314    else {
315      ctx.bouton_prenom_nom.parent().show();
316    }
317    if (ctx.bouton_prenom_n.attr('valeur')=='') {
318      ctx.bouton_prenom_n.parent().hide();
319    }
320    else {
321      ctx.bouton_prenom_n.parent().show();
322    }
323  }
324
325})(jQuery);;
326(function ($) {
327  
328  $(document).ready(function(){
329//     return;
330    
331    // Transformation de tous les liens dont l'url contient une query string
332    $('A').each(function(){
333      var lien = $(this);
334      var href = lien.attr('href');
335      if (typeof href == typeof undefined || href == false) {
336        href = '';
337      }
338      if (href.match(/^(http|mailto)/)) {
339        return;
340      }
341      var a = href.split('?');
342      if (a.length>1) {
343        href = a.shift();
344        var qs = a.join('&');
345        a = qs.split('#');
346        if (a.length>1) {
347          href += '#' + a.pop();
348          qs = a.join('#');
349        }
350        
351        var data = lien.attr('post-data');
352        if (typeof(data)=='undefined') {
353          data = '';
354        }
355        else {
356          data += '&';
357        }
358        data += qs;
359        lien.attr('href',href);
360        lien.attr('post-data',data);
361      }
362    });
363    
364    $('FORM').each(function(){
365      var form = $(this);
366      var action = form.attr('action');
367      if (typeof action == typeof undefined || action == false) {
368        action = '';
369      }
370      if (action.match(/^http/)) {
371        return;
372      }
373      var a = action.split('?');
374      if (a.length>1) {
375        action = a.shift();
376        var data = form.attr('post-data');
377        if (typeof(data)=='undefined') {
378          data = '';
379        }
380        else {
381          data += '&';
382        }
383        data += a.join('&');
384        form.append("<INPUT id='__post-data__' name='__post-data__' t
384ype='hidden'>");
385        input = form.children('#__post-data__');
386        input.val(data);
387        form.attr('action',action);
388      }
389    });
390
391    // Formulaire et input ajoutés par hook_alter_page
392    var form = jQuery('#__context__');
393    var input = form.children('input');
394    
395    // Chaque tag <A> ayant un attribut post-data
396    $('A[post-data]').each(function(){
397      var lien = $(this);
398      var href = lien.attr('href');
399      if (typeof href == typeof undefined || href == false) {
400        href = '';
401      }
402      var target = lien.attr('target');
403      if (!target) target = '_self';
404      var data = lien.attr('post-data');
405      var get_scroll = jQuery(this).attr('data-mnc-context-scroll')==1;
406      lien.removeAttr('post-data');
407      // Interception du click
408      lien.click(function(){
409        if (get_scroll) {
410          var scroll = 'scroll='+jQuery(document).scrollTop();
411          if (data=='') {
412            data = scroll;
413          }
414          else {
415            data += '&' + scroll;
416          }
417        }
418        form.attr('action',href);
419        form.attr('target',target);
420        input.val(data);
421        form.submit();
422        // et rien d'autre
423        return false;
424      });
425    });
426    
427 
428    
429  });
430  
431})(jQuery)
432;

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.