/xoops/installer/2.0.18/install/include/install.js
http://xoopsfrance.codeplex.com · JavaScript · 98 lines · 62 code · 24 blank · 12 comment · 19 complexity · ef996a3c44f8e55f4f0c3e529d4207fa MD5 · raw file
- if ( typeof window.$ != 'function' ) {
- function $() {
- var elements = new Array();
-
- for (var i = 0; i < arguments.length; i++) {
- var element = arguments[i];
- if (typeof element == 'string')
- element = document.getElementById(element);
-
- if (arguments.length == 1)
- return element;
-
- elements.push(element);
- }
-
- return elements;
- }
- }
-
- function xoopsGetElementById(id){
- return $(id);
- }
-
- function showThemeSelected(imgId, selectId, imgDir, extra, xoopsUrl) {
-
- if (xoopsUrl == null) {
- xoopsUrl = "./";
- }
-
- imgDom = xoopsGetElementById(imgId);
- selectDom = xoopsGetElementById(selectId);
- imgDom.src = xoopsUrl + "/"+ imgDir + "/" + selectDom.options[selectDom.selectedIndex].value + "/screenshot.png" + extra;
- }
-
- function selectModule( id , button) {
- element = xoopsGetElementById(id);
- if ( button.value == 1) {
- element.style.background = '#E6EFC2';
- } else {
- element.style.background = 'transparent';
- }
- }
-
- function passwordStrength(password) {
- var score = 0;
-
- //if password bigger than 6 give 1 point
- if (password.length > 6) score++;
-
- //if password has both lower and uppercase characters give 1 point
- if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;
-
- //if password has at least one number give 1 point
- if (password.match(/\d+/)) score++;
-
- //if password has at least one special caracther give 1 point
- if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) ) score++;
-
- //if password bigger than 12 give another 1 point
- if (password.length > 12) score++;
-
- document.getElementById("passwordDescription").innerHTML = desc[score];
- document.getElementById("passwordStrength").className = "strength" + score;
- }
-
- function suggestPassword( passwordlength ) {
- var pwchars = "abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ.,:";
- var pwchars = "abcdefhjmnpqrstuvwxyz1234567890,?;.:!$=+@_-&|#ABCDEFGHJKLMNPQRSTUVWYXZ";
- var passwd = document.getElementById('generated_pw');
- passwd.value = '';
-
- for ( i = 0; i < passwordlength; i++ ) {
- passwd.value += pwchars.charAt( Math.floor( Math.random() * pwchars.length ) )
- }
- return passwd.value;
- }
-
-
- /**
- * Copy the generated password (or anything in the field) to the form
- *
- * @param string the form name
- *
- * @return boolean always true
- */
- function suggestPasswordCopy(id) {
- generated_pw = xoopsGetElementById('generated_pw');
-
- adminpass = xoopsGetElementById('adminpass')
- adminpass.value = generated_pw.value;
-
- adminpass2 = xoopsGetElementById('adminpass2')
- adminpass2.value = generated_pw.value;
-
- passwordStrength(adminpass.value)
- return true;
- }