MediaWiki:VKWidget.js

+function (cfg) { // reinit vk widgets by new params; +wikipage.content hook support, // that missed in the original widget. @user:fngplg, 2018 // forward-compatible w\ any possbile option: https://vk.com/dev/widget_community // mw.hook('fng.vkwidget').fire(widgetid) // 

if (cfg.loaded) return; cfg.loaded = true; mw.hook('wikipage.content').add(function($content) {       var timer = setInterval(function { var $widgets = $content.find('[data-wikia-widget="vk"]'); if (!$widgets.length) { clearInterval(timer); return; }           if (!window.VK || !window.VK.Widgets) return; clearInterval(timer); $widgets.each(function {               var $this = $(this),                    elementId = $this.attr('id'),                    options = $this.data,                    groupId = options.groupId,                    addOptions = $this.closest('.vk').data;                if ($this.find('iframe').length && !Object.keys(addOptions).length) return;// there is nothing to do                options = $.extend({}, options, addOptions);                setTimeout(function { $('#' + elementId).children.remove;// remove previous one mw.hook('fng.vkwidget').fire(window.VK.Widgets.Group(elementId, options, groupId)); }, 100);           });        }, 100);    }); }((window.fng = window.fng || {vkwidget:{}}).vkwidget = window.fng.vkwidget || {});