NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name OkCupid keyboard shortcuts // @namespace http://tampermonkey.net/ // @version 0.1 // @description Keyboard shortcuts for OkCupid // @author Alexandre // @match https://www.okcupid.com/* // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js // ==/UserScript== (function() { 'use strict'; function new_message() { console.log('clicking on message'); $('.actions2015-chat').click(); var hi = 'Hi ' + $('.userinfo2015-basics-username')[0].textContent.trim() + '!'; var value = $('.compose textarea').val(); if (!value){ console.log('adding hi message'); $('.compose textarea').val(hi); } } function show_more() { console.log('clicking +more'); $('.i-maximize').click(); } function submit_message() { console.log('submitting message'); $('button[type=submit]').click(); } function close_message() { console.log('closing box'); $('.old_template .controls .close')[0].click(); } function show_image() { console.log('showing image'); $('.userinfo2015-thumb img')[0].click(); } $('body').keydown(function (e) { if ((event.keyCode == 77) && event.ctrlKey) { // ctrl+m new_message(); } else if ((event.keyCode == 188) && event.ctrlKey){ // ctrl+, show_more(); } else if ((event.keyCode == 10 || event.keyCode == 13) && event.ctrlKey) { // ctrl+enter submit_message(); } else if (event.keyCode == 27) { // escape close_message(); } else if ((event.keyCode == 73) && event.ctrlKey) { // ctrl+i show_image(); } }); })();