Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Submitting a New Extension #52

Open
kennethkutyn-optimizely opened this issue Sep 2, 2019 · 1 comment
Open

Submitting a New Extension #52

kennethkutyn-optimizely opened this issue Sep 2, 2019 · 1 comment

Comments

@kennethkutyn-optimizely
Copy link

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();" } }

@asaschachar
Copy link
Contributor

@kennethkutyn-optimizely I made a couple changes to simplify the code. Can you verify the extension in this branch does what you expect? #53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants