Greasy Fork Links

Add links to navigate to the update tab and links to install scripts

Ajankohdalta 10.7.2016. Katso uusin versio.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Greasy Fork Links
// @namespace   chriskim06
// @description Add links to navigate to the update tab and links to install scripts
// @include     https://greasyfork.org/en/users/*
// @version     1.3.0
// @grant       none
// @locale      en
// ==/UserScript==

(function() {

  function createSpan(link, text) {
    var el = document.createElement('span');
    el.className = 'name-description-separator';
    el.innerHTML = text;
    link.parentNode.insertBefore(el, link.nextElementSibling);
  }

  var scripts = document.getElementById('user-script-list');
  if (scripts !== null) {
    var items = document.querySelectorAll('#user-script-list > li');
    for (var i = 0; i < items.length; i++) {
      var link = items[i].querySelector('a');
      var el = document.createElement('a');
      el.href = '/en/scripts/' + items[i].dataset.scriptId + '/versions/new';
      el.innerHTML = 'Edit';
      link.parentNode.insertBefore(el, link.nextElementSibling);
      createSpan(link, ' - ');
      el = document.createElement('a');
      el.href = link.href + '/delete';
      el.innerHTML = 'Delete';
      link.parentNode.insertBefore(el, link.nextElementSibling);
      createSpan(link, '/');
      el = document.createElement('a');
      el.href = link.href + '/code/' + link.innerHTML.replace(/ /g, '%20') + '.user.js';
      el.innerHTML = 'Install';
      link.parentNode.insertBefore(el, link.nextElementSibling);
      createSpan(link, ' - ');
      link.href = link.href + '/code';
    }
    scripts.previousElementSibling.querySelector('h3').innerHTML = 'Scripts (' + items.length + ')';
  }

})();