Skip to content

Commit b4cc5fd

Browse files
committed
optimize js injection
nachtrag
1 parent 1dde5e8 commit b4cc5fd

File tree

171 files changed

+476
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+476
-125
lines changed

src/html/admin/mapeditor_section.twig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{% extends "html/admindefaults.twig" %}
2+
{% from 'html/executeJavascript.twig' import executeJs %}
23

34
{% block body %}
45
{% include 'html/breadcrumb.twig' %}
@@ -428,5 +429,5 @@
428429
</div>
429430
</div>
430431
</div>
431-
{% include 'html/executeJavascriptAjaxUpdate.twig' %}
432-
{% endblock %}
432+
{{ executeJs(EXECUTEJSAJAXUPDATE) }}
433+
{% endblock %}

src/html/admindefaults.twig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@
8787
</div>
8888
</div>
8989
</div>
90-
{% include 'html/executeJavascriptAfterRender.twig' %}
90+
{% from 'html/executeJavascript.twig' import executeJs %}
91+
{{ executeJs(EXECUTEJSAFTERRENDER) }}
9192
</body>
9293

9394
</html>

src/html/ajaxwindow.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{% from 'html/executeJavascript.twig' import executeJs %}
2+
13
<html lang="de">
24

35
<head>
@@ -28,7 +30,7 @@
2830
{% endblock %}
2931
{% endif %}
3032
</div>
31-
{% include 'html/executeJavascriptAfterRender.twig' %}
33+
{{ executeJs(EXECUTEJSAFTERRENDER) }}
3234
</body>
3335

3436
</html>

src/html/breadcrumb.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{% from 'html/executeJavascript.twig' import executeJs %}
2+
13
<div class="box">
24
<div class="box_title" style="text-align: left">/
35
{% for key, item in NAVIGATION %}
@@ -11,7 +13,7 @@
1113
</div>
1214
</div>
1315
<br />
14-
{% include 'html/executeJavascript.twig' %}
16+
{{ executeJs(EXECUTEJSBEFORERENDER) }}
1517
{% if INFORMATION %}
1618
{% include 'html/systeminformation.twig' %}
1719
{% else %}

src/html/colony/menu/buildmenues.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{% embed "html/colony/menu/submenuForm.twig" %}
2+
3+
{% from 'html/executeJavascript.twig' import executeJs %}
24
{% block containment %}
35
<div>
46
<table cellpading="0" cellspacing="0" style="text-align: center;">
@@ -14,6 +16,6 @@
1416
</tr>
1517
</table>
1618
</div>
17-
{% include 'html/executeJavascriptAjaxUpdate.twig' %}
19+
{{ executeJs(EXECUTEJSAJAXUPDATE) }}
1820
{% endblock %}
1921
{% endembed %}

src/html/colony/menu/moduleFab.twig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{% embed "html/colony/menu/submenuForm.twig" %}
2-
{% block containment %}
2+
{% from 'html/executeJavascript.twig' import executeJs %}
33

4+
{% block containment %}
45
<div class="box" style="width: 40vw;">
56
<input type="hidden" name="func" id="func" value="{{ FUNC.getFunction.value }}" />
67
<input type="hidden" id="colony-id" value="{{ HOST.getId }}" />
@@ -164,11 +165,11 @@
164165
</div>
165166

166167
</div>
167-
{% include 'html/executeJavascriptAfterRender.twig' %}
168+
{{ executeJs(EXECUTEJSAFTERRENDER) }}
168169
<style>
169170
.level-box button.active {
170171
background-color: #d3d3d3;
171172
}
172173
</style>
173174
{% endblock %}
174-
{% endembed %}
175+
{% endembed %}

src/html/colony/telescopeSectionTable.twig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{# needs following variables: HEAD_ROW, MAP_FIELDS) #}
2-
{% include 'html/executeJavascriptAjaxUpdate.twig' %}
2+
{% from 'html/executeJavascript.twig' import executeJs %}
3+
4+
{{ executeJs(EXECUTEJSAJAXUPDATE) }}
35
<table id="starmapsectiontable" class="use">
46
<tr>
57
<th>x|y</th>

src/html/executeJavascript.twig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
{% if EXECUTEJSBEFORERENDER %}
1+
{% macro executeJs(jsArray) %}
2+
{% if jsArray %}
23
<script>
3-
{% for item in EXECUTEJSBEFORERENDER %}
4+
{% for item in jsArray %}
45
{% autoescape false %}
56
{{ item }}
67
{% endautoescape %}
78
{% endfor %}
89
</script>
910
{% endif %}
11+
{% endmacro %}

src/html/executeJavascriptAfterRender.twig

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/html/executeJavascriptAjaxUpdate.twig

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)