Skip to content

Option to use saved items list #50

Open
@Spegs21

Description

@Spegs21

I've heard people may have better luck by adding to the cart from the saved items list.

This seemed like it should be a fairly easy implementation but the page is slow to load so the script runs before the button loads and can't find it.

if (pagetitle.includes(ITEM_KEYWORD) || pagetitle.includes("Saved")) {

         //Create Custom Badge
         //
         const $badge = createFloatingBadge("Auto Detecting Mode", "Initializing ..");
         console.log('BEGIN ')
         document.body.appendChild($badge);
         $badge.style.transform = "translate(0, 0)"
         //Out of Stock Button
         //
         var OOSButton;
         const OOSButton_SavedItems_L1 = "c-button c-button-outline c-button-sm c-button-block add-to-cart-button"
         //c-button c-button-outline c-button-sm c-button-block c-button-icon c-button-icon-leading add-to-cart-button
         const OOSButton_L1 = "c-button c-button-disabled c-button-lg c-button-block add-to-cart-button"
         const OOSButton_L2 = "btn btn-disabled btn-lg btn-block add-to-cart-button"
         console.log('BEGIN ')
         if (document.getElementsByClassName(OOSButton_L1).length == 1)
         {
             OOSButton = document.getElementsByClassName(OOSButton_L1);
             console.log('OOS Button Class 1 : ' + OOSButton_L1)
         }
         else if (document.getElementsByClassName(OOSButton_L2).length == 1)
         {
             OOSButton = document.getElementsByClassName(OOSButton_L2);
             console.log('OOS Button Class 2 : ' + OOSButton_L2)
         }
         else if (document.getElementsByClassName(OOSButton_SavedItems_L1).length == 1)
         {
             OOSButton = document.getElementsByClassName(OOSButton_SavedItems_L1);
             console.log('OOS Button Saved Items Class 1 : ' + OOSButton_SavedItems_L1)
         }

I tired adding event handlers to wait for the page to load but I could never get the window.onLoad event to fire for the popup, even if I attached an event handler to it.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions