Github - Issue improvement

Color issues title red and scroll to last comment on title click.

This script is marked as "external"
This script was commisioned by someone else, and I will not check if it works. If it breaks, contact me
Click here to install Browse More Scripts
// ==UserScript==
// @name         Github - Issue improvement
// @namespace    b6db3896b91a87d189f1c1439dfe95f6f03e51b0
// @version      0.5
// @description  Color issues title red and scroll to last comment on title click.
// @author       /u/AyrA_ch
// @include      /^https?:\/\/(www\.)?github.com\/[^\/]+\/[^\/]+\/issues.*$/
// @grant        none
// @external     true
// ==/UserScript==

//Version log
//0.5 - We now need to scroll the HTML element for some reason
//0.4 - Version log, remove jQuery dependency, title cursor now a hand
//0.3 - Attempt to fix script not being included where it needs to be
//0.2 - Clicking on title now scrolls to bottom
//0.1 - Initial version, styles title red

(function () {
    var s = document.createElement("style");
    s.innerHTML = ".js-issue-title{color:red;cursor:pointer}";
    document.querySelector("head").appendChild(s);
    //Define timer variable
    var timer = false;
    //Event when clicking on the title
    var clickEvent = function () {
        document.documentElement.scrollTop = 0x7FFFFFFF;
    };
    //Registers events
    var addClickEvent = function () {
        //Register our event again
        var titles = document.querySelectorAll(".js-issue-title");
        for (var i = 0; i < titles.length; i++) {
            titles[i].removeEventListener("click", clickEvent);
            titles[i].addEventListener("click", clickEvent);
        }
        return titles.length > 0;
    };
    //Schedule a timer event
    var scheduleUpdater = function () {
        //Only if we have not already scheduled
        if (!timer) {
            //run function in timer that registers click events and resets the timer
            timer = window.setTimeout(function () {
                addClickEvent();
                timer = false;
            }, 100);
        }
    };
    var observer = new MutationObserver(scheduleUpdater);
    var config = {
        attributes: true,
        childList: true,
        characterData: false
    };
    observer.observe(document.body, config);

    //Register event for all existing elements
    addClickEvent();
})();

/*
LICENSE:
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
The full license text can be found here: http://creativecommons.org/licenses/by-nc-sa/4.0/
The link has an easy to understand version of the license and the full license text.

DISCLAIMER:
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*/

Copyright © 2018 by Kevin Gut 📧 | More services | Generated for 3.21.246.53