-
Notifications
You must be signed in to change notification settings - Fork 0
/
layout
367 lines (319 loc) · 13.3 KB
/
layout
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<!DOCTYPE html>
<html lang="{{App::getLocale()}}">
<head>
@section('head')
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1,shrink-to-fit=no">
@if(!empty($config['main']['favicon']))
<link rel="shortcut icon" href="{!! apply_filters('favicon', htmlspecialchars(content_url($config['main']['favicon'])), $config['main']['favicon']) !!}">
@endif
@if(!empty($title))
<title>{!! apply_filters('meta_title', htmlspecialchars($title), $title) !!}</title>
@endif
<meta property="og:type" content="website">
@if(!empty($ogTitle))
<meta property="og:title" content="{!! apply_filters('og_title', htmlspecialchars($ogTitle), $ogTitle) !!}" />
<meta name="twitter:title" content="{!! apply_filters('og_title', htmlspecialchars($ogTitle), $ogTitle) !!}" />
@endif
@if(!empty($ogImage))
<meta property="og:image" content="{!! apply_filters('og_image', htmlspecialchars($ogImage), $ogImage) !!}" />
<meta name="twitter:image" content="{!! apply_filters('og_image', htmlspecialchars($ogImage), $ogImage) !!}" />
<meta name="twitter:card" content="photo" />
@endif
@if(!empty($ogUrl))
<meta property="og:url" content="{!! apply_filters('og_url', htmlspecialchars($ogUrl), $ogUrl) !!}" />
<meta name="twitter:url" content="{!! apply_filters('og_url', htmlspecialchars($ogUrl), $ogUrl) !!}" />
@endif
@if(!empty($description))
<meta name="description" content="{!! apply_filters('meta_description', htmlspecialchars($description), $description) !!}" />
@endif
@if(!empty($ogDescription))
<meta property="og:description" content="{!! apply_filters('og_description', htmlspecialchars($description), $description) !!}" />
@endif
<meta property="og:site_name" content="{!! apply_filters('og_site_name', htmlspecialchars(Helpers::getSiteName()), Helpers::getSiteName()) !!}" />
@if(!empty($canonicalUrl))
<link rel="canonical" href="{!! apply_filters('canonical_url', htmlspecialchars($canonicalUrl), $canonicalUrl) !!}" />
@endif
<!-- Custom CSS -->
@if(App::isLocal())
<link href="{{assetWithCacheBuster('/css/main-with-libs.css')}}" rel="stylesheet">
@else
<link href="{{assetWithCacheBuster('/css/main.min.css')}}" rel="stylesheet">
@endif
@if(App::isLocal())
<link href="{{assetWithCacheBuster('/themes/modern/style.css')}}" rel="stylesheet">
@else
<link href="{{assetWithCacheBuster('/themes/modern/style.min.css')}}" rel="stylesheet">
@endif
@if(!empty($languageDirection) && $languageDirection == 'rtl')
@include('partials.rtlCss')
@endif
@if(!empty($navbarColor))
<style>
@include('partials.themeCss')
</style>
@endif
{{do_action('print_head_styles')}}
<!-- Custom Fonts -->
<link href="{{assetWithCacheBuster('/font-awesome-4.1.0/css/font-awesome.min.css')}}" rel="stylesheet" type="text/css">
<!-- jQuery Version 1.11.0 -->
@if(App::isLocal())
<script src="{{ assetWithCacheBuster('bower_components/jquery/dist/jquery.min.js')}}"></script>
@else
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
@endif
{{do_action('print_head_scripts')}}
<script>
var BASE_PATH = '{{ url('') }}';
var ASSET_BASE_PATH = '{{ asset('') }}';
var CONTENT_BASE_PATH = '{{ content_url('') }}/';
window.asset = function(path) {
path = path || '';
return path.match(/^http[s]?:\/\/.*$/) ? path : ASSET_BASE_PATH + path;
}
window.contentUrl = function(path) {
path = path || '';
return path.match(/^http[s]?:\/\/.*$/) ? path : CONTENT_BASE_PATH + path;
}
var SiteMainConfig = {!! @$mainConfigJSON !!};
var SiteQuizConfig = {!! @$quizConfigJSON !!};
SiteQuizConfig.showSharePromptModal = (SiteQuizConfig.showSharePromptModal === "true") ? true : false;
SiteQuizConfig.showPageLikePrompt = (SiteQuizConfig.showPageLikePrompt === "true") ? true : false;
SiteQuizConfig.showFacebookComments = (SiteQuizConfig.showFacebookComments === "true") ? true : false;
var User = {
isLoggedIn: function(){
return (!$.isEmptyObject(this.data));
},
setData: function(data){
var wasAlreadyLoggedIn = this.isLoggedIn();
this.data = data;
//Logged in after setting new data. Trigger logged in event
if(!wasAlreadyLoggedIn && this.isLoggedIn()){
$('body').trigger('loggedIn');
}
}
};
User.data = {!! $userData or '{}' !!};
@if(!empty($categories))
window.Categories = {!! json_encode($categories) !!};
@endif
</script>
@if(!empty($languageStrings))
<script>
var languageStrings = {!! json_encode($languageStrings) !!};
var defaultLanguageStrings = {!! json_encode($defaultLanguageStrings) !!};
//Translation
function __(key){
if(languageStrings.hasOwnProperty(key)){
return languageStrings[key];
} else if (defaultLanguageStrings.hasOwnProperty(key)){
return defaultLanguageStrings[key];
} else {
return key;
}
}
</script>
@endif
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo @$config['main']['social']['facebook']['appId'];?>',
xfbml : true,
version : 'v2.5',
cookie : true
});
$('body').trigger('fb-api-loaded');
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/{{$languageFbCode}}/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
})(document, 'script', 'facebook-jssdk');
</script>
@if(!empty($config['main']['customCode']['head']))
{!! $config['main']['customCode']['head'] !!}
@endif
@show
{{do_action('head')}}
</head>
<body class="{{apply_filters('body_class', "")}}">
{{do_action('body_begin')}}
<div id="fb-root"></div>
<div class="body_wrap @if(!empty($currentPage))page-{{$currentPage}}@endif">
<div class="body-container container-fluid modern-touch">
@section('header')
@include('header')
@show
<div class="row">
<div class="col-md-8 col-sm-7 col-xs-12 main-content-col @if($languageDirection == 'rtl') pull-right @endif">
@yield('content')
</div>
<div class="col-md-4 col-sm-5 col-xs-12 sidebar-col @if($languageDirection == 'rtl') pull-left @endif">
@section('sidebar')
@include('sidebar')
@show
</div>
</div>
{{do_action_ref_array('show_widgets', ['commonFooterSection', &$widgets])}}
@if(!empty($widgets['commonFooterSection']))
<div class="row">
<div class="col-md-12">
<div class="common-foot-widget-section">
@foreach($widgets['commonFooterSection'] as $widget)
{!! do_shortcode($widget['content']) !!}
@endforeach
</div>
</div>
</div>
@endif
<!-- /.container-fluid -->
</div>
<div class="container-fluid">
<div class="row footer-row">
<div class="col-md-12">
@section('footer')
@include('footer')
@show
</div>
</div>
</div>
<!-- /#page-wrapper -->
</div>
<!-- /#wrapper -->
<div id="loginModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<h4 class="login-prompt-message">{{__('loginBtn')}} / {{__('signUpBtn')}}</h4>
<div class="login-panel">
<div id="loginError" class="hide"></div>
<ul>
<li>
<div class="btn btn-fb btn-block" data-action="loginWithFB"><span>{{__('loginWithFB')}}</span></div>
</li>
</ul>
</div>
<div class="logging-in-msg">
<h4 class="text-center">{{__('loggingYouIn')}}</h4>
</div>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
@section('foot')
<!-- Logging in -->
<script>
(function(){
var body = $('body');
var socialLoginErrorElm = $('#loginError');
var loginModal = $('#loginModal');
body.on('social-login:error', function(e, error) {
socialLoginErrorElm.removeClass('hide').html('<div class="alert alert-danger">' + error + '</div>');
loginModal.removeClass("logging-in");
});
window.loginWithFb = function(){
FB.login(function(response) {
if (response.authResponse) {
if(response.authResponse.grantedScopes.split(',').indexOf('email') < 0) {
//If email permission not granted
body.trigger('social-login:error', (__('fbNoEmailError')));
return;
}
FB.api('/me', {fields: 'id,name,email'}, function(response) {
console.log('Logged in as ' + response.name + '.');
//Dual check email - needed to if check if the user has a verified email ID
if(!response.email) {
body.trigger('social-login:error', (__('fbNoEmailError')));
return;
}
body.trigger('loggedIn:fb');
});
} else {
body.trigger('social-login:error', (__('fbPermissionError')));
}
}, {
scope: 'email',
auth_type: 'rerequest',
'return_scopes': true
});
}
var body = $('body');
body.on('click', '[data-action="loginWithFB"]', function(e){
loginWithFb();
e.preventDefault();
});
body.on('loggedIn', function(){
loginModal.modal('hide');
});
body.on('loggedIn:fb', function(){
if(!User.isLoggedIn()) {
$.get(BASE_PATH + '/login/fb').success(function(response){
User.setData(response.user);
}).fail(function(jqXHR, textStatus, errorThrown){
body.trigger('social-login:error', jqXHR.responseText);
}).always(function(){
loginModal.removeClass("logging-in");
});
}
});
body.on('prompt-login', function(e, message){
loginModal.find('.login-prompt-message').html(message);
loginModal.modal('show');
});
})();
function showNewPointsAlert(addedPoints) {
var alertOptions = {
title: "+"+ addedPoints +" " + __('points'),
text: __('earnedNewPointsMessage'),
imageUrl: "{{LeaderboardHelpers::getPointsIcon()}}",
confirmButtonText: __('earnedNewPointsOkayBtnText'),
allowEscapeKey: true,
allowOutsideClick: true,
customClass: 'new-points-alert'
}
@if(!empty($mainBtnColor))
alertOptions.confirmButtonColor = '{{{$mainBtnColor}}}';
@endif
swal(alertOptions);
}
$('body').on('user-activity-recorded', function() {
$.get('{{route('getMyPoints')}}').success(function(response) {
if(response && response.points) {
var oldPoints = parseInt(User.data.points);
var newPoints = parseInt(response.points);
User.data.points = newPoints;
User.setData(User.data);
if(oldPoints != newPoints) {
var animateClass = 'animated bounceIn';
$('#headerUserMenu').removeClass(animateClass).addClass(animateClass);
var addedPoints = parseInt(newPoints) - parseInt(oldPoints);
@if(MyConfig::isTrue('leaderboard.showNewPointsAlert'))
showNewPointsAlert(addedPoints);
@endif
}
}
}).fail(function() {
});
});
</script>
<!-- Bootstrap Core JavaScript -->
<script src="{{ assetWithCacheBuster('/themes/modern/js/libs/modernizr.min.js') }}"></script>
<script src="{{ assetWithCacheBuster('/themes/modern/js/libs/bootstrap.min.js') }}"></script>
<script src="{{ assetWithCacheBuster('/bower_components/sweetalert/dist/sweetalert.min.js')}}"></script>
{{do_action('print_foot_scripts')}}
@if(!empty($config['main']['customCode']['foot']))
{{$config['main']['customCode']['foot']}}
@endif
@show
{{do_action('foot')}}
</body>
</html>