Skip to content

Commit

Permalink
Greasemonkey v4: xmlHttpRequest.open no longer accept path
Browse files Browse the repository at this point in the history
without protocol and host (#372)
  • Loading branch information
jesus2099 committed Jan 4, 2018
1 parent 964defd commit 5ccb7cc
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions jasrac-mb-minc_WORK-IMPORT-CROSS-LINKING.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var meta = function() {
// ==UserScript==
// @name JASRAC. work importer/editor into MusicBrainz + MB-JASRAC-音楽の森 links + MB back search links
// @version 2017.11.14
// @version 2018.1.4
// @changelog https://github.com/jesus2099/konami-command/commits/master/jasrac-mb-minc_WORK-IMPORT-CROSS-LINKING.user.js
// @description One click imports JASRAC works into MusicBrainz (name, iswc, type, credits, edit note, sort name, search hint) and マス歌詞®(mass-lyrics) and wikipedia links. It will do the same magic in work editor. Work links to both JASRAC and 音楽の森 / ongakunomori / music forest / minc / magic db and back to MB
// @homepage http://userscripts-mirror.org/scripts/show/94676
Expand Down Expand Up @@ -63,7 +63,7 @@ var xhrJobs = {
async: true,
method: "get",
init: function(xhr) {
xhrJobs["workinfo-get"].url = "/ws/2/work/" + xhrWork.mbid + "?fmt=json&inc=annotation+aliases";
xhrJobs["workinfo-get"].url = MBS + "/ws/2/work/" + xhrWork.mbid + "?fmt=json&inc=annotation+aliases";
},
onload: function() {
if (this.status > 199 && this.status < 400 && this.responseText.match(new RegExp(xhrWork.mbid))) {
Expand Down Expand Up @@ -152,7 +152,7 @@ var xhrJobs = {
info: "get current work annotation",
method: "get",
init: function(xhr) {
xhrJobs["annotation-get"].url = "/ws/2/work/" + xhrWork.mbid + "?inc=annotation";
xhrJobs["annotation-get"].url = MBS + "/ws/2/work/" + xhrWork.mbid + "?inc=annotation";
},
onload: function() {
if (this.status > 199 && this.status < 400 && this.responseText.match(new RegExp("<work.+id=\"" + xhrWork.mbid + "\">"))) {
Expand All @@ -171,7 +171,7 @@ var xhrJobs = {
info: "JASRAC work code annotation",
method: "post",
init: function(xhr) {
xhrJobs["annotation-add"].url = "/work/" + xhrWork.mbid + "/edit_annotation";
xhrJobs["annotation-add"].url = MBS + "/work/" + xhrWork.mbid + "/edit_annotation";
var curl = workLookupURL("jasrac", "code", xhrWork.code);
xhrJobs["annotation-add"].params = "edit-annotation.text=" + encodeURIComponent("JASRAC: '''" + xhrWork.code + "''' ([http://tickets.musicbrainz.org/browse/MBS-7359|MBS-7359])" + (xhrWork.annotation ? "\n" + xhrWork.annotation : "")) + "&edit-annotation.changelog=" + encodeURIComponent("JASRAC: " + xhrWork.code + " (MBS-7359)") + "&edit-annotation.edit_note=" + encodeURIComponent("JASRAC: '''" + xhrWork.code + "''' (" + curl + ") ← requires JASRACへの直リンク ('''jasrac_DIRECT-LINK''')\nStill needed for JASRAC auto‐linking (until http://tickets.musicbrainz.org/browse/MBS-7359).\n\n" + MBlinks());
},
Expand All @@ -180,7 +180,7 @@ var xhrJobs = {
async: false,
method: "post",
init: function(xhr) {
xhrJobs["alias-add"].url = "/work/" + xhrWork.mbid + "/add-alias";
xhrJobs["alias-add"].url = MBS + "/work/" + xhrWork.mbid + "/add-alias";
xhrJobs["alias-add"].params = "edit-alias.as_auto_editor=" + (isAutoEdit() ? "1" : "0");
var newAlias = xhrWork.newAliases.shift();
if (newAlias) {
Expand Down
4 changes: 2 additions & 2 deletions mb. MERGE HELPOR 2.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name mb. MERGE HELPOR 2
// @version 2016.6.15
// @version 2018.1.4
// @changelog https://github.com/jesus2099/konami-command/commits/master/mb.%20MERGE%20HELPOR%202.user.js
// @description musicbrainz.org: Merge helper highlights last clicked, shows info, indicates oldest MBID, manages (remove) entity merge list; merge queue (clear before add) tool; don’t reload page for nothing when nothing is checked
// @homepage http://userscripts-mirror.org/scripts/show/124579
Expand Down Expand Up @@ -281,7 +281,7 @@ function loadEntInfo() {
var rowid = entInfoZone.getAttribute("id").match(/\d+$/)[0];
entInfoZone.appendChild(loadimg("info"));
var mbid = entities[rowid].a.getAttribute("href").match(rembid)[0];
var url = "/ws/2/" + mergeType + "/" + mbid + "?inc=";
var url = self.location.protocol + "//" + self.location.host + "/ws/2/" + mergeType + "/" + mbid + "?inc=";
switch (mergeType) {
case "artist":
url += "release-groups+works+recordings";
Expand Down
4 changes: 2 additions & 2 deletions mb_ALL-LINKS.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name mb. ALL LINKS
// @version 2017.6.16
// @version 2018.1.4
// @changelog https://github.com/jesus2099/konami-command/commits/master/mb_ALL-LINKS.user.js
// @description Hidden links include fanpage, social network, etc. (NO duplicates) Generated autolinks (configurable) includes plain web search, auto last.fm, Discogs and LyricWiki searches, etc. Shows begin/end dates on URL and provides edit link. Expands Wikidata links to wikipedia articles.
// @homepage http://userscripts-mirror.org/scripts/show/108889
Expand Down Expand Up @@ -288,7 +288,7 @@ var favicontry = [];
var guessOtherFavicons = true;
var sidebar = document.getElementById("sidebar");
var tokenValues = {};
var entityUrlRelsWS = "/ws/2/%entity-type%/%entity-mbid%?inc=url-rels";
var entityUrlRelsWS = self.location.protocol + "//" + self.location.host + "/ws/2/%entity-type%/%entity-mbid%?inc=url-rels";
var extlinks;
var j2css = document.createElement("style");
j2css.setAttribute("type", "text/css");
Expand Down
10 changes: 5 additions & 5 deletions mb_COLLECTION-HIGHLIGHTER.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var meta = {raw: function() {
// ==UserScript==
// @name mb. COLLECTION HIGHLIGHTER
// @version 2017.12.2
// @version 2018.1.4
// @changelog https://github.com/jesus2099/konami-command/commits/master/mb_COLLECTION-HIGHLIGHTER.user.js
// @description musicbrainz.org: Highlights releases, release-groups, etc. that you have in your collections (anyone’s collection can be loaded) everywhere
// @homepage http://userscripts-mirror.org/scripts/show/126380
Expand Down Expand Up @@ -130,6 +130,7 @@ for (var j = 0; j < keys.length; j++) {
// # MAIN RUN #
// # #
// ############################################################################
var MBS = self.location.protocol + "//" + self.location.host;
var cat = self.location.pathname.match(/(area(?!.+(artists|labels|releases|places|aliases|edits))|artist(?!.+(releases|recordings|works|relationships|aliases|edits))|artists|event|labels|releases|recordings|report|series|track|works|aliases|cdtoc|collection(?!s|.+edits)|collections|edit(?!s|\/subscribed)|edits|votes|edit\/subscribed|isrc|label(?!.+edits)|place(?!.+(aliases|edits))|puid|ratings|recording(?!s|.+edits)|relationships|release[-_]group(?!.+edits)|release(?!s|-group|.+edits)|search(?!\/edits)|tracklist|tag|url|work(?!s))/);
if (cat) {
/* -------- CONFIGURATION START (don’t edit above) -------- */
Expand Down Expand Up @@ -157,7 +158,6 @@ if (cat) {
j2ss.insertRule("li." + prefix + "Row { padding-left: 4px; }", 0);
j2ss.insertRule("." + prefix + "Item { text-shadow: 0 0 8px " + highlightColour + "!important; }", 0);
j2ss.insertRule("." + prefix + "Row ." + prefix + "Item { border: 0; padding: 0; }", 0);
var MBS = self.location.protocol + "//" + self.location.host;
var collectionsID = GM_getValue("collections") || "";
var releaseID;
var stuff, collectedStuff = ["collection", "release", "release-group", "recording", "artist", "work", "label"];
Expand Down Expand Up @@ -467,7 +467,7 @@ function loadCollection(collectionMBID, WSMode, pageOrOffset) {
};
debug(MBS + url, true);
chrono();
xhr.open("GET", url, true);
xhr.open("GET", MBS + url, true);
xhr.send(null);
}
// ############################################################################
Expand Down Expand Up @@ -556,7 +556,7 @@ function fetchReleasesStuff(pi) {
};
debug(MBS + url, true);
chrono();
xhr.open("GET", url, true);
xhr.open("GET", MBS + url, true);
xhr.send(null);
}
}
Expand Down Expand Up @@ -742,7 +742,7 @@ function stuffRemover(checks, pp) {
};
debug(MBS + url);
chrono();
xhr.open("GET", url, true);
xhr.open("GET", MBS + url, true);
xhr.send(null);
} else {
if (!stuff[checkAgainst].rawids) {/* Protection for some edge cases of new script using old script data */
Expand Down
6 changes: 3 additions & 3 deletions mb_INLINE-STUFF.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name mb. INLINE STUFF
// @version 2017.8.10
// @version 2018.1.4
// @changelog https://github.com/jesus2099/konami-command/commits/master/mb_INLINE-STUFF.user.js
// @description musicbrainz.org release page: Inline recording names, comments, ISRC and AcoustID. Displays CAA count and add link if none. Highlights duplicates in releases and edits.
// @homepage http://userscripts-mirror.org/scripts/show/81127
Expand Down Expand Up @@ -70,7 +70,7 @@ var shownacoustids = [];
var shownworks = {count: 0};
var isrcURL = "/isrc/%s";
var acoustidURL = "//acoustid.org/track/%s";
var releasewsURL = MBS + "/ws/2/release/%s/?inc=recordings+isrcs"; /* http://wiki.musicbrainz.org/XMLWebService#release_resources */
var releasewsURL = "/ws/2/release/%s/?inc=recordings+isrcs"; /* http://wiki.musicbrainz.org/XMLWebService#release_resources */
var str_GUID = "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}";
var re_GUID = new RegExp(str_GUID, "i");
var AcoustIDlinkingURL = "//acoustid.org/edit/toggle-track-mbid?track_gid=%acoustid&mbid=%mbid&state=%state";
Expand Down Expand Up @@ -136,7 +136,7 @@ if (pagecat) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = isrcFish;
coolBubble.info("Loading “" + document.querySelector("h1").textContent + "” shadow release…");
xhr.open("GET", releasewsURL.replace(/%s/, relMBID), true);
xhr.open("GET", MBS + releasewsURL.replace(/%s/, relMBID), true);
xhr.overrideMimeType("text/xml");
xhr.send(null);
}
Expand Down
4 changes: 2 additions & 2 deletions mb_INLINE-TRACK-ARTIST.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name mb. INLINE TRACK ARTIST
// @version 2017.11.30
// @version 2018.1.4
// @changelog https://github.com/jesus2099/konami-command/commits/master/mb_INLINE-TRACK-ARTIST.user.js
// @description musicbrainz.org: highlights track title, length and artist differences in recording page
// @homepage http://userscripts-mirror.org/scripts/show/166877
Expand Down Expand Up @@ -139,7 +139,7 @@ if (mbid && tracks.length > 0) {
coolBubble.error("Error " + this.status + (this.statusText ? " “" + this.statusText + "”" : "") + " while fetching inline track stuff.");
});
coolBubble.info("Loading “" + document.querySelector("h1").textContent + "” shadow recording…");
xhr.open("get", "/ws/2/recording?query=rid:" + mbid, true);
xhr.open("get", self.location.protocol + "//" + self.location.host + "/ws/2/recording?query=rid:" + mbid, true);
/* xhr.open("get", "/ws/2/recording/" + mbid + "?inc=releases+artist-credits+mediums", true); */
xhr.overrideMimeType("text/xml");
xhr.send(null);
Expand Down
8 changes: 4 additions & 4 deletions mb_MASS-MERGE-RECORDINGS.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var meta = function() {
// ==UserScript==
// @name mb. MASS MERGE RECORDINGS
// @version 2017.12.11
// @version 2018.1.4
// @changelog https://github.com/jesus2099/konami-command/commits/master/mb_MASS-MERGE-RECORDINGS.user.js
// @description musicbrainz.org: Merges selected or all recordings from release A to release B
// @homepage http://userscripts-mirror.org/scripts/show/120382
Expand Down Expand Up @@ -226,7 +226,7 @@ function mergeRecsStep(_step) {
}
}
};
xhr.open("POST", urls[step], true);
xhr.open("POST", MBS + urls[step], true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
setTimeout(function() { xhr.send(params[step]); }, chrono(MBSminimumDelay));
}
Expand Down Expand Up @@ -254,7 +254,7 @@ function checkMerge(errorText) {
}
retry.checking = false;
});
xhr.open("GET", "/search/edits?negation=0&combinator=and&conditions.0.field=recording&conditions.0.operator=%3D&conditions.0.name=" + from.value + "&conditions.0.args.0=" + from.value + "&conditions.1.field=recording&conditions.1.operator=%3D&conditions.1.name=" + to.value + "&conditions.1.args.0=" + to.value + "&conditions.2.field=type&conditions.2.operator=%3D&conditions.2.args=74&conditions.3.field=status&conditions.3.operator=%3D&conditions.3.args=1", true);
xhr.open("GET", MBS + "/search/edits?negation=0&combinator=and&conditions.0.field=recording&conditions.0.operator=%3D&conditions.0.name=" + from.value + "&conditions.0.args.0=" + from.value + "&conditions.1.field=recording&conditions.1.operator=%3D&conditions.1.name=" + to.value + "&conditions.1.args.0=" + to.value + "&conditions.2.field=type&conditions.2.operator=%3D&conditions.2.args=74&conditions.3.field=status&conditions.3.operator=%3D&conditions.3.args=1", true);
setTimeout(function() { xhr.send(null); }, chrono(retryDelay));
}
function nextButt(successOrEditID) {
Expand Down Expand Up @@ -713,7 +713,7 @@ function loadReleasePage() {
infoMerge("Error " + this.status + " “" + this.statusText + "”", false);
}
});
xhr.open("GET", "/release/" + remoteRelease.id + remoteRelease.disc, true);
xhr.open("GET", MBS + "/release/" + remoteRelease.id + remoteRelease.disc, true);
setTimeout(function() { xhr.send(null); }, chrono(MBSminimumDelay));
}
function bestStartPosition(localTrack, matchAC) {
Expand Down
4 changes: 2 additions & 2 deletions mb_PENDING-EDITS.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name mb. PENDING EDITS
// @version 2017.5.31
// @version 2018.1.4
// @changelog https://github.com/jesus2099/konami-command/commits/master/mb_PENDING-EDITS.user.js
// @description musicbrainz.org: Adds/fixes links to entity (pending) edits (if any); optionally adds links to associated artist(s) (pending) edits
// @homepage http://userscripts-mirror.org/scripts/show/42102
Expand Down Expand Up @@ -174,7 +174,7 @@ function checkOpenEdits(obj) {
updateLink(xhrpe.object, this);
}
});
xhrPendingEdits[obj.base].xhr.open("get", obj.openedits.getAttribute("href"), true);
xhrPendingEdits[obj.base].xhr.open("get", MBS + obj.openedits.getAttribute("href"), true);
xhrPendingEdits[obj.base].xhr.setRequestHeader("base", obj.base);
xhrPendingEdits[obj.base].xhr.send(null);
}
Expand Down
4 changes: 2 additions & 2 deletions mb_POWER-VOTE.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var meta= { rawmdb: function() {
// ==UserScript==
// @name mb. POWER VOTE
// @version 2017.6.16
// @version 2018.1.4
// @changelog https://github.com/jesus2099/konami-command/commits/master/mb_POWER-VOTE.user.js
// @description musicbrainz.org: Adds some buttons to check all unvoted edits (Yes/No/Abs/None) at once in the edit search page. You can also collapse/expand (all) edits for clarity. A handy reset votes button is also available + Double click radio to vote single edit + range click with shift to vote a series of edits. , Hidden (collapsed) edits will never be voted (even if range click or shift+click force vote).
// @homepage http://userscripts-mirror.org/scripts/show/57765
Expand Down Expand Up @@ -159,7 +159,7 @@ if (editform) {
updateXHRstat(--pendingXHRvote);
}
});
xhr.open("POST", "/edit/enter_votes", true);
xhr.open("POST", self.location.protocol + "//" + self.location.host + "/edit/enter_votes", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("Content-length", params.length);
xhr.setRequestHeader("Connection", "close");
Expand Down
4 changes: 2 additions & 2 deletions mb_TAGGER-LINKS-NOW.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name mb. TAGGER LINKS NOW
// @version 2016.6.15
// @version 2018.1.4
// @changelog https://github.com/jesus2099/konami-command/commits/master/mb_TAGGER-LINKS-NOW.user.js
// @description musicbrainz.org: Quickly show or update "TAGGER" links with desired port
// @homepage http://userscripts-mirror.org/scripts/show/88065
Expand Down Expand Up @@ -39,7 +39,7 @@
var userjs = "jesus2099userjs88065";
/* ----- - ----- CONFIG */
var automatic = true; /*will background load tport (only when none) so TAGGER buttons do appear on next page browsing without bother triggering it manually*/
var url = "/search?query=artist%3AAJICO+AND+release%3A%22AJICO+SHOW%22+AND+format%3AVHS&type=release&method=advanced&tport=%tagger-port%";
var url = self.location.protocol + "//" + self.location.host + "/search?query=artist%3AAJICO+AND+release%3A%22AJICO+SHOW%22+AND+format%3AVHS&type=release&method=advanced&tport=%tagger-port%";
var txt_notaggerlinks = "%tagger-img% (%tagger-port%)"; /* %tagger-port% variable shows the current port and %tagger-img% the tagger image */
var txt_taggerlinksloaded = "%tagger-img% (%tagger-port%)";
var txt_loading = "⌛ loading…";
Expand Down

0 comments on commit 5ccb7cc

Please sign in to comment.