-
Notifications
You must be signed in to change notification settings - Fork 0
/
layout.html.twig
178 lines (153 loc) · 7.68 KB
/
layout.html.twig
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{% block title %}Base{% endblock %} - AsyncTweets</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/3.3.2/cerulean/bootstrap.min.css" />
<style>
main.container > div.tweets > div.media:not(:first-child) {
border-top: thin solid Grey;
padding-top: 0.5em;
}
div.navbar-inverse {
margin-bottom: 0px;
}
.pagination {margin:10px 0px;}
/* don't use "white-space: pre-wrap;" on the <p> image container */
div.tweets div.media > blockquote > p:first-child {
white-space: pre-wrap;
}
div.tweets blockquote.media-body img {
max-width: 20em;
max-height: 15em;
}
</style>
</head>
<body{% block body_attrs %}{% endblock %}>
{% block body %}
<main class="container">
{% block content_title %}{% endblock %}
{% for flashMessage in app.session.flashbag.get('message') %}
<div class="alert alert-success">
{{ flashMessage|raw }}
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
</div>
{% endfor %}
{% block content %}Empty block.{% endblock %}
</main>
<!-- Footer -->
<div class="navbar navbar-inverse" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="{{ path('asynctweets_homepage') }}"
class="navbar-brand">AsyncTweets</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav">
<li>
<a href="http://validator.w3.org/check?uri=referer" title="Valid HTML5">
<img width="32" height="32" alt="Valid HTML5"
src="http://alexislefebvre.com/images/HTML5_Badge_32.png">
</a>
</li>
<li>
<a href="http://bootswatch.com/cerulean/">Cerulean theme</a>
</li>
<li>
<a href="http://getbootstrap.com/">Bootstrap</a>
</li>
<li>
<a href="http://alexislefebvre.com/">AlexisLefebvre.com</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/alexislefebvre/AsyncTweetsBundle">
<span class="glyphicon glyphicon-question-sign"></span>
About
</a>
</li>
</ul>
</div>
</div>
</div>
{% endblock %}
<script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script>window.jQuery && document.write('<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"><\/script>')</script>
<script>
var glyphicon_link = '<span class="glyphicon glyphicon-new-window"></span>';
/* Add glyphicon to external links */
function externalLinks(parent) {
/* http://trevordavis.net/blog/use-jquery-to-open-all-external-links-in-a-new-window/#comment-406848859 */
$(parent + " a[href^='http']:not([href*='" + window.location.host + "'])")
.attr('target','_blank')
.append(' ', glyphicon_link)
;
}
$(document).ready(function() {
/* keys */
$(document).bind('keyup', function(event) {
/* 37 = left, 39 = right */
if ([37,39].indexOf(event.which) !== -1) {
var text = ((event.which == 37) ? 'Previous' : 'Next');
var el = $('div.navigation:first > div > ul.pagination > li > a:contains("' + text + '")');
if (el.length != 0) {
// http://www.w3schools.com/jsref/met_html_click.asp
el.get(0).click();
}
return false;
}
});
externalLinks('body');
/* http://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements/1207393#1207393 */
$('main.container').on(
'click',
'div.navigation > div > ul.pagination > li > a',
function(event) {
$.ajax({
url: $(this).attr('href'),
success: function( data ) {
var $data = $("<div>").html(data);
$('main.container').html(
$data
.find('main.container')
.html()
);
externalLinks('main.container div.tweets');
/* http://stackoverflow.com/questions/3338642/updating-address-bar-with-new-url-without-hash-or-reloading-the-page/3340186#3340186 */
window.history.pushState(
data,
$data.find('title').text(),
this.url
);
/* update the <title> */
$('title').text($data.find('title').text());
/* Scroll to the top of tweets */
$('html, body').animate({
scrollTop: $('main.container > div.tweets')
.last().offset().top
}, 250);
}
});
event.preventDefault();
return false;
}
);
$('main.container').on(
'click',
'#tweets-delete',
function() {
return window.confirm('Delete old tweets?');
}
);
});
</script>
</body>
</html>