Skip to content

Instantly share code, notes, and snippets.

View robisatthefunction's full-sized avatar

Robert Saunders robisatthefunction

  • Optimizely
View GitHub Profile
var utils = window.optimizely.get('utils');
utils.waitForElement('#details > div.headerPhotoContainer > div > div > section > div > div.detail-title-container > div > div > a').then(function(element){
element.addEventListener('click',function(){
utils.waitForElement('#mytraderModal > div.modalContent.padding15.clearBoth > wc-digital-retailing').then(function(element){
document.querySelector("#mytraderModal > div.modalContent.padding15.clearBoth > wc-digital-retailing").shadowRoot.querySelector("div > div.make-scrollable > div > div.container > div:nth-child(3) > div:nth-child(3) > div > label").innerHTML = "Phone Number (Recommended)";
});
});
});
var decisionString = window.optimizely.get('state').getDecisionString({
campaignId: campaignId,
shouldCleanString: true
});
var redirectInfo = window.optimizely.get('state').getRedirectInfo();
var listVar = extension.listVar;
var prop = extension.prop;
var delimiter = '|';
// Public Methods
// Run fetchRecos(targetId) in the console after you execute this in the console
console.log("version 2.27");
function htmlToElement(html) {
var template = document.createElement('template');
html = html.trim(); // Never return a text node of whitespace as the result
template.innerHTML = html;
return template.content.firstChild;
}
var utils = optimizely.get('utils');
var recommender = optimizely.get('recommender');
// This boolean tells whether you are in the editor, so that you can special case if needed.
var editorMode = !!window.optimizely_p13n_inner ||
window.location != window.parent.location &&
window.location.search.indexOf('optimizely_editor') > -1,
logEnabled = editorMode || window.localStorage.getItem('logRecs');
var log = function() {
{
"plugin_type": "widget",
"name": "Video Popup",
"edit_page_url": "https://robisatthefunction.github.io/mockWebsite/index.html",
"form_schema": [
{
"default_value": "#000000",
"field_type": "color",
"name": "fgcolor",
"label": "Text Color",
window.dcpAttributes = undefined;
function onActivated() {
var utils = window.optimizely.get('utils');
var visitorId = window.optimizely.get('visitor').visitorId;
var projectId = window.optimizely.get('data').projectId;
// [MUST CHANGE] add customer DCP table ID here
var datatasource = undefined;
// [MUST CHANGE] change window.customerID to variable they are using
(function () {
window['optimizely'] = window['optimizely'] || [];
var utils = window["optimizely"].get('utils');
utils.waitUntil(function () {
return utag.data;
}).then(function () {
window.optimizely = window.optimizely || [];
window.optimizely.push({
"type": "user",
"attributes": utag.data // filter down
window.searchVariation = function () {
if (document.readyState === "loading" || document.readyState === "uninitialized") {
document.addEventListener("DOMContentLoaded", addSearch);
} else {
when("nav.gnav", function () {
if (!document.querySelector(".subnav-menu") && !document.querySelector(".ods-18792435885-menu")) {
addBar();
} else {
grabData();
}
window.searchVariation();
document.addEventListener('DOMContentLoaded', function() {
});