fix: Fixed updating magnet link after selecting same torrent again (#6028)

This commit is contained in:
Rukario 2023-09-26 18:35:43 -07:00 committed by GitHub
parent 7973d873ff
commit 3d4b177516
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 25 deletions

View File

@ -483,10 +483,7 @@ export class Inspector extends EventTarget {
string = string || none;
if (string.startsWith('https://') || string.startsWith('http://')) {
string = encodeURI(string);
Utils.setInnerHTML(
e.info.comment,
`<a href="${string}" target="_blank" >${string}</a>`,
);
e.info.comment.innerHTML = `<a href="${string}" target="_blank" >${string}</a>`;
} else {
setTextContent(e.info.comment, string);
}
@ -554,10 +551,7 @@ export class Inspector extends EventTarget {
setTextContent(e.info.magnetLink, mixed);
} else {
const link = torrents[0].getMagnetLink();
Utils.setInnerHTML(
e.info.magnetLink,
`<a class="inspector-info-magnet" href="${link}"><button></button></a>`,
);
e.info.magnetLink.innerHTML = `<a class="inspector-info-magnet" href="${link}"><button></button></a>`;
}
}

View File

@ -22,23 +22,6 @@ export const Utils = {
return result;
},
/**
* Checks to see if the content actually changed before poking the DOM.
*/
setInnerHTML(e, html) {
if (!e) {
return;
}
/* innerHTML is listed as a string, but the browser seems to change it.
* For example, "&infin;" gets changed to "∞" somewhere down the line.
* So, let's use an arbitrary different field to test our state... */
if (e.currentHTML !== html) {
e.currentHTML = html;
e.innerHTML = html;
}
},
};
function toggleClass(buttons, button, pages, page, callback) {