Skip to content

Instantly share code, notes, and snippets.

@dvingerh
Created September 17, 2018 13:57
Show Gist options
  • Save dvingerh/7d200cdea24b43e5543dae4ee9149c73 to your computer and use it in GitHub Desktop.
Save dvingerh/7d200cdea24b43e5543dae4ee9149c73 to your computer and use it in GitHub Desktop.
akes it easier to visually identify freeleech torrents and torrents with no seeders on PTP
// ==UserScript==
// @name PTP Clear View Improved
// @namespace https://passthepopcorn.me
// @version 1.0
// @description Makes it easier to visually identify freeleech torrents and torrents with no seeders on PTP
// @author jax913, cammy
// @match https://passthepopcorn.me/torrents.php*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js
// @grant MIT
// ==/UserScript==
this.$ = this.jQuery = jQuery.noConflict(true);
var color_green = "#418b00";
var color_red = "#d14841";
var color_purple = "#c269e0";
var text_shadow = true; // If true, adds a bit of text shadow to freeleech text colors
var freeleech_colors = true; // If true, adds color to 'Freeleech!' and 'Half-leech!' texts behind freeleech torrents
var fade_dead_torrents = true; // If true, reduces the opacity of torrents without any seeders to make seeded torrents stand out more
var fade_non_freeleech = true; // If true, reduces the opacity of non-freeleech torrents when specifically searching for freeleech torrents (freetorrent=1 in the url) - dead torrents will still be faded if enabled
var bought_freeleech_time_color = true; // If true, adds a color to the "User bought freeleech from X" timestamp on relevant torrents
jQuery(document).ready(function() {
jQuery('.basic-movie-list__torrent-row').each(function( val ) {
var foundFree = jQuery(this).find('.torrent-info__download-modifier--free');
var foundHalf = jQuery(this).find('.torrent-info__download-modifier--half');
if (fade_non_freeleech){
if (jQuery.inArray('freetorrent=1',window.location.search.substring(1).split('&')) == true) {
if ( foundFree.length == 1 || foundHalf.length == 1 ) {
jQuery(this).css('opacity', '1');
}
else {
jQuery(this).css('opacity', '0.5');
}
}
}
if (freeleech_colors) {
if ( foundFree.length || foundHalf) {
jQuery(foundFree).css("color", color_green);
jQuery(foundHalf).css("color", color_green);
if (text_shadow) {
jQuery(foundFree).css("text-shadow", "0px 0px 2px " + color_green);
jQuery(foundHalf).css("text-shadow", "0px 0px 2px " + color_green);
}
}
}
if (fade_dead_torrents) {
var foundSeeders = jQuery(this).find('.no-seeders').length != 1;
if (! foundSeeders) {
jQuery(this).css('opacity', '0.5');
}
}
});
jQuery('tr[class$="group_torrent_header"]').each(function( val ) {
var foundFree = jQuery(this).find('.torrent-info__download-modifier--free');
var foundHalf = jQuery(this).find('.torrent-info__download-modifier--half');
if (fade_dead_torrents) {
var foundSeeders = jQuery(this).find('.no-seeders').length != 1;
if (! foundSeeders) {
jQuery(this).css('opacity', '0.5');
}
}
if (freeleech_colors) {
if (foundFree || foundHalf) {
jQuery(foundFree).css("color", color_green);
jQuery(foundHalf).css("color", color_green);
if (text_shadow) {
jQuery(foundFree).css("text-shadow", "0px 0px 2px " + color_green);
jQuery(foundHalf).css("text-shadow", "0px 0px 2px " + color_green);
}
}
}
});
if (bought_freeleech_time_color) {
jQuery('h2.text--center').find("span.time").css("color", color_purple);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment