Created
March 21, 2022 14:31
-
-
Save danzig666/2ca7cfba4bca1bfb8bbf6df507a7e7a2 to your computer and use it in GitHub Desktop.
nCore++ 2022-03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name nCore++ | |
// @namespace [email protected] | |
// @version 0.3.5 | |
// @description Various improvements to nCore | |
// @author nyuszika7h/Danzig | |
// @match https://ncore.pro/* | |
// @grant GM.xmlHttpRequest | |
// ==/UserScript== | |
/* globals $ */ | |
(function() { | |
'use strict'; | |
const VERSION = GM_info.script.version; | |
const modules = { | |
Login2FARedirectFix() { | |
// NOTE: Login oldalon nincs jQuery | |
if (location.pathname === '/login.php' && location.search) { | |
document.querySelector('a[href="/login.php?2fa"]').href = '/login.php?2fa' + location.search.replace('?', '&'); | |
} | |
}, | |
UnDeReferer() { | |
$('a[href^="https://dereferer.me/?"]').each((i, el) => { | |
const $el = $(el); | |
const oldUrl = $el.attr('href'); | |
$el.attr('href', oldUrl.slice(22)); | |
const newUrl = $el.attr('href'); | |
console.log(`nCore++: UnDeReferer: ${oldUrl} -> ${newUrl}`); | |
$el.prop('rel', 'noreferrer'); | |
}); | |
$('a[href^="https://dereferer.link/?"]').each((i, el) => { | |
const $el = $(el); | |
const oldUrl = $el.attr('href'); | |
$el.attr('href', oldUrl.slice(24)); | |
const newUrl = $el.attr('href'); | |
console.log(`nCore++: UnDeReferer: ${oldUrl} -> ${newUrl}`); | |
$el.prop('rel', 'noreferrer'); | |
}); | |
}, | |
GETSearch() { | |
$('#kereses_mezo').prop('method', 'GET'); | |
}, | |
IMDBLiveRating() { | |
const $imdbRating = $('.inforbar_txt td:contains("IMDb értékelés:")').next(); | |
if ($imdbRating.length === 0) { | |
return; | |
} | |
const imdbUrl = $imdbRating.parent().next().find('a').prop('href')+'/reference'; | |
console.log(`nCore++: IMDBLiveRating: querying ${imdbUrl}`); | |
GM.xmlHttpRequest({ | |
method: 'GET', | |
url: imdbUrl, | |
onload: resp => { | |
const $resp = $(resp.responseText); | |
const oldRating = $imdbRating.text(); | |
const newRating = $resp.find('.ipl-rating-star__rating').first().text().trim().split('/')[0]+' '+$resp.find('.ipl-rating-star__total-votes').text().trim() | |
console.log(`nCore++: IMDBLiveRating: ${oldRating} -> ${newRating}`); | |
$imdbRating.text(newRating).css('font-weight', 'bold'); | |
} | |
}); | |
}, | |
NewsLink() { | |
window.newslink = () => { | |
console.debug('nCore++: NewsLink: adding links'); | |
$('.news').each((i, el) => { | |
const newsId = $(el).prop('id').split('_')[2]; | |
const newsLink = `https://ncore.pro/?action=news&id=${newsId}`; | |
if ($(el).find('.news_right_top').text().includes('[link]')) { | |
return; | |
} | |
$(el).find('.comment').after(`<a href="${newsLink}" style="float: right; margin-left: 1em">[link]</a>`); | |
}); | |
}; | |
window.newslink(); | |
unsafeWindow.more_news = function more_news(honnan,kizart){ | |
$('#korabbi_div').remove(); | |
$('#korabbi').html($('#korabbi').html()+"<p id=\"ajax_loader_more\" align=\"center\">"+window.ajax_loader+"</p>"); | |
$.get("ajax.php?action=news_more&h="+honnan+"&k="+kizart,function(data){ | |
$('#ajax_loader_more').remove(); | |
$('#korabbi').html($('#korabbi').html()+data); | |
$("img.lazy").lazyload({ | |
effect : "fadeIn" | |
}); | |
window.newslink(); | |
}); | |
} | |
}, | |
BetterTorrentList() { | |
// Torrent nevek szélesítése | |
$('.torrent_txt > a, .torrent_txt2 > a').each((i, el) => { | |
$(el).text($(el).prop('title')); | |
$(el).css({ | |
'display': 'block', | |
'overflow': 'hidden', | |
'text-overflow': 'ellipsis', | |
'white-space': 'nowrap', | |
}); | |
$(el).parent().css('width', '400px'); | |
}); | |
// Anonymous feltöltő oszlop helyett letöltés link | |
const passkey = $('link[rel="alternate"]').prop('href').split('=')[1]; | |
$('.box_feltolto').text('Részletek'); | |
$('.box_feltolto2').each((i, el) => { | |
const torrentId = $(el).parent().find('[class^="torrent_txt"] a').prop('href').split('=')[2]; | |
//const downloadLink = `https://ncore.pro/torrents.php?action=download&id=${torrentId}&key=${passkey}`; | |
const downloadLink = `https://ncore.pro/torrents.php?action=details&id=${torrentId}`; | |
$(el).html(`<a href="${downloadLink}" title="Torrent letöltése">Details</a>`); | |
}); | |
}, | |
}; | |
console.log(`nCore++ version ${VERSION} loaded`); | |
Object.entries(modules).forEach(([name, init]) => { | |
console.log(`nCore++: Loading module: ${name}`); | |
init(); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment