MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
Autoplay MP4s with autoplay class
No edit summary
(Autoplay MP4s with autoplay class)
 
(8 intermediate revisions by one other user not shown)
Line 104: Line 104:
$( createCollapseButtons );
$( createCollapseButtons );


 
/* Autoplay videos with autoplay class */
// Raw text on sidebar (hopefully this works lol)
var vids = document.getElementsByClassName("autoplay");
$wgHooks['SkinBuildSidebar'][] = 'lfHideSidebar';
for(var i = 0; i < vids.length; i++){
function lfHideSidebar( $skin, &$bar ) {
  vids[i].controls = true;
   global $wgUser;
  vids[i].setAttribute("playsinline", "");
    'text' => wfMessage( 'Sidebar' )->inContentLanguage()->parse(),
  vids[i].muted = true;
   vids[i].autoplay = true;
  vids[i].loop = true;
  vids[i].play();
}
}

Navigation menu