Skip to content

Instantly share code, notes, and snippets.

@seangenabe
Last active November 18, 2017 16:56
Show Gist options
  • Save seangenabe/cc7cd26c791d16d244d7 to your computer and use it in GitHub Desktop.
Save seangenabe/cc7cd26c791d16d244d7 to your computer and use it in GitHub Desktop.
kasi-time enabler
// ==UserScript==
// @name kasi-time enabler
// @namespace http://example.com/
// @version 0.2
// @description
// @match http://www.kasi-time.com/*
// @copyright 2012+, You
// @downloadUrl https://gist.github.com/seangenabe/cc7cd26c791d16d244d7/raw/kasi-time.user.js
// @updateUrl https://gist.github.com/seangenabe/cc7cd26c791d16d244d7/raw/kasi-time.user.js
// ==/UserScript==
var filter = Function.prototype.call.bind(Array.prototype.filter);
var body = document.body;
body.oncontextmenu = null;
body.onselectstart = null;
body.oncopy = null;
body.style.webkitUserSelect = 'initial';
document.onkeydown = null;
$(window).load(function() {
var lyrics = document.getElementById('lyrics')
lyrics.style.webkitUserSelect = null;
$('body').off('copy contextmenu selectstart', false);
$('body').css({
'-moz-user-select': 'initial',
'-khtml-user-select': 'initial',
'-ms-user-select': 'initial',
'-webkit-user-select': 'initial',
'user-select': 'initial'
})
// Adds a Select All button to quickly select all lyrics.
var button = document.createElement('button');
button.addEventListener('click', function() {
var selection = window.getSelection();
selection.removeAllRanges();
var range = document.createRange();
range.selectNode(lyrics);
selection.addRange(range);
});
button.appendChild(document.createTextNode('Select All'));
document.querySelector('.lyrics_menu').appendChild(button);
// Enables printing
var limitingStyle = filter(document.head.querySelectorAll('style'), function(s) {
return ~s.innerText.indexOf("印刷禁止");
});
$(limitingStyle).remove();
// Remove ads
$('.ad, .ad2').remove();
});
@seishun
Copy link

seishun commented Nov 18, 2017

Doesn't work in Firefox 57 and Greasemonkey 4. Try https://github.com/furyutei/KashiKaikin instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment