Skip to content

Instantly share code, notes, and snippets.

@yesil
Created August 15, 2024 16:11
Show Gist options
  • Save yesil/38eaa648c9e5e53c5d800a713bb5210f to your computer and use it in GitHub Desktop.
Save yesil/38eaa648c9e5e53c5d800a713bb5210f to your computer and use it in GitHub Desktop.
WCS Overlay for adobe.com Milo pages
javascript:(function()%7Blet%20overlay%20%3D%20document.getElementById('wcs-osi-overlay')%3B%0Aif%20(overlay)%20%7B%0A%20%20overlay.style.display%20%3D%20overlay.style.display%20%3D%3D%3D%20'none'%20%3F%20''%20%3A%20'none'%3B%0A%7D%20else%20%7B%0A%20%20const%20style%20%3D%20document.createElement('style')%3B%0A%20%20style.innerHTML%20%3D%20%60%0A%23wcs-osi-overlay%20%7B%0Aposition%3A%20fixed%3B%0Atop%3A%2064px%3B%0Aright%3A%200px%3B%0Awidth%3A%20600px%3B%0Aheight%3A%20360px%3B%0Abackground-color%3A%20rgb(239%20221%20221)%3B%0Az-index%3A%201000%3B%0Adisplay%3A%20flex%3B%0Aflex-direction%3A%20column%3B%0Ajustify-content%3A%20center%3B%0Apadding%3A%2020px%3B%0Aborder%3A%202px%20solid%20%23e0e0e0%3B%0Aborder-radius%3A%208px%3B%0A%7D%0A%60%3B%0A%0A%20%20document.head.appendChild(style)%3B%0A%20%20overlay%20%3D%20document.createElement('div')%3B%0A%20%20overlay.setAttribute('id'%2C%20'wcs-osi-overlay')%3B%0A%20%20document.body.appendChild(overlay)%3B%0A%20%20document.body.addEventListener('mouseover'%2C%20(e)%20%3D%3E%20%7B%0A%20%20%20%20const%20el%20%3D%20e.target.closest('%5Bdata-wcs-osi%5D.placeholder-resolved')%3B%0A%0A%20%20%20%20if%20(!el)%20return%3B%0A%0A%20%20%20%20const%20%7B%0A%20%20%20%20%20%20offerSelectorIds%3A%20%5BofferSelectorId%5D%2C%0A%20%20%20%20%20%20offerId%2C%0A%20%20%20%20%20%20productArrangement%3A%20%7B%20productCode%2C%20productFamily%20%7D%2C%0A%20%20%20%20%20%20productArrangementCode%2C%0A%20%20%20%20%20%20planType%2C%0A%20%20%20%20%20%20offerType%2C%0A%20%20%20%20%20%20customerSegment%2C%0A%20%20%20%20%20%20marketSegments%3A%20%5BmarketSegment%5D%2C%0A%20%20%20%20%20%20pricePoint%2C%0A%20%20%20%20%20%20language%2C%0A%20%20%20%20%20%20priceDetails%3A%20%7B%20taxDisplay%20%7D%2C%0A%20%20%20%20%7D%20%3D%20el.value%5B0%5D%3B%0A%0A%20%20%20%20const%20%7B%20country%2C%20forceTaxExclusive%20%7D%20%3D%20el.options%3B%0A%0A%20%20%20%20overlay.innerHTML%20%3D%20Object.entries(%7B%0A%20%20%20%20%20%20'Offer%20Selector%20ID'%3A%20%60%3Ca%20target%3D%22_blank%22%20href%3D%22https%3A%2F%2Fwww.adobe.com%2Fweb_commerce_artifact%3Foffer_selector_ids%3D%24%7BofferSelectorId%7D%26country%3D%24%7Bcountry%7D%26language%3D%24%7Blanguage%7D%26api_key%3Dwcms-commerce-ims-ro-user-milo%26landscape%3DPUBLISHED%22%3E%24%7BofferSelectorId%7D%3C%2Fa%3E%60%2C%0A%20%20%20%20%20%20'Offer%20ID'%3A%20%60%3Ca%20target%3D%22_blank%22%20href%3D%22https%3A%2F%2Faos.adobe.io%2Foffers%2F%24%7BofferId%7D%3Fcountry%3D%24%7Bcountry%7D%26api_key%3Dwcms-commerce-ims-user-prod%26environment%3DPROD%26landscape%3DPUBLISHED%22%3E%24%7BofferId%7D%3C%2Fa%3E%60%2C%0A%20%20%20%20%20%20'Offer%20Type'%3A%20offerType%2C%0A%20%20%20%20%20%20'Plan%20Type'%3A%20planType%2C%0A%20%20%20%20%20%20'Customer%20Segment'%3A%20customerSegment%2C%0A%20%20%20%20%20%20'Market%20Segment'%3A%20marketSegment%2C%0A%20%20%20%20%20%20'PA%20Code'%3A%20productArrangementCode%2C%0A%20%20%20%20%20%20'Product%20Code'%3A%20productCode%2C%0A%20%20%20%20%20%20'Product%20Family'%3A%20productFamily%2C%0A%20%20%20%20%20%20'Price%20Point'%3A%20pricePoint%2C%0A%20%20%20%20%20%20Language%3A%20language%2C%0A%20%20%20%20%20%20'TAX%20Display'%3A%20taxDisplay%2C%0A%20%20%20%20%20%20'Force%20Tax%20Exclusive'%3A%20forceTaxExclusive%2C%0A%20%20%20%20%7D)%0A%20%20%20%20%20%20.map(%0A%20%20%20%20%20%20%20%20(%5Bkey%2C%20value%5D)%20%3D%3E%20%60%3Cdiv%3E%3Cspan%20style%3D%22font-weight%3A%20700%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%3E%24%7Bkey%7D%3A%3C%2Fspan%3E%20%24%7Bvalue%7D%3C%2Fdiv%3E%60%2C%0A%20%20%20%20%20%20)%0A%20%20%20%20%20%20.join('')%3B%0A%20%20%7D)%3B%0A%7D%7D)()%3B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment