Error loading release group (HTTP status ' + status + ') |
';
+ }
+ );
+
+ parent.insertBefore(button, parent.firstChild);
+}
+
+function inject_release_button(parent, _table_parent, _table, _mbid) {
+ var mbid = _mbid || parent.querySelector("a").href.match(MBID_REGEX),
+ table = _table || document.createElement("table");
+
+ table.style.marginTop = "1em";
+ table.style.marginLeft = "1em";
+ table.style.paddingLeft = "1em";
+
+ var button = create_button(
+ "/ws/2/release/" + mbid + "?inc=media+recordings+artist-credits&fmt=json",
+ function(toggled) {
+ if (toggled) parent.appendChild(table); else parent.removeChild(table);
+ },
+ function(json) {
+ parse_release(json, table);
+ },
+ function(status) {
+ table.innerHTML = '