Skip to content

Instantly share code, notes, and snippets.

@SonofUgly
Last active August 28, 2018 23:36
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 SonofUgly/db7ed64cae414bb8fa65d9d1152ea25b to your computer and use it in GitHub Desktop.
Save SonofUgly/db7ed64cae414bb8fa65d9d1152ea25b to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Archive Unrestricted
// @namespace archiveorgUnrestricted
// @description None
// @include *://archive.org/download/*
// @include *://archive.org/details/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// @version 1.0
// @grant none
// ==/UserScript==
// Add link to restricted files
$('tr.directory-listing-table__restricted-file td:first-child').each(function(){
$(this).html('<a name="' + $(this).html() + '" href="'+$(this).html()+'">'+$(this).html()+'</a>');
});
// Change restricted file text color
$('tr.directory-listing-table__restricted-file').css('color', '#333');
// Remove lock symbol
$('tr.directory-listing-table__restricted-file td:nth-child(4)').remove();
// Remove restricted file warning
$('div.download-directory-listing pre p').remove();
// Clone .zip and .rar links to a 4th column
$('tr.directory-listing-table__restricted-file').each(function(){
if($(this).not(':contains(".zip_meta.txt")').is(':contains(".zip"),:contains(".rar")')){
$('td:first',this).clone().insertAfter($('td:last',this));
}
});
// Add '/' to 4th column links and change text to 'View archive'
$('table.directory-listing-table tr td:nth-child(4) a').each(function(){
this.href = this.href.replace(/\.(zip|rar)/,".$1/")
$(this).text("View archive");
});
// Truncate extra long links
$("table.directory-listing-table td:first-child a").each(function() {
var $link = $(this);
var text = $link.text();
if(text.length > 108) {
$link.text(text.substring(0, 104) + "...");
}
});
// Change TV borrow link text to download
$('#tvborrow').text('Download this video');
// Remove Stream Only notice
$('div.download-button.streamo').remove();
// Change DVD borrow link to download link
$('a.stealth:nth-child(1)').each(function(){
this.href = this.href.replace('services/borrow', 'download');
});
// Change book borrow link text to download
$('.download-lending-message > a:nth-child(1)').each(function(){
$(this).text("Download");
});
// Change book borrow redirect to download link
$('.download-lending-message > a:nth-child(1)').each(function(){
this.href = this.href.replace('details', 'download');
this.href = this.href.replace('#maincontent', '');
});
// Change loggedin tag to be more noticeable
$('div.item-details-metadata > div > span.value > a[href*="/details/loggedin"]').each(function(){
$(this).css({'font-weight' : 'bold', 'color' : '#F00'})
$(this).text("LOG IN REQUIRED");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment