mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-02-26 09:56:29 +00:00
Compare commits
1 Commits
1ab63cbc92
...
3ff30bf0e7
Author | SHA1 | Date | |
---|---|---|---|
|
3ff30bf0e7 |
@ -182,7 +182,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
{% for button in highlighted %}
|
{% for button in highlighted %}
|
||||||
{% if button.display %}
|
{% if button.display %}
|
||||||
document.getElementById("highlighted_button{{ button.id }}").addEventListener("click", function() {
|
$("#highlighted_button{{ button.id }}").click(function() {
|
||||||
addConso({{ button.destination_id }}, {{ button.amount }},
|
addConso({{ button.destination_id }}, {{ button.amount }},
|
||||||
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name|escapejs }}",
|
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name|escapejs }}",
|
||||||
{{ button.id }}, "{{ button.name|escapejs }}");
|
{{ button.id }}, "{{ button.name|escapejs }}");
|
||||||
@ -193,7 +193,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
{% for category in categories %}
|
{% for category in categories %}
|
||||||
{% for button in category.templates_filtered %}
|
{% for button in category.templates_filtered %}
|
||||||
{% if button.display %}
|
{% if button.display %}
|
||||||
document.getElementById("button{{ button.id }}").addEventListener("click", function() {
|
$("#button{{ button.id }}").click(function() {
|
||||||
addConso({{ button.destination_id }}, {{ button.amount }},
|
addConso({{ button.destination_id }}, {{ button.amount }},
|
||||||
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name|escapejs }}",
|
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name|escapejs }}",
|
||||||
{{ button.id }}, "{{ button.name|escapejs }}");
|
{{ button.id }}, "{{ button.name|escapejs }}");
|
||||||
@ -202,6 +202,15 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
{% for button in search_results %}
|
||||||
|
{% if button.display %}
|
||||||
|
$("#search_button{{ button.id }}").click(function() {
|
||||||
|
addConso({{ button.destination_id }}, {{ button.amount }},
|
||||||
|
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name|escapejs }}",
|
||||||
|
{{ button.id }}, "{{ button.name|escapejs }}");
|
||||||
|
});
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
searchbar = document.getElementById("search-input")
|
searchbar = document.getElementById("search-input")
|
||||||
|
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
@ -215,10 +224,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
xhr.open("GET", location.pathname + "?search=" +
|
xhr.open("GET", location.pathname + "?search=" +
|
||||||
encodeURI(pattern) + "#search", true)
|
encodeURI(pattern) + "#search", true)
|
||||||
xhr.onload = () => {
|
xhr.onload = () => {
|
||||||
let newdoc = parser.parseFromString(xhr.responseText, "text/html");
|
|
||||||
document.getElementById("search-results").innerHTML =
|
document.getElementById("search-results").innerHTML =
|
||||||
newdoc.getElementById("search-results").innerHTML;
|
parser.parseFromString(xhr.responseText, "text/html").getElementById("search-results").innerHTML
|
||||||
eval(newdoc.getElementById("search-script").text);
|
|
||||||
};
|
};
|
||||||
xhr.send();
|
xhr.send();
|
||||||
}
|
}
|
||||||
@ -227,15 +234,4 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
|||||||
debounce(updateSearch)()
|
debounce(updateSearch)()
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" id="search-script">
|
|
||||||
{% for button in search_results %}
|
|
||||||
{% if button.display %}
|
|
||||||
document.getElementById("search_button{{ button.id }}").addEventListener("click", function() {
|
|
||||||
addConso({{ button.destination_id }}, {{ button.amount }},
|
|
||||||
{{ polymorphic_ctype }}, {{ button.category_id }}, "{{ button.category.name|escapejs }}",
|
|
||||||
{{ button.id }}, "{{ button.name|escapejs }}");
|
|
||||||
});
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user