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'}
<div class="wrapper">
<main class="main error">
{extends file='page.tpl'}
{block name='main'}
<div class="error">
{include file="inc/logo.tpl"}
<h2>{t}An error occurred{/t}</h2>
<p><i>{$error|escape|nl2br}</i></p>
</main>
{include file='inc/footer.tpl'}
</div>
{/block}

View file

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

View file

@ -1,4 +1,3 @@
</div>
<footer class="small-font">
<div class="footer_wrapper">
{include file='snippets/dev.tpl' assign=dev}
@ -21,9 +20,3 @@
{t params=['@youtubedl'=>$youtubedl]}Based on @youtubedl{/t}
</div>
</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>
<meta charset="UTF-8"/>
<meta name=viewport content="width=device-width, initial-scale=1"/>
@ -27,5 +25,3 @@
{$debug_render->renderHead()}
{/if}
</head>
<body>
<div class="page {$class}">

View file

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

View file

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

View file

@ -1,6 +1,5 @@
{include file='inc/head.tpl'}
{include file='inc/header.tpl'}
<main class="main">
{extends file='page.tpl'}
{block name='main'}
<div><img class="logo" src="{base_url}/img/logo.png"
alt="{$config->appName}" width="328" height="284"></div>
<form action="{path_for name="info"}">
@ -20,18 +19,23 @@
{if $config->convert}
<div class="mp3 small-font">
<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>
{t}Audio only (MP3){/t}
</label>
{if $config->convertSeek}
<div class="seekOptions">
<label for="from">{t}From{/t}</label> <input type="text" pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
placeholder="HH:MM:SS" value="" name="from"
id="from"/>
<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 $config->convertSeek}
<div class="seekOptions">
<label for="from">{t}From{/t}</label> <input type="text"
pattern="(\d+:)?(\d+:)?\d+(\.\d+)?"
placeholder="HH:MM:SS" value=""
name="from"
id="from"/>
<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}
</div>
</div>
@ -44,6 +48,4 @@
<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>
</div>
</main>
{include file='inc/footer.tpl'}
{/block}

View file

@ -1,108 +1,106 @@
{include file="inc/head.tpl"}
<div class="wrapper">
{extends file='page.tpl'}
{block name='main'}
<div itemscope itemtype="https://schema.org/VideoObject">
<main class="main">
{include file="inc/logo.tpl"}
{include file='snippets/title.tpl' assign=title}
<p id="download_intro">
{t params=['@title' => $title]}You are going to download @title.{/t}
</p>
{if isset($video->thumbnail)}
<img itemprop="thumbnailUrl" class="thumb" src="{$video->thumbnail}" alt=""/>
{include file="inc/logo.tpl"}
{include file='snippets/title.tpl' assign=title}
<p id="download_intro">
{t params=['@title' => $title]}You are going to download @title.{/t}
</p>
{if isset($video->thumbnail)}
<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 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 isset($video->formats) && count($video->formats) > 1}
<h3><label for="format">{t}Available formats:{/t}</label></h3>
<select name="format" id="format" class="formats monospace">
<optgroup label="{t}Generic formats{/t}">
{foreach $config->genericFormats as $format => $name}
{*
To make the default generic formats translatable:
{t}Best{/t}
{t}Remux best video with best audio{/t}
{t}Worst{/t}
*}
<option value="{$format}">{t}{$name}{/t}</option>
{/foreach}
</optgroup>
<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))}
{if isset($video->formats) && count($video->formats) > 1}
<h3><label for="format">{t}Available formats:{/t}</label></h3>
<select name="format" id="format" class="formats monospace">
<optgroup label="{t}Generic formats{/t}">
{foreach $config->genericFormats as $format => $name}
{*
To make the default generic formats translatable:
{t}Best{/t}
{t}Remux best video with best audio{/t}
{t}Worst{/t}
*}
<option value="{$format}">{t}{$name}{/t}</option>
{/foreach}
</optgroup>
<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;
{/for}
{if isset($format->width)}
{$format->width}x{$format->height}
{for $foo=1 to (10 - (("{$format->width}x{$format->height}")|strlen))}
&nbsp;
{/for}
{if isset($format->width)}
{$format->width}x{$format->height}
{for $foo=1 to (10 - (("{$format->width}x{$format->height}")|strlen))}
&nbsp;
{/for}
{else}
{for $foo=1 to 10}
&nbsp;
{/for}
{/if}
{if isset($format->filesize)}
{($format->filesize/1000000)|round:2} MB
{for $foo=1 to (7 - (($format->filesize/1000000)|round:2|strlen))}
&nbsp;
{/for}
{else}
{for $foo=1 to 10}
&nbsp;
{/for}
{/if}
{if isset($format->format_note)}
{$format->format_note}
{/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>
{else}
{for $foo=1 to 10}
&nbsp;
{/for}
{/if}
{if isset($format->filesize)}
{($format->filesize/1000000)|round:2} MB
{for $foo=1 to (7 - (($format->filesize/1000000)|round:2|strlen))}
&nbsp;
{/for}
{else}
{for $foo=1 to 10}
&nbsp;
{/for}
{/if}
{if isset($format->format_note)}
{$format->format_note}
{/if}
&nbsp;({$format->format_id})
</option>
{/strip}
{/if}
{/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>
</main>
</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}
</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>
{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'}
<div class="wrapper">
<main class="main">
{include file="inc/logo.tpl"}
<h2>{t}This video is protected{/t}</h2>
<p>{t}You need a password in order to download this video.{/t}</p>
<form action="" method="POST">
<label class="sr-only" for="password">{t}Video password{/t}</label>
<input class="URLinput" type="password" name="password" id="password"/>
<br/><br/>
<input class="downloadBtn" type="submit" value="{t}Download{/t}"/>
</form>
</main>
{include file='inc/footer.tpl'}
{extends file='page.tpl'}
{block name='main'}
{include file="inc/logo.tpl"}
<h2>{t}This video is protected{/t}</h2>
<p>{t}You need a password in order to download this video.{/t}</p>
<form action="" method="POST">
<label class="sr-only" for="password">{t}Video password{/t}</label>
<input class="URLinput" type="password" name="password" id="password"/>
<br/><br/>
<input class="downloadBtn" type="submit" value="{t}Download{/t}"/>
</form>
{/block}

View file

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