Skip to content

Commit

Permalink
Merge pull request IsThereAnyDeal#365 from MxtOUT/recentlyUpdated
Browse files Browse the repository at this point in the history
Fix dynamic highlighting of "Recently Updated" block
  • Loading branch information
tfedor authored Aug 4, 2019
2 parents 258a022 + 2268c57 commit 80439a4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions js/content/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -3387,20 +3387,19 @@ let StoreFrontPageClass = (function(){

StoreFrontPageClass.prototype.highlightDynamic = function() {

let recentlyUpdatedNode = document.querySelector(".recently_updated_block");
if (recentlyUpdatedNode) {
let recentlyUpdated = document.querySelector(".recently_updated");
if (recentlyUpdated) {
let observer = new MutationObserver(mutations => {
if (mutations[0].oldValue.display === "none") {
Highlights.highlightAndTag(recentlyUpdatedNode.querySelectorAll(".store_capsule"));
}
mutations.forEach(mutation => Highlights.highlightAndTag(mutation.addedNodes[0].children));
observer.disconnect();
});
observer.observe(recentlyUpdatedNode, {attributes: true, attributeFilter: ["style"], attributeOldValue: true});
observer.observe(recentlyUpdated, { childList: true });
}

// Monitor and highlight wishlishted recommendations at the bottom of Store's front page
let contentNode = document.querySelector("#content_more");
if (contentNode) {
let observer = new MutationObserver(function(mutations){
let observer = new MutationObserver(mutations => {
mutations.forEach(mutation =>
mutation.addedNodes.forEach(node => {
if (node.nodeType !== Node.ELEMENT_NODE) { return; }
Expand Down

0 comments on commit 80439a4

Please sign in to comment.