Would like to add this extension to the library. It is basically a template that can be used to easily build an extension quickly (includes code to place the extension on the page.
@kennethkutyn-optimizely I made a couple changes to simplify the code. Can you verify the extension in this branch does what you expect? https://github.com/optimizely/library/pull/53
Would like to add this extension to the library. It is basically a template that can be used to easily build an extension quickly (includes code to place the extension on the page.
{ "plugin_type": "widget", "name": "Extension Template", "edit_page_url": "www.optimizely.com", "form_schema": [ { "default_value": "before", "field_type": "dropdown", "name": "position", "label": "Position", "options": { "choices": [ { "value": "before", "label": "Before" }, { "value": "after", "label": "After" }, { "value": "replace", "label": "Replace" }, { "value": "prepend", "label": "At Beginning" }, { "value": "append", "label": "At End Of" } ] } }, { "default_value": "None", "field_type": "selector", "name": "selector", "label": "Selector", "options": null }, { "default_value": "Title Text", "field_type": "text", "name": "title", "label": "title", "options": null }, { "default_value": "Title Text", "field_type": "text", "name": "text", "label": "text", "options": null } ], "description": "", "options": { "html": "<div id=\"optimizely-extension-{{ widget.$instance }}\" class=\"heroWidget\">\n</div>", "css": "", "apply_js": "$(function() {\n \nif(extension.position == \"before\"){ \n $(extension.selector).before(extension.$html);\n} else if(extension.position == \"prepend\") { \n $(extension.selector).prepend(extension.$html);\n} else if(extension.position == \"after\") { \n $(extension.selector).after(extension.$html);\n} else if(extension.position == \"append\") { \n $(extension.selector).append(extension.$html);\n}else{\n $(extension.selector).html(extension.$html);\n}\t\n\n});", "undo_js": "$('#optimizely-extension-' + extension.$instance).remove();" } }