Image Popup - humaniplex.com

View images on HX in a glightbox popup

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        Image Popup - humaniplex.com
// @namespace   Violentmonkey Scripts
// @match       https://www.humaniplex.com/*
// @match       https://rentry.org/hxx
// @match       https://rentry.co/hxx
// @grant       none
// @version     1.0.7
// @author      -
// @description View images on HX in a glightbox popup
// @license     MIT
// ==/UserScript==

let $head = document.querySelector('head')
let $link = document.createElement('link')
$link.rel = 'stylesheet'
$link.href = '//cdn.jsdelivr.net/npm/glightbox/dist/css/glightbox.min.css'
let $script = document.createElement('script')
$script.type = 'text/javascript'
$head.append($link)
$head.append($script)
$script.onload = () => {
  // images in gallery
  document.querySelectorAll('.ph_cont .ph a').forEach((a) => {
    a.className += ' glightbox'
  })

  // images in /photos
  if (location.pathname.match(/^\/photos\/$/)) {
    document.querySelectorAll('table[align=center] td a').forEach((a) => {
      a.className += ' glightbox'
    })
  }

  // add blank profile pic if missing in /profiles/:user
  if (location.pathname.match(/^\/profiles\/.+$/)) {
    let $td = document.querySelector('tbody tbody tr[valign=top] td')
    if ($td && $td.innerText == "") {
      let $b = document.querySelector('tbody tbody tr[valign=top] td+td font b')
      let name = $b.innerText
      $td.innerHTML = `<div class="photo"><a href="/photos/`+name+`"><img style="width:120px;" src="/images/icons/icon_60x60_chick.gif"/></a></div>`
    }
  }

  // images in /classifieds/*
  if (location.pathname.match(/^\/classifieds\/.+$/)) {
    document.querySelectorAll('table.outline a img').forEach(($img) => {
      $img.removeAttribute('onclick')
      $img.parentNode.className += ' glightbox'
    })
  }

  // add link to own profile when logged in
  let $b = document.querySelector("form[action='https://www.humaniplex.com/login.html'] td[align=center] b")
  if ($b) {
    let name = $b.innerText
    let profileLink = '<a href="/profiles/' + name + '">' + name + '</a>'
    $b.innerHTML = profileLink
  }

  // init lightbox
  let lightbox = GLightbox({})
}
$script.src = '//cdn.jsdelivr.net/gh/mcstudios/glightbox/dist/js/glightbox.min.js'


// Add CSS tweaks for https://rentry.org/hxx
  let css = `
.ntable th:nth-child(1) {
  width: 20%;
}

.ntable th:nth-child(3) {
  width: 20%;
}
`
if (location.hostname == 'rentry.org' || location.hostname == 'rentry.co') {
  let style = document.createElement("style");
  style.type = "text/css";
  style.appendChild(document.createTextNode(css));
  document.head.appendChild(style);
}