NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name 1337x Magnets Next To Links
// @namespace c@demcooki.es
// @version 1.4
// @description Adds a magnet links next to links to torrents in search results and lists
// @license MIT
// @author demcookies
// @oujs:author dem
// @match *://1337x.to/*
// @match *://1337x.st/*
// @match *://1337x.ws/*
// @match *://1337x.eu/*
// @match *://1337x.se/*
// @match *://1337x.is/*
// @match *://1337x.gd/*
// @grant none
// ==/UserScript==
// ==OpenUserJS==
// @author dem
// ==/OpenUserJS==
(function() {
'use strict';
var paths = ['/popular-', '/top-', '/trending', '/home', '/cat/', '/sub/', '-torrents/', 'user/', 'search/'];
var path = location.pathname;
if (!paths.map(x => path.includes(x) ? true : false).some(Boolean)) {
return;
}
var jQ = window.jQuery;
var torrents = jQ('.table-list tbody .name');
torrents.each(function(){
jQ(this).css('padding-left', '60px');
jQ(this).append(
jQ('<a/>', {
'class': 'mgn',
'href': 'javascript:;'
}).text('🧲')
);
});
jQ('.mgn').css({
'position': 'absolute',
'left': '38px',
'top': '50%',
'margin-top': '-10px',
'font-size': '13px',
'transform': 'rotate(-90deg)'
});
jQ('.mgn').on('click', function(){
if (jQ(this).attr('href') == 'javascript:;') {
var url = jQ(this).parent().find('a').eq(1).attr('href');
var e = jQ(this);
jQ.ajax({
url: url,
success: function(response) {
var mag = jQ(response).find('.no-top-radius').first().find('.clearfix li a').first().attr('href');
e.attr('href', mag);
e.off('click');
location.href = mag;
}
});
} else {
jQ(this).off('click');
location.href = jQ(this).attr('href');
}
});
})();