Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name VattuPageturner
- // @require https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
- // @version 1
- // @description Arrow keys turn pages of Vattu, thanks/apologies to Billy King
- // @include http://*rice-boy.com/vattu/*
- // ==/UserScript==
- //Returns variable from URL stored with PHP GET format in variable str
- function getURLVars(str) {
- var vars = {};
- var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
- vars[key] = value;
- });
- return vars[str];
- }
- function main() {
- $('title').append(' - '+getURLVars('c'));
- (new Image()).src = (parseInt(getURLVars('c'))-1)+'.png';
- (new Image()).src = (parseInt(getURLVars('c'))+1)+'.png';
- $(document).keydown(function(e) {
- switch(e.which) {
- case 37:
- window.location='index.php?c='+(parseInt(getURLVars('c'))-1);
- break;
- case 39:
- window.location='index.php?c='+(parseInt(getURLVars('c'))+1);
- break;
- }
- });
- }
- $(document).ready(main);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement