KittenEvil.github.com / Confluence NBSP fixed

// ==UserScript==
// @name        Confluence NBSP fixed
// @description Change nbsp to space in wiki
// @namespace   rusinov.usa.cc
// @version     2016.03.10.02
// @include     https://wiki.intermedia.net/*
// @grant       unsafeWindow
// @run-at      document-end
// @author      andy.roussinov@gmail.com
// @updateURL   https://openuserjs.org/install/KittenEvil.github.com/Confluence_NBSP_fixed.user.js
// @downloadURL https://openuserjs.org/install/KittenEvil.github.com/Confluence_NBSP_fixed.user.js
// ==/UserScript==


var $,
setTimeoutCount = 0,
setTimeoutCountMax = 60000,
setTimeoutDelay = 500,
hereDoc;
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
  var script = document.createElement('script');
  script.setAttribute('src', '//code.jquery.com/jquery-2.1.0.min.js');
  script.addEventListener('load', function () {
    var script = document.createElement('script');
    script.textContent = 'window.jQ=jQuery.noConflict(true);(' + callback.toString() + ')();';
    //document.body.appendChild(script);
    document.getElementsByTagName('head') [0].appendChild(script);
  }, false);
  //    document.body.appendChild(script);
  document.getElementsByTagName('head') [0].appendChild(script);
}

function main() {
    var replaced = $("body").html().replace(/  /g,'  ');
    $("body").html(replaced);
}

setTimeout(function () {
  addJQuery(main);
}, 1000);