1
0
mirror of https://github.com/aquatix/digimarks.git synced 2025-12-06 20:55:10 +01:00

Moved autocompletion items to seperate javascript call

This commit is contained in:
2018-03-26 15:33:07 +02:00
parent 63636d3355
commit 6516c4af1d
3 changed files with 25 additions and 7 deletions

View File

@@ -90,13 +90,6 @@
minLength: 3,
limit: 10,
data: {
{% for bookmark in bookmarks %}
{% if bookmark.favicon %}
"{{ bookmark.title | replace('\n', '') }}": "{{ url_for('static', filename='favicons/' + bookmark.favicon) }}",
{% else %}
"{{ bookmark.title | replace('\n', '') }}": null,
{% endif %}
{% endfor %}
},
}
var elem = document.querySelector('.autocomplete');
@@ -106,4 +99,5 @@
});
*/
</script>
<script src="{{ url_for('bookmarks_js', userkey=userkey) }}" ></script>
{% endblock %}

11
templates/bookmarks.js Normal file
View File

@@ -0,0 +1,11 @@
var elem = document.querySelector('.autocomplete');
var instance = M.Autocomplete.getInstance(elem);
instance.updateData({
{% for bookmark in bookmarks %}
{% if bookmark.favicon %}
"{{ bookmark.title | replace('"', '\\"') | replace('\n', '') }}": "{{ url_for('static', filename='favicons/' + bookmark.favicon) }}",
{% else %}
"{{ bookmark.title | replace('"', '\\"') | replace('\n', '') }}": null,
{% endif %}
{% endfor %}
});