diff --git a/js/contentScript/pubpeer.js b/js/contentScript/pubpeer.js index 62c590f..f4b326d 100644 --- a/js/contentScript/pubpeer.js +++ b/js/contentScript/pubpeer.js @@ -13,6 +13,7 @@ class PubPeer { this.type = ""; this.publicationIds = []; this.publications = []; + this.pubpeerUrls = []; this.uriEncodedUrls = {}; this.pageUrls = this.extractValidUrls(); this.uriEncodedDOIs = {}; @@ -145,7 +146,7 @@ class PubPeer { }; let param = { - version: "1.6.0", + version: "1.6.2", browser: Browser.name, urls: this.pageUrls, }; @@ -205,6 +206,20 @@ class PubPeer { break; } this.initTopBarRemoveEvent(); + this.initHeaderSubContentToggleEvent(); + } + + initHeaderSubContentToggleEvent() { + const toggleElement = document.getElementById("pubpeer-toggle-subcontent"); + if (toggleElement) { + toggleElement.onclick = function () { + const subContent = document.getElementById("pubpeer-header-subcontent"); + if (subContent) { + subContent.style.display = + subContent.style.display === "none" ? "block" : "none"; + } + }; + } } initTopBarRemoveEvent() { @@ -212,9 +227,10 @@ class PubPeer { "btn-close-pubpeer-article-summary" ); if (closeElement) { + const that = this; closeElement.onclick = function () { - this.parentNode.remove(); - this.onAfterRemovingTopBar(); + this.parentNode.parentNode.remove(); + that.onAfterRemovingTopBar(); }; } } @@ -352,9 +368,38 @@ class PubPeer { `; } pElement.innerHTML = ` - - ${hrefText} -