Page Index Toggle Pages: 1
Topic Tools
Hot Topic (More than 10 Replies) Little new feature: Caps Lock detection (Read 5,481 times)
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Little new feature: Caps Lock detection
May 3rd, 2009 at 2:10pm
Post Tools
New
cgi-bin\yabb2\Languages\English\LogInOut.lng
cgi-bin\yabb2\Languages\English\Register.lng

cgi-bin\yabb2\Sources\LogInOut.pl
cgi-bin\yabb2\Sources\Register.pl

public_html\yabbfiles\YaBB.js

in CVS.

Add Caps Lock detection on Login and Register Password fields.
« Last Edit: May 3rd, 2009 at 2:11pm by deti »  

Was immer Du tun kannst
oder ertrumst tun zu knnen,
beginne es.
Khnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
Jet Li
Legacy Dev Team
Development Team
****
Offline



Posts: 6,588
Location: Hong Kong
Re: Little new feature: Caps Lock detection
Reply #1 - May 3rd, 2009 at 2:18pm
Post Tools
thnx, deti.

- What about in Edit Profile?
- Add new Member in Admin Center

How this feature works:
- Only if user have CAPS Button enabled, get warning. No if press Shift Button.
« Last Edit: May 3rd, 2009 at 2:41pm by Jet Li »  

caps-register.png (Attachment deleted)
caps-login.png (Attachment deleted)

PM me for YaBB Installation Service
Back to top
WWWGTalkFacebook  
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: Little new feature: Caps Lock detection
Reply #2 - May 3rd, 2009 at 2:46pm
Post Tools
New
Admin\Admin.pl

Languages\English\LogInOut.lng
Languages\English\Profile.lng
Languages\English\Register.lng

Sources\Profile.pl

in CVS.

Add Caps Lock detection on PW-Validation, Profile and Admin-AddMembers page for Passwords.
  

Was immer Du tun kannst
oder ertrumst tun zu knnen,
beginne es.
Khnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
Jet Li
Legacy Dev Team
Development Team
****
Offline



Posts: 6,588
Location: Hong Kong
Re: Little new feature: Caps Lock detection
Reply #3 - May 3rd, 2009 at 2:57pm
Post Tools
Great deti. Works all pefect. Smiley
  

PM me for YaBB Installation Service
Back to top
WWWGTalkFacebook  
IP Logged
 
AntonioK
Senior Member
****
Offline



Posts: 978
Location: Russian Federation
Re: Little new feature: Caps Lock detection
Reply #4 - May 26th, 2009 at 12:45pm
Post Tools
Maybe to add regex checking "if not in 0-9 a-z and special chars" to alert user for the wrong keyboard layot (russian, for example) like caps lock had done?
  

If you're interested on History... If you have some sense of humour... The Historian of Female.
Back to top
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: Little new feature: Caps Lock detection
Reply #5 - May 26th, 2009 at 1:53pm
Post Tools
Good idea, but I can't test it on my keyboard. So do this please for me.

Replace in yabbfiles/YaBB.js the function capsLock with this:
Code
Select All
// Caps Lock detection
function capsLock(eve,ident){
	keyCode = eve.keyCode ? eve.keyCode : eve.which;
	shiftKey = eve.shiftKey ? eve.shiftKey : ((keyCode == 16) ? true : false);
	if (((keyCode >= 65 && keyCode <= 90) && !shiftKey)||((keyCode >= 97 && keyCode <= 122) && shiftKey)) {
		document.getElementById(ident).style.display = 'block';
	} else {
		document.getElementById(ident).style.display = 'none';
		character = String.fromCharCode(keyCode)
		if (/[^\s\w!@#$%\^&\*\(\)\+\|`~\-=\\:;'",\.\/\?\[\]\{\}]/.test(character))
			alert('You are not using the right characters. The character you typed in was: ' + character);
	}
} 


Don't forget to reload your browser after uploading the file on your server, or just empty your browser chache so that the YaBB.js must be reloaded by the browser. If nothing happen, test with this character:

you must get an alert. At least I get it. Otherwise you did something wrong.

Thanks!
  

Was immer Du tun kannst
oder ertrumst tun zu knnen,
beginne es.
Khnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
AntonioK
Senior Member
****
Offline



Posts: 978
Location: Russian Federation
Re: Little new feature: Caps Lock detection
Reply #6 - May 27th, 2009 at 7:05pm
Post Tools
I will test it tomorrow, course now I can't access my server.

But I want to say that there shouldn't be alert(), - just text message near input is better. I have mentioned "alert" in the meaning "sometiong that alerts", not JS alert. Alerts is annoying, and for second looks horrible in Opera =)

And it is necessary to use language-file variable, not hardcoded alert string...

Here you are some russian, if you need to:

Quote:
- .
- , . (c)
« Last Edit: May 27th, 2009 at 7:09pm by AntonioK »  

If you're interested on History... If you have some sense of humour... The Historian of Female.
Back to top
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: Little new feature: Caps Lock detection
Reply #7 - May 27th, 2009 at 8:41pm
Post Tools
@ AntonioK
I know that! The code here is just for testing. The other things I do when I know the basic code works on other language keyboards. Wink
  

Was immer Du tun kannst
oder ertrumst tun zu knnen,
beginne es.
Khnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
AntonioK
Senior Member
****
Offline



Posts: 978
Location: Russian Federation
Re: Little new feature: Caps Lock detection
Reply #8 - May 29th, 2009 at 10:08am
Post Tools
@ deti, your code doesn't work for me when I am typing on russian.

On our projects we using
Code
Select All
function checkPass(value) {
  if (value.match(/[--]/) != null) {
   document.getElementById('wrong-lang').style.display='block';
  } else {
   document.getElementById('wrong-lang').style.display='none';
  }
}
 



and it works always. But it is only for Russian, Ukrainian and other cyrillic layots.
« Last Edit: May 29th, 2009 at 10:08am by AntonioK »  

If you're interested on History... If you have some sense of humour... The Historian of Female.
Back to top
IP Logged
 
AntonioK
Senior Member
****
Offline



Posts: 978
Location: Russian Federation
Re: Little new feature: Caps Lock detection
Reply #9 - May 30th, 2009 at 9:44am
Post Tools
I am very-very sorry, I just discovered I forgot svn up the project.

Your code works for russian symbols typing! But there is a bug: I get alert even when I press ctrl+shift to change the keyboard layot.
  

If you're interested on History... If you have some sense of humour... The Historian of Female.
Back to top
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: Little new feature: Caps Lock detection
Reply #10 - Jun 2nd, 2009 at 10:11pm
Post Tools
Thanks for the feedback.

New
cgi-bin\yabb2\Admin\Admin.pl

cgi-bin\yabb2\Languages\English\LogInOut.lng
cgi-bin\yabb2\Languages\English\Profile.lng
cgi-bin\yabb2\Languages\English\Register.lng

cgi-bin\yabb2\Sources\LogInOut.pl
cgi-bin\yabb2\Sources\Profile.pl
cgi-bin\yabb2\Sources\Register.pl

public_html\yabbfiles\YaBB.js

in CVS and SVN.

AntonioK, please test it here http://www.yabbworld.com/cgi-bin/yabbcvs/YaBB.pl after Jet Li updated it (probably tomorrow) and report.
  

Was immer Du tun kannst
oder ertrumst tun zu knnen,
beginne es.
Khnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
Jet Li
Legacy Dev Team
Development Team
****
Offline



Posts: 6,588
Location: Hong Kong
Re: Little new feature: Caps Lock detection
Reply #11 - Jun 3rd, 2009 at 4:47am
Post Tools
deti wrote on Jun 2nd, 2009 at 10:11pm:
after Jet Li updated it (probably tomorrow) and report.

Done. Smiley
  

PM me for YaBB Installation Service
Back to top
WWWGTalkFacebook  
IP Logged
 
AntonioK
Senior Member
****
Offline



Posts: 978
Location: Russian Federation
Re: Little new feature: Caps Lock detection
Reply #12 - Jun 3rd, 2009 at 5:31am
Post Tools
deti wrote on Jun 2nd, 2009 at 10:11pm:

It works. Olala =)
  

If you're interested on History... If you have some sense of humour... The Historian of Female.
Back to top
IP Logged
 
deti
Legacy Dev Team
Development Team
****
Offline



Posts: 2,650
Location: Prien am Chiemsee, Germany
Re: Little new feature: Caps Lock detection
Reply #13 - Jun 3rd, 2009 at 8:08am
Post Tools
Thanks for the idea and for testing. You are welcome!
  

Was immer Du tun kannst
oder ertrumst tun zu knnen,
beginne es.
Khnheit besitzt Genie,
Macht und magische Kraft.
Beginne es jetzt.
Whatever you can do
or dream you can,
begin it.
Boldness has genius,
power and magic in it.
Begin it now.
J. W. Goethe
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Topic Tools
 
  « Board Index ‹ Board  ^Top