500px.com View

Gets you to the real image (and more)!

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         500px.com View
// @namespace    github.com/hrxn
// @version      0.5
// @description  Gets you to the real image (and more)!
// @author       Hrxn <github.com/hrxn>
// @license      Creative Commons BY-NC-SA
// @match        *://500px.com/*
// @grant        none
// @icon         https://assetcdn.500px.org/assets/favicon-1e8257b93fb787f8ceb66b5522ee853c.ico
// ==/UserScript==
'use strict';

var fivehundredpx = function () {
    var resrc = [];
    var rname = [];
    function conWrite(link, title) {
        console.log(link);
        console.log(title);
    }
    function addLinks(src, fn) {
        var el = document.querySelector('.main_container .sidebar_region .actions_region');
        el.insertAdjacentHTML('afterEnd', '<a href="' + src + '" target="_blank"> [ View... ] </a> | <a href="' + src + '" download="' + fn + '"> [ Try Download... ] </a>');
    }
    function aryreset() {
        resrc = [];
        rname = [];
    }
    function afilters(s1, s2) {
        s2 = s2.replace(" on 500px", "");
        resrc.push(s1);
        rname.push(s2);
        if (resrc.length > 1 && rname.length > 1) {
            var r1 = resrc[resrc.length - 1];
            var r2 = rname[rname.length - 1];
            addLinks(r1, r2);
            conWrite(r1, r2);
            aryreset();
        } else {
            var r3 = resrc[0];
            var r4 = rname[0];
            addLinks(r3, r4);
            conWrite(r3, r4);
        }
    }
    var observerHandler = function (mutations) {
        mutations.forEach(function (mutation) {
            if (mutation.type === 'attributes' && mutation.attributeName === 'src' && mutation.target.className === 'photo' && mutation.target.src.indexOf('m%3D2048') > 0) {
                afilters(mutation.target.src, mutation.target.alt);
            }
        });
    };
    var MutationObserver = window.MutationObserver;
    var target = document.querySelector('body');
    var observer = new MutationObserver(observerHandler);
    var config = {attributes: true, subtree: true};
    observer.observe(target, config);
};
fivehundredpx();