Guest User

planet9.js

a guest
Feb 17th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        Planet9
  3. // @namespace   http://www.zooniverse.org
  4. // @description Keyboard control for Zooniverse Planet 9 project
  5. // @version     1
  6. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
  7. // @include https://www.zooniverse.org/projects/marckuchner/backyard-worlds-planet-9/classify
  8. // @grant       none
  9. // ==/UserScript==
  10.  
  11. document.addEventListener('keydown',function(e) {
  12.     if (e.which==37) pip(-1);
  13.     else if (e.which==39) pip(1);
  14.     else if (e.which==13) $('.continue').click();
  15. });
  16.  
  17. function pip(x) {
  18.     pips=$('.subject-frame-pips');
  19.     n=pips.children('BUTTON').length;
  20.     i=pips.children('BUTTON.active').index();
  21.     i+=x;
  22.     i=i%n;
  23.     pips.children('BUTTON').eq(i).click();
  24. }
Add Comment
Please, Sign In to add comment