DanielTepesKraus / Detailed Tag Information Doctor

// ==UserScript==
// @name        Detailed Tag Information Doctor
// @namespace   Derpibooru.org
// @version      1.0
// @description  Provides options to "clean up" the tag search screen.
// @author       DanielTepesKraus | https://www.derpibooru.org/profiles/DanielTepesKraus
// @include      https://derpibooru.org/*
// @include      https://www.derpibooru.org/*
// @include      https://derpiboo.ru/*
// @include      https://www.derpiboo.ru/*
// @include      https://trixiebooru.org*
// @include      https://www.trixiebooru.org*
// @grant        none
// ==/UserScript==
/* jshint -W097 */
'use strict';

//////////////////////////////////////////////////////////////////////////////////////////
//HERE ARE YOUR OPTIONS
//
//DETAILED TAG DESCRIPTIONS
//With this set to 0, the large detailed tag description block will be hidden by default.
var detoff = 1
//0 = Hidden by default
//1 = Displayed by default
//
//IMPLIED TAGS TOGGLE BUTTON
//With this set to 1, the list of implied tags is replaced with a "toggle" button
//to switch them on and off.
var impoff = 1
//0 = Disabled
//1 = Enabled
//
//"EXAMPLE" PICTURE IN DETAILED DESCRIPTION
//With this set to 0, the "example" picture found in some detailed descriptions
//is replaced with a much smaller and more convenient text link.
var exaoff = 1
//0 = Off
//1 = On
//
//DO NOT TOUCH ANYTHING BELOW THIS LINE
//////////////////////////////////////////////////////////////////////////////////////////

function togglelinkson(){
  linklist.innerHTML = detailedold
  document.getElementById('toggleimpliedlinkoff').addEventListener('click', togglelinksoff, false);
}

function togglelinksoff(){
  linklist.innerHTML = detailednew
  document.getElementById('toggleimpliedlinkon').addEventListener('click', togglelinkson, false);
}

var linklist = document.getElementById('tag_info_more');
var isimplied = linklist.innerHTML.indexOf("<strong>Implied by:</strong>");
if (linklist.innerHTML.indexOf("<strong>Associated links:</strong>") > 1){
  isimplied = -1
}
var detailedold = "<hr></hr><a href='#' id='toggleimpliedlinkoff' onClick='togglelinksoff()'>Toggle Implied Tags List</a>" + linklist.innerHTML;
var detailednew = "<hr></hr><a href='#' id='toggleimpliedlinkon' onClick='togglelinkson()'>Toggle Implied Tags List</a>" + linklist.innerHTML.substring(linklist.innerHTML.indexOf("<br>") + 0);
if (isimplied > -1) {
  if (impoff == 1) {
    linklist.innerHTML = detailednew
    document.getElementById('toggleimpliedlinkon').addEventListener('click', togglelinkson, false);
  }
}

if (linklist.innerHTML.indexOf('<span class="imgspoiler">') > -1){
  if (exaoff == 1) {
    var scrubexample = document.getElementsByClassName('imgspoiler');
    scrubexample[0].innerHTML = "Example"
  }
}

if ( $( "#tag_info_more" ).length ) {
  if (detoff == 0){
    $('#tag_info_more').toggle();return false;
  }
}