VSCO last media - vsco.co

12/2/2021, 9:24:03 PM

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        VSCO last media - vsco.co
// @namespace   Violentmonkey Scripts
// @match       https://vsco.co/*/gallery
// @grant       none
// @version     1.0.1
// @author      interested one
// @description 12/2/2021, 9:24:03 PM
// @license unlicense
// @require https://cdn.jsdelivr.net/npm/@violentmonkey/dom@2
// ==/UserScript==

var d = (d = window.__PRELOADED_STATE__) && (d = d.entities) && (d = d.images);

if (!d) {
  for (var i = 0; i < document.scripts.length; i++) {
    var s_text = document.scripts[i].textContent;
    if (s_text && s_text.indexOf("window.__PRELOADED_STATE__") != -1) {
      d = JSON.parse(s_text.substr(s_text.indexOf("{")));
      d = d.entities && d.entities.images;
    }
  }
}


if (d) {
  var maxDate = 0;
  for (var key in d) {
    if (d.hasOwnProperty(key)) {
      maxDate = Math.max(d[key].uploadDate, maxDate);
    }
  }
  
  if (maxDate) {
    var label = VM.hm("div", { style: "position: relative" },
      VM.hm("div", { style: "position: absolute; top: 2em;" },
          VM.hm("div", { style: "position: fixed; z-index: 2;" }, 
            VM.hm("div", { style: "width: 10em; line-height: 2.5em; text-align: center; background: cadetblue; color: aliceblue;" }, "Last: " + new Date(maxDate).toLocaleDateString())
          )
      )
    );
    document.querySelector("header[role=banner]").prepend(label);
  }
}