NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name 4shared garimpador
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Infinite Scroll no Search com a listagem em modo 'miniatura' + Visualização Alternativa de Pastas
// @author poots
// @collaborator garimpador
// @match *.4shared.com/*
// @require https://code.jquery.com/jquery-2.2.4.min.js
// @updateURL https://openuserjs.org/meta/garimpador/4shared_garimpador.meta.js
// @grant none
// ==/UserScript==
(function ($, undefined) {
$(function () {
var isFolder = window.location.href.search("/folder/") !== -1;
var isSearch = window.location.href.search("search.4shared.com/") !== -1;
if (isSearch) {
var lista = $("#list_view").is('.cheked_view');
var pontoCarrega = $('.pagerOn').offset().top;
var triggered = false;
$(window).scroll(function () {
if ((($(this).scrollTop() + $(window).height()) >= pontoCarrega) && !triggered) {
var proximoLink = $('.pagerOn').next('td').find('a').attr('href');
triggered = true;
if (typeof(proximoLink) !== 'undefined') {
$.ajax({
'url' : proximoLink,
'success' : function(data){
if (!lista) {
var novoPager = $("table:has(.pager):last", data);
var maisItems = $(".res_table:last .item", data);
$('.res_table .item:last').after(maisItems);
$("table:has(.pager):last").replaceWith(novoPager);
pontoCarrega = $('.pagerOn').offset().top;
triggered = false;
}
}
});
}
}
});
}
if (isFolder) {
var link = window.location.href.replace("/folder", "//folder");
$(".d1mainButtons .centered").append("<a href='" + link + "' class='d1btn floatRight' style='background: #2679d3 !important; color: #fff !important;'>Visualização Alternativa</a>");
}
});
})(window.jQuery.noConflict(true));