summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/media4svg/media4svg.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-04-14 03:02:32 +0000
committerNorbert Preining <norbert@preining.info>2020-04-14 03:02:32 +0000
commitc7235aafe4ddb8f9800cdf784212d4c53bb53e32 (patch)
tree3485e2d65f65d8128206c5a1c45c842b26e84705 /macros/latex/contrib/media4svg/media4svg.sty
parentc98e9ebef816f09dc54c52a01df4f978e1b210fc (diff)
CTAN sync 202004140302
Diffstat (limited to 'macros/latex/contrib/media4svg/media4svg.sty')
-rw-r--r--macros/latex/contrib/media4svg/media4svg.sty60
1 files changed, 36 insertions, 24 deletions
diff --git a/macros/latex/contrib/media4svg/media4svg.sty b/macros/latex/contrib/media4svg/media4svg.sty
index a14c4cd00f..f0451ae7ec 100644
--- a/macros/latex/contrib/media4svg/media4svg.sty
+++ b/macros/latex/contrib/media4svg/media4svg.sty
@@ -38,8 +38,8 @@
\RequirePackage{xparse}
\RequirePackage{atbegshi}
-\def\g@msvg@date@tl{2020/04/09}
-\def\g@msvg@version@tl{0.1}
+\def\g@msvg@date@tl{2020/04/13}
+\def\g@msvg@version@tl{0.2}
\ProvidesExplPackage{media4svg}{\g@msvg@date@tl}{\g@msvg@version@tl}
{acrobat-9/X compatible media}
@@ -47,6 +47,20 @@
\tl_gset_eq:NN\g_msvg_date_tl\g@msvg@date@tl
\tl_gset_eq:NN\g_msvg_version_tl\g@msvg@version@tl
+\msg_set:nnnn{media4svg}{support~outdated}{
+ Support~package~`#1'~too~old.
+}{
+ Update~your~installation~of~`#1'.~Aborting.
+}
+\@ifpackagelater{expl3}{2020/04/06}{}{
+ \msg_fatal:nnn{media4svg}{support~outdated}{l3kernel}
+ \tex_endinput:D
+}
+\@ifpackagelater{l3keys2e}{2020/03/06}{}{
+ \msg_fatal:nnn{media4svg}{support~outdated}{l3packages}
+ \tex_endinput:D
+}
+
%package options
\msg_set:nnnn{media4svg}{unknown~package~option}{Unknown~package~option~`#1'.}{
Package option~`#1'~is~unknown;\\
@@ -253,7 +267,18 @@
transform='translate({?x},{?(y-(\dim_to_decimal_in_bp:n{\g_msvg_ht_tl}))})'
width='\dim_to_decimal_in_bp:n{\g_msvg_wd_tl}'~
height='\dim_to_decimal_in_bp:n{\g_msvg_tt_tl}'~
- cursor='pointer'~
+ \tl_if_blank:VT\g_msvg_controls_tl{
+ ontouchstart='
+ event.preventDefault();event.stopPropagation();
+ if($("\g_msvg_id_tl").paused){
+ $("\g_msvg_id_tl").play();
+ }else{
+ $("\g_msvg_id_tl").pause();
+ }
+ return;% <-- this prevents download-video? dialogue in Chrome
+ '~
+ cursor='pointer'
+ }
>{?nl}
<video~
x="0"~y="0"~
@@ -266,20 +291,6 @@
event.target.play();'~
onmousedown='event.preventDefault();event.stopPropagation();
event.target.pause();'~
- ontouchend='event.preventDefault();event.stopPropagation();
- if(event.targetTouches.length!=0){
- permPause@msvg@\g_msvg_id_tl=true;
- }else{
- if(permPause@msvg@\g_msvg_id_tl){
- permPause@msvg@\g_msvg_id_tl=false;
- }
- else{event.target.play();}
- }
- '~
- ontouchstart='event.preventDefault();event.stopPropagation();
- var~permPause@msvg@\g_msvg_id_tl=false;
- event.target.pause();'~
- ontouchmove='event.preventDefault();event.stopPropagation();'~
}
\tl_if_blank:VF\g_msvg_time_tl{
onloadstart='event.target.currentTime=\g_msvg_time_tl;'~
@@ -669,25 +680,26 @@
% base64-encodes external binary file into tl variable;
% non-LuaTeX version, running media4svg.lua via shell-escape
% (very slow!)
-\newread\g_msvg_stream_ior
+\cs_set_eq:NN\ior_msvg_shell_open:Nn\ior_shell_open:Nn
+\cs_generate_variant:Nn\ior_msvg_shell_open:Nn{Nx}
\cs_new_protected_nopar:Nn\msvg_convert_file_to_blob:nN{% #1 filename, #2 tlvar
\sys_if_shell_unrestricted:F{
\msg_error:nnx{media4svg}{unrestricted~shell~required}{#1}
}
% get path to media4svg.lua
- \immediate\openin\g_msvg_stream_ior="|kpsewhich~media4svg.lua"\relax
- \ior_str_get:NN\g_msvg_stream_ior\l_tmpa_tl
+ \ior_shell_open:Nn\g_tmpa_ior{kpsewhich~media4svg.lua}
+ \ior_str_get:NN\g_tmpa_ior\l_tmpa_tl
\tl_if_blank:VT\l_tmpa_tl{
\msg_error:nnxx{media4svg}{missing~script}{media4svg.lua}{#1}
}
- \closein\g_msvg_stream_ior
+ \ior_close:N\g_tmpa_ior
% encode
- \immediate\openin\g_msvg_stream_ior="|texlua~\l_tmpa_tl\space #1"\relax
+ \ior_msvg_shell_open:Nx\g_tmpa_ior{texlua~\l_tmpa_tl\space #1}
\message{<#1}
\tl_gclear_new:N#2
- \ior_str_map_inline:Nn\g_msvg_stream_ior{
+ \ior_str_map_inline:Nn\g_tmpa_ior{
\tl_gput_right:Nn#2{##1{?nl}}\message{.}}\message{>}
- \closein\g_msvg_stream_ior
+ \ior_close:N\g_tmpa_ior
}
\msg_set:nnnn{media4svg}{file~not~found}{