kopia lustrzana https://github.com/miklobit/TiddlyWiki5
				
				
				
			Add support for tiddlers containing mp4 videos
							rodzic
							
								
									814353d8ce
								
							
						
					
					
						commit
						99df9f46f7
					
				| 
						 | 
				
			
			@ -1835,6 +1835,7 @@ $tw.boot.startup = function(options) {
 | 
			
		|||
	$tw.utils.registerFileType("image/x-icon","base64",".ico",{flags:["image"]});
 | 
			
		||||
	$tw.utils.registerFileType("application/font-woff","base64",".woff");
 | 
			
		||||
	$tw.utils.registerFileType("audio/ogg","base64",".ogg");
 | 
			
		||||
	$tw.utils.registerFileType("video/mp4","base64",".mp4");
 | 
			
		||||
	$tw.utils.registerFileType("audio/mp3","base64",".mp3");
 | 
			
		||||
	$tw.utils.registerFileType("audio/mp4","base64",[".mp4",".m4a"]);
 | 
			
		||||
	$tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,35 @@
 | 
			
		|||
/*\
 | 
			
		||||
title: $:/core/modules/parsers/videoparser.js
 | 
			
		||||
type: application/javascript
 | 
			
		||||
module-type: parser
 | 
			
		||||
 | 
			
		||||
The video parser parses a video tiddler into an embeddable HTML element
 | 
			
		||||
 | 
			
		||||
\*/
 | 
			
		||||
(function(){
 | 
			
		||||
 | 
			
		||||
/*jslint node: true, browser: true */
 | 
			
		||||
/*global $tw: false */
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var AudioParser = function(type,text,options) {
 | 
			
		||||
	var element = {
 | 
			
		||||
			type: "element",
 | 
			
		||||
			tag: "video",
 | 
			
		||||
			attributes: {
 | 
			
		||||
				controls: {type: "string", value: "controls"}
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		src;
 | 
			
		||||
	if(options._canonical_uri) {
 | 
			
		||||
		element.attributes.src = {type: "string", value: options._canonical_uri};
 | 
			
		||||
	} else if(text) {
 | 
			
		||||
		element.attributes.src = {type: "string", value: "data:" + type + ";base64," + text};
 | 
			
		||||
	}
 | 
			
		||||
	this.tree = [element];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports["video/mp4"] = AudioParser;
 | 
			
		||||
 | 
			
		||||
})();
 | 
			
		||||
 | 
			
		||||
		Ładowanie…
	
		Reference in New Issue