-
Notifications
You must be signed in to change notification settings - Fork 10
/
Overclocked.skin.php
executable file
·531 lines (470 loc) · 16.8 KB
/
Overclocked.skin.php
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
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup Skins
*/
class SkinOverclocked extends SkinTemplate {
var $skinname = 'overclocked', $stylename = 'Overclocked',
$template = 'OverclockedTemplate', $useHeadElement = true;
/**
* Add JavaScript via ResourceLoader
*
* Uncomment this function if your skin has a JS file or files.
* Otherwise you won't need this function and you can safely delete it.
*
* @param OutputPage $out
*/
public function initPage( OutputPage $out ) {
parent::initPage( $out );
/* Viewport meta tag for mobile users. */
$out->addMeta( 'viewport', 'width=device-width, initial-scale=1' );
/* Theme meta tag for "brand" coloring in certain browsers.
Off-black to match the fixed header. */
$out->addMeta( 'theme-color', '#333' );
if( !$out->getUser()->isLoggedIn() ) {
$toggleGoogleAds = true;
}
else {
$user = $out->getUser();
$toggleGoogleAds = $user->getOption( 'overclocked-ads' );
}
/**
* Disable Google Ads on certain namespaces
*/
global $wgTitle;
$namespace = $wgTitle->getNamespace();
if ( $namespace == -1 || $namespace == 4 ) {
$toggleGoogleAds = false;
}
if( $toggleGoogleAds ) {
$out->addHeadItem('pcgw-admanager', '<script src="https://hb.vntsm.com/v3/live/ad-manager.min.js" type="text/javascript" data-site-id="5ee882ebb519801b8a4d573b" data-mode="scan" async></script>');
}
$out->addModules( array( 'skins.overclocked.js' ) );
}
/**
* Add CSS via ResourceLoader
*
* @param $out OutputPage
*/
function setupSkinUserCss( OutputPage $out ) {
parent::setupSkinUserCss( $out );
$out->addModuleStyles( array(
'mediawiki.skinning.elements', 'skins.overclocked.styles'
) );
}
}
/**
* BaseTemplate class for Overclocked skin
*
* @ingroup Skins
*/
class OverclockedTemplate extends BaseTemplate {
/**
* Outputs the entire contents of the page
*/
public function execute() {
/**
* Personal navigation bar
*/
$personalTools = $this->getPersonalTools();
$pageNav = $this->data['content_navigation'];
global $toggleGoogleAds;
if( !$this->data['loggedin'] ) {
$personalLogin = $personalTools;
$toggleGoogleAds = true;
$toggleFloatingTOC = false;
$loggedIn = false;
}
else {
$loggedIn = true;
$personalBar[2] = $personalTools['notifications-alert'];
$personalBar[3] = $personalTools['notifications-notice'];
$personalFlyout[0] = $personalTools['watchlist'];
$personalFlyout[1] = $personalTools['mytalk'];
$personalFlyout[2] = $personalTools['mycontris'];
$personalFlyout[3] = $personalTools['preferences'];
$personalFlyout[5] = $personalTools['logout'];
foreach ( $personalFlyout as $key => $item ) {
$personalFlyout[$key]['class'] = "group-start";
}
if ( isset( $personalTools['adminlinks'] ) ) {
$personalFlyout[4] = $personalTools['adminlinks'];
}
foreach ( $personalFlyout as $key => $item ) {
$personalFlyout[$key]['id'] = rtrim( $personalFlyout[$key]['id'] . '-flyout' );
}
/* Work around for Echo preferences. */
$personalFlyout[3]['id'] = 'pt-preferences';
ksort( $personalFlyout );
/**
* Replace watch button with star
*/
$watchStatus = $this->getSkin()->getUser()->isWatched( $this->getSkin()->getRelevantTitle() ) ? 'unwatch' : 'watch';
if ( isset( $pageNav['actions'][$watchStatus] ) ) {
$pageNav['views'][$watchStatus] = $pageNav['actions'][$watchStatus];
$pageNav['views'][$watchStatus]['class'] = rtrim( 'icon ' . $pageNav['views'][$watchStatus]['class'] );
$pageNav['views'][$watchStatus]['primary'] = true;
unset( $pageNav['actions'][$watchStatus] );
}
/**
* Preferences
*/
$user = $this->getSkin()->getUser();
$toggleGoogleAds = $user->getOption( 'overclocked-ads' );
$toggleFloatingTOC = $user->getOption( 'overclocked-floating-toc' );
}
global $wgSkinOverclockedAds;
global $wgTitle;
$namespace = $wgTitle->getNamespace();
/**
* Disable Google Ads on certain namespaces
*/
if ( $namespace == -1 || $namespace == 4 ) {
$toggleGoogleAds = false;
}
$this->html( 'headelement' ); ?>
<?php if( $toggleGoogleAds == true ) { ?>
<?php echo $wgSkinOverclockedAds['tag']; ?>
<?php } ?>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-10XTTXMB7R"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-10XTTXMB7R');
</script>
<!-- NEW NAV -->
<header id="pcgw-header">
<div class="pcgw-header_limit">
<div id="pcgw-header-sidebar-toggle"></div>
<div id="pcgw-header-search-toggle"></div>
<!-- LOGO -->
<div id="pcgw-header-logo">
<a href="<?php echo htmlspecialchars( $this->data['nav_urls']['mainpage']['href'] ) ?>">
<img src="//pcgamingwiki.com/images/0/04/PCGamingWiki_notext.svg" alt="<?php $this->text( 'sitename' ) ?>" width="40px" height="40px"/>
</a>
</div>
<div style="display: flex; align-items: center; justify-content: space-between; flex: 1;">
<!-- MENU -->
<div id="pcgw-header-sidebar">
<ul class="header-item-left-container">
<?php
$sidebar = $this->getSidebar();
foreach($sidebar as $boxName => $box) {
?>
<li id='<?php echo Sanitizer::escapeId( $box['id'] ) ?>'<?php echo Linker::tooltip( $box['id'] ) ?>>
<span class="header-item dropdown-toggle"><?php echo htmlspecialchars( $box['header'] ); ?></span>
<?php
if(is_array($box['content'])) { ?>
<ul class="dropdown-menu">
<?php foreach($box['content'] as $key => $item) {
echo $this->makeListItem($key, $item);
} ?>
</ul>
<?php
}
?>
</li>
<?php
} ?>
</ul>
<ul id="p-personal-mobile">
<?php
if( $loggedIn == false ) {
foreach ( $personalLogin as $key => $item ) {
echo $this->makeListItem( $key, $item );
}
}
else {
?>
<div id="p-personal-logged-in">
<div id="personal-bar-flyout">
<div>
<a href="<?php echo $personalTools['userpage']['links'][0]['href']; ?>"><?php echo $personalTools['userpage']['links'][0]['text']; ?></a>
<ul>
<?php
foreach ( $personalFlyout as $key => $item ) {
echo $this->makeListItem( $key, $item );
}
?>
</ul>
</div>
</div>
</div>
<?php
}
?>
</ul>
</div>
<div class="rightside-wrap">
<!-- SEARCH -->
<div id="header-search">
<form action="<?php $this->text( 'wgScript' ); ?>" id="searchform">
<?php
echo $this->makeSearchInput( array( 'id' => 'searchInput' ) );
echo Html::hidden( 'title', $this->get( 'searchtitle' ) );
?>
</form>
</div>
<!-- LOGIN -->
<ul id="p-personal">
<?php
if( $loggedIn == false ) {
foreach ( $personalLogin as $key => $item ) {
echo $this->makeListItem( $key, $item );
}
}
else {
?>
<div id="p-personal-logged-in">
<?php
foreach ( $personalBar as $key => $item ) {
echo $this->makeListItem( $key, $item );
}
?>
<div id="personal-bar-flyout">
<div>
<a href="<?php echo $personalTools['userpage']['links'][0]['href']; ?>"><?php echo $personalTools['userpage']['links'][0]['text']; ?></a>
<ul>
<?php
foreach ( $personalFlyout as $key => $item ) {
echo $this->makeListItem( $key, $item );
}
?>
</ul>
</div>
</div>
</div>
<?php
}
?>
</ul>
</div>
</div>
</div>
</header>
<div id="masthead" <?php if ( $toggleFloatingTOC ) { ?> class="floating-toc-enabled" <?php } ?>>
<div id="main-column">
<?php if( $toggleGoogleAds == true ) { ?>
<!-- horizontal header ad -->
<div class="ad-header-container">
<!-- PCGamingWiki - dynamic ad unit -->
<script>
window.isMobile = (/android|ipad|iphone|ipod|samsung/i).test(navigator.userAgent);
console.log(isMobile);
</script>
<script>
var id = window.isMobile ? '5ee8e36fa624ae2e71258530' : '5ee8e359b519801b8a4d57ff';
document.write('<div class="vm-placement" data-id="' + id + '"></div>');
</script>
<!-- / PCGamingWiki - dynamic ad unit -->
</div>
<?php } ?>
<?php if ( $this->data['sitenotice'] ) { ?>
<div id="site-notice"><?php $this->html( 'sitenotice' ); ?></div>
<?php } ?>
<div id="main-content">
<div id="mw-head">
<ul id="mw-head-left">
<?php
foreach ( $pageNav['namespaces'] as $key => $tab ) {
echo $this->makeListItem( $key, $tab );
}
?>
</ul>
<ul id="mw-head-right">
<!-- "View", "Edit", "History" buttons -->
<?php
foreach ( $pageNav['views'] as $key => $tab ) {
echo $this->makeListItem( $key, $tab );
}
if ( $this->data['isarticle'] && $loggedIn == true ) {
?>
<div id="mw-head-more">
<div>
<a href="#">More</a>
<ul>
<?php
foreach ( $pageNav['actions'] as $key => $tab ) {
echo $this->makeListItem( $key, $tab );
}
?>
</ul>
</div>
</div>
<?php
}
?>
</ul>
</div>
<?php if ( $this->data['newtalk'] ) { ?>
<div class="user-message"><?php $this->html( 'newtalk' ); ?></div>
<?php } ?>
<?php if( $toggleGoogleAds == true ) { ?>
<!-- instream video ad -->
<div id="instream">
<!-- Venatus video ad placement -->
<div class="vm-placement" id="vm-av" data-format="isvideo"></div>
<!-- / Venatus video ad placement -->
</div>
<?php } ?>
<!-- Article header -->
<div class="article-header">
<!-- Indicators -->
<?php echo $this->getIndicators(); ?>
<!-- Article title -->
<h1 class="article-title"><?php $this->html( 'title' ); ?></h1>
</div>
<!-- Site subtitle, "From PCGamingWiki, the wiki about fixing PC games" -->
<div id="site-sub">
<?php if ( $this->data['isarticle'] ) { $this->msg( 'tagline' ); } ?>
<?php if ( $this->data['subtitle'] ) { ?><div id="sub-sub-title"><?php $this->html( 'subtitle' ); ?></div><?php } ?>
<?php $this->html( 'undelete' ); ?>
</div>
<!-- Body content container. If ads are enabled, an "mw-body-with-ads" class is added so that ad-specific styles can be applied on certain pages. -->
<?php if( $toggleGoogleAds == false ) { ?>
<div id="body-content" class="mw-body">
<?php } else { ?>
<div id="body-content" class="mw-body mw-body-with-ads">
<!-- mpu ad -->
<div id="mpu">
<!-- PCGamingWiki - 300x250 Static (5ee8e351a624ae2e7125852e) - 300x250 - Place in <BODY> of page where ad should appear -->
<div class="vm-placement" data-id="5ee8e351a624ae2e7125852e"></div>
<!-- / PCGamingWiki - 300x250 Static (5ee8e351a624ae2e7125852e) -->
</div>
<?php } ?>
<?php $this->html( 'bodytext' ); ?>
<?php if( $toggleGoogleAds == true ) { ?>
<!-- PCGamingWiki - Rich Media (5ee8e341a624ae2e7125852c) - 1x1 - Place in <BODY> of page where ad should appear -->
<div class="vm-placement" data-id="5ee8e341a624ae2e7125852c" style="display:none"></div>
<!-- / PCGamingWiki - Rich Media (5ee8e341a624ae2e7125852c) -->
<?php } ?>
<?php $this->html( 'catlinks' ); ?>
<?php $this->html( 'dataAfterContent' ); ?>
</div>
</div>
<?php if( $toggleGoogleAds == true ) { ?>
<!-- footer ad -->
<div class="ad-footer-container">
<!-- PCGamingWiki - dynamic ad unit -->
<script>
window.isMobile = (/android|ipad|iphone|ipod|samsung/i).test(navigator.userAgent);
console.log(isMobile);
</script>
<script>
var id = window.isMobile ? '5ee8e36fa624ae2e71258530' : '5ee8e359b519801b8a4d57ff';
document.write('<div class="vm-placement" data-id="' + id + '"></div>');
</script>
<!-- / PCGamingWiki - dynamic ad unit -->
</div>
<?php } ?>
</div>
</div>
<!-- Footer -->
<footer id="pcgw-footer" class="pcgw-footer">
<!-- Social links -->
<div class="pcgw-footer-column">
<div id="footer-social-links">
<!-- Facebook Icon -->
<a href="https://www.facebook.com/PCGamingWiki">
<div class="icon-container footer-facebook icon"></div>
</a>
<!-- Twitter Icon -->
<a href="https://www.twitter.com/PCGamingWiki">
<div class="icon-container footer-twitter icon"></div>
</a>
<!-- YouTube Icon -->
<a href="//www.youtube.com/user/PCGamingWikiTV">
<div class="icon-container footer-youtube icon"></div>
</a>
<!-- Steam Icon -->
<a href="//steamcommunity.com/groups/pcgamingwiki">
<div class="icon-container footer-steam icon"></div>
</a>
<!-- Discord Icon -->
<a href="https://discord.gg/SU27ykMcsD">
<div class="icon-container footer-discord icon"></div>
</a>
</div>
</div>
<!-- Other links -->
<div class="pcgw-footer-column">
<div id="footer-links-container">
<ul>
<li>PCGamingWiki
<li><a href="//pcgamingwiki.com/wiki/PCGamingWiki:About">About us</a>
<li><a href="//pcgamingwiki.com/wiki/PCGamingWiki:About#Contact">Contact us</a>
<li><a href="//pcgamingwiki.com/wiki/PCGamingWiki:About#Advertising">Advertising</a>
<li><a href="//pcgamingwiki.com/wiki/PCGamingWiki:Privacy_policy">Privacy policy</a>
<li><a href="//pcgamingwiki.com/wiki/PCGamingWiki:General_disclaimer">General disclaimer</a>
</ul>
<ul>
<li>Friends
<li><a href="//pcgamingwiki.com/wiki/PCGamingWiki:Partnerships">Partnerships</a>
<li><a href="//pcgamingwiki.com/wiki/PCGamingWiki:Extension">Extension</a>
<li><a href="//pcgamingwiki.com/wiki/PCGamingWiki:API">API</a>
<li><a href="https://www.applegamingwiki.com">AppleGamingWiki</a>
<li><a href="https://www.gog.com?pp=708a77db476d737e54b8bf4663fc79b346d696d2">GOG.com</a>
<li><a href="https://gamesplanet.com?ref=pcgwiki">Gamesplanet</a>
<li><a href="https://www.cheapshark.com">CheapShark</a>
</ul>
<ul>
<li>Powered by
<li><a href="https://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a>
<li><a href="https://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki">Semantic MediaWiki</a>
<li><a href="https://www.mediawiki.org/wiki/Extension:Cargo">Cargo</a>
<li><a href="https://github.com/PCGamingWiki">Open source</a>
<li><a href="https://www.patreon.com/PCGamingWiki">Patrons</a>
<li>and You <3
</ul>
</div>
<!-- Page last modified, copyright, and disclaimer texts -->
<?php
if ( isset( $this->getFooterLinks()['info'] ) ) {
$footerNav = $this->getFooterLinks()['info'] ?>
<div id="footer-info-lastmod"><?php $this->html( $footerNav[0] ) ?></div>
<div id="footer-info-copyright"><?php $this->html( $footerNav[1] ) ?></div>
<?php
}
?>
<div id="footer-info-disclaimer">Some store links may include affiliate tags. Buying through these links helps support PCGamingWiki (<a href="/wiki/PCGamingWiki:About#Support_us">Learn more</a>).</div>
</div>
</footer>
<!-- See schema.org and developers.google.com/structured-data for more information on what this does. -->
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Organization",
"name": "PCGamingWiki",
"url": "//pcgamingwiki.com",
"logo": "//pcgamingwiki.com/images/d/d8/PCGamingWiki.svg",
"sameAs": [ "https://www.facebook.com/PCGamingWiki",
"https://twitter.com/PCGamingWiki",
"https://plus.google.com/+PCGamingWiki" ]
}
</script>
<!-- Open Sans font family -->
<link rel="stylesheet" media="screen" href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,300,600">
<?php $this->printTrail(); ?>
<!-- GOG Affiliate Link Tag -->
<script type="text/javascript" src="https://cdn.adt598.com/atag.js?as=1649876489" charset="UTF-8"></script>
</body>
</html><?php
}
}