Commit 881ba760 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

fix: optimize search script

parent c6634b83
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
window.content = { {% for card in the_cards %} window.content = { {% for card in the_cards %}
"{{ card.url | slugify }}": { "{{ card.url | slugify }}": {
"title": "{{ card.shortcut | xml_escape }}", "title": "{{ card.shortcut | xml_escape }}",
"content": {{ card.content | strip_html | strip_newlines | jsonify }}, "content": {{ card.content | strip_html | strip_newlines | truncate: 150 | jsonify }},
"url": "{{ card.url | xml_escape | relative_url }}" "url": "{{ card.url | xml_escape | relative_url }}"
} {% unless forloop.last %},{% endunless %} {% endfor %} } {% unless forloop.last %},{% endunless %} {% endfor %}
}; };
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
for (var i = 0; i < results.length; i++) { for (var i = 0; i < results.length; i++) {
var node = document.createElement("tr"); var node = document.createElement("tr");
node.innerHTML = construct_cell(prettify(window.content[results[i].ref].title), node.innerHTML = construct_cell(prettify(window.content[results[i].ref].title),
window.content[results[i].ref].content.substring(0, 125) + '...', window.content[results[i].ref].content.substring(0, 150) + '...',
window.content[results[i].ref].url); window.content[results[i].ref].url);
el_table_body.appendChild(node); el_table_body.appendChild(node);
} }
...@@ -84,4 +84,4 @@ ...@@ -84,4 +84,4 @@
el_tr_placeholder.style.display = "none"; el_tr_placeholder.style.display = "none";
}) })
</script> </script>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment