Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Better GDOS
- // @match https://www.gov.pl/web/gdos/obwieszczenia-i-zawiadomienia3
- // @grant none
- // @version 1.0
- // @author bad455
- // ==/UserScript==
- $(function() {
- let $articles = $('.article-area__article li > a'),
- articles = JSON.parse(localStorage.getItem('articles') || '{}');
- $articles.each(function() {
- let $article = $(this),
- href = $article.attr('href');
- if(articles.hasOwnProperty(href)) {
- displayDesc($article, articles[href]);
- return;
- }
- $.get(href, function(response) {
- let desc = $(response).find('.article-area__article .editor-content p').text();
- displayDesc($article, desc);
- articles[href] = desc;
- localStorage.setItem('articles', JSON.stringify(articles));
- });
- });
- });
- function displayDesc($article, desc) {
- let $desc = $('<div>'+desc+'</div>').insertAfter($article);
- $article.css('margin-bottom', '0.5em');
- $desc.css('margin-bottom', '2em');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement