Changes

no edit summary
Line 335: Line 335:  
//})
 
//})
   −
// Basic webp/webm/etc. support
+
// Basic webp/webm/ogg/mp4 video support using <img> and <video> in elements with respective classes
    
$('.webp').each(function () {
 
$('.webp').each(function () {
Line 347: Line 347:  
});
 
});
   −
$('.webm').each(function () {
+
for (var ext of ['webm', 'ogg', 'mp4']) {
var video = $('<video>').attr('controls');
+
$('.' + ext).each(function () {
var source = $('<source>').attr('type', 'video/webm');
+
var video = $('<video>').attr('controls');
for (var attr in $(this).data()) {
+
var source = $('<source>').attr('type', 'video/' + ext);
;(attr === 'src' || attr === 'type' ? source : video).attr(attr, (attr === 'src' ? 'https://en.kancollewiki.net/Special:Filepath/' : '') + $(this).data(attr));
+
for (var attr in $(this).data()) {
}
+
;(attr === 'src' || attr === 'type' ? source : video).attr(attr, (attr === 'src' ? 'https://en.kancollewiki.net/Special:Filepath/' : '') + $(this).data(attr));
video.append(source);
+
}
      $(this).append(video);
+
video.append(source);
});
+
      $(this).append(video);
 +
});
 +
}
    
});
 
});
cssedit, gkautomate
7,064

edits