Treehouse Expiry Times

Shows expiry times of all munzees in a treehouse. Powered by CuppaZee

目前为 2019-12-18 提交的版本,查看 最新版本

// ==UserScript==
// @name         Treehouse Expiry Times
// @version      1.1
// @description  Shows expiry times of all munzees in a treehouse. Powered by CuppaZee
// @author       sohcah
// @match        https://www.munzee.com/m/*/*
// @match        https://www.munzee.com/m/*/*/
// @grant        none
// @namespace https://greasyfork.org/users/398283
// ==/UserScript==

(function() {
    'use strict';
    if($('.pin')[0].src.includes('treehouse')) {
        var x = location.pathname.split('/');
        $.get(`https://us-central1-cuppazeex.cloudfunctions.net/munzee?munzee=${x[3]}&user=${x[2]}`,function(data){
            console.log(data.details.bouncers)
            let i = 0;
            for(var unicorn of Array.from($('.unicorn'))) {
                let bouncer = data.details.bouncers[i]
                unicorn.innerHTML = `${i==0?`<a href="https://cuppazee.uk/munzee/${x[2]}/${x[3]}"><img src="https://cuppazee.uk/statics/CZXBannerTransp.png" style="height:48px;"/></a><br><br>`:''}<img style="height: 32px;" src="${bouncer.munzee_logo}">Hosting <a href="${bouncer.unicorn_munzee.code}">${bouncer.unicorn_munzee.friendly_name}</a>! <span title="${moment(bouncer.good_until*1000).format()}">Expires in ${moment.duration(bouncer.good_until*1000-Date.now()).humanize()} (${moment(bouncer.good_until*1000).format('LTS')})</span>`
                i++
            }
        })
    }
})();