DPChallenge: A Digital Photography Contest You are not logged in. (log in or register
 

DPChallenge Forums >> Web Site Suggestions >> Script to let you vote using only your keyboard
Pages:  
Showing posts 1 - 25 of 43, (reverse)
AuthorThread
11/06/2006 02:11:53 AM · #1
I have written a script that will allow you to vote using only your keyboard. No mouse required.

Firefox will allow you to do this already (if you have the right configuration settings set) but I think my script adds a little more value.

Some of the things it does:
- When the image voting page loads it automatically sets the focus to the comments box. This way you can immediately start typing your comment.
- After you type your comment (or if you don't want to leave one) just hit a number key (either the top row numbers or the keypad) and your vote will be submitted (use 0 for a vote of 10).
- You can choose to see a confirmation message before your vote is submitted (hit enter to accept the vote or esc to cancel the vote) or you can have it just submit the vote and leave you alone.

To Install
- You will need Firefox.
- Install the Greasemonkey extension: https://addons.mozilla.org/firefox/748/
- Go to my script page and click 'Install' when prompted: //www.jamesleesmith.com/gm/dpc_keyboard_vote.user.js

If you already have this installed you can just go to the script page above and click install again...or not. If you're happy with the old one then you don't have to do anything :) This does add the ability to comment right off the bat though.

You can see the discussion this script was created for here:
//www.dpchallenge.com/forum.php?action=read&FORUM_THREAD_ID=345766

Edited to clarify instructions.

Message edited by author 2006-11-06 02:33:54.
11/06/2006 02:26:05 AM · #2
I downloaded this when I saw it on the other thread, and didn't get the chance to thank you for it. It works perfectly and is quite handy.
11/06/2006 02:36:48 AM · #3
Originally posted by movieman:

I downloaded this when I saw it on the other thread, and didn't get the chance to thank you for it. It works perfectly and is quite handy.


No problem! I didn't know if it would be that handy when I first started writing it but now that I've been using it I dig it a lot.
11/06/2006 07:13:49 AM · #4
Is this something that could be implemented server side for dpchallenge so that everyone could reap the benefit? Sounds pretty handy but I use (and prefer) IE7.
11/06/2006 07:39:05 AM · #5
for me it posted my number score int he comment box. i used the numbers at top since i am on a laptop. I am not sure if it is supposed to do that but not something that i want shown all the time.
11/06/2006 10:24:57 AM · #6
Originally posted by Elvis_L:

for me it posted my number score int he comment box. i used the numbers at top since i am on a laptop. I am not sure if it is supposed to do that but not something that i want shown all the time.


It definatly is not supposed to do that. I'm writing and testing this script in Firefox 2 and I have never had it type my score in the comment box. Which version of Firefox are you using?

Message edited by author 2006-11-06 10:28:52.
11/06/2006 10:32:49 AM · #7
Originally posted by mssnare:

Originally posted by Elvis_L:

for me it posted my number score int he comment box. i used the numbers at top since i am on a laptop. I am not sure if it is supposed to do that but not something that i want shown all the time.


It definatly is not supposed to do that. I'm writing and testing this script in Firefox 2 and I have never had it type my score in the comment box. Which version of Firefox are you using?


I am using version 2. i tried it beofre and after it asked me if i wanted to verify my vote and it did it both times. it does make the vote but it also types the score.
11/06/2006 10:48:00 AM · #8
I may just have to do that!!!
11/06/2006 10:49:49 AM · #9
Originally posted by Elvis_L:


I am using version 2. i tried it beofre and after it asked me if i wanted to verify my vote and it did it both times. it does make the vote but it also types the score.


Ahh. It sounds like you are using the first version of the script which did have a bug where if you tried to tell it not to prompt you then it would ask you if you should be prompted every time.

I fixed this but the version you are using may be causing your vote to be typed into the comments.

If you have time and are still interested please visit the script page again //www.jamesleesmith.com/gm/dpc_keyboard_vote.user.js
and install it again. That will make sure you have the latest version.

If it still puts your vote in the comments please send me a PM and we can try some other things.

Thanks for your help!
-James
11/06/2006 10:50:13 AM · #10
How "complete" is it when it requires Firefox?
Maybe this site should have some javascript to detect onKeyPress and capture '1' thru '1+0' and make it browser independent.
Not hard at all.
11/06/2006 10:56:11 AM · #11
Originally posted by wackybill:

Is this something that could be implemented server side for dpchallenge so that everyone could reap the benefit? Sounds pretty handy but I use (and prefer) IE7.


I would like that also. I'm unable to install software at my office PC, so I'm stuck with IE7 there. Still need to test the script at home, but it sounds like a great idea, definitely will give it a try.
11/14/2006 06:52:12 AM · #12
I'm giving this a go now - very handy, but I have a problem when typing anything involving the number keys in the comments...so if, for example, you type anything with an exclamation mark you find yourself voting with a 1! Brackets give the max score, conversely...
11/14/2006 07:25:19 AM · #13
Its useful, but for me it automatically scrolls down after each image has loaded so I have to scroll back up anyway. Might as well just use the mouse :P
11/14/2006 07:49:09 AM · #14
That would be awesome
12/02/2006 01:08:16 AM · #15
Originally posted by Konador:

Its useful, but for me it automatically scrolls down after each image has loaded so I have to scroll back up anyway. Might as well just use the mouse :P


To fix this, just change the bottom of the script from:

{ document.getElementById('COMMENT').focus(); }

to

{ document.getElementById('COMMENT').focus(); scrollTo(null,80); }

This way it will always put your window at the top of the image, and you'll still be able to type comments (though it will move if you start typing).

-Jeff
12/02/2006 01:22:49 AM · #16
Originally posted by jimness:

I'm giving this a go now - very handy, but I have a problem when typing anything involving the number keys in the comments...so if, for example, you type anything with an exclamation mark you find yourself voting with a 1! Brackets give the max score, conversely...


Got a solution for this one as well... if you don't mind pressing alt-number to vote:

if(key >= 48 && key <= 57 && event.altKey){
vote = key - 48;
}else if(key >= 96 && key <= 105 && event.altKey){
vote = key - 96;
}

To answer your question, rswank - it can't be used in IE because GreaseMonkey (a FireFox-only plugin) is applying the script to the vote page. Langdon would have to incorporate the script (or something similar) to make it work for all browsers.
12/02/2006 10:01:32 AM · #17
I don't have greasemonkey on this machine yet, but what happens if you want to type a number in the comment?
12/02/2006 11:49:05 AM · #18
I tired it, didn't work, uninstalled greasemonkey and script:
1) added digits to my votes depending on what I voted. For example, I voted on 5 images in the free study currently up. I voted them all a 5 as a test. When I looked at the thumbs page, they were all categorized as me giving them a 6. so I voted 5 more images 6'es. On the thumbs page it registered them all as 7's. So I go back and just for fun voted the next 5 images 1,2,3,4,5 - all were registered as 4's except the 5 which was changed to a 6. To make sure I cleared cache, rebooted computer, restarted browser and hmmm....same thing.

I will go back and change all votes using regular method which actually was easier, less complicated and reliable.

2)always defaulted to comment box with cursor. entered vote, carriage return, comment - always kept vote number in comment box after posting. I don't want the vote I give in the comment box thank you.
12/02/2006 11:54:18 AM · #19
I should at this point note that I had the same issue as the previous poster. There is a part of the script that directs focus to the comment box, and I think this is where the trouble lies. Once focus is on the comment box, anything typed also winds up in there. Unless you're going to comment on all images (almost no one has time to do this on a regular basis) it doesn't make sense to direct focus there.
I hope this helps to sort out the minor issues with your script; it would be mighty useful without this flaw! As it is, I use the "find as you type" feature that makes keypad voting *mostly* work with Firefox (unless there's a character in the title that is identical to your vote).
12/02/2006 01:08:10 PM · #20
This script is a huge improvement, and works fine for me in Firefox 2. I applied two modifications:

1. I only use the number key pad to vote, leaving the top number keys for typing. For this, change this:
if(key >= 48 && key <= 57){
vote = key - 48;
}else if(key >= 96 && key <= 105){
vote = key - 96;
}

to this:
if(key >= 96 && key <= 105){
vote = key - 96;
}


2. I applied smurfguy's modification, to make the script scroll back up to the top edge of the image. To repeat his instructions, change this:
{ document.getElementById('COMMENT').focus(); }
to this:
{ document.getElementById('COMMENT').focus(); scrollTo(null,80); }

Message edited by author 2006-12-02 13:08:51.
12/02/2006 01:46:24 PM · #21
How does one go in to edit the scripting. Sorry, its like my wife asked me to find the mustard in the refrigerator right now. ;)
12/02/2006 01:50:10 PM · #22
Originally posted by wavelength:

How does one go in to edit the scripting. Sorry, its like my wife asked me to find the mustard in the refrigerator right now. ;)


nevermind, found it.
12/02/2006 02:15:26 PM · #23
I thought I add this here, since there are some current GreaseMonkey users in here:

Mmm, GreaseMonkey. Thanks for introducing me, James! (See my new thread on adding profile images to the forum threads.)
12/02/2006 09:57:50 PM · #24
I have put a modified version of this on my DPCmod webpage - with proper credits and a link to your website, James.

My version incorporates the auto-scroll features I talked about above (to put the image at the top of your screen).

For numers in the comments here's what it does:
- If the first key you press is a number, it votes
- If the first key you press is not a number, it assumes you're leaving a comment, and starts typing your comment. You must then use ALT-number to vote with the keyboard.

If you install this version of the script, make sure to uninstall any other versions you may have. (Instructions on the page.)

Let me know if you have questions or problems.

Thanks,
-Jeff

Message edited by author 2006-12-02 21:59:40.
12/02/2006 10:49:17 PM · #25
Originally posted by smurfguy:

I have put a modified version of this on my DPCmod webpage - with proper credits and a link to your website, James.


That's pretty cool; we may have a useful collection of DPC power tools, if this continues to grow. It would be useful if you chose some sort of a free license for your little scripts. This way others would be encouraged to improve them. This may make me finally learn JavaScript - perhaps it *is* useful for something, after all. :^)

Do you suppose the ALT- modification is needed when using the number pad? I have ALT-1 ... ALT-0 switching desktops, so those key combinations are trapped before they reach the browser. It's easy enough for me to modify the script, though.
Pages:  
Current Server Time: 03/29/2024 02:15:28 AM

Please log in or register to post to the forums.


Home - Challenges - Community - League - Photos - Cameras - Lenses - Learn - Prints! - Help - Terms of Use - Privacy - Top ^
DPChallenge, and website content and design, Copyright © 2001-2024 Challenging Technologies, LLC.
All digital photo copyrights belong to the photographers and may not be used without permission.
Current Server Time: 03/29/2024 02:15:28 AM EDT.