Ferium add command for curseforge

2022/6/6 21:48:18

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        Ferium add command for curseforge
// @namespace   Violentmonkey Scripts
// @match       https://www.curseforge.com/minecraft/mc-mods/*
// @match       https://www.curseforge.com/minecraft/mc-mods
// @license     MIT
// @grant       none
// @version     0.2.0
// @author      -
// @description 2022/6/6 21:48:18
// ==/UserScript==


const elem = document.querySelector('div[class="-mx-1 flex-wrap flex"]')
if(elem) {
  const id = elem.querySelector("[data-project-id]").dataset.projectId
  console.log(id)
  elem.innerHTML += `<div class="px-1">
    <a href="javascript:void(0)"
       onclick='navigator.clipboard.writeText("ferium add ${id}");this.innerText="Copied!"'
       class="button button--hollow"
       data-tooltip="ferium add ${id}"
       one-link-mark="yes">
      <span class="button__text">Ferium</span>
  </a></div>`
}

const searched = document.querySelectorAll('div[class="my-2"] > .project-listing-row')
for(const project of Array.from(searched)) {
  const id = project.querySelector('a[data-project-id]').dataset.projectId
  if(!project.querySelector('a[data-tooltip="ferium add ${id}"]'))
    project.querySelector('div[class="flex mb-2 -mx-1"]').innerHTML += `<div class="px-1">
      <a href="javascript:void(0)"
         onclick='navigator.clipboard.writeText("ferium add ${id}");this.innerText="Copied!"'
         class="button button--hollow"
         data-tooltip="ferium add ${id}"
         one-link-mark="yes">
        <span class="button__text">Ferium</span>
      </a></div>`
}