Skip to content

Instantly share code, notes, and snippets.

@kimhogeling
Last active March 28, 2018 09:37
Show Gist options
  • Save kimhogeling/d6e1314f61324c0210a21c8385264d51 to your computer and use it in GitHub Desktop.
Save kimhogeling/d6e1314f61324c0210a21c8385264d51 to your computer and use it in GitHub Desktop.
script to insert a test widget (minified version)
!function(a,widgetId='183',appId='f371b9ed',searchTerm='Wohnzimmer'){function h(){var l=document.createElement('div');return l.setAttribute('class','s24widget'),l.setAttribute('id','s24widget'),l.setAttribute('data-app-id',appId),l.setAttribute('data-widget-id',widgetId),l.setAttribute('data-search-term',searchTerm),l}function j(){var l=document.createElement('script');return l.src='https://widget.s24.com/js/s24widget.min.js',l}function k(){a.map(l=>l.removeEventListener('click',k)),this.appendChild(h()),this.appendChild(j())}a.map(l=>l.addEventListener('click',k))}(Array.prototype.slice.call(document.querySelectorAll('body *')))
@kimhogeling
Copy link
Author

kimhogeling commented Mar 28, 2018

Instructions

  1. Open the page on which you want to try a widget.
  2. Copy-paste this script into the browser's console and adjust widgetId, appId and searchTerm.
  3. Press Enter to run the script.
  4. Now just click anywhere on the page, where you want to insert the widget.

Semantic Widget?

If the widget ist semantic, just empty the search term like so: ...,searchTerm='')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment