appscms-tools-theme 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,89 +0,0 @@
1
- ---
2
- layout: null
3
- sitemap: false
4
- ---
5
-
6
- {% assign counter = 0 %}
7
- var documents = [{% for page in site.pages %}{% if page.url contains '.xml' or page.url contains 'assets' or page.url contains 'category' or page.url contains 'tag' %}{% else %}{
8
- "id": {{ counter }},
9
- "url": "{{ site.url }}{{site.baseurl}}{{ page.url }}",
10
- "title": "{{ page.title }}",
11
- "body": "{{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
12
- }, {% endif %}{% endfor %}{% for page in site.without-plugin %}{
13
- "id": {{ counter }},
14
- "url": "{{ site.url }}{{site.baseurl}}{{ page.url }}",
15
- "title": "{{ page.title }}",
16
- "body": "{{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
17
- }, {% endfor %}{% for page in site.posts %}{
18
- "id": {{ counter }},
19
- "url": "{{ site.url }}{{site.baseurl}}{{ page.url }}",
20
- "title": "{{ page.title }}",
21
- "body": "{{ page.date | date: "%Y/%m/%d" }} - {{ page.content | markdownify | replace: '.', '. ' | replace: '</h2>', ': ' | replace: '</h3>', ': ' | replace: '</h4>', ': ' | replace: '</p>', ' ' | strip_html | strip_newlines | replace: ' ', ' ' | replace: '"', ' ' }}"{% assign counter = counter | plus: 1 %}
22
- }{% if forloop.last %}{% else %}, {% endif %}{% endfor %}];
23
-
24
- var idx = lunr(function () {
25
- this.ref('id')
26
- this.field('title')
27
- this.field('body')
28
-
29
- documents.forEach(function (doc) {
30
- this.add(doc)
31
- }, this)
32
- });
33
- function lunr_search(term) {
34
- document.getElementById('lunrsearchresults').innerHTML = '<ul></ul>';
35
- if(term) {
36
- document.getElementById('lunrsearchresults').innerHTML = "<p>Search results for '" + term + "'</p>" + document.getElementById('lunrsearchresults').innerHTML;
37
- //put results on the screen.
38
- var results = idx.search(term);
39
- if(results.length>0){
40
- //console.log(idx.search(term));
41
- //if results
42
- for (var i = 0; i < results.length; i++) {
43
- // more statements
44
- var ref = results[i]['ref'];
45
- var url = documents[ref]['url'];
46
- var title = documents[ref]['title'];
47
- var body = documents[ref]['body'].substring(0,160)+'...';
48
- document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML = document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML + "<li class='lunrsearchresult'><a href='" + url + "'><span class='title'>" + title + "</span><br /><span class='body'>"+ body +"</span><br /><span class='url'>"+ url +"</span></a></li>";
49
- }
50
- } else {
51
- document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML = "<li class='lunrsearchresult'>No results found...</li>";
52
- }
53
- }
54
- return false;
55
- }
56
-
57
- function lunr_search(term) {
58
- $('#lunrsearchresults').show( 400 );
59
- $( "body" ).addClass( "modal-open" );
60
-
61
- document.getElementById('lunrsearchresults').innerHTML = '<div id="resultsmodal" class="modal fade show d-block" tabindex="-1" role="dialog" aria-labelledby="resultsmodal"> <div class="modal-dialog shadow-lg" role="document"> <div class="modal-content"> <div class="modal-header" id="modtit"> <button type="button" class="close" id="btnx" data-dismiss="modal" aria-label="Close"> &times; </button> </div> <div class="modal-body"> <ul class="mb-0"> </ul> </div> <div class="modal-footer"><button id="btnx" type="button" class="btn btn-danger btn-sm" data-dismiss="modal">Close</button></div></div> </div></div>';
62
- if(term) {
63
- document.getElementById('modtit').innerHTML = "<h5 class='modal-title'>Search results for '" + term + "'</h5>" + document.getElementById('modtit').innerHTML;
64
- //put results on the screen.
65
- var results = idx.search(term);
66
- if(results.length>0){
67
- //console.log(idx.search(term));
68
- //if results
69
- for (var i = 0; i < results.length; i++) {
70
- // more statements
71
- var ref = results[i]['ref'];
72
- var url = documents[ref]['url'];
73
- var title = documents[ref]['title'];
74
- var body = documents[ref]['body'].substring(0,160)+'...';
75
- document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML = document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML + "<li class='lunrsearchresult'><a href='" + url + "'><span class='title'>" + title + "</span><br /><small><span class='body'>"+ body +"</span><br /><span class='url'>"+ url +"</span></small></a></li>";
76
- }
77
- } else {
78
- document.querySelectorAll('#lunrsearchresults ul')[0].innerHTML = "<li class='lunrsearchresult'>Sorry, no results found. Close & try a different search!</li>";
79
- }
80
- }
81
- return false;
82
- }
83
-
84
- $(function() {
85
- $("#lunrsearchresults").on('click', '#btnx', function () {
86
- $('#lunrsearchresults').hide( 5 );
87
- $( "body" ).removeClass( "modal-open" );
88
- });
89
- });