/
@layout.latte
194 lines (186 loc) · 9.42 KB
/
@layout.latte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<!DOCTYPE HTML>
<html lang="cs" dir="ltr">{* lang cs, někdy také cs-cz je definice jazyka a dir ltr značí, že texe se čte zleva doprava *}
<head>
<script>{* scripty pracující s uri adresou stránky... jsou umístěny co nejdříve to jde *}
if(history.replaceState) { {* odstranění flash id a backlink parametru z adresy stránky *}
l = location.toString();
r = [['_fid',4],['backlink',5]];
for(i in r) {
uri = l.indexOf(r[i][0]+'=');
if(uri != -1) {
uri = l.substr(0, uri)+l.substr(uri+r[i][0].length+r[i][1]+2);
if( (uri.substr(uri.length-1) == '?') || (uri.substr(uri.length-1) == '&') ) {
uri = uri.substr(0, uri.length-1);
}
history.replaceState('', '', uri);{* první parametr je objekt do kterého si můžu ukládat stavy... například {"page": page} ... dané page pak jde načíst a inkrementovat; Druhý parametr je <title> stránky, ale FF i Chrome na to aktuálně kašlou... nechávám teda tento údaj prázdný. *}
}
}
}
{if $presenter->getName() == 'Default'}{* Jinde než na indexu k tomu stejně nemůže dojít *}
toBlock = false;
function removeHash() {
if( (location.hash) && (history.replaceState) ) {
h = {$hashes};
for(i in h) {
if('#'+h[i] == location.hash.toString()) {
toBlock = h[i];
history.replaceState('', '', location.toString().replace('#', ''));
}
}
}
}
removeHash();
{/if}
</script>
<meta charset="utf-8">
<title>{block #title|striptags|trim}{/block} | {$settings->title}</title>
<meta name="author" content="ic - ic.czech@gmail.com">
<meta name="viewport" content="width=device-width">{* říká smartphonům (Android, iPhone, ...) že mají použít svou skutečnou šířku monitoru a nesnažit se simulovat skutečný počítač *}
<meta n:ifset="$robots" name="robots" content="{$robots}">
<meta n:ifset="$settings->description" name="description" content="{$settings->description}">
<link rel="profile" href="http://purl.org/uF/2008/03/">{* profile="http://purl.org/uF/2008/03/" značí specifikaci hodně druhů mikroformátů (včetně hCard), které nejsou ve stádiu návrhu, což je třeba hAtom: http://purl.org/uF/hAtom/0.1/ *}
<link rel="profile" href="http://purl.org/uF/hAtom/0.1/">
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">{* ikonka webu *}
<link n:if="$presenter->getName() != 'Default'" rel="home" href="{$baseUri}" title="úvodní stránka">{* odkaz na homepage *}
<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->{* javascriptová oprava vad v IE8 a menších *}
<link n:if="$presenter->getParam(Nette\Application\Presenter::FLASH_KEY)" rel="canonical" href="{link this, Nette\Application\Presenter::FLASH_KEY => NULL}">{* v případě existence flash identifikátoru v uri (_fid=XXXX) přidá odkaz na kanonickou adresu *}
{if $settings->style != '0'}
{var $css = array('null', 'black', 'pokus')}
<!--[if lt IE 9]>
{control cssSmall $css[$settings->style].'/netbook.less'}
{control cssSmall $css[$settings->style].'/ie_hack.less'}
<![endif]-->{* pro IE starší než 9 je tu takovýhle hack, aby z nich nebyla mobilní verze *}
{control cssSmall $css[$settings->style].'/smartphone.less'}{* defaultní vzhled je pro smartphony, aby nemusely (na často mobilním) připojení stahovat veškerou luxusní grafiku s obrázky pro normální počítače. *}
{control cssBig $css[$settings->style].'/netbook.less'}
{/if}
{* @todo: vložit google analytics sem *}
</head>
<body>
{* přidat varování... všechny daňové údaje musí být na webu *}
<header>
<h1><em>pm</em> studio</h1>
<strong>výroba reklamy</strong>
</header>
<script>
document.getElementsByTagName('h1')[0].style.visibility = 'hidden';
a = document.createElement('a');
a.href = '/';
a.title = 'přejít na hlávní stránku';
a.appendChild(document.createTextNode('domů'));
document.getElementsByTagName('header')[0].appendChild(a);
document.getElementsByTagName('script')[1].parentNode.removeChild(document.getElementsByTagName('script')[1]);{* sebedestrukce *}
</script>
<hr id="bg">
<section>
{cache 'menu', expire => '+'.$settings->cache.' minutes', if => $settings->cache > 0}
<nav id="menu"><strong class="hide">menu:</strong>{control menu}</nav>
<ul n:if="$settings->global_email != '' || $settings->global_phone != ''" class="contact">
<li n:if="$settings->global_email != ''"><a href="mailto:{$settings->global_email|replace:'@':'(at)'}">{!$settings->global_email|replace:'@':'<img src="/images/at-char.gif" alt="@">'}</a></li>
<li n:if="$settings->global_phone != ''" class="phone">{$settings->global_phone}</li>
</ul>
{/cache}
<script>{* script pro vylepšení skrývání položek seznamu s obsahem stránek *}
a = document.getElementsByTagName('nav')[0].children[1].children;
for(i=0;i<a.length;i++) {
if( ('/'+a[i].lastChild.href.replace(/.+#/i, '') == location.pathname) || ( (location.pathname == '/') && (a[i].lastChild.href.replace(/.+#/i, '') == {$settings->default_presenter}) ) ) {
a[i].lastChild.className = 'active';
} else {
a[i].lastChild.className = 'pasive';
}
{if $presenter->getName() == 'Default'}
a[i].lastChild.href = a[i].lastChild.href.replace('#', '')
a[i].lastChild.onclick = function() { return !jsTarget(this) };
{/if}
}
{if $presenter->getName() == 'Default'}
function jsTarget(v) {
o = v.parentNode.parentNode.children;{* Tato část se stará o přidělení třídy active, právě aktivovanému odkazu a zároveň nastavení třídy pasive všem ostatním odkazům menu *}
for(i=0;i<o.length;i++) {
o[i].lastChild.className='pasive';
}
v.className='active';
v = v.href;{* No a odtud už je to důležité *}
id = v.substr(v.lastIndexOf('/')+1);
a = document.getElementById(id).parentNode.children;
for(i=0;i<a.length;i++) {
a[i].style.display='none';
}
document.getElementById(id).style.display='block';
if(history.replaceState) {
history.replaceState('', '', {$basePath}+'/'+id);
} else { {* prohlížeče, které neumí replaceState() umí alespoň změnit hash (bez reloadu stránky) a tím se kliknutí uloží do historie a je možné ji pak pohodlně procházet *}
location.replace('#'+id);
}
return true;
}
{/if}
document.getElementsByTagName('script')[1].parentNode.removeChild(document.getElementsByTagName('script')[1]);{* sebedestrukce *}
</script>
<hr>
{include #content}
</section>
<script n:if="$settings->default_presenter != '0' && $presenter->getName() == 'Default'">{* musí být nutně až po! načtení samotného obsahu do ul-li *}
if( (!location.hash) && (location.pathname == {$basePath}+'/') ) {
location.replace('#{!$settings->default_presenter}');
removeHash();
if(toBlock) {
document.getElementById(toBlock).style.display = 'block';
}
}
document.getElementsByTagName('script')[1].parentNode.removeChild(document.getElementsByTagName('script')[1]);{* sebedestrukce *}
</script>
<hr class="show">
<aside>
{snippet flashes div}
<p n:foreach="$flashes as $flash" class="flash {$flash->type}" onclick="this.className='hide'">{$flash->message}</p>
{/snippet}
<p n:if="$settings->important">
<strong>{$settings->important_title}</strong>
<br>
{$settings->important}
<br>
</p>
<p n:if="$user->loggedIn">
{if $user->isInRole('administrator')}
<strong>možnosti úprav</strong><br>
<a n:href="menu:">upravit menu</a><br>
<a n:href="news:add">napsat novinku</a><br>
<a n:href="content:edit">upravit obsah obsahových sekcí</a><br>
<a n:href="ad:edit">upravit kalkulaci reklam</a><br>
<a n:href="contact:edit">upravit kontakt</a><br>
<a n:href="settings:">upravit nastavení webu</a><br>
{/if}
<a n:href="auth:logout">odhlásit se</a><br>
</p>
</aside>
<hr>
<footer>
<p>vzhled <a n:href="switchSkin! 0">bez css</a>, <a n:href="switchSkin! 1">black</a> , <a n:href="switchSkin! 2">pokus</a> | <a href="https://github.com/iiic/pm-studio">fork me on github</a> | <a href="{$basePath}/prace">texty</a> | multihosting <a href="http://ovh.cz">OVH</a></p>
</footer>
{control packedJs 'jquery.js', 'jquery.ajaxform.js', 'jquery.nette.js', 'netteForms.js', 'my.scripts.js'}
<script n:ifset="$_GET['lol']">
// pěkná animace posunu pozadí objektu, ale náročná jak sviňa,
//lepší by to teoreticky mělo být na Win7 s některým prohlížečem,
//který podporuje hardwarovou akceleraci webu, ale tohle nemohu vyzkoušet.
var scrollSpeed = 1; // Speed in milliseconds
var step = 1; // How many pixels to move per step
var current = 0; // The current pixel row
var imageHeight = 2247; // Background image width
var headerHeight = 1280; // How wide the header is.
//The pixel row where to start a new loop
var restartPosition = -(imageHeight - headerHeight);
function scrollBg(){
//Go to next pixel row.
current -= step;
//If at the end of the image, then go to the top.
if (current == restartPosition){
current = 0;
}
//Set the CSS of the header.
$('#bg').css("background-position","58% "+current+"px");
}
//Calls the scrolling function repeatedly
var init = setInterval("scrollBg()", scrollSpeed);
</script>
</body>
</html>