MediaWiki:StrawpollIntegrator2.js

From Inkipedia, the Splatoon wiki
Revision as of 21:53, 1 March 2022 by Fumple (talk | contribs) (Remove `www.` as it doesn't work on strawpoll.com)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/**
 * Name:        StrawpollIntegrator
 * Author:      Fujimaru-kun
 * Description: Allows intergration with strawpoll.com polls
 */
 
mw.hook('wikipage.content').add(function($content) {
    if (!$content) {
        return;
    }
    $content.find('.strawpollcom').each(function() {
        var $this = $(this),
            id = $this.attr('data-poll-id'),
            css = {
                width: 'inherit',
                height: 'inherit',
                border: 0
            };
        $this.html(
            $('<iframe>', {
                src: 'https://strawpoll.com/embed/' + id,
                css: css
            })
        );
    });
});