Skip to content

Instantly share code, notes, and snippets.

@glinesbdev
Last active January 3, 2020 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glinesbdev/3b1cef601fe48069fc6961bcde432b54 to your computer and use it in GitHub Desktop.
Save glinesbdev/3b1cef601fe48069fc6961bcde432b54 to your computer and use it in GitHub Desktop.
Tamper Monkey Scripts
// ==UserScript==
// @name Gitlab search shortcut
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Gives a keyboard shortcut to the search field in Gitlab
// @author Bradyn Glines
// @include /^https:\/\/gitlab\.*/*/
// @grant none
// ==/UserScript==
(function() {
'use strict';
var keys = [];
document.addEventListener('keydown', e => {
var search = document.querySelector("#search");
keys.push(e.key);
if (search) {
if (keys.includes('/') && keys.includes('Meta')) {
search.focus();
}
if (e.key === 'Escape') {
search.blur();
}
}
})
document.addEventListener('keyup', e => {
keys = [];
})
})();
// ==UserScript==
// @name YouTube 'Like' Keyboard Shortcut
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Like a YouTube video with a keyboard shortcut
// @author Bradyn Glines
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
if (window.location.href.indexOf('watch?v=') > -1) {
document.addEventListener('keyup', e => {
if (e.key === ';') {
document.querySelector('#menu-container a').click();
}
});
}
})();
// ==UserScript==
// @name YTMusic Skip Ad
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Keyboard shortcut to skip YT Music ads
// @author Bradyn Glines
// @match https://*.youtube.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
if (window.location.href.indexOf('watch?v=') > -1) {
document.addEventListener('keyup', e => {
if (e.key === '.') {
document.querySelector('.ytp-ad-skip-button.ytp-button').click();
}
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment