-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathheadIncludeJavaScript.tpl
More file actions
187 lines (167 loc) · 8.3 KB
/
headIncludeJavaScript.tpl
File metadata and controls
187 lines (167 loc) · 8.3 KB
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
{*
DO NOT EDIT THIS FILE
*}
<script data-cfasync="false">
var WCF_PATH = '{unsafe:$__wcf->getPath()|encodeJS}';
var WSC_API_URL = '{unsafe:$__wcf->getPath()|encodeJS}';
var WSC_RPC_API_URL = '{link controller="Api" id="rpc"}{/link}';
{* The SECURITY_TOKEN is defined in wcf.globalHelper.js *}
var LANGUAGE_ID = {$__wcf->getLanguage()->languageID};
var LANGUAGE_USE_INFORMAL_VARIANT = {if LANGUAGE_USE_INFORMAL_VARIANT}true{else}false{/if};
var TIME_NOW = {TIME_NOW};
var LAST_UPDATE_TIME = {LAST_UPDATE_TIME};
var ENABLE_DEBUG_MODE = {if ENABLE_DEBUG_MODE}true{else}false{/if};
var ENABLE_PRODUCTION_DEBUG_MODE = {if ENABLE_PRODUCTION_DEBUG_MODE}true{else}false{/if};
var ENABLE_DEVELOPER_TOOLS = {if ENABLE_DEVELOPER_TOOLS}true{else}false{/if};
var PAGE_TITLE = '{unsafe:PAGE_TITLE|phrase|encodeJS}';
var REACTION_TYPES = {unsafe:$__wcf->getReactionHandler()->getReactionsJSVariable()};
{if ENABLE_DEBUG_MODE}
{* This constant is a compiler option, it does not exist in production. *}
var COMPILER_TARGET_DEFAULT = {if !VISITOR_USE_TINY_BUILD || $__wcf->user->userID}true{else}false{/if};
{/if}
{if $__wcf->getStyleHandler()->getColorScheme() === 'system'}
{
const colorScheme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
document.documentElement.dataset.colorScheme = colorScheme;
}
{/if}
</script>
<script data-cfasync="false" src="{$__wcf->getPath()}js/WoltLabSuite/WebComponent.min.js?v={LAST_UPDATE_TIME}"></script>
<script data-cfasync="false" src="{$phrasePreloader->getUrl($__wcf->language)}"></script>
{js application='wcf' file='require' bundle='WoltLabSuite.Core' core='true' hasTiny=true}
{js application='wcf' file='require.config' bundle='WoltLabSuite.Core' core='true' hasTiny=true}
{js application='wcf' file='require.linearExecution' bundle='WoltLabSuite.Core' core='true' hasTiny=true}
{js application='wcf' file='wcf.globalHelper' bundle='WoltLabSuite.Core' core='true' hasTiny=true}
{js application='wcf' file='3rdParty/tslib' bundle='WoltLabSuite.Core' core='true' hasTiny=true}
<script data-cfasync="false">
requirejs.config({
baseUrl: '{unsafe:$__wcf->getPath()|encodeJS}js',
urlArgs: 't={LAST_UPDATE_TIME}'
{hascontent}
, paths: {
{content}{event name='requirePaths'}{/content}
}
{/hascontent}
});
{* Safari ignores the HTTP cache headers for the back/forward navigation. *}
window.addEventListener('pageshow', function(event) {
if (event.persisted) {
window.location.reload();
}
});
{event name='requireConfig'}
</script>
<script data-relocate="true">
require(['Language', 'WoltLabSuite/Core/BootstrapFrontend', 'User'], function(Language, BootstrapFrontend, User) {
{hascontent}
Language.addObject({
{content}{event name='javascriptLanguageImport'}{/content}
});
{/hascontent}
User.init(
{$__wcf->user->userID},
{if $__wcf->user->userID}'{unsafe:$__wcf->user->username|encodeJS}'{else}''{/if},
{if $__wcf->user->userID}'{unsafe:$__wcf->user->getLink()|encodeJS}'{else}''{/if},
'{link controller='GuestTokenDialog'}{/link}'
);
BootstrapFrontend.setup({
backgroundQueue: {
url: '{link controller="BackgroundQueuePerform"}{/link}',
force: {if $forceBackgroundQueuePerform|isset}true{else}false{/if}
},
{if $__wcf->user->userID && SERVICE_WORKER_PUBLIC_KEY !== ''}
serviceWorker: {
publicKey: '{unsafe:SERVICE_WORKER_PUBLIC_KEY|encodeJS}',
serviceWorkerJsUrl: '{$__wcf->getPath('wcf')}service-worker/',
registerUrl: '{link controller="RegisterServiceWorker"}{/link}',
notificationLastReadTime: {$__wcf->getUserNotificationHandler()->getTimeOfLastReadNotification()}
},
{/if}
dynamicColorScheme: {if $__wcf->getStyleHandler()->getColorScheme() === 'system'}true{else}false{/if},
endpointUserPopover: {if $__wcf->getSession()->getPermission('user.profile.canViewUserProfile')}'{link controller='UserPopover'}{/link}'{else}''{/if},
executeCronjobs: {if $executeCronjobs}'{link controller="CronjobPerform"}{/link}'{else}undefined{/if},
{if ENABLE_SHARE_BUTTONS}
{assign var='__shareProviders' value="\n"|explode:SHARE_BUTTONS_PROVIDERS}
shareButtonProviders: [
{if 'Facebook'|in_array:$__shareProviders}["Facebook", "{jslang}wcf.message.share.facebook{/jslang}", {icon size=24 name='facebook' type='brand' encodeJson=true}],{/if}
{if 'Twitter'|in_array:$__shareProviders}["Twitter", "{jslang}wcf.message.share.twitter{/jslang}", {icon size=24 name='x-twitter' type='brand' encodeJson=true}],{/if}
{if 'Reddit'|in_array:$__shareProviders}["Reddit", "{jslang}wcf.message.share.reddit{/jslang}", {icon size=24 name='reddit' type='brand' encodeJson=true}],{/if}
{if 'WhatsApp'|in_array:$__shareProviders}["WhatsApp", "{jslang}wcf.message.share.whatsApp{/jslang}", {icon size=24 name='whatsapp' type='brand' encodeJson=true}],{/if}
{if 'LinkedIn'|in_array:$__shareProviders}["LinkedIn", "{jslang}wcf.message.share.linkedIn{/jslang}", {icon size=24 name='linkedin-in' type='brand' encodeJson=true}],{/if}
{if 'Pinterest'|in_array:$__shareProviders}["Pinterest", "{jslang}wcf.message.share.pinterest{/jslang}", {icon size=24 name='pinterest' type='brand' encodeJson=true}],{/if}
{if 'XING'|in_array:$__shareProviders}["XING", "{jslang}wcf.message.share.xing{/jslang}", {icon size=24 name='xing' type='brand' encodeJson=true}],{/if}
{event name='javascriptShareButtonProviders'}
],
{/if}
styleChanger: {if $__wcf->getStyleHandler()->showStyleChanger()}true{else}false{/if},
{if $__wcf->user->userID && !$__wcf->getMessageQuoteManager()->getRemoveQuoteIDs()|empty}removeQuotes: [{implode from=$__wcf->getMessageQuoteManager()->getRemoveQuoteIDs() item=uuid}'{unsafe:$uuid|encodeJS}'{/implode}],{/if}
{if $__wcf->user->userID && !$__wcf->getMessageQuoteManager()->getUsedQuotes()|empty}usedQuotes: new Map([
{foreach from=$__wcf->getMessageQuoteManager()->getUsedQuotes() key=editorID item=uuids}['{unsafe:$editorID|encodeJS}', [{implode from=$uuids item=uuid}'{unsafe:$uuid|encodeJS}'{/implode}]]{/foreach}
]),
{/if}
});
});
</script>
{include file='__devtoolsLanguageChooser'}
{if ENABLE_DEBUG_MODE && ENABLE_DEVELOPER_TOOLS}
<script data-relocate="true">
require(["WoltLabSuite/Core/Devtools/Style/LiveReload"], (LiveReload) => LiveReload.watch());
</script>
{/if}
<script data-relocate="true">
// prevent jQuery and other libraries from utilizing define()
__require_define_amd = define.amd;
define.amd = undefined;
</script>
{js application='wcf' lib='jquery' hasTiny=true}
{js application='wcf' lib='jquery-ui' hasTiny=true}
{js application='wcf' lib='jquery-ui' file='touchPunch' bundle='WCF.Combined' hasTiny=true}
{js application='wcf' lib='jquery-ui' file='nestedSortable' bundle='WCF.Combined' hasTiny=true}
{js application='wcf' file='WCF.Assets' bundle='WCF.Combined' hasTiny=true}
{js application='wcf' file='WCF' bundle='WCF.Combined' hasTiny=true}
<script data-relocate="true">
define.amd = __require_define_amd;
$.holdReady(true);
</script>
<script data-relocate="true">
WCF.User.init(
{$__wcf->user->userID},
{if $__wcf->user->userID}'{unsafe:$__wcf->user->username|encodeJS}'{else}''{/if}
);
</script>
{js application='wcf' file='WCF.ColorPicker' bundle='WCF.Combined' hasTiny=true}
{js application='wcf' file='WCF.Label' bundle='WCF.Combined' hasTiny=true}
{js application='wcf' file='WCF.Location' bundle='WCF.Combined' hasTiny=true}
{js application='wcf' file='WCF.Message' bundle='WCF.Combined' hasTiny=true}
{js application='wcf' file='WCF.User' bundle='WCF.Combined' hasTiny=true}
{js application='wcf' file='WCF.Moderation' bundle='WCF.Combined' hasTiny=true}
{event name='javascriptInclude'}
<noscript>
<style>
.jsOnly {
display: none !important;
}
.noJsOnly {
display: block !important;
}
</style>
</noscript>
<script data-relocate="true">
$(function() {
{if MODULE_TROPHY && $__wcf->session->getPermission('user.profile.trophy.canSeeTrophies')}
require(['WoltLabSuite/Core/Ui/User/Trophy/List'], function (UserTrophyList) {
new UserTrophyList();
});
{/if}
{event name='javascriptInit'}
{if ENABLE_POLLING && $__wcf->user->userID}
require(['WoltLabSuite/Core/Notification/Handler'], function(NotificationHandler) {
NotificationHandler.setup({
icon: '{$__wcf->getStyleHandler()->getStyle()->getFaviconAppleTouchIcon()}',
});
});
{/if}
});
</script>
{include file='shared_imageViewer'}
{include file='headIncludeJsonLd'}