old_contents: // ==UserScript==
  // @name           FallenSwordHelper
  // @namespace      terrasoft.gr
  // @description    Fallen Sword Helper
  // @include        https://www.fallensword.com/*
  // @include        https://guide.fallensword.com/*
  // @include        https://fallensword.com/*
  // @include        https://*.fallensword.com/*
  // @include        https://local.huntedcow.com/fallensword/*
  // @exclude        https://forum.fallensword.com/*
  // @exclude        https://wiki.fallensword.com/*
  // @exclude        https://www.fallensword.com/app.php*
  // @exclude        https://www.fallensword.com/fetchdata.php*
  // @version        $_VER
  // @downloadURL    $_DLURL
  // @grant          none
  // ==/UserScript==
  
  // No warranty expressed or implied. Use at your own risk.
  
  // EVERYTHING MUST BE IN main()
  function fshMain(ver) {
  
    window.FSH = window.FSH || {};
    window.FSH.version = ver;
  
    var cssFiles = ['$_CALFCSS'];
    var scriptFiles = [
      'https://cdnjs.cloudflare.com/ajax/libs/localforage/1.5.3/localforage.min.js',
      '$_CALFJS'
    ];
    if (typeof window.jQuery !== 'undefined') {
      scriptFiles.push('https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js');
    }
    var count = cssFiles.length + scriptFiles.length;
  
    function onPageLoad() {
      count -= 1;
      if (count === 0) {FSH.dispatch();}
    }
  
    cssFiles.forEach(function(c) {
      var linkTag = document.createElement('link');
      linkTag.type = 'text/css';
      linkTag.rel = 'stylesheet';
      linkTag.onload = onPageLoad;
      linkTag.href = c;
      document.body.appendChild(linkTag);
    });
  
    scriptFiles.forEach(function(s) {
      var scriptTag = document.createElement('script');
      scriptTag.type = 'text/javascript';
      scriptTag.onload = onPageLoad;
      scriptTag.src = s;
      document.body.appendChild(scriptTag);
    });
  
  } // end of var main
  
  function setVer() {
    var ver = '$_VER';
    if (typeof GM_info === 'undefined') {return ver + '_native';}
    if (GM_info.scriptHandler === 'Greasemonkey' &&
        Number(GM_info.version.split('.')[0]) >= 4) {return;}
    return ver;
  }
  
  function injectFsh(fshVer) {
    var script = document.createElement('script');
    script.textContent = '(' + fshMain.toString() + ')(\'' + fshVer + '\');';
    document.body.appendChild(script);
    document.body.removeChild(script);
  }
  
  var getVer = setVer();
  if (getVer) {injectFsh(getVer);}
  
new_contents: // ==UserScript==
  // @name           FallenSwordHelper
  // @namespace      terrasoft.gr
  // @description    Fallen Sword Helper
  // @include        https://www.fallensword.com/*
  // @include        https://guide.fallensword.com/*
  // @include        https://fallensword.com/*
  // @include        https://*.fallensword.com/*
  // @include        https://local.huntedcow.com/fallensword/*
  // @exclude        https://forum.fallensword.com/*
  // @exclude        https://wiki.fallensword.com/*
  // @exclude        https://www.fallensword.com/app.php*
  // @exclude        https://www.fallensword.com/fetchdata.php*
  // @version        $_VER
  // @downloadURL    $_DLURL
  // @grant          none
  // ==/UserScript==
  
  // No warranty expressed or implied. Use at your own risk.
  
  // EVERYTHING MUST BE IN main()
  function fshMain(ver) {
  
    window.FSH = window.FSH || {};
    window.FSH.version = ver;
  
    var cssFiles = ['$_CALFCSS'];
    var scriptFiles = [
      'https://cdnjs.cloudflare.com/ajax/libs/localforage/1.5.3/localforage.min.js',
      '$_CALFJS'
    ];
    if (typeof window.jQuery !== 'undefined') {
      scriptFiles.push('https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js');
    }
    var count = cssFiles.length + scriptFiles.length;
  
    function onPageLoad() {
      count -= 1;
      if (count === 0) {FSH.dispatch();}
    }
  
    cssFiles.forEach(function(c) {
      var linkTag = document.createElement('link');
      linkTag.type = 'text/css';
      linkTag.rel = 'stylesheet';
      linkTag.onload = onPageLoad;
      linkTag.href = c;
      document.body.appendChild(linkTag);
    });
  
    scriptFiles.forEach(function(s) {
      var scriptTag = document.createElement('script');
      scriptTag.type = 'text/javascript';
      scriptTag.onload = onPageLoad;
      scriptTag.src = s;
      document.body.appendChild(scriptTag);
    });
  
  } // end of var main
  
  var verTest = [
    [
      function() {return GM_info === 'undefined';},
      function(ver) {return ver + '_native';}
    ],
    [
      function() {
        return GM_info.scriptHandler === 'Greasemonkey' &&
          Number(GM_info.version.split('.')[0]) >= 4;
      },
      function() {return false;}
    ],
    [function() {return true;}, function(ver) {return ver;}]
  ];
  
  function setVer() {
    var ver = '$_VER';
    return verTest.find(function(e) {return e[0]();})[1](ver);
  }
  
  function injectFsh(fshVer) {
    var script = document.createElement('script');
    script.textContent = '(' + fshMain.toString() + ')(\'' + fshVer + '\');';
    document.body.appendChild(script);
    document.body.removeChild(script);
  }
  
  var getVer = setVer();
  if (getVer) {injectFsh(getVer);}
  
subject: reduce complexity (updated eslint rule 4.14.0)