Easier to maintain template structure

This the head and footer don't have to be included everytime and the hierarchy is easier to read
This commit is contained in:
Pierre Rudloff 2022-02-03 21:38:29 +01:00
parent de74808459
commit ac8c53375a
11 changed files with 201 additions and 195 deletions

View file

@ -1,8 +1,8 @@
{include file='inc/head.tpl'} {extends file='page.tpl'}
<div class="wrapper"> {block name='main'}
<main class="main error"> <div class="error">
{include file="inc/logo.tpl"} {include file="inc/logo.tpl"}
<h2>{t}An error occurred{/t}</h2> <h2>{t}An error occurred{/t}</h2>
<p><i>{$error|escape|nl2br}</i></p> <p><i>{$error|escape|nl2br}</i></p>
</main> </div>
{include file='inc/footer.tpl'} {/block}

View file

@ -1,12 +1,12 @@
{include file='inc/head.tpl'} {extends file='page.tpl'}
{include file='inc/header.tpl'} {block name='main'}
{include file='inc/logo.tpl'} {include file='inc/logo.tpl'}
<h2 class="titre">{t}Supported websites{/t}</h2> <h2 class="titre">{t}Supported websites{/t}</h2>
<div class="tripleliste"> <div class="tripleliste">
<ul> <ul>
{foreach $extractors as $extractor} {foreach $extractors as $extractor}
<li>{$extractor}</li> <li>{$extractor}</li>
{/foreach} {/foreach}
</ul> </ul>
</div> </div>
{include file='inc/footer.tpl'} {/block}

View file

@ -1,4 +1,3 @@
</div>
<footer class="small-font"> <footer class="small-font">
<div class="footer_wrapper"> <div class="footer_wrapper">
{include file='snippets/dev.tpl' assign=dev} {include file='snippets/dev.tpl' assign=dev}
@ -21,9 +20,3 @@
{t params=['@youtubedl'=>$youtubedl]}Based on @youtubedl{/t} {t params=['@youtubedl'=>$youtubedl]}Based on @youtubedl{/t}
</div> </div>
</footer> </footer>
</div>
{if isset($debug_render)}
{$debug_render->render()}
{/if}
</body>
</html>

View file

@ -1,5 +1,3 @@
<!doctype html>
<html lang="{$locale->getLocale()->getBcp47()}">
<head> <head>
<meta charset="UTF-8"/> <meta charset="UTF-8"/>
<meta name=viewport content="width=device-width, initial-scale=1"/> <meta name=viewport content="width=device-width, initial-scale=1"/>
@ -27,5 +25,3 @@
{$debug_render->renderHead()} {$debug_render->renderHead()}
{/if} {/if}
</head> </head>
<body>
<div class="page {$class}">

View file

@ -27,4 +27,3 @@
</div> </div>
{/if} {/if}
</header> </header>
<div class="wrapper">

View file

@ -1,5 +1,8 @@
<h1 class="logobis"> <h1 class="logobis">
<a class="logocompatible" href="{base_url}"> <a class="logocompatible" href="{base_url}">
<span class="logocompatiblemask"><img src="{base_url}/img/logocompatiblemask.png" width="447" height="107" <span class="logocompatiblemask">
alt="{$config->appName}"/></span> <img src="{base_url}/img/logocompatiblemask.png" width="447" height="107"
</a></h1> alt="{$config->appName}"/>
</span>
</a>
</h1>

View file

@ -1,6 +1,5 @@
{include file='inc/head.tpl'} {extends file='page.tpl'}
{include file='inc/header.tpl'} {block name='main'}
<main class="main">
<div><img class="logo" src="{base_url}/img/logo.png" <div><img class="logo" src="{base_url}/img/logo.png"
alt="{$config->appName}" width="328" height="284"></div> alt="{$config->appName}" width="328" height="284"></div>
<form action="{path_for name="info"}"> <form action="{path_for name="info"}">
@ -20,18 +19,23 @@
{if $config->convert} {if $config->convert}
<div class="mp3 small-font"> <div class="mp3 small-font">
<div class="mp3-inner"> <div class="mp3-inner">
<input type="checkbox" id="audio" class="audio" name="audio" {($config->defaultAudio) ? 'checked' : ''}> <input type="checkbox" id="audio" class="audio"
name="audio" {($config->defaultAudio) ? 'checked' : ''}>
<label for="audio"><span class="ui"></span> <label for="audio"><span class="ui"></span>
{t}Audio only (MP3){/t} {t}Audio only (MP3){/t}
</label> </label>
{if $config->convertSeek} {if $config->convertSeek}
<div class="seekOptions"> <div class="seekOptions">
<label for="from">{t}From{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?" <label for="from">{t}From{/t}</label> <input type="text"
placeholder="HH:MM:SS" value="" name="from" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
id="from"/> placeholder="HH:MM:SS" value=""
<label for="to">{t}to{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?" name="from"
placeholder="HH:MM:SS" value="" name="to" id="to"/> id="from"/>
</div> <label for="to">{t}to{/t}</label> <input type="text"
pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
placeholder="HH:MM:SS" value="" name="to"
id="to"/>
</div>
{/if} {/if}
</div> </div>
</div> </div>
@ -44,6 +48,4 @@
<a class="bookmarklet small-font" <a class="bookmarklet small-font"
href="javascript:window.location='{$domain}{path_for name='info' queryParams=['url' => '%url%']}'.replace('%url%', encodeURIComponent(location.href));">{t}Bookmarklet{/t}</a> href="javascript:window.location='{$domain}{path_for name='info' queryParams=['url' => '%url%']}'.replace('%url%', encodeURIComponent(location.href));">{t}Bookmarklet{/t}</a>
</div> </div>
{/block}
</main>
{include file='inc/footer.tpl'}

View file

@ -1,108 +1,106 @@
{include file="inc/head.tpl"} {extends file='page.tpl'}
<div class="wrapper"> {block name='main'}
<div itemscope itemtype="https://schema.org/VideoObject"> <div itemscope itemtype="https://schema.org/VideoObject">
<main class="main"> {include file="inc/logo.tpl"}
{include file="inc/logo.tpl"} {include file='snippets/title.tpl' assign=title}
{include file='snippets/title.tpl' assign=title} <p id="download_intro">
<p id="download_intro"> {t params=['@title' => $title]}You are going to download @title.{/t}
{t params=['@title' => $title]}You are going to download @title.{/t} </p>
</p> {if isset($video->thumbnail)}
{if isset($video->thumbnail)} <img itemprop="thumbnailUrl" class="thumb" src="{$video->thumbnail}" alt=""/>
<img itemprop="thumbnailUrl" class="thumb" src="{$video->thumbnail}" alt=""/> {/if}
{if isset($video->description)}
<meta itemprop="description" content="{$video->description|escape}"/>
{/if}
{if isset($video->upload_date)}
<meta itemprop="uploadDate" content="{$video->upload_date}"/>
{/if}
<br/>
<form action="{path_for name="download"}">
<input type="hidden" name="url" value="{$video->webpage_url}"/>
{if $config->uglyUrls}
<input type="hidden" name="page" value="download"/>
{/if} {/if}
{if isset($video->description)} {if isset($video->formats) && count($video->formats) > 1}
<meta itemprop="description" content="{$video->description|escape}"/> <h3><label for="format">{t}Available formats:{/t}</label></h3>
{/if} <select name="format" id="format" class="formats monospace">
{if isset($video->upload_date)} <optgroup label="{t}Generic formats{/t}">
<meta itemprop="uploadDate" content="{$video->upload_date}"/> {foreach $config->genericFormats as $format => $name}
{/if} {*
<br/> To make the default generic formats translatable:
<form action="{path_for name="download"}"> {t}Best{/t}
<input type="hidden" name="url" value="{$video->webpage_url}"/> {t}Remux best video with best audio{/t}
{if $config->uglyUrls} {t}Worst{/t}
<input type="hidden" name="page" value="download"/> *}
{/if} <option value="{$format}">{t}{$name}{/t}</option>
{if isset($video->formats) && count($video->formats) > 1} {/foreach}
<h3><label for="format">{t}Available formats:{/t}</label></h3> </optgroup>
<select name="format" id="format" class="formats monospace"> <optgroup label="{t}Detailed formats{/t}" class="monospace">
<optgroup label="{t}Generic formats{/t}"> {foreach $video->formats as $format}
{foreach $config->genericFormats as $format => $name} {if $config->stream || $format->protocol|in_array:array('http', 'https')}
{* {strip}
To make the default generic formats translatable: <option value="{$format->format_id}">
{t}Best{/t} {$format->ext}
{t}Remux best video with best audio{/t} {for $foo=1 to (5 - ($format->ext|strlen))}
{t}Worst{/t} &nbsp;
*} {/for}
<option value="{$format}">{t}{$name}{/t}</option> {if isset($format->width)}
{/foreach} {$format->width}x{$format->height}
</optgroup> {for $foo=1 to (10 - (("{$format->width}x{$format->height}")|strlen))}
<optgroup label="{t}Detailed formats{/t}" class="monospace">
{foreach $video->formats as $format}
{if $config->stream || $format->protocol|in_array:array('http', 'https')}
{strip}
<option value="{$format->format_id}">
{$format->ext}
{for $foo=1 to (5 - ($format->ext|strlen))}
&nbsp; &nbsp;
{/for} {/for}
{if isset($format->width)} {else}
{$format->width}x{$format->height} {for $foo=1 to 10}
{for $foo=1 to (10 - (("{$format->width}x{$format->height}")|strlen))} &nbsp;
&nbsp; {/for}
{/for} {/if}
{else} {if isset($format->filesize)}
{for $foo=1 to 10} {($format->filesize/1000000)|round:2} MB
&nbsp; {for $foo=1 to (7 - (($format->filesize/1000000)|round:2|strlen))}
{/for} &nbsp;
{/if} {/for}
{if isset($format->filesize)} {else}
{($format->filesize/1000000)|round:2} MB {for $foo=1 to 10}
{for $foo=1 to (7 - (($format->filesize/1000000)|round:2|strlen))} &nbsp;
&nbsp; {/for}
{/for} {/if}
{else} {if isset($format->format_note)}
{for $foo=1 to 10} {$format->format_note}
&nbsp; {/if}
{/for} &nbsp;({$format->format_id})
{/if} </option>
{if isset($format->format_note)} {/strip}
{$format->format_note} {/if}
{/if}
&nbsp;({$format->format_id})
</option>
{/strip}
{/if}
{/foreach}
</optgroup>
</select>
<br/>
<br/>
{/if}
{if $config->stream}
<input type="checkbox" {if $config->stream !== 'ask'}checked{/if} name="stream" id="stream"/>
<label for="stream">{t}Stream the video through the server{/t}</label>
<br/>
<br/>
{/if}
{if $config->convertAdvanced}
<input type="checkbox" name="customConvert" id="customConvert"/>
<label for="customConvert">{t}Convert into a custom format:{/t}</label>
<select title="{t}Custom format{/t}" name="customFormat" aria-label="{t}Format to convert to{/t}">
{foreach $config->convertAdvancedFormats as $format}
<option>{$format}</option>
{/foreach} {/foreach}
</select> </optgroup>
{t}with{/t} </select>
<label for="customBitrate" class="sr-only">{t}Bit rate{/t}</label> <br/>
<input type="number" value="{$config->audioBitrate}" title="{t}Custom bitrate{/t}" <br/>
class="customBitrate" {/if}
name="customBitrate" id="customBitrate" aria-describedby="customBitrateUnit"/> {if $config->stream}
<span id="customBitrateUnit">{t}kbit/s audio{/t}</span> <input type="checkbox" {if $config->stream !== 'ask'}checked{/if} name="stream" id="stream"/>
<br/> <label for="stream">{t}Stream the video through the server{/t}</label>
<br/> <br/>
{/if} <br/>
<input class="downloadBtn" type="submit" value="{t}Download{/t}"/><br/> {/if}
</form> {if $config->convertAdvanced}
</main> <input type="checkbox" name="customConvert" id="customConvert"/>
<label for="customConvert">{t}Convert into a custom format:{/t}</label>
<select title="{t}Custom format{/t}" name="customFormat" aria-label="{t}Format to convert to{/t}">
{foreach $config->convertAdvancedFormats as $format}
<option>{$format}</option>
{/foreach}
</select>
{t}with{/t}
<label for="customBitrate" class="sr-only">{t}Bit rate{/t}</label>
<input type="number" value="{$config->audioBitrate}" title="{t}Custom bitrate{/t}"
class="customBitrate"
name="customBitrate" id="customBitrate" aria-describedby="customBitrateUnit"/>
<span id="customBitrateUnit">{t}kbit/s audio{/t}</span>
<br/>
<br/>
{/if}
<input class="downloadBtn" type="submit" value="{t}Download{/t}"/><br/>
</form>
</div> </div>
{include file="inc/footer.tpl"} {/block}

18
templates/page.tpl Normal file
View file

@ -0,0 +1,18 @@
<!doctype html>
<html lang="{$locale->getLocale()->getBcp47()}">
{include file='inc/head.tpl'}
<body>
<div class="page {$class}">
{include file='inc/header.tpl'}
<div class="wrapper">
<main class="main">
{block name="main"}{/block}
</main>
</div>
{include file='inc/footer.tpl'}
</div>
{if isset($debug_render)}
{$debug_render->render()}
{/if}
</body>
</html>

View file

@ -1,14 +1,12 @@
{include file='inc/head.tpl'} {extends file='page.tpl'}
<div class="wrapper"> {block name='main'}
<main class="main"> {include file="inc/logo.tpl"}
{include file="inc/logo.tpl"} <h2>{t}This video is protected{/t}</h2>
<h2>{t}This video is protected{/t}</h2> <p>{t}You need a password in order to download this video.{/t}</p>
<p>{t}You need a password in order to download this video.{/t}</p> <form action="" method="POST">
<form action="" method="POST"> <label class="sr-only" for="password">{t}Video password{/t}</label>
<label class="sr-only" for="password">{t}Video password{/t}</label> <input class="URLinput" type="password" name="password" id="password"/>
<input class="URLinput" type="password" name="password" id="password"/> <br/><br/>
<br/><br/> <input class="downloadBtn" type="submit" value="{t}Download{/t}"/>
<input class="downloadBtn" type="submit" value="{t}Download{/t}"/> </form>
</form> {/block}
</main>
{include file='inc/footer.tpl'}

View file

@ -1,41 +1,40 @@
{include file="inc/head.tpl"} {extends file='page.tpl'}
<div class="wrapper"> {block name='main'}
<main class="main"> {include file="inc/logo.tpl"}
{include file="inc/logo.tpl"}
{if isset($video->title)} {if isset($video->title)}
{include file='snippets/title.tpl' assign=title} {include file='snippets/title.tpl' assign=title}
<p> <p>
{t params=['@title'=>$title]}Videos extracted from @title:{/t} {t params=['@title'=>$title]}Videos extracted from @title:{/t}
</p> </p>
{/if} {/if}
{if $config->stream} {if $config->stream}
<a href="{path_for name="download"}?url={$video->webpage_url}" class="downloadBtn">Download everything</a> <a href="{path_for name="download"}?url={$video->webpage_url}" class="downloadBtn">Download everything</a>
{/if} {/if}
{foreach $video->entries as $entry} {foreach $video->entries as $entry}
<div class="playlist-entry"> <div class="playlist-entry">
<h3 class="playlist-entry-title"><a target="_blank" href="{strip} <h3 class="playlist-entry-title">
<a target="_blank" href="{strip}
{if isset($entry->ie_key) and $entry->ie_key == Youtube and !filter_var($entry->url, FILTER_VALIDATE_URL)} {if isset($entry->ie_key) and $entry->ie_key == Youtube and !filter_var($entry->url, FILTER_VALIDATE_URL)}
https://www.youtube.com/watch?v= https://www.youtube.com/watch?v=
{/if} {/if}
{$entry->url} {$entry->url}
{/strip}"> {/strip}">
{if !isset($entry->title)} {if !isset($entry->title)}
{if $entry->ie_key == YoutubePlaylist} {if $entry->ie_key == YoutubePlaylist}
Playlist Playlist
{else}
Video
{/if}
{else} {else}
{$entry->title} Video
{/if} {/if}
</a></h3> {else}
<a target="_blank" class="downloadBtn" {$entry->title}
href="{path_for name="download"}?url={$entry->url}">{t}Download{/t}</a> {/if}
<a target="_blank" href="{path_for name="info"}?url={$entry->url}">{t}More options{/t}</a> </a>
</div> </h3>
{/foreach} <a target="_blank" class="downloadBtn"
href="{path_for name="download"}?url={$entry->url}">{t}Download{/t}</a>
</main> <a target="_blank" href="{path_for name="info"}?url={$entry->url}">{t}More options{/t}</a>
{include file="inc/footer.tpl"} </div>
{/foreach}
{/block}