From 6fdc28bf967da57d847d3cf51ba163295d3c97cd Mon Sep 17 00:00:00 2001 From: Dariusz Murakowski Date: Tue, 18 Jul 2017 16:15:19 -0400 Subject: [PATCH] Mugenmonkey: put DS3 build name in --- (Mugenmonkey) Dark Souls 3 build title.user.js | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 (Mugenmonkey) Dark Souls 3 build title.user.js diff --git a/(Mugenmonkey) Dark Souls 3 build title.user.js b/(Mugenmonkey) Dark Souls 3 build title.user.js new file mode 100644 index 0000000..b8033fd --- /dev/null +++ b/(Mugenmonkey) Dark Souls 3 build title.user.js @@ -0,0 +1,28 @@ +// ==UserScript== +// @name (Mugenmonkey) Dark Souls 3 build title +// @namespace http://tampermonkey.net/ +// @version 0.1 +// @description append build name to page title +// @author Dariusz Murakowski +// @match https://mugenmonkey.com/darksouls3/* +// @grant none +// @run-at document-idle +// ==/UserScript== + +(function() { + 'use strict'; + + // from https://stackoverflow.com/questions/12685963/get-element-by-tag-and-class + // and https://stackoverflow.com/questions/18242171/get-element-by-tag-name-and-class-name + // see https://stackoverflow.com/questions/12011867/getelementbyid-and-tagname-and-classname + // and https://stackoverflow.com/questions/11502563/jquery-id-tag-vs-id-findtag-which-is-preferable + //var title_nodes = document.querySelectorAll('span#build-title'); + var title_nodes = document.querySelectorAll('div.buildInfo.left'); + console.log(title_nodes); + if (title_nodes.length == 1) { + var build_name = title_nodes[0].innerText; + //console.log(build_name); + document.title = document.title + " - " + build_name; + } + // alternatively, using jQuery: var build_name = $('span#build-title').text(); // how to use $().find('span')? +})(); \ No newline at end of file -- 2.7.4