NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name NCore-csatolt-kepek-a-listaba
// @namespace ncore
// @version 1.0.0
// @description A details-ben felcsatolt képeket megmutatja a fő listába kinyitás nélkül
// @author loverseny
// @match https://ncore.cc/torrents*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
const waitInSec = 3;
Object.defineProperty(Array.prototype, 'chunk_inefficient', {
value: function(chunkSize) {
var array = this;
return [].concat.apply([],
array.map(function(elem, i) {
return i % chunkSize ? [] : [array.slice(i, i + chunkSize)];
})
);
}
});
let $head = $("head").append(`
<style>
.customPreview {
padding-left: 3px;
width: 290px;
}
.fastDownload {
width: 25px;
}
.fastImage {
margin-bottom: 20px;
}
.banner {
display: none !important;
}
.torrent_lenyilo_tartalom {
display: none;
}
.torrent_txt {
width: 90% !important;
}
.torrent_txt2 {
width: 90% !important;
}
.box_nagy {
height: auto !important;
}
.box_nagy2 {
height: auto !important;
}
</style>
`);
function openTorrent(boxElems, idx) {
try {
let boxElem = $(boxElems.get(idx));
let openDetailsLinkElem = boxElem.find(".box_nev2 div[class*='torrent_txt'] a");
openDetailsLinkElem.trigger("click");
let torrentId = openDetailsLinkElem.attr('href').match(/id=\d+/g)[0].replace('id=','');
setTimeout( () => {
$('#' + torrentId + ' .torrent_lenyilo_lehetoseg').append('<div class="download_separ"></div><div class="fajlok_txt"><a href="javascript:void();" onclick="$(\'#'+torrentId+' .torrent_lenyilo_tartalom\').toggle()">Toggle</a></div>');
let findResult = $('#' + torrentId + ' td.kepmeret_ico a');
let images = '';
findResult.each(idx2 => {
let imgLink = $(findResult.get(idx2)).attr("href");
images += '<img class="customPreview" src="'+imgLink+'" />';
});
setTimeout(()=>{ $('#' + torrentId).append('<div class="fastImage">'+images+'</div>'); }, 100);
}, 1000 * waitInSec);
} catch (e) {
console.error(e);
}
}
let boxElems = $('.box_torrent');
let tmpArr = [];
for (var i = 0; i < boxElems.length; i++) {
tmpArr.push(i);
}
tmpArr.chunk_inefficient(12).forEach( (v, i) => {
setTimeout(function(){
v.forEach(i2 => {
openTorrent(boxElems, i2);
});
}, 1000 * waitInSec * i);
});
})();