Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Userscript for removing bloat from KissAnime site, also adds random features.

KissAnime Cleaner

You guys may have noticed but I've not been updating this for a while and a few pieces are broken. Feel free to update this on your own if you want to or to use Juici's Fork, which he has kindly been keeping more up to date.

This userscript for KissAnime was made for my personal use to remove large chunks of the site that I do not use, including any options to login or use features only for members. Along the way I ended up adding some other small features listed below.

Features

  • Removes any link, tabs, buttons, pages, etc. that I will never use.
    • Also removes ads on any pages that still remain
  • Use up and down arrow keys to navigate suggested search results box on all pages (top right)
  • Fake fullscreen mode toggle with \ key
    • Maintained across page loads, if you make your browser fullscreen with F11 it will look like real fullscreen. Seek bar is hidden in HTML5 player when in fake fullscreen.
  • Configurable Options (Press Home key on keyboard or the option in the User Script Commands menu for KissAnime Cleaner menu)
    • Pause the video on page load
    • Automatically advance to the next video when the current one finishes
      • Option to chooses how many videos to play (-1 for continuous playback)
    • Automatically scroll down some on video pages
    • Resize Video Area to keep it centered and visible in smaller windows
    • Use the arrow keys to go to the previous or next video (only when video is paused)
    • Use the - and = keys to increase and decrease the playback speed for HTML5 player (flash player does not provide support)
    • Player option (flash, html5) moved to KissAnime Clear menu (home key on keyboard)
    • Select preferred quality (should now work for both flash and html5)
      • Will attempt to set quality of video to selected value or next lowest value if selected is not available
    • Set Player Volume

The script also works on KissCartoon and KissAsian.

Usage

Only tested in FireFox with Greasemonkey (should work with Tapermonkey and Chrome).

  • Get Greasemonkey for FireFox if you don't already have it. link
  • Click on the Raw link for kissanime_cleaner.user.js below, wait 5 seconds, and click install to add the script.

Feel free to borrow, modify, and/or steal any of the script for your own needs. No credit is required.

// ==UserScript==
// @name KissAnime Cleaner
// @namespace 9001
// @description Cleans up KissAnime pages. Tested to work with Firefox and Greasemonkey.
// @include https://kissanime.to/*
// @include http://kissanime.to/*
// @include https://kisscartoon.me/*
// @include http://kisscartoon.me/*
// @include https://kissasian.com/*
// @include http://kissasian.com/*
// @version 3.3.15
// @downloadURL https://gist.github.com/crapier/91926a6353207f4524cc/raw/kissanime_cleaner.user.js
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_registerMenuCommand
// @grant unsafeWindow
// ==/UserScript==
// Prevent script from running in frames and iframes
if (window.top != window.self) {
return;
}
// Get the pages jQuery
var $ = unsafeWindow.jQuery;
// Option constants
var PLAYER_FLASH = 0;
var PLAYER_HTML5 = 1;
// Option variables
var pause_option = GM_getValue("pause", true);
var quality_option = GM_getValue("quality", '1080');
var autoplay_option = GM_getValue("auto", true);
var autoplay_count = GM_getValue("auto_count", -1)
var autoscroll_option = GM_getValue("scroll", true);
var player_option = GM_getValue("player", PLAYER_FLASH);
var resize_option = GM_getValue("resize", true);
var arrow_key_navagation = GM_getValue("arrow_nav", true);
var speed_control = GM_getValue("speed_control", true);
var volume_control = GM_getValue("volume_control", 100);
var remove_login = GM_getValue("remove_login", true);
var remove_comments = GM_getValue("remove_comments", true);
var fake_fullscreen = GM_getValue("fake_fullscreen", false);
// Current page url
var url = document.location.href;
// Regular Expressions to check against for determining what type page currently on and what to clean
var home = /http:\/\/kissanime\.to\/$|https:\/\/kissanime\.to\/$|http:\/\/kisscartoon\.me\/$|https:\/\/kisscartoon\.me\/$|http:\/\/kissasian\.com\/$|https:\/\/kissasian\.com\/$/;
var anime_list = /http:\/\/kissanime\.to\/(AnimeList|Genre|Status|Search|UpcomingAnime)|https:\/\/kissanime\.to\/(AnimeList|Genre|Status|Search|UpcomingAnime)|http:\/\/kisscartoon\.me\/(CartoonList|Status|Genre|Search)|https:\/\/kisscartoon\.me\/(CartoonList|Status|Genre|Search)|http:\/\/kissasian\.com\/(DramaList|Status|Country|Genre|Search)|https:\/\/kissasian\.com\/(DramaList|Status|Country|Genre|Search)/;
var anime_page = /http:\/\/kissanime\.to\/Anime\/[^\/]*$|https:\/\/kissanime\.to\/Anime\/[^\/]*$|http:\/\/kisscartoon\.me\/Cartoon\/[^\/]*$|https:\/\/kisscartoon\.me\/Cartoon\/[^\/]*$|http:\/\/kissasian\.com\/Drama\/[^\/]*$|https:\/\/kissasian\.com\/Drama\/[^\/]*$/;
var video_page = /http:\/\/kissanime\.to\/Anime\/[^\/]*\/[^\/]*\?id=\n*|https:\/\/kissanime\.to\/Anime\/[^\/]*\/[^\/]*\?id=\n*|http:\/\/kisscartoon\.me\/Cartoon\/[^\/]*\/[^\/]*\?id=\n*|https:\/\/kisscartoon\.me\/Cartoon\/[^\/]*\/[^\/]*\?id=\n*|http:\/\/kissasian\.com\/Drama\/[^\/]*\/[^\/]*\?id=\n*|https:\/\/kissasian\.com\/Drama\/[^\/]*\/[^\/]*\?id=\n*/;
//---------------------------------------------------------------------------------------------------------------
// Clean Home page
//---------------------------------------------------------------------------------------------------------------
if (home.test(url)) {
console.log('Performing Cleaning for Home Page');
// Remove Sections from the right side of the page
//Get the rightside from the document
var rightside = document.getElementById('rightside');
// Check if the rightside exist and proceed if it does
if (rightside) {
// Loop through all righside elements
for (var i = 0; i < rightside.childElementCount; i++) {
// Check to make sure element has children
if (rightside.children[i].childElementCount > 0) {
// Check for children that to be removed
if (rightside.children[i].children[0].textContent.search('Remove ads') > 0 ||
rightside.children[i].children[0].textContent.search('Like me please') > 0 ||
rightside.children[i].children[0].textContent.search('omments') > 0) {
// Remove Child if it matches, decrement index to account for removing the child
rightside.removeChild(rightside.children[i--]);
// Check if the next element is a clear2 div and remove it if it is
if (i + 1 > -1 && i + 1 < rightside.childElementCount) {
if (rightside.children[i + 1].className == 'clear2') {
rightside.removeChild(rightside.children[i + 1]);
}
}
}
}
}
}
// Remove Register link in nav sub bar
var navsub = document.getElementById('navsubbar');
if (navsub) {
navsub.children[0].children[0].remove();
navsub.children[0].childNodes[1].remove();
}
//Remove ads
var leftad = document.getElementById('divFloatLeft');
if (leftad) {
leftad.remove();
}
var rightad = document.getElementById('divFloatRight');
if (rightad) {
rightad.remove();
}
var middlead2 = document.getElementById('divAds2');
if (middlead2) {
middlead2.remove();
}
var middlead = document.getElementById('divAds');
if (middlead) {
middlead.remove();
}
// Removes adspaces
var adspace1 = document.getElementById('adsIfrme1');
if (adspace1) {
adspace1.remove();
}
// Remove or hide stubborn ads
var adcheck_count = 0;
var adremover = setInterval(function() {
adcheck_count++;
var body = document.body;
if (body.childElementCount > 1) {
var inital_count = body.childElementCount;
for (var i = inital_count - 1; i > 0 ; i--) {
body.children[i].remove();
}
}
var container = document.getElementById('containerRoot');
var total_elements = container.childElementCount;
for (var i = total_elements - 1; container.children[i].id != 'container' ; i--) {
container.children[i].style.visibility = 'hidden';
container.children[i].style.height = '0px';
container.children[i].style.width = '0px';
}
if (adcheck_count == 50) {
clearInterval(adremover);
}
}, 100);
console.log('Done!');
}
//---------------------------------------------------------------------------------------------------------------
// Clean Anime List Pages
//---------------------------------------------------------------------------------------------------------------
if (anime_list.test(url)) {
console.log('Performing Cleaning for Anime List Pages');
// Remove large spaces left by empty adspace
// Get the ads frame
var adspace = document.getElementById('adsIfrme1');
// If the ad frame was gotten proceed
if (adspace) {
// Check and remove the clear before the adspace
if (adspace.parentElement.previousElementSibling && adspace.parentElement.previousElementSibling.className == 'clear') {
adspace.parentElement.previousElementSibling.remove();
}
// Check and remove the clear a bit after the adspace
if (adspace.parentElement.nextElementSibling && adspace.parentElement.nextElementSibling.nextElementSibling &&
adspace.parentElement.nextElementSibling.nextElementSibling.nextElementSibling &&
adspace.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.className == 'clear') {
adspace.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.remove();
}
// Remove the adspace's parent (and thus it)
adspace.parentElement.remove();
}
//Remove other ads
var leftad = document.getElementById('divFloatLeft');
if (leftad) {
leftad.remove();
}
var rightad = document.getElementById('divFloatRight');
if (rightad) {
rightad.remove();
}
var adspace2 = document.getElementById('adsIfrme2');
if (adspace2) {
adspace2.remove();
}
// Remove or hide stubborn ads
var adcheck_count = 0;
var adremover = setInterval(function() {
adcheck_count++;
var body = document.body;
if (body.childElementCount > 1) {
var inital_count = body.childElementCount;
for (var i = inital_count - 1; i > 0 ; i--) {
body.children[i].remove();
}
}
var container = document.getElementById('containerRoot');
var total_elements = container.childElementCount;
for (var i = total_elements - 1; container.children[i].id != 'container' ; i--) {
container.children[i].style.visibility = 'hidden';
container.children[i].style.height = '0px';
container.children[i].style.width = '0px';
}
if (adcheck_count == 50) {
clearInterval(adremover);
}
}, 100);
console.log('Done!');
}
//---------------------------------------------------------------------------------------------------------------
// Clean Episode List Pages
//---------------------------------------------------------------------------------------------------------------
if (anime_page.test(url)) {
console.log('Performing Cleaning for Episode List Pages');
// Remove large spaces left by empty adspace
// Get the ads frame
var adspace = document.getElementById('adsIfrme1');
// If the ad frame was gotten proceed
if (adspace) {
// Check and remove the clear before the adspace
if (adspace.parentElement.previousElementSibling && adspace.parentElement.previousElementSibling.className == 'clear') {
adspace.parentElement.previousElementSibling.remove();
}
// Check and remove the clear a bit after the adspace
if (adspace.parentElement.nextElementSibling && adspace.parentElement.nextElementSibling.nextElementSibling &&
adspace.parentElement.nextElementSibling.nextElementSibling.nextElementSibling &&
adspace.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.className == 'clear') {
adspace.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.remove();
}
// Remove the adspace's parent (and thus it)
adspace.parentElement.remove();
}
//Remove other ads
var leftad = document.getElementById('divFloatLeft');
if (leftad) {
leftad.remove();
}
var rightad = document.getElementById('divFloatRight');
if (rightad) {
rightad.remove();
}
var middlead = document.getElementById('divAds');
if (middlead) {
middlead.remove();
}
// Remove share stuff from episode list pages
var eplist = $('div.barContent.episodeList')[0].children[1];
if (eplist) {
// Page has episodes
if (eplist.childElementCount > 3) {
// delete all elements before the listings
eplist.children[0].remove();
eplist.children[0].remove();
eplist.children[0].remove();
eplist.children[0].remove();
}
// Page has no episdoes (not aired)
else {
eplist.children[0].remove();
eplist.children[0].remove();
eplist.children[0].remove();
}
}
if (remove_comments) {
// Remove comments
var comment_location = 2;
if (/kissasian/.test(url)) {
comment_location = 3;
}
var comments = $('div.bigBarContainer')[comment_location];
if (comments) {
comments.remove();
}
}
var bookmark_link = document.getElementById('spanBookmark');
if (bookmark_link) {
bookmark_link.remove();
}
// Remove or hide stubborn ads
var adcheck_count = 0;
var adremover = setInterval(function() {
adcheck_count++;
var body = document.body;
if (body.childElementCount > 1) {
var inital_count = body.childElementCount;
for (var i = inital_count - 1; i > 0 ; i--) {
body.children[i].remove();
}
}
var container = document.getElementById('containerRoot');
var total_elements = container.childElementCount;
for (var i = total_elements - 1; container.children[i].id != 'container' ; i--) {
container.children[i].style.visibility = 'hidden';
container.children[i].style.height = '0px';
container.children[i].style.width = '0px';
}
var rightside = document.getElementById('rightside');
total_elements = rightside.childElementCount;
for (var i = total_elements - 1; rightside.children[i].className != 'rightBox' ; i--) {
rightside.children[i].style.visibility = 'hidden';
rightside.children[i].style.height = '0px';
rightside.children[i].style.width = '0px';
}
if (adcheck_count == 50) {
clearInterval(adremover);
}
}, 100);
console.log('Done!');
}
//---------------------------------------------------------------------------------------------------------------
// Clean Video Page
//---------------------------------------------------------------------------------------------------------------
if (video_page.test(url)) {
console.log('Performing Cleaning for Video Page');
// Override functions so they wont be do anything when called by the pages code
// Function to inject into page
var override = function() {
DoDetect2 = function() {}
CheckAdImage = function() {}
}
// Create script to inject
var script1 = document.createElement('script');
script1.type = "text/javascript";
script1.innerHTML = 'var override = ' + override.toString();
// inject the script
document.getElementsByTagName('head')[0].appendChild(script1);
// Call our new function
unsafeWindow.override();
// Removes adspaces
var adspace6 = document.getElementById('adsIfrme6');
if (adspace6) {
adspace6.remove();
}
var adspace7 = document.getElementById('adsIfrme7');
if (adspace7) {
adspace7.remove();
}
var adspace8 = document.getElementById('adsIfrme8');
if (adspace8) {
adspace8.remove();
}
var adspace10 = document.getElementById('adsIfrme10');
if (adspace10) {
adspace10.remove();
}
var adspace11 = document.getElementById('adsIfrme11');
if (adspace11) {
adspace11.remove();
}
var adCheck1 = document.getElementById('adCheck1');
if (adCheck1) {
adCheck1.remove();
}
var adCheck2 = document.getElementById('adCheck2');
if (adCheck2) {
adCheck2.remove();
}
var adCheck3 = document.getElementById('adCheck3');
if (adCheck3) {
adCheck3.remove();
}
var divdownload = document.getElementById('divDownload');
if (divdownload) {
divdownload.remove();
}
var divfilename = document.getElementById('divFileName');
if (divfilename) {
divfilename.remove();
}
// Removes Empty spaces from Video pages
// Remove Clears
var vid_parent = document.getElementById('centerDivVideo').parentElement;
for (var i = 0; i < vid_parent.childElementCount; i++) {
if (vid_parent.children[i].className == 'clear' || vid_parent.children[i].className == 'clear2') {
vid_parent.removeChild(vid_parent.children[i--]);
}
}
vid_parent.children[3].remove();
if (remove_comments) {
// Get the comment section on the video pages
var comments = document.getElementById('btnShowComments');
// If it exist remove it and the element just prior to it also, share stuff of some kind
if (comments) {
comments = comments.parentElement;
comments.previousElementSibling.remove();
comments.previousElementSibling.remove();
comments.previousElementSibling.remove();
comments.remove();
}
// remove comments for kisscartoon site
var alt_comments = document.getElementById('divComments');
if (alt_comments) {
alt_comments.previousElementSibling.remove();
alt_comments.previousElementSibling.remove();
alt_comments.remove();
}
}
// Hide on page quality selector, conflicts with custom menu selector
var page_select_player = document.getElementById('selectPlayer');
if (page_select_player) {
page_select_player.parentElement.style.cssText = 'display:none;';
}
// hide lights off feature that is pointless with ads already removed
var lights_off = document.getElementById('switch');
if (lights_off) {
lights_off.remove();
}
// remove device player link and text
$('.clsTempMSg').remove();
var USE_FLASH_FOR_PAGE;
var YOUTUBE_FLASH_PLAYER;
if (player_option == PLAYER_FLASH) {
if (document.cookie.indexOf('usingFlashV1') < 0) {
// Reload page with correct player
document.cookie = 'usingFlashV1=true;path=/';
document.cookie = 'usingHTML5V1=; expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/';
document.location.href = document.location.href;
}
// check if page actually has youtube info
if (unsafeWindow.jwplayer) {
USE_FLASH_FOR_PAGE = true;
YOUTUBE_FLASH_PLAYER = false;
} else if (unsafeWindow.myPlayer) {
USE_FLASH_FOR_PAGE = false;
YOUTUBE_FLASH_PLAYER = false;
} else {
USE_FLASH_FOR_PAGE = true;
YOUTUBE_FLASH_PLAYER = true;
}
} else {
if (document.cookie.indexOf('usingHTML5V1') < 0) {
// Reload page with correct player
document.cookie = 'usingFlashV1=; expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/';
document.cookie = 'usingHTML5V1=true;path=/';
document.location.href = document.location.href;
}
// check that page actually has html5 player
if (unsafeWindow.myPlayer) {
USE_FLASH_FOR_PAGE = false;
YOUTUBE_FLASH_PLAYER = false;
} else if (unsafeWindow.jwplayer) {
USE_FLASH_FOR_PAGE = true;
YOUTUBE_FLASH_PLAYER = false;
} else {
USE_FLASH_FOR_PAGE = true;
YOUTUBE_FLASH_PLAYER = true;
}
}
// Flash Player
if (USE_FLASH_FOR_PAGE) {
console.log('Using Flash Player');
if (YOUTUBE_FLASH_PLAYER) {
console.log('Using YouTube Player');
// Functions to inject on page for flash video control
// Fires when youtube player is ready
var onYouTubePlayerReady = function(playerId) {
console.log('Youtube Player Custom Controls Initialized');
if (pause_option) {
embedVideo.pauseVideo();
}
embedVideo.addEventListener('onStateChange', 'check_for_end');
// translate option into youtubes quality strings values
var youtube_quality_option;
if (quality_option == '1080') {
youtube_quality_option = 'hd1080';
} else if (quality_option == '720') {
youtube_quality_option = 'hd720';
} else if (quality_option == '480') {
youtube_quality_option = 'large';
} else if (quality_option == '360') {
youtube_quality_option = 'medium';
}
// set the quality
embedVideo.setPlaybackQuality(youtube_quality_option);
// set the volume
embedVideo.setVolume(volume_control);
// focus on the video (so pressing f will fullscreen)
setTimeout('embedVideo.focus();', 0);
// Force position to be absolute (compatibility with 'Turn Off the Lights')
setTimeout(function() {
if (embedVideo.style.cssText.indexOf("position: relative !important") >= 0) {
embedVideo.style.cssText = embedVideo.style.cssText.substr(0, embedVideo.style.cssText.indexOf("position: relative !important;")) + embedVideo.style.cssText.substr(embedVideo.style.cssText.indexOf("position: relative !important") + 30);
}
}, 100);
}
// Check for end of playback and move to next video
var check_for_end = function(state) {
if (state == 0 && autoplay_option && autoplay_count != 0) {
if (autoplay_count > 0) {
autoplay_count--;
if (autoplay_count == 0) {
autoplay_count = -1;
autoplay_option = false;
}
document.dispatchEvent(update_userscript);
}
var button = document.getElementById('btnNext');
if (button) {
var link = button.parentElement;
document.location.href = link.href;
}
}
}
// Create script to inject
var script2 = document.createElement('script');
script2.type = "text/javascript";
script2.innerHTML = 'var onYouTubePlayerReady = ' + onYouTubePlayerReady.toString() + '\n' +
'var check_for_end = ' + check_for_end.toString() + '\n' +
'var pause_option = ' + pause_option.toString() + '\n' +
'var quality_option = "' + quality_option.toString() + '"\n' +
'var autoplay_option = ' + autoplay_option.toString() + '\n' +
'var autoplay_count = ' + autoplay_count.toString() + '\n' +
'var volume_control = ' + volume_control.toString() + '\n' +
'var update_userscript = new Event("UDUS")';
// Inject the script
document.getElementsByTagName('head')[0].appendChild(script2);
// Update values for userscript before switching to next video
document.addEventListener('UDUS', function(event) {
autoplay_count = unsafeWindow.autoplay_count;
autoplay_option = unsafeWindow.autoplay_option;
GM_setValue("auto", autoplay_option);
GM_setValue("auto_count", autoplay_count);
});
}
else {
console.log('Using jwplayer.');
// Functions to inject on page for flash video control
// Fires when youtube player is ready
var flash_player_controls = function () {
// wait till video is loaded into player
jwplayer().onReady(function() {
console.log("jwplayer custom Controls Initialized");
// change the quality to desired flash option
var available_levels = jwplayer().getQualityLevels();
var level_set = false;
var desired_level = parseInt(quality_option);
// try to find exact quality level
for (var i = 0; i < available_levels.length; i++) {
if (desired_level == parseInt(available_levels[i].label)) {
jwplayer().setCurrentQuality(i);
level_set = true;
break;
}
}
// try to find best level alternate
if (!level_set) {
// check if desired level is lower than all available
if (desired_level < parseInt(available_levels[0].label)) {
jwplayer().setCurrentQuality(0);
}
// check if desired level is higher than all available
else if(desired_level > parseInt(available_levels[available_levels.length - 1].label)) {
jwplayer().setCurrentQuality(available_levels.length - 1);
}
// else find level that is next smallest
else {
for (var i = 0; i < available_levels.length; i++) {
if(desired_level < parseInt(available_levels[i].label)) {
jwplayer().setCurrentQuality(i-1);
break;
}
}
}
}
// pause the video if option is enabled
if (pause_option) {
jwplayer().pause();
}
// settup callback for end of video checks
jwplayer().onComplete(check_for_end);
});
}
// Check for end of playback and move to next video
var check_for_end = function () {
var button = document.getElementById('btnNext');
if (button && autoplay_option && autoplay_count != 0) {
if (autoplay_count > 0) {
autoplay_count--;
if (autoplay_count == 0) {
autoplay_count = -1;
autoplay_option = false;
}
document.dispatchEvent(update_userscript);
}
var link = button.parentElement;
document.location.href = link.href;
}
}
// Create script to inject
var script2 = document.createElement('script');
script2.type = "text/javascript";
script2.innerHTML = 'var flash_player_controls = ' + flash_player_controls.toString() + '\n' +
'var check_for_end = ' + check_for_end.toString() + '\n' +
'var pause_option = ' + pause_option.toString() + '\n' +
'var quality_option = "' + quality_option.toString() + '"\n' +
'var autoplay_option = ' + autoplay_option.toString() + '\n' +
'var autoplay_count = ' + autoplay_count.toString() + '\n' +
'var update_userscript = new Event("UDUS")';
// Inject the script
document.getElementsByTagName('head')[0].appendChild(script2);
// call injected function, hopefully after jwplayer has been settup
setTimeout(function() {
unsafeWindow.flash_player_controls();
},500);
// Update values for userscript before switching to next video
document.addEventListener('UDUS', function(event) {
autoplay_count = unsafeWindow.autoplay_count;
autoplay_option = unsafeWindow.autoplay_option;
GM_setValue("auto", autoplay_option);
GM_setValue("auto_count", autoplay_count);
});
}
}
// HTML5 Player
else {
console.log('Using HTML5 Player');
// move quality select below player
var html_quality_select = document.getElementById('selectQuality');
if (html_quality_select) {
var video_area = document.getElementById('centerDivVideo');
var leftover_text = html_quality_select.parentElement;
var empty_div = document.createElement('div');
video_area.parentElement.insertBefore(html_quality_select, video_area.nextSibling);
video_area.parentElement.insertBefore(empty_div, video_area.nextSibling);
leftover_text.remove();
}
// Functions to inject on page for html5 video control
var html5_video_options = function() {
console.log("HTML5 Player custom Controls Initialized");
// change the quality to desired flash option
var available_levels = $('#selectQuality')[0];
var level_set = false;
var desired_level = parseInt(quality_option);
// try to find exact quality level
for (var i = 0; i < available_levels.length; i++) {
if (desired_level == parseInt(available_levels.options[i].innerHTML)) {
available_levels.selectedIndex = i;
$('#selectQuality').change();
$('.clsTempMSg').remove();
level_set = true;
break;
}
}
// try to find best level alternate
if (!level_set) {
// check if desired level is higher than all available
if (desired_level < parseInt(available_levels.options[available_levels.length - 1].innerHTML)) {
available_levels.selectedIndex = available_levels.length - 1;
$('#selectQuality').change();
$('.clsTempMSg').remove();
}
// check if desired level is lower than all available
else if (desired_level > parseInt(available_levels.options[0].innerHTML)) {
available_levels.selectedIndex = 0;
$('#selectQuality').change();
$('.clsTempMSg').remove();
}
// else find level that is next smallest
else {
for (var i = 0; i < available_levels.length; i++) {
if (desired_level > parseInt(available_levels.options[i].innerHTML)) {
available_levels.selectedIndex = i;
$('#selectQuality').change();
$('.clsTempMSg').remove();
}
}
}
}
if (pause_option) {
my_video_1_html5_api.pause();
}
my_video_1_html5_api.volume = volume_control / 100;
my_video_1_html5_api.addEventListener('ended', html5_video_end);
}
var html5_video_end = function() {
var button = document.getElementById('btnNext');
if (button && autoplay_option && autoplay_count != 0) {
if (autoplay_count > 0) {
autoplay_count--;
if (autoplay_count == 0) {
autoplay_count = -1;
autoplay_option = false;
}
document.dispatchEvent(update_userscript);
}
var link = button.parentElement;
document.location.href = link.href;
}
}
// injected speed controls
var playback_decrease = function() {
my_video_1_html5_api.playbackRate -= 0.25;
}
var playback_increase = function() {
my_video_1_html5_api.playbackRate += 0.25;
}
// Create script to inject
var script2 = document.createElement('script');
script2.type = "text/javascript";
script2.innerHTML = 'var html5_video_options = ' + html5_video_options.toString() + '\n' +
'var html5_video_end = ' + html5_video_end.toString() + '\n' +
'var pause_option = ' + pause_option.toString() + '\n' +
'var quality_option = ' + quality_option.toString() + '\n' +
'var autoplay_option = ' + autoplay_option.toString() + '\n' +
'var autoplay_count = ' + autoplay_count.toString() + '\n' +
'var playback_decrease = ' + playback_decrease.toString() + '\n' +
'var playback_increase = ' + playback_increase.toString() + '\n' +
'var volume_control = ' + volume_control.toString() + '\n' +
'var update_userscript = new Event("UDUS")';
// Inject the script
document.getElementsByTagName('head')[0].appendChild(script2);
// Call the injected script
unsafeWindow.html5_video_options();
// Update values for userscript before switching to next video
document.addEventListener('UDUS', function(event) {
autoplay_count = unsafeWindow.autoplay_count;
autoplay_option = unsafeWindow.autoplay_option;
GM_setValue("auto", autoplay_option);
GM_setValue("auto_count", autoplay_count);
});
}
// Scroll to the Container
if (autoscroll_option) {
document.getElementById('container').scrollIntoView(true);
}
var resize_video_area = function() {
if (fake_fullscreen) {
var resize_width = window.innerWidth;
var resize_height = window.innerHeight;
document.getElementById('container').style.width = "" + (resize_width) + "px";
document.getElementById('adsIfrme').style.width = "" + (resize_width) + "px";
$(".barContent")[0].children[0].style.width = "" + (resize_width) + "px";
document.getElementById('centerDivVideo').style.width = "" + (resize_width) + "px";
document.getElementById('centerDivVideo').style.height = "" + (resize_height) + "px";
if (USE_FLASH_FOR_PAGE) {
document.getElementById('divContentVideo').style.width = "" + (resize_width) + "px";
document.getElementById('divContentVideo').style.height = "" + (resize_height) + "px";
document.getElementById('embedVideo').style.width = "" + (resize_width) + "px";
document.getElementById('embedVideo').style.height = "" + (resize_height) + "px";
} else {
document.getElementById('divContentVideo').style.width = "" + (resize_width) + "px";
document.getElementById('divContentVideo').style.height = "" + (resize_height) + "px";
document.getElementById('my_video_1').style.width = "" + (resize_width) + "px";
document.getElementById('my_video_1').style.height = "" + (resize_height) + "px";
}
var seek_bar = $('.vjs-control-bar');
if (seek_bar.length > 0) {
seek_bar[0].style.visibility = 'hidden';
}
document.getElementById('centerDivVideo').scrollIntoView(true);
document.body.style.overflow = 'hidden';
}
else {
var resize_to = window.innerWidth - 30;
if (resize_to > 970) {
resize_to = 970;
}
document.getElementById('container').style.width = "" + (resize_to) + "px";
document.getElementById('adsIfrme').style.width = "" + (resize_to - 20) + "px";
$(".barContent")[0].children[0].style.width = "" + (resize_to - 40) + "px";
document.getElementById('centerDivVideo').style.width = "" + (resize_to - 40) + "px";
document.getElementById('centerDivVideo').style.height = "" + (resize_to - 40) * 552 / 845 + "px";
if (USE_FLASH_FOR_PAGE) {
document.getElementById('divContentVideo').style.width = "" + (resize_to - 40) + "px";
document.getElementById('divContentVideo').style.height = "" + (resize_to - 40) * 552 / 845 + "px";
document.getElementById('embedVideo').style.width = "" + (resize_to - 40) + "px";
document.getElementById('embedVideo').style.height = "" + (resize_to - 40) * 552 / 845 + "px";
} else {
document.getElementById('divContentVideo').style.width = "" + (resize_to - 40) + "px";
document.getElementById('divContentVideo').style.height = "" + (resize_to - 40) * 552 / 845 + "px";
document.getElementById('my_video_1').style.width = "" + (resize_to - 40) + "px";
document.getElementById('my_video_1').style.height = "" + (resize_to - 40) * 552 / 845 + "px";
}
var seek_bar = $('.vjs-control-bar');
if (seek_bar.length > 0) {
seek_bar[0].style.visibility = 'visible';
}
document.body.style.overflow = 'visible';
}
}
if (resize_option) {
window.addEventListener("resize", resize_video_area);
// wait some for vid to get added to page, and initialy resize it
setTimeout(function() {
resize_video_area();
}, 1000);
}
// Keys listener for navigating between episodes with left and right arrow keys
// Arrow key keycodes
var LEFT_ARROW_KEY = 37;
var RIGHT_ARROW_KEY = 39;
var MINUS_DASH_KEY = 173;
var PLUS_EQUALS_KEY = 61;
var BAR_FORWARD_SLASH_KEY = 220;
var key_listener = function(event) {
// Get which key is pressed
var key_pressed = event.which;
if (arrow_key_navagation) {
// check to make sure video isnt playing
if ((USE_FLASH_FOR_PAGE && YOUTUBE_FLASH_PLAYER && unsafeWindow.embedVideo.getPlayerState() == 2) || (USE_FLASH_FOR_PAGE && !YOUTUBE_FLASH_PLAYER && unsafeWindow.jwplayer().getState() == "PAUSED")
|| (!USE_FLASH_FOR_PAGE && my_video_1_html5_api.paused)) {
// Left arrow key to go to previous video
if (key_pressed == LEFT_ARROW_KEY) {
var button = document.getElementById('btnPrevious');
if (button) {
var link = button.parentElement;
document.location.href = link.href;
}
// Prevent Default Action of scrolling
event.preventDefault();
}
// right arrow key for next video
else if (key_pressed == RIGHT_ARROW_KEY) {
var button = document.getElementById('btnNext');
if (button) {
var link = button.parentElement;
document.location.href = link.href;
}
// Prevent Default Action of scrolling
event.preventDefault();
}
}
}
// Speed controls for HTLM5 player (flash doesn't support atm)
if (speed_control && !USE_FLASH_FOR_PAGE) {
if (key_pressed == MINUS_DASH_KEY && unsafeWindow.my_video_1_html5_api.playbackRate > 0.25) {
unsafeWindow.playback_decrease();
}
if (key_pressed == PLUS_EQUALS_KEY && unsafeWindow.my_video_1_html5_api.playbackRate < 5) {
unsafeWindow.playback_increase();
}
}
if (key_pressed == BAR_FORWARD_SLASH_KEY) {
fake_fullscreen = !fake_fullscreen;
GM_setValue('fake_fullscreen', fake_fullscreen);
resize_video_area();
}
}
// Add the listener for keypresses
document.addEventListener("keydown", key_listener);
console.log('Done!');
}
//---------------------------------------------------------------------------------------------------------------
// Clean All pages
//---------------------------------------------------------------------------------------------------------------
console.log('Performing Cleaning for All Pages')
// Remove share stuff next to search bar
// Get the search element near the top of the page
var search = document.getElementById('search');
// If it exist then proceed to remove the child that is the facebook, share stuff next to it
if (search) {
search.children[0].children[2].remove();
}
// Remove Login at the top of the page
if (remove_login) {
var login = document.getElementById('topHolderBox');
if (login) {
login.remove();
}
}
// Remove Tabs I don't Use
var mobile = document.getElementById('liMobile');
if (mobile) {
mobile.remove();
}
var report_error = document.getElementById('liReportError');
if (report_error) {
report_error.remove();
}
var request_anime = document.getElementById('liRequest');
if (request_anime) {
request_anime.remove();
}
var forum = document.getElementById('liCommunity');
if (forum) {
forum.remove();
}
var faq = document.getElementById('liFAQ');
if (faq) {
faq.remove();
}
var manga = document.getElementById('liReadManga');
if (manga) {
manga.remove();
}
// Remove Footer
var footer = document.getElementById('footer');
if (footer) {
footer.remove();
}
// Remove 'random' hides that appear on the sides of the page, all pages
if ($('div.divCloseBut')) {
$('div.divCloseBut').remove();
}
// Keys listener for Script Menu Options
// Home Key Code
var HOME_KEY = 36;
var menu_open = false;
var menu;
var global_key_listener = function(event) {
// Get which key is pressed
var key_pressed = event.which;
if (key_pressed == HOME_KEY) {
// Prevent Default Action of scrolling to top of page
event.preventDefault();
open_menu();
}
}
var open_menu = function() {
if (!menu_open) {
menu_open = true;
// Make div element for menu
menu = document.createElement('div');
menu.style.cssText = 'color:black;width:250px;height:320px;background-color:white;position:fixed;top:0;bottom:0;left:0;right:0;margin:auto;border:5px solid;border-radius:10px;border-color:#7FCA03;padding:10px;z-index:5;';
menu.innerHTML = '<center><b>KissAnime Cleaner Options</b></center>' +
'<form><input style="margin:2px;" type="checkbox" name="pause" value="true" id="pause_option_box"> Pause Videos on Page Load <br>' +
'<input style="margin:2px;" type="checkbox" name="autoplay" value="true" id="autoplay_option_box"> Automatically Play Next <input style="margin:0px;font-size:111%;font-family:Tahoma,Arial,Helvetica,sans-serif;" type="number" name="autoplaycount" id="autoplay_count" min="-1" max="999"> Video(s) (choose -1 to play all)<br>' +
'<input style="margin:2px;" type="checkbox" name="autoscroll" value="true" id="autoscroll_option_box"> Automatically Scroll Down to Video Area <br>' +
'<input style="margin:2px;" type="checkbox" name="resize" value="true" id="resize_option_box"> Resize Video Area <br>' +
'<input style="margin:2px;" type="checkbox" name="arrow_nav" value="true" id="arrow_nav_box"> Arrow Keys Navigate Between Videos <br>' +
'<input style="margin:2px;" type="checkbox" name="speed_playback" value="true" id="playback_speed_control_box"> Enable HTML5 Playback speed controls <br>' +
'<input style="margin:2px;" type="checkbox" name="remove_login" value="true" id="remove_login_box"> Disable Login <br>' +
'<input style="margin:2px;" type="checkbox" name="remove_comments" value="true" id="remove_comments_box"> Disable Comments <br><br>' +
'<center><b>Player Options</b></center>' +
'<table style="width: 100%;border-collapse:separate;border-spacing:2px;"><tr><td><input style="margin:2px;" type="radio" name="player" value="flash" id="flash_option"> Flash Player</td>' +
'<td align="right"><select style="margin:2px;" id="quality_select">' +
'<option value="360">360p</option>' +
'<option value="480">480p</option>' +
'<option value="720">720p</option>' +
'<option value="1080">1080p</option>' +
'</select></td></tr>' +
'<tr><td><input style="margin:2px;" type="radio" name="player" value="html5" id="html5_option"> HTML5 Player</td>' +
'<td align="right">Volume <input style="margin:0px;font-size:111%;font-family:Tahoma,Arial,Helvetica,sans-serif;" type="number" name="volumepercent" id="volume_percent" min="0" max="100"></td></tr></table>' +
'<center><input style="margin:2px;font-size:111%;font-family:Tahoma,Arial,Helvetica,sans-serif;padding:2px 5px 2px 5px;width:44px;height:27px;line-height:3px;" type="button" value="Save" id="menu_sumbit_button"></center></form>';
// Add menu to page
document.getElementById('containerRoot').appendChild(menu);
// Set menus starting options to current values
// Checkboxes
var pause_option_box = document.getElementById('pause_option_box');
if (pause_option) {
pause_option_box.checked = true;
}
var autoplay_option_box = document.getElementById('autoplay_option_box');
if (autoplay_option) {
autoplay_option_box.checked = true;
}
var resize_option_box = document.getElementById('resize_option_box');
if (resize_option) {
resize_option_box.checked = true;
}
var autoplay_count_input = document.getElementById('autoplay_count');
autoplay_count_input.style.width = '40px';
autoplay_count_input.value = autoplay_count;
var autoscroll_option_box = document.getElementById('autoscroll_option_box');
if (autoscroll_option) {
autoscroll_option_box.checked = true;
}
var arrow_nav_box = document.getElementById('arrow_nav_box');
if (arrow_key_navagation) {
arrow_nav_box.checked = true;
}
var playback_speed_control_box = document.getElementById('playback_speed_control_box');
if (speed_control) {
playback_speed_control_box.checked = true;
}
var remove_login_box = document.getElementById('remove_login_box');
if (remove_login) {
remove_login_box.checked = true;
}
var remove_comments_box = document.getElementById('remove_comments_box');
if (remove_comments) {
remove_comments_box.checked = true;
}
// Player radios
var flash_option = document.getElementById('flash_option');
var html5_option = document.getElementById('html5_option');
if (player_option == PLAYER_FLASH) {
if (flash_option) {
flash_option.checked = true;
}
} else if (player_option == PLAYER_HTML5) {
if (html5_option) {
html5_option.checked = true;
}
}
// Quality select
var quality_select = document.getElementById('quality_select');
if (quality_select) {
quality_select.value = quality_option;
}
var volume_percent_input = document.getElementById('volume_percent');
volume_percent_input.style.width = '40px';
volume_percent_input.value = volume_control;
// Get the save button
var submit_button = document.getElementById('menu_sumbit_button');
// Save the values and close the menu
submit_button.onclick = menu_save;
} else {
menu_save();
}
}
var menu_save = function() {
// Get all of the form choices for checking
var pause_option_box = document.getElementById('pause_option_box');
var autoplay_option_box = document.getElementById('autoplay_option_box');
var autoplay_count_input = document.getElementById('autoplay_count');
var autoscroll_option_box = document.getElementById('autoscroll_option_box');
var resize_option_box = document.getElementById('resize_option_box');
var flash_option = document.getElementById('flash_option');
var html5_option = document.getElementById('html5_option');
var quality_select = document.getElementById('quality_select');
var arrow_nav_box = document.getElementById('arrow_nav_box');
var playback_speed_control_box = document.getElementById('playback_speed_control_box');
var volume_percent_input = document.getElementById('volume_percent');
var remove_login_box = document.getElementById('remove_login_box');
var remove_comments_box = document.getElementById('remove_comments_box');
// Update Greasemonkey stored values for options
GM_setValue("pause", pause_option_box.checked);
GM_setValue("auto", autoplay_option_box.checked);
GM_setValue("scroll", autoscroll_option_box.checked);
GM_setValue("auto_count", parseInt(autoplay_count_input.value));
GM_setValue("resize", resize_option_box.checked);
GM_setValue("arrow_nav", arrow_nav_box.checked);
GM_setValue("quality", quality_select.value);
GM_setValue("speed_control", playback_speed_control_box.checked);
GM_setValue("volume_control", volume_percent_input.value);
GM_setValue("remove_login", remove_login_box.checked);
GM_setValue("remove_comments", remove_comments_box.checked);
// Check which player option is checked
if (flash_option.checked) {
// Update greasemonkey stored value
GM_setValue("player", PLAYER_FLASH);
// Set appropriate cookies
document.cookie = 'usingFlashV1=true;path=/';
document.cookie = 'usingHTML5V1=; expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/';
// Reload page if value has changed
if (player_option != PLAYER_FLASH && video_page.test(url)) {
document.location.href = document.location.href;
}
player_option = PLAYER_FLASH;
} else if (html5_option.checked) {
// Update greasemonkey stored value
GM_setValue("player", PLAYER_HTML5);
// Set appropriate cookies
document.cookie = 'usingFlashV1=; expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/';
document.cookie = 'usingHTML5V1=true;path=/';
// Reload page if value has changed
if (player_option != PLAYER_HTML5 && video_page.test(url)) {
document.location.href = document.location.href;
}
player_option = PLAYER_HTML5;
}
// Update this pages userscript options
pause_option = pause_option_box.checked;
autoplay_option = autoplay_option_box.checked;
autoscroll_option = autoscroll_option_box.checked;
arrow_key_navagation = arrow_nav_box.checked;
autoplay_count = parseInt(autoplay_count_input.value);
quality_option = quality_select.value;
speed_control = playback_speed_control_box.checked;
// Update unsafeWindow values that might matter if on video pages
if (video_page.test(url)) {
unsafeWindow.autoplay_option = autoplay_option_box.checked;
unsafeWindow.autoplay_count = parseInt(autoplay_count_input.value);
}
menu.remove();
menu_open = false;
}
// Add the listener for keypresses
document.addEventListener("keydown", global_key_listener);
// Also add as GM menu command
GM_registerMenuCommand("Options Menu", open_menu, "o");
// The search results
var search_results = document.getElementById('result_box');
// The search form text box
var search_form = document.getElementById('keyword');
// Current search selection, -1 if nothing
var search_selection = -1;
// used to scroll search results to current highlighted results
var scroll_height = 0;
// Interval for checking if any results match and appear
var navigation_interval;
// Used to count how many times results are checked for before giving up
var navigation_attempts;
// Key codes
var UP_ARROW_KEY = 38;
var DOWN_ARROW_KEY = 40;
var ENTER_KEY = 13;
// Prevent up and down arrow keys from causing the results to refresh
var prevent_key_reg = function(event) {
var key_pressed = event.which;
if (key_pressed == UP_ARROW_KEY || key_pressed == DOWN_ARROW_KEY) {
event.stopPropagation();
}
}
// Add above in the capture phase of event propagation, so it happens first
document.addEventListener('keyup', prevent_key_reg, true);
// Intercept Enter key press to check if anything is selected
var go_to_selection = function(event) {
var key_pressed = event.which;
if (key_pressed == ENTER_KEY) {
// Check if anything is selected
if (search_selection >= 0 && search_selection < search_results.childElementCount) {
// Go to selection
document.location.href = search_results.children[search_selection].href;
// Prevent form submission
event.preventDefault();
}
}
}
document.addEventListener('keydown', go_to_selection);
// Navigate up and down in search results
var navigate_search_results = function(event) {
var key_pressed = event.which;
if (key_pressed == UP_ARROW_KEY) {
if (search_selection > 0) {
search_results.children[search_selection].style.backgroundColor = '';
search_results.children[--search_selection].style.backgroundColor = '#565E66';
scroll_height -= search_results.children[search_selection + 1].clientHeight;
if (search_selection == 0) {
scroll_height = 0;
}
search_results.scrollTop = scroll_height;
}
}
if (key_pressed == DOWN_ARROW_KEY) {
if (search_selection < search_results.childElementCount - 1) {
if (search_selection >= 0) {
search_results.children[search_selection].style.backgroundColor = '';
}
search_results.children[++search_selection].style.backgroundColor = '#565E66';
scroll_height += search_results.children[search_selection - 1].clientHeight;
search_results.scrollTop = scroll_height;
}
}
}
// Checks if there are navigatable results and adds navigate listener
var reset_navigation = function() {
search_selection = -1;
scroll_height = 0;
++navigation_attempts;
if (search_results.childElementCount > 0) {
document.addEventListener('keydown', navigate_search_results);
clearInterval(navigation_interval);
} else {
document.removeEventListener('keydown', navigate_search_results);
if (navigation_attempts >= 10) {
clearInterval(navigation_interval);
}
}
}
// Called everytime search text box input changes to see if there is navigatable results
var try_navigation = function() {
clearInterval(navigation_interval);
navigation_attempts = 0;
navigation_interval = setInterval(reset_navigation, 200);
}
search_form.addEventListener('input', try_navigation);
console.log('Done!');
@Rhylar
Copy link

Rhylar commented Feb 19, 2016

@crapier I went check. I also checked the other kiss websites. Seems that specific link was the only thing affected. Although I believed I have seen the same symptoms before at another page, I just dont know where. I also happen to notice at the HOMEPAGE, there is a banner at the very bottom left side appearing.

@crapier
Copy link
Author

crapier commented Feb 19, 2016

3.3.12

  • Updated regular expression. (should catch any urls with strange characters now)
  • Also Hides all the new ads that have popped up on the home page and such. Note I had to hide them because every time I tried deleting them they would just move to another place on the page (I tried like 3 times, it was rather amazing). I'll have to look at how they are adding it to the page to see if I can block it completely.

3.3.13

  • Fake fullscreen mode toggle with \ key (makes player take up the full window, not tested with flash, maintained across page loads so it can function kind of like an automatic fullscreen in combination with browser fullscreen mode F11)
  • Thanks to @TheMercz for the idea

They may be changing video hosts/player soon, will work on updating script once things have stabilized again.

@rcdailey
Copy link

rcdailey commented Mar 6, 2016

Anyone noticing this problem? Video can't be started, and has a transparent play button over a progress indicator. The video never loads.

problem

I disabled the user script but it still happens.

@crapier
Copy link
Author

crapier commented Mar 6, 2016

@rcdailey I think they might be having issues with their video hosts again. They may be changing soon, but I'm not sure. If it happens without the userscript then its probably on their end. You might try reporting the video as broken to see if they will reupload it, but if not then you might have to find it somewhere else.

@Rhylar
Copy link

Rhylar commented Mar 6, 2016

Yeah, they do have a new player. It seems to be loading really slow though, plus even when I selected 1080p on their profile it does not switch to that quality automatically. Hopefully it does not affect the script in any way (For example on this new player, latest One Piece Episode: https://kissanime.to/Anime/One-Piece/Episode-732?id=123466 )

@rayout00
Copy link

rayout00 commented Mar 7, 2016

New Openload.io player doesn't automatically scale when you resize the browser window. Dunno if this is just on my end or not, but it doesn't let you select the quality either. Everything else works as usual.

Thanks again for all your hard work.

@rcdailey
Copy link

rcdailey commented Mar 9, 2016

Seems to be working again. I have to complain about the new video player though. They show various frames across the whole episode on the player before you play the video. That's going to cause huge spoilers.

Any way to turn off those snapshots?

@crapier
Copy link
Author

crapier commented Mar 9, 2016

@rcdailey Have they finally settled on a particular player? I don't really want to work to much on the script until they stop faffing about. They seemed to be testing two different ones, openload.io and onedrive. Did they settle on one of these or something different? I'll have to check what api functions are available for they player they settle on, as well as possibly rework the script for the video pages, because they seem to be placing the video in and iframe instead of directly on the page.

@Vowen32
Copy link

Vowen32 commented Apr 21, 2016

Can you add checkboxes on the menu for keeping the download and bookmark section? :)

@crapier
Copy link
Author

crapier commented Apr 28, 2016

@Vowen32 Sry been busy with school. Once the semesters over I'll look into adding that, and fixing a few bugs I've noticed.

@Rhylar
Copy link

Rhylar commented Jun 11, 2016

@crapier Hey boss, when you are back, would you be able to have the option to select what server you want to view your video. I find that sometimes if the KissAnime server doesnt work, I had to use the other ones they offer like Stream or Openload to watch and I had to turn off the Cleaner Script to access the server selector. Thank you for your hard work.

@crapier
Copy link
Author

crapier commented Jul 6, 2016

@Rhylar will add that to my todo list, still a bit busy

@crapier
Copy link
Author

crapier commented Jul 8, 2016

@gaveitatry
Try using a more accurate selectors so you only mess with the correct things.
Assuming I'm thinking of the right thing try using this instead

$(".barTitle")[0].innerHTML = $(".barTitle")[0].innerHTML.replace('information', "")
And place it around line 312 so it will only activate on episode list pages

and for the anime pages themselves
$("#navsubbar")[0].innerHTML = $("#navsubbar")[0].innerHTML.replace('information', "")
Place it around line 899 so it will only activate on the video pages

@xTDAround
Copy link

xTDAround commented Jul 14, 2016

@graveitatry

This was killing me for a while, but once you mentioned that the site would redirect to http:// instead of https://, I realized how easy of a fix this was.

You were correct about implementing "http://" into the script. After including the // @include "http://kissanime.to" into the mix, the scripts starts taking effect on the site.

However, although running, it isn't injecting correctly.
This is solved at the "// Curent Page url" section; just added http://kissanime.to/ and everything worked.

It should look like this:

// Current page url
var url = document.location.href;
// Regular Expressions to check against for determining what type page currently on and what to clean
var home = /http://kissanime.to/$|https://kissanime.to/$|http://kisscartoon.me/$|http://kissasian.com/$/;
var anime_list = /http://kissanime.to/(AnimeList|Genre|Status|Search|UpcomingAnime)|https://kissanime.to/(AnimeList|Genre|Status|Search|UpcomingAnime)|http://kisscartoon.me/(CartoonList|Status|Genre|Search)|http://kissasian.com/(DramaList|Status|Country|Genre|Search)/;
var anime_page = /http://kissanime.to/Anime/[^\/]$|https://kissanime.to/Anime/[^\/]$|http://kisscartoon.me/Cartoon/[^\/]$|http://kissasian.com/Drama/[^\/]$/;
var video_page = /http://kissanime.to/Anime/[^\/]/[^\/]?id=\n_|https://kissanime.to/Anime/[^\/]/[^\/]?id=\n_|http://kisscartoon.me/Cartoon/[^\/]/[^\/]?id=\n_|http://kissasian.com/Drama/[^\/]/[^\/]?id=\n_/;

@thomasjurgen
Copy link

thomasjurgen commented Jul 14, 2016

I've @include http://kissanime.to, and the updated regular expressions, and some things from the Home button menu work, but others still not work, like pausing videos when i load page, and using + and - to modify the video speed. Also, i still see some ads, and empty frames where the removed ads should have been.

@thomasjurgen
Copy link

thomasjurgen commented Jul 14, 2016

It works now! Thanks

@xTDAround
Copy link

xTDAround commented Jul 15, 2016

@gaveitatry

Oh, yeh, I'm new to Github commenting...don't know what tags do what (I don't really do forums).
But anyway, thanks for posting the corrected code up.

@Rhylar
Copy link

Rhylar commented Jul 18, 2016

Oooh, The whole Kiss Network is full of popup ads now too. I think this community will be grateful for your updated version @crapier. Thank you very much.

@BDubbB
Copy link

BDubbB commented Jul 19, 2016

Will the fix for Kissanime Cleaner's include section be implemented as an update or should I go in and mess with it all manually?

@crapier
Copy link
Author

crapier commented Jul 21, 2016

I've updated it so it should match if they change the http/https for any of the sites now, but I can't test it cause I can't connect to kissanime right now. Have been busy and not got around to watching much anime or anything really, so sorry for the slow updates.

Freetime is so nice to have, but when you don't have it you miss it T.T

Edit: as for the popups I have an idea that might be able to block those, but I can't implement and test anything for a while probably? (plus I cant access kissanime atm)

@dayleboi
Copy link

dayleboi commented Jul 24, 2016

you sir are a legend, i had already managed to remove the ads and get around the adblock-blocker, but the autoplay is amazing i've wanted that site to have that for a good while now, and might i add another thank you for removing those comments, i could not handle the stupidity of some of the sites users. so once more, thank you so much, i will be recommending this script to all my friends that use that site. amazing work!

Copy link

ghost commented Sep 1, 2016

I can't view any videos on kissanime, I think they edit somethings since recently the site had been unstable and always service unavailable.

@thomasjurgen
Copy link

thomasjurgen commented Sep 1, 2016

Can anyone help with this problem? http://i.imgur.com/mbvBR3s.png
The add-on works fine on other pages, but on anime pages it fails to remove certain elements like the login, and that panel with firefox, and it also doesn't show the video.

Also, i don't know if it's possible, but lately there have been some pop-up ads which show up when you click on the site, it would be nice if this script could remove that too.

@Juici
Copy link

Juici commented Sep 1, 2016

@TK17 @romagia
I have created a fork to fix an issue that appears to have cropped up today. The issue involves the accidental removal of the video from the page; this fork fixes that.

@crapier
I'd be honoured if you'd include this fix in your version, no credit needed.

@romagia
For the pop-ups i found using the Adblock Plus Pop-up Addon and disallowing popups in the firefox settings sufficiently blocks popups

Copy link

ghost commented Sep 1, 2016

@Juici I can view the videos now after updating the script, thanks a lot.

@Juici
Copy link

Juici commented Sep 8, 2016

@gaveitatry
That seems like a bad bug. If you don't mind could you tell me your:

  • browser (firefox, chrome, etc.)
  • userscript extension/addon (greasemonkey, tampermonkey, etc.)
  • other extensions/addons that might affect the anime page such as adblock (and it's filters)
  • other userscripts that are running on the page.

It'd be a real help to pinpoint the issue if you can, because as of yet I haven't experienced this problem and have no way of replicating it to find out the issue.

@crapier
Copy link
Author

crapier commented Nov 8, 2016

You guys may have noticed but I've not been updating this for a while and a few pieces are broken. Feel free to update this on your own if you want to or to use Juici's Fork, which he has kindly been keeping more up to date.

@Juici (or anyone else) If you have any questions about my code feel free to still ask them here and I'll try to respond as soon as I can.

Copy link

ghost commented Dec 21, 2016

After the crisis of kissanime, all the hacking nonsense and DMCA takedowns, kissanime is finally back http://kissanime.ru/ .But the script doesn't seem to be working anymore, as expected since they changed their servers and upgrade their site alot recently. So can you also update the script or ask someone to instead? much appreciated. Also their facebook got hacked so this is their new account; https://www.facebook.com/kissanimefp/

@Ryuza
Copy link

Ryuza commented Mar 15, 2017

The video playback speed commands were working just fine yesterday, but not today. I am using the HTML5 player. Everything else works. I tried
-Restarting my browser
-Restarting my computer
-Disabling all other scripts
-Uninstalling and reinstalling the script
-Using Juici's fork.

@lofyihutre
Copy link

lofyihutre commented Nov 27, 2017

Okay so I Know there isn't really a right way to watch kisscartoon but I didn't know how else to title this blog

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