500px.com View

Gets you to the real image (and more)!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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();