Skip to content

Instantly share code, notes, and snippets.

@Hypfer
Created January 21, 2021 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hypfer/935fece064f8e353da601c413b2ec9e1 to your computer and use it in GitHub Desktop.
Save Hypfer/935fece064f8e353da601c413b2ec9e1 to your computer and use it in GitHub Desktop.
Userscript which enables the Webinterface of a Yamaha RX-V473 AV Receiver
// ==UserScript==
// @name RX-V473 WebControl Restore
// @match http://192.168.*.*
// @version 1
// @run-at document-start
// @grant GM_addStyle
// ==/UserScript==
(function(open) {
unsafeWindow.XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
this.origOnload = this.onload;
this.onload = function (httpObj) {
var xmlData = this.responseXML;
if (xmlData) {
var Cmd = ["Service","System", "Main_Zone", "Zone_2", "Zone_3", "Zone_4",
"Tuner", "USB", "HD_Radio" , "NET_RADIO" , "SERVER" , "SiriusXM" ,
"Rhapsody" , "Napster" , "Pandora" , "AirPlay","iPod_USB"];
var cmdname = "";
for ( var i = 0; i < Cmd.length; i++ ) {
var zone = xmlData.getElementsByTagName(Cmd[i]);
if (zone.length == 1) {
cmdname = Cmd[i];
break;
}
}
if (cmdname == "System") {
var Val = xmlData.getElementsByTagName("Model_Name");
if (Val.length) {
if (Val[0].firstChild) {
Val[0].firstChild.nodeValue = "RX-V673";
}
}
}
}
this.origOnload();
}
open.call(this, method, url, async, user, pass);
};
})(unsafeWindow.XMLHttpRequest.prototype.open);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment