summaryrefslogtreecommitdiff
path: root/texmf-dist/tex/latex
diff options
context:
space:
mode:
Diffstat (limited to 'texmf-dist/tex/latex')
-rw-r--r--texmf-dist/tex/latex/ltx4yt/ltx4yt.sty172
-rw-r--r--texmf-dist/tex/latex/ltx4yt/ytpu.def112
2 files changed, 284 insertions, 0 deletions
diff --git a/texmf-dist/tex/latex/ltx4yt/ltx4yt.sty b/texmf-dist/tex/latex/ltx4yt/ltx4yt.sty
new file mode 100644
index 00000000..685ed1dc
--- /dev/null
+++ b/texmf-dist/tex/latex/ltx4yt/ltx4yt.sty
@@ -0,0 +1,172 @@
+%%
+%% This is file `ltx4yt.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% ltx4yt.dtx (with options: `copyright,package')
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% ltx4yt.sty package, %%
+%% Copyright (C) 2020 %%
+%% dpstory@uakron.edu %%
+%% %%
+%% This program can redistributed and/or modified under %%
+%% the terms of the LaTeX Project Public License %%
+%% Distributed from CTAN archives in directory %%
+%% macros/latex/base/lppl.txt; either version 1 of the %%
+%% License, or (at your option) any later version. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\NeedsTeXFormat{LaTeX2e}[1997/12/01]
+\ProvidesPackage{ltx4yt}
+ [2020/07/30 v0.7 ltx4yt: Play YouTube videos in the default browser (dps)]
+\RequirePackage{xkeyval}
+\DeclareOption{usepopup}{\def\lo@dpu{\InputIfFileExists{ytpu.def}
+ {\PackageInfo{ltx4yt}{Loading ytpu.def}}
+ {\PackageInfo{ltx4yt}{Can't find ytpu.def}}}}
+\DeclareOption{!usepopup}{}
+\let\lo@dpu\relax
+\AtEndOfPackage{\lo@dpu}
+\ProcessOptions
+\RequirePackage{xcolor}
+\RequirePackage{eforms}
+\ifx\lo@dpu\relax\else
+\def\YT@rpPU{\RequirePackage{popupmenu}[2020/07/26]}\expandafter
+\YT@rpPU\fi
+\newcommand{\ytvIdPresets}[1]{\def\yt@vIdPresets{#1}}
+\definecolor{webbrown}{rgb}{.6,0,0} % from the web package
+\ytvIdPresets{\linktxtcolor{webbrown}}
+\providecommand{\URI}[1]{/S/URI/URI(#1)}
+\def\ytNF{false}
+\def\ytURL{https://www.youtube.com}
+\newcommand{\ytvId}{\@ifstar{\def\yt@ask{*}\yt@@vId}
+ {\let\yt@ask\@empty\yt@@vId}}
+\newcommand{\yt@@vId}[3][]{%
+ \ifx\yt@ask\@empty
+ \def\yt@lnk@hash{embed/#2}\else
+ \def\yt@lnk@hash{watch?v=#2}\fi
+ \setLink[\presets{\yt@vIdPresets}#1
+ \A{\URI{\ytURL/\yt@lnk@hash}}]{#3}%
+}
+\newcommand{\ytvIdML}{\@ifstar{\def\yt@ask{*}\yt@@vIdML}
+ {\let\yt@ask\@empty\yt@@vIdML}}
+\newcommand{\yt@@vIdML}[3][]{%
+ \ifx\yt@ask\@empty
+ \def\yt@lnk@hash{embed/#2}\else
+ \def\yt@lnk@hash{watch?v=#2}\fi
+ \mlsetLink[\presets{\yt@vIdPresets}#1
+ \A{\URI{\ytURL/\yt@lnk@hash}}]{#3}%
+}
+\newif\ifytwatch \ytwatchfalse
+\def\yt@@parse{\let\ytspec\@empty\yt@parse}
+\def\yt@parse{\@ifnextchar\@nil{\@gobble}{\yt@parsei}}
+\def\yt@parsei{\@ifnextchar\watchId{% check for \watchId
+ \ytwatchtrue\yt@parse@watch}{\yt@parseii}}
+\def\yt@parse@watch\watchId#1{\g@addto@macro
+ \ytspec{\watchId{#1}}\yt@parse}
+\def\yt@parseii{\@ifnextchar\embedId{% check for \embedId
+ \yt@parse@embedId}{\yt@parseiii}}
+\def\yt@parse@embedId\embedId#1{\g@addto@macro
+ \ytspec{\embedId{#1}}\yt@parse}
+\def\yt@parseiii{\@ifnextchar\embed{% check for \embed
+ \yt@parse@embed}{\yt@parseiv}}
+\def\yt@parse@embed\embed#1{\g@addto@macro
+ \ytspec{\embed{#1}}\yt@parse}
+\def\yt@parseiv{\@ifnextchar\params{% check for \params
+ \yt@parse@params}{\yt@parsev}}
+\def\yt@parse@params\params#1{\ifytwatch
+ \g@addto@macro\ytspec{&#1}\else
+ \g@addto@macro\ytspec{?#1}\fi
+ \yt@parse}
+\def\yt@parsev#1\@nil{\g@addto@macro\ytspec{#1}}
+\newcommand{\ytLink}[3][]{\begingroup
+ \def\embedId##1{embed/##1}%
+ \def\params##1{##1}\def\embed##1{embed?##1}%
+ \def\watchId##1{watch?v=##1}\def\channel##1{c/##1}%
+ \def\user##1{user/##1}%
+ \yt@@parse#2\@nil % returns arg in \ytspec
+ \def\URLArg{\ytURL/\ytspec}%
+ \setLink[\presets{\yt@vIdPresets}#1\A{\URI{\URLArg}}
+ ]{#3}\endgroup
+}
+\newcommand{\ytLinkML}[3][]{\begingroup
+ \def\embedId##1{embed/##1}%
+ \def\params##1{##1}\def\embed##1{embed?##1}%
+ \def\watchId##1{watch?v=##1}\def\channel##1{c/##1}%
+ \def\user##1{user/##1}%
+ \yt@@parse#2\@nil % returns arg in \ytspec
+ \def\URLArg{\ytURL/\ytspec}%
+ \mlsetLink[\presets{\yt@vIdPresets}#1
+ \A{\URI{\URLArg}}
+ ]{#3}\endgroup
+}
+\newcommand{\ytComboList}[4][]{%
+ \comboBox[\Ff{\FfCommitOnSelChange}\DV{\yt@pl@def}\V{\yt@pl@def}
+ \presets{\yt@ComboListPresets}#1]{ytSelect#2}
+ {#3}{#4}{*\yt@pl@pl}% 2020/07/22 v0.4
+}
+\newcommand{\ytStrPLAY}{PLAY}
+\newcommand{\ytComboBtn}[4][]{%
+ \pushButton[\TU{Click to play}\CA{\ytStrPLAY}
+ \presets{\yt@ComboBtnPresets}#1
+ \A{\JS{var f=this.getField("ytSelect#2");\r
+ var ytID=f.value;\r
+ var i=f.currentValueIndices;\r
+ var ytFV=f.getItemAt(i,false);\r
+ var i=ytFV.indexOf("*");\r
+ if ( i == -1 )\r\t
+ app.launchURL("\ytURL/embed/"+ytID,\ytNF);\r
+ else\r\t
+ app.launchURL("\ytURL/watch?v="+ytID,\ytNF);
+ }}]{ytSelectBtn#2}{#3}{#4}%
+}
+\newcommand{\ytPlayList}{\begingroup\@makeother\_\@makeother\'
+ \ytPlayList@i}
+\def\ytPlayList@i#1#2{\gdef\yt@pl@def{#1}\xdef\yt@pl@pl{#2}\endgroup}
+\newcommand{\ytComboListPresets}[1]{\def\yt@ComboListPresets{#1}}
+\let\yt@ComboListPresets\@empty
+\newcommand{\ytComboBtnPresets}[1]{\def\yt@ComboBtnPresets{#1}}
+\let\yt@ComboBtnPresets\@empty
+\newcommand{\ytIdTitle}[2]{[(#2)(#1)]}
+\newcommand{\declarePlayList}[1]{\bgroup
+ \Hy@unicodefalse
+ \let\pl@yList\@empty
+ \ifpdfmarkup
+ \def\Esc{\eqbs}\else\def\Esc{}\fi
+ \def\cs##1{\eqbs\eqbs##1}\relax
+ \@makeother\_\@makeother\-
+ \yt@declarePlayList{#1}%
+}
+\def\yt@declarePlayList#1#2{%
+ \yt@declarePlayList@i#2\@nil\relax\relax
+ \toks@=\expandafter{\pl@yList}\relax
+ \xdef#1{\pl@yList}\egroup
+}
+\def\yt@declarePlayList@i{\@ifnextchar\@nil
+ {\expandafter\@gobbletwo\@gobble}
+ {\yt@declarePlayList@ii}%
+}
+\def\yt@declarePlayList@ii\ytIdTitle#1#2{%
+ \pdfstringdef\yt@PLTitle{#1}%
+ \edef\y{[(#2)(\yt@PLTitle)]}%
+ \expandafter\g@addto@macro\expandafter
+ \pl@yList\expandafter{\y}%
+ \yt@declarePlayList@i
+}
+\newcommand{\ytInputQuery}[3][]{%
+ \textField[\TU{Enter a query text string}#1]{ytSearchTxt}{#2}{#3}}
+\newcommand{\ytSearch}[3][]{%
+ \pushButton[\CA{Search}#1\AAmouseup{%
+ var f=this.getField("ytSearchTxt");\r
+ var v=f.value;\r
+ if ( v.replace(/\string\s/g,"") != "" )\r\t
+ app.launchURL("\ytURL/embed?listType=search&list="+v);}
+ ]{ytSearchBtn}{#2}{#3}}
+\newcommand{\ytClearQuery}[3][]{%
+ \pushButton[\CA{Clear}#1
+ \AAmouseup{this.resetForm("ytSearchTxt");}
+ ]{ytSearchClr}{#2}{#3}%
+}
+\endinput
+%%
+%% End of file `ltx4yt.sty'.
diff --git a/texmf-dist/tex/latex/ltx4yt/ytpu.def b/texmf-dist/tex/latex/ltx4yt/ytpu.def
new file mode 100644
index 00000000..496e80a6
--- /dev/null
+++ b/texmf-dist/tex/latex/ltx4yt/ytpu.def
@@ -0,0 +1,112 @@
+%%
+%% This is file `ytpu.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% ltx4yt.dtx (with options: `copyright,pujs')
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% ltx4yt.sty package, %%
+%% Copyright (C) 2020 %%
+%% dpstory@uakron.edu %%
+%% %%
+%% This program can redistributed and/or modified under %%
+%% the terms of the LaTeX Project Public License %%
+%% Distributed from CTAN archives in directory %%
+%% macros/latex/base/lppl.txt; either version 1 of the %%
+%% License, or (at your option) any later version. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\ytPopupAllMenuData{// ltx4yt: Begin popup menu data^^J}%
+\let\ytMenuNames\@gobble
+\newcommand{\ytUseMenus}[1]{\bgroup
+ \@for\yt@menu:=#1\do{%
+ \edef\x{\noexpand\g@addto@macro\noexpand
+ \ytMenuNames{,"\yt@menu"}}\x
+ \edef\x{\expandafter\noexpand\@nameuse{\yt@menu}}%
+ \toks@=\expandafter{\x^^J}%
+ \expandafter\g@addto@macro\expandafter
+ \ytPopupAllMenuData\expandafter{\the\toks@}%
+ }\g@addto@macro\ytPopupAllMenuData
+ {// ltx4yt: End of popup menu data}%
+ \egroup
+}
+\@onlypreamble\ytUseMenus
+\newcommand{\puIdTitle}[2]{\Hy@unicodefalse\pdfstringdef\x@YT{#1}%
+ \edef\y@YT{\noexpand\item{title={\x@YT},%
+ return={[\noexpand\itemindex,'#2']}}}\y@YT}
+\def\ytpubtnCnt{0}
+\newcommand{\ytPopupBtn}[4][]{\bgroup
+ \@tempcnta\ytpubtnCnt\relax
+ \advance\@tempcnta\@ne
+ \xdef\ytpubtnCnt{\the\@tempcnta}%
+ \pushButton[\cmd{\pmpvCAOff}\CA{YT Menu}
+ \textColor{0 0 1}\W1\BC{}\textSize{0}
+ \H{N}\S{S}\presets{\yt@PopupPresets}#1
+ \AAmouseenter{ytPopupMenu("#2");} % dps
+ ]{ytPopup\ytpubtnCnt}{#3}{#4}\egroup
+}
+\newcommand{\ytPopupPresets}[1]{\def\yt@PopupPresets{#1}}
+\let\yt@PopupPresets\@empty
+\begin{insDLJS*}{yt}
+\begin{newsegment}{ltx4yt: %
+Popup Menu Data and JavaScript support functions}
+var YTdebug=false;
+var aYTLastChoice=new Array;
+var bYTLastChoice=false;
+\ytPopupAllMenuData
+var aChoice; // make local
+function ytProcessMenu(cMenu) { // aMenu->cMenu now a string
+ var aMenu=eval(cMenu);
+ var cChoice = app.popUpMenuEx.apply( app, aMenu );
+ ytProcessMenu.cChoice=cChoice;
+ if ( cChoice != null ) {
+ aChoice=eval(cChoice);
+ if (aChoice[1]=="") return null;
+ var thisChoice=aChoice[0];
+ eval(cMenu+thisChoice).bMarked=true;
+ if (!bYTLastChoice) {
+ eval(cMenu+aChoice[0]).bMarked=true;
+ } else {
+ var structLoc=eval(aYTLastChoice[1])[0]
+ eval(aYTLastChoice[0]+structLoc).bMarked=false;
+ eval(cMenu+aChoice[0]).bMarked=true;
+ }
+ return aChoice;
+ } else return null;
+}
+function ytPopupMenu(cMenu) { // cMenu now a string
+ var aChoice=ytProcessMenu(cMenu);
+ var cChoice=ytProcessMenu.cChoice;
+ var aMenu=eval(cMenu);
+ if (aChoice!=null) {
+ var title=eval(cMenu+aChoice[0]).cName;
+ var i=title.indexOf("*");
+ var _hash=(i == -1)?"embed/"+aChoice[1]:"watch?v="+aChoice[1];
+ if (!bYTLastChoice) {
+ if(YTdebug) %
+console.println("launching url https://www.youtube.com/"+_hash);
+ else app.launchURL("https://www.youtube.com/"+_hash,false);
+ aYTLastChoice=[cMenu,cChoice];
+ bYTLastChoice=true;
+ } else {
+var cLastMenu=eval(aYTLastChoice[1])[0]
+ aYTLastChoice=[cMenu,cChoice];
+ if (cLastMenu!=aChoice[0]) {
+ if (YTdebug) %
+console.println("will launch url: https://www.youtube.com/"+_hash);
+ else app.launchURL("https://www.youtube.com/"+_hash,false);
+ } else {
+ if (YTdebug) console.println("will NOT launch url");
+ // choice is the same, uncheck this item
+ eval(cMenu+aChoice[0]).bMarked=false;
+ bYTLastChoice=false;
+ }
+ }
+ }
+}
+\end{newsegment}
+\end{insDLJS*}
+\endinput
+%%
+%% End of file `ytpu.def'.