Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robisatthefunction/5620102f1ebdffe7600146ae0abd1e40 to your computer and use it in GitHub Desktop.
Save robisatthefunction/5620102f1ebdffe7600146ae0abd1e40 to your computer and use it in GitHub Desktop.
{
"plugin_type": "widget",
"name": "Text Change: Hydration Compatible",
"edit_page_url": "atticandbutton.us",
"form_schema": [
{
"default_value": ".hero__title",
"name": "selector",
"field_type": "selector",
"options": null,
"label": "selector"
},
{
"default_value": "Hello",
"name": "text",
"field_type": "text",
"options": null,
"label": "text"
}
],
"description": "",
"options": {
"html": "",
"css": "",
"apply_js": "var utils = window.optimizely.get('utils');\n\n//https://docs.developers.optimizely.com/web/docs/utilities#section-observe-selector\nutils.observeSelector(extension.selector, function(element) {\n element.innerHTML = extension.text;\n}, {\n \"timeout\": 1000000,\n \"once\": false,\n \"onTimeout\": function() {\n console.log(\"Stopped observing\");\n }\n});\n\n",
"undo_js": "var extensionElement = document.getElementById('optimizely-extension-' + extension.$instance);\nif (extensionElement) {\n extensionElement.parentElement.removeChild(extensionElement);\n}\n"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment