Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.