Wpis z mikrobloga

#repostuj

Jakby kogoś #!$%@?ła nowa strona repostuj, to zrobiłem skrypcik do tempermonkey, który pobiera wszystkie "nowe" zdjęcia i wyświetla je w zwykłej liście. Co prawda robi trochę requestów, ale chyba im to nie przeszkadza, skoro tak zmienili interfejs.

// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://www.repostuj.pl/
// @grant none
// ==/UserScript==

(function() {
'use strict';
const startBlocks = $(".post-blocks");
let oldLink = null;
let nextLink = $("#post-prev").attr("href");

$('body').html(startBlocks);

const appendNext = () => {
$.get(nextLink).then(content => {
nextLink = $(content).find("#post-prev").attr("href");
$('body').append($(content).find(".post-blocks"));

if (nextLink && oldLink !== nextLink) {
oldLink = nextLink;
appendNext();
}
});
};

appendNext();
})();