diff options
author | Alex Boag-Munroe <alex.munroe@jupix.com> | 2019-02-03 20:33:36 +0000 |
---|---|---|
committer | Alex Boag-Munroe <alex.munroe@jupix.com> | 2019-02-03 20:33:36 +0000 |
commit | 622da2a39c26b228c3335cb08e9330aba4129ebf (patch) | |
tree | 88404f190e39c875f54b9e3c04c21285eadf2f3e /pelican-bootstrap3 | |
parent | 6a93a9b5eaae1fe352b7b534a6b14a599343b7b9 (diff) | |
download | pelican-themes-622da2a39c26b228c3335cb08e9330aba4129ebf.tar.gz |
Upgrade Tipue to Tipue 7.0
Diffstat (limited to 'pelican-bootstrap3')
-rwxr-xr-x | pelican-bootstrap3/static/tipuesearch/img/search.png | bin | 368 -> 0 bytes | |||
-rwxr-xr-x | pelican-bootstrap3/static/tipuesearch/tipuesearch.css | 404 | ||||
-rw-r--r-- | pelican-bootstrap3/static/tipuesearch/tipuesearch.js | 416 | ||||
-rw-r--r-- | pelican-bootstrap3/static/tipuesearch/tipuesearch.min.js | 180 | ||||
-rw-r--r-- | pelican-bootstrap3/static/tipuesearch/tipuesearch_content.js | 30 | ||||
-rw-r--r-- | pelican-bootstrap3/static/tipuesearch/tipuesearch_set.js | 57 |
6 files changed, 693 insertions, 394 deletions
diff --git a/pelican-bootstrap3/static/tipuesearch/img/search.png b/pelican-bootstrap3/static/tipuesearch/img/search.png Binary files differdeleted file mode 100755 index 8c6943d..0000000 --- a/pelican-bootstrap3/static/tipuesearch/img/search.png +++ /dev/null diff --git a/pelican-bootstrap3/static/tipuesearch/tipuesearch.css b/pelican-bootstrap3/static/tipuesearch/tipuesearch.css index 79ab356..b79ad5f 100755 --- a/pelican-bootstrap3/static/tipuesearch/tipuesearch.css +++ b/pelican-bootstrap3/static/tipuesearch/tipuesearch.css @@ -1,203 +1,363 @@ +@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400|Source+Code+Pro'); + /* -Tipue Search 5.0 -Copyright (c) 2015 Tipue +Tipue Search 7.0 +Copyright (c) 2018 Tipue Tipue Search is released under the MIT License http://www.tipue.com/search */ -#tipue_search_input +/* basics */ + + +.tipue_search_group:after { - font: 13px/1.6 'open sans', sans-serif; - color: #333; - padding: 12px 12px 12px 40px; - width: 170px; - border: 1px solid #e2e2e2; - border-radius: 0; - -moz-appearance: none; - -webkit-appearance: none; - box-shadow: none; - outline: 0; - margin: 0; - background: #fff url('img/search.png') no-repeat 15px 15px; + content: ""; + display: table; + clear: both; } -#tipue_search_content + +/* fonts, colors */ + + +#tipue_search_input { - max-width: 650px; - padding-top: 15px; - margin: 0; + font: 15px/1 'Open Sans', sans-serif; + color: #333; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } -#tipue_search_warning +.tipue_search_icon { - font: 300 15px/1.6 'Open Sans', sans-serif; - color: #555; - margin: 7px 0; + font: 300 24px/1 'Open Sans', sans-serif; + color: #777; } -#tipue_search_warning a +#tipue_search_results_count, .tipue_search_related, .tipue_search_note { - color: #396; + font: 12px/1.3 'Source Code Pro', monospace; + text-transform: uppercase; + color: #999; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} +#tipue_search_replace, #tipue_search_error, .tipue_search_content_text +{ + font: 300 16px/1.6 'Open Sans', sans-serif; + color: #666; +} +#tipue_search_replace a +{ + color: #339e41; text-decoration: none; } -#tipue_search_warning a:hover +#tipue_search_replace a:hover { - color: #555; + color: #666; } -#tipue_search_results_count +.tipue_search_related_btn { - font: 300 15px/1.7 'Open Sans', sans-serif; - color: #555; + font: 11px/1 'Source Code Pro', monospace; + color: #666; + text-transform: uppercase; + letter-spacing: 1px; + background-color: #f7f7f7; } .tipue_search_content_title { - font: 300 21px/1.7 'Open Sans', sans-serif; - margin-top: 23px; + font: 300 30px/1.2 'Open Sans', sans-serif; + color: #333; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } .tipue_search_content_title a { color: #333; text-decoration: none; } -.tipue_search_content_title a:hover -{ - color: #555; -} -.tipue_search_content_url +.tipue_search_content_url, .tipue_search_content_debug { - font: 300 14px/1.9 'Open Sans', sans-serif; - word-wrap: break-word; - hyphens: auto; + font: 300 15px/1.7 'Open Sans', sans-serif; + color: #333; } .tipue_search_content_url a { - color: #396; + color: #339e41; text-decoration: none; } .tipue_search_content_url a:hover { - color: #555; + color: #666; } -.tipue_search_content_text +.tipue_search_content_bold { - font: 300 15px/1.6 'Open Sans', sans-serif; - color: #555; - word-wrap: break-word; - hyphens: auto; - margin-top: 3px; + font-weight: 400; + color: #333; } -.tipue_search_content_debug +.tipue_search_note a { - font: 300 13px/1.6 'Open Sans', sans-serif; - color: #555; - margin: 5px 0; + color: #999; + text-decoration: none; } -.h01 +.tipue_search_image_close { - color: #333; - font-weight: 400; + font: 22px/1 'Source Code Pro', monospace; + color: #ccc; } - -#tipue_search_foot +#tipue_search_zoom_text { - margin: 51px 0 21px 0; + font: 11px/1.7 'Source Code Pro', monospace; + color: #ccc; + text-transform: uppercase; + letter-spacing: 1px; } -#tipue_search_foot_boxes +#tipue_search_zoom_text a { - padding: 0; - margin: 0; - font: 12px 'Open Sans', sans-serif; + color: #ccc; + text-decoration: none; + border-bottom: 2px solid #f7f7f7; } -#tipue_search_foot_boxes li +#tipue_search_zoom_text a:hover { - list-style: none; - margin: 0; - padding: 0; - display: inline; + border: 0; +} +#tipue_search_foot_boxes +{ + font: 13px/1 'Source Code Pro', sans-serif; + text-transform: uppercase; + color: #333; } #tipue_search_foot_boxes li a { - padding: 10px 17px 11px 17px; - background-color: #fff; - border: 1px solid #e2e2e2; - border-radius: 1px; - color: #333; - margin-right: 7px; - text-decoration: none; - text-align: center; + background-color: #f7f7f7; + color: #666; } #tipue_search_foot_boxes li.current { - padding: 10px 17px 11px 17px; - background: #f6f6f6; - border: 1px solid #e2e2e2; - border-radius: 1px; - color: #333; - margin-right: 7px; - text-align: center; + background: #252525; + color: #ccc; } -#tipue_search_foot_boxes li a:hover +#tipue_search_foot_boxes li a:hover, .tipue_search_related_btn:hover { - background: #f6f6f6; + background: #252525; + color: #ccc; } -/* spinner */ +/* search box */ -.tipue_search_spinner +#tipue_search_input { - padding: 31px 0; - width: 50px; - height: 28px; + float: left; + width: 200px; + background-color: #f3f3f3; + border: none; + padding: 9px 6px 10px 15px; + height: 56px; + border-radius: 3px; + -moz-appearance: none; + -webkit-appearance: none; + box-sizing: border-box; + box-shadow: none; + outline: 0; + margin: 0; } -.tipue_search_spinner > div +.tipue_search_button +{ + position: relative; + float: left; + width: 47px; + height: 56px; + margin-left: -3px; + background-color: #f3f3f3; + border: none; + border-radius: 3px; + box-sizing: border-box; + cursor: pointer; + outline: 0; +} +.tipue_search_icon +{ + float: left; + transform: rotate(-45deg); + -moz-appearance: none; + -webkit-appearance: none; + box-sizing: border-box; + box-shadow: none; + outline: 0; + margin: -1px 0 0 8px; +} + + +/* search results */ + + +#tipue_search_content +{ + max-width: 100%; + margin: 0; +} +.tipue_search_result +{ + padding-top: 21px; +} +#tipue_search_results_count +{ + padding-top: 9px; +} +.tipue_search_related +{ + padding-top: 13px; +} +.tipue_search_related_block +{ + padding-bottom: 6px; +} +#tipue_search_warning +{ + padding-top: 10px; +} +.tipue_search_related_btn { - background-color: #777; - height: 100%; - width: 3px; display: inline-block; - margin-right: 2px; - -webkit-animation: stretchdelay 1.2s infinite ease-in-out; - animation: stretchdelay 1.2s infinite ease-in-out; + padding: 9px 10px; + text-decoration: none; + text-align: center; + border-radius: 3px; + margin: 9px 9px 0 0; + outline: 0; + transition: 0.2s; + cursor: pointer; +} +#tipue_search_replace +{ + padding-top: 13px; +} +#tipue_search_error +{ + padding-top: 13px; } -.tipue_search_spinner .tipue_search_rect2 +.tipue_search_content_url { - -webkit-animation-delay: -1.1s; - animation-delay: -1.1s; + padding-top: 3px; + word-wrap: break-word; + hyphens: auto; } -.tipue_search_spinner .tipue_search_rect3 +.tipue_search_content_text { - -webkit-animation-delay: -1.0s; - animation-delay: -1.0s; + word-wrap: break-word; + hyphens: auto; + margin-top: 1px; } -@-webkit-keyframes stretchdelay +.tipue_search_note { - 0%, 40%, 100% - { - -webkit-transform: scaleY(0.4) - } - 20% - { - -webkit-transform: scaleY(1.0) - } + padding-top: 5px; } -@keyframes stretchdelay +.tipue_search_content_debug { - 0%, 40%, 100% - { - transform: scaleY(0.4); - -webkit-transform: scaleY(0.4); - } - 20% - { - transform: scaleY(1.0); - -webkit-transform: scaleY(1.0); - } + margin: 5px 0; } +/* images */ +.tipue_search_image +{ + padding: 9px 0 6px 0; +} +.tipue_search_img +{ + width: 200px; + max-width: 100%; + height: auto; + transition: 0.5s; + border-radius: 1px; +} +.tipue_search_img:hover +{ + opacity: 0.7; +} +.tipue_search_image_zoom +{ + cursor: pointer; +} +#tipue_search_image_modal +{ + display: none; + position: fixed; + z-index: 1000; + left: 0; + top: 0; + width: 100%; + height: 100%; + overflow: auto; + background-color: rgba(0, 0, 0, 0.9); +} +.tipue_search_image_close +{ + position: absolute; + top: 0; + right: 0; + padding: 25px 30px; + cursor: pointer; +} +.tipue_search_image_block +{ + margin: 0 auto; + max-width: 900px; + padding: 73px 30px 30px 30px; + box-sizing: border-box; + color: #fff; +} +#tipue_search_zoom_img +{ + max-width: 100%; + height: auto; +} +#tipue_search_zoom_text, .tipue_search_zoom_options +{ + padding-top: 9px; +} + + +/* footer */ +#tipue_search_foot +{ + margin: 51px 0 21px 0; +} +#tipue_search_foot_boxes +{ + padding: 0; + margin: 0; + cursor: pointer; +} +#tipue_search_foot_boxes li +{ + display: inline; + list-style: none; + margin: 0; + padding: 0; +} +#tipue_search_foot_boxes li a +{ + padding: 10px 17px 11px 17px; + border-radius: 3px; + margin-right: 7px; + text-decoration: none; + text-align: center; + transition: 0.2s; +} +#tipue_search_foot_boxes li.current +{ + padding: 10px 17px 11px 17px; + border-radius: 3px; + margin-right: 7px; + text-align: center; +} + diff --git a/pelican-bootstrap3/static/tipuesearch/tipuesearch.js b/pelican-bootstrap3/static/tipuesearch/tipuesearch.js index 60e5281..e616686 100644 --- a/pelican-bootstrap3/static/tipuesearch/tipuesearch.js +++ b/pelican-bootstrap3/static/tipuesearch/tipuesearch.js @@ -1,7 +1,7 @@ /* -Tipue Search 5.0 -Copyright (c) 2015 Tipue +Tipue Search 7.0 +Copyright (c) 2018 Tipue Tipue Search is released under the MIT License http://www.tipue.com/search */ @@ -13,79 +13,28 @@ http://www.tipue.com/search var set = $.extend( { - 'show' : 7, - 'newWindow' : false, - 'showURL' : true, - 'showTitleCount' : true, - 'minimumLength' : 3, - 'descriptiveWords' : 25, - 'highlightTerms' : true, - 'highlightEveryTerm' : false, - 'mode' : 'static', - 'liveDescription' : '*', - 'liveContent' : '*', - 'contentLocation' : 'tipuesearch/tipuesearch_content.json', - 'debug' : false - + 'contextBuffer' : 60, + 'contextLength' : 60, + 'contextStart' : 90, + 'debug' : false, + 'descriptiveWords' : 25, + 'footerPages' : 3, + 'highlightTerms' : true, + 'imageZoom' : true, + 'minimumLength' : 3, + 'newWindow' : false, + 'show' : 10, + 'showContext' : true, + 'showRelated' : true, + 'showTime' : true, + 'showTitleCount' : true, + 'showURL' : true, + 'wholeWords' : true }, options); return this.each(function() { - - var tipuesearch_in = { - pages: [] - }; - $.ajaxSetup({ - async: false - }); - var tipuesearch_t_c = 0; - - if (set.mode == 'live') - { - for (var i = 0; i < tipuesearch_pages.length; i++) - { - $.get(tipuesearch_pages[i]) - .done(function(html) - { - var cont = $(set.liveContent, html).text(); - cont = cont.replace(/\s+/g, ' '); - var desc = $(set.liveDescription, html).text(); - desc = desc.replace(/\s+/g, ' '); - - var t_1 = html.toLowerCase().indexOf('<title>'); - var t_2 = html.toLowerCase().indexOf('</title>', t_1 + 7); - if (t_1 != -1 && t_2 != -1) - { - var tit = html.slice(t_1 + 7, t_2); - } - else - { - var tit = tipuesearch_string_1; - } - - tipuesearch_in.pages.push( - { - "title": tit, - "text": desc, - "tags": cont, - "url": tipuesearch_pages[i] - }); - }); - } - } - if (set.mode == 'json') - { - $.getJSON(set.contentLocation) - .done(function(json) - { - tipuesearch_in = $.extend({}, json); - }); - } - - if (set.mode == 'static') - { - tipuesearch_in = $.extend({}, tipuesearch); - } + var tipuesearch_t_c = 0; var tipue_search_w = ''; if (set.newWindow) @@ -95,8 +44,20 @@ http://www.tipue.com/search function getURLP(name) { - return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20')) || null; + var locSearch = location.search; + var splitted = (new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(locSearch)||[,""]); + var searchString = splitted[1].replace(/\+/g, '%20'); + try + { + searchString = decodeURIComponent(searchString); + } + catch(e) + { + searchString = unescape(searchString); + } + return searchString || null; } + if (getURLP('q')) { $('#tipue_search_input').val(getURLP('q')); @@ -114,29 +75,30 @@ http://www.tipue.com/search function getTipueSearch(start, replace) { - $('#tipue_search_content').hide(); - $('#tipue_search_content').html('<div class="tipue_search_spinner"><div class="tipue_search_rect1"></div><div class="tipue_search_rect2"></div><div class="rect3"></div></div>'); - $('#tipue_search_content').show(); + window.scrollTo(0, 0); var out = ''; - var results = ''; var show_replace = false; var show_stop = false; var standard = true; var c = 0; - found = []; + var found = []; - var d = $('#tipue_search_input').val().toLowerCase(); - d = $.trim(d); + var d_o = $('#tipue_search_input').val(); + d_o = d_o.replace(/\+/g, ' ').replace(/\s\s+/g, ' '); + + d_o = $.trim(d_o); + var d = d_o.toLowerCase(); if ((d.match("^\"") && d.match("\"$")) || (d.match("^'") && d.match("'$"))) { standard = false; } + var d_w = d.split(' '); + if (standard) { - var d_w = d.split(' '); d = ''; for (var i = 0; i < d_w.length; i++) { @@ -196,44 +158,39 @@ http://www.tipue.com/search } d_w = d_t.split(' '); - for (var i = 0; i < tipuesearch_in.pages.length; i++) + for (var i = 0; i < tipuesearch.pages.length; i++) { var score = 0; - var s_t = tipuesearch_in.pages[i].text; + var s_t = tipuesearch.pages[i].text; for (var f = 0; f < d_w.length; f++) { - var pat = new RegExp(d_w[f], 'gi'); - if (tipuesearch_in.pages[i].title.search(pat) != -1) + if (set.wholeWords) + { + var pat = new RegExp('\\b' + d_w[f] + '\\b', 'gi'); + } + else { - var m_c = tipuesearch_in.pages[i].title.match(pat).length; + var pat = new RegExp(d_w[f], 'gi'); + } + if (tipuesearch.pages[i].title.search(pat) != -1) + { + var m_c = tipuesearch.pages[i].title.match(pat).length; score += (20 * m_c); } - if (tipuesearch_in.pages[i].text.search(pat) != -1) + if (tipuesearch.pages[i].text.search(pat) != -1) { - var m_c = tipuesearch_in.pages[i].text.match(pat).length; + var m_c = tipuesearch.pages[i].text.match(pat).length; score += (20 * m_c); } - - if (set.highlightTerms) + if (tipuesearch.pages[i].tags) { - if (set.highlightEveryTerm) - { - var patr = new RegExp('(' + d_w[f] + ')', 'gi'); - } - else + if (tipuesearch.pages[i].tags.search(pat) != -1) { - var patr = new RegExp('(' + d_w[f] + ')', 'i'); + var m_c = tipuesearch.pages[i].tags.match(pat).length; + score += (10 * m_c); } - s_t = s_t.replace(patr, "<span class=\"h01\">$1</span>"); } - - if (tipuesearch_in.pages[i].tags.search(pat) != -1) - { - var m_c = tipuesearch_in.pages[i].tags.match(pat).length; - score += (10 * m_c); - } - - if (tipuesearch_in.pages[i].url.search(pat) != -1) + if (tipuesearch.pages[i].url.search(pat) != -1) { score += 20; } @@ -242,7 +199,7 @@ http://www.tipue.com/search { for (var e = 0; e < tipuesearch_weight.weight.length; e++) { - if (tipuesearch_in.pages[i].url == tipuesearch_weight.weight[e].url) + if (tipuesearch.pages[i].url == tipuesearch_weight.weight[e].url) { score += tipuesearch_weight.weight[e].score; } @@ -252,7 +209,7 @@ http://www.tipue.com/search if (d_w[f].match('^-')) { pat = new RegExp(d_w[f].substring(1), 'i'); - if (tipuesearch_in.pages[i].title.search(pat) != -1 || tipuesearch_in.pages[i].text.search(pat) != -1 || tipuesearch_in.pages[i].tags.search(pat) != -1) + if (tipuesearch.pages[i].title.search(pat) != -1 || tipuesearch.pages[i].text.search(pat) != -1 || tipuesearch.pages[i].tags.search(pat) != -1) { score = 0; } @@ -264,9 +221,11 @@ http://www.tipue.com/search found.push( { "score": score, - "title": tipuesearch_in.pages[i].title, + "title": tipuesearch.pages[i].title, "desc": s_t, - "url": tipuesearch_in.pages[i].url + "img": tipuesearch.pages[i].img, + "url": tipuesearch.pages[i].url, + "note": tipuesearch.pages[i].note }); c++; } @@ -274,42 +233,30 @@ http://www.tipue.com/search } else { - for (var i = 0; i < tipuesearch_in.pages.length; i++) + for (var i = 0; i < tipuesearch.pages.length; i++) { var score = 0; - var s_t = tipuesearch_in.pages[i].text; + var s_t = tipuesearch.pages[i].text; var pat = new RegExp(d, 'gi'); - if (tipuesearch_in.pages[i].title.search(pat) != -1) + if (tipuesearch.pages[i].title.search(pat) != -1) { - var m_c = tipuesearch_in.pages[i].title.match(pat).length; + var m_c = tipuesearch.pages[i].title.match(pat).length; score += (20 * m_c); } - if (tipuesearch_in.pages[i].text.search(pat) != -1) + if (tipuesearch.pages[i].text.search(pat) != -1) { - var m_c = tipuesearch_in.pages[i].text.match(pat).length; + var m_c = tipuesearch.pages[i].text.match(pat).length; score += (20 * m_c); } - - if (set.highlightTerms) + if (tipuesearch.pages[i].tags) { - if (set.highlightEveryTerm) - { - var patr = new RegExp('(' + d + ')', 'gi'); - } - else + if (tipuesearch.pages[i].tags.search(pat) != -1) { - var patr = new RegExp('(' + d + ')', 'i'); + var m_c = tipuesearch.pages[i].tags.match(pat).length; + score += (10 * m_c); } - s_t = s_t.replace(patr, "<span class=\"h01\">$1</span>"); - } - - if (tipuesearch_in.pages[i].tags.search(pat) != -1) - { - var m_c = tipuesearch_in.pages[i].tags.match(pat).length; - score += (10 * m_c); } - - if (tipuesearch_in.pages[i].url.search(pat) != -1) + if (tipuesearch.pages[i].url.search(pat) != -1) { score += 20; } @@ -318,7 +265,7 @@ http://www.tipue.com/search { for (var e = 0; e < tipuesearch_weight.weight.length; e++) { - if (tipuesearch_in.pages[i].url == tipuesearch_weight.weight[e].url) + if (tipuesearch.pages[i].url == tipuesearch_weight.weight[e].url) { score += tipuesearch_weight.weight[e].score; } @@ -330,9 +277,11 @@ http://www.tipue.com/search found.push( { "score": score, - "title": tipuesearch_in.pages[i].title, + "title": tipuesearch.pages[i].title, "desc": s_t, - "url": tipuesearch_in.pages[i].url + "img": tipuesearch.pages[i].img, + "url": tipuesearch.pages[i].url, + "note": tipuesearch.pages[i].note }); c++; } @@ -347,28 +296,80 @@ http://www.tipue.com/search document.title = '(' + c + ') ' + title; tipuesearch_t_c++; } - - if (show_replace == 1) - { - out += '<div id="tipue_search_warning">' + tipuesearch_string_2 + ' ' + d + '. ' + tipuesearch_string_3 + ' <a id="tipue_search_replaced">' + d_r + '</a></div>'; - } + if (c == 1) { - out += '<div id="tipue_search_results_count">' + tipuesearch_string_4 + '</div>'; + out += '<div id="tipue_search_results_count">' + tipuesearch_string_4; } else { - c_c = c.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); - out += '<div id="tipue_search_results_count">' + c_c + ' ' + tipuesearch_string_5 + '</div>'; + var c_c = c.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); + out += '<div id="tipue_search_results_count">' + c_c + ' ' + tipuesearch_string_5; + } + if (set.showTime) + { + var endTimer = new Date().getTime(); + var time = (endTimer - startTimer) / 1000; + out += ' (' + time.toFixed(2) + ' ' + tipuesearch_string_14 + ')'; + set.showTime = false; + } + out += '</div>'; + + if (set.showRelated && standard) + { + f = 0; + for (var i = 0; i < tipuesearch_related.Related.length; i++) + { + if (d == tipuesearch_related.Related[i].search) + { + if (!f) + { + out += '<div class="tipue_search_related">' + tipuesearch_string_10 + '</div><div class="tipue_search_related_block">'; + } + if (show_replace) + { + d_o = d; + } + + if (tipuesearch_related.Related[i].include) + { + var r_d = d_o + ' ' + tipuesearch_related.Related[i].related; + } + else + { + var r_d = tipuesearch_related.Related[i].related; + } + + out += '<a class="tipue_search_related_btn" id="' + r_d + '">' + tipuesearch_related.Related[i].related + '</a>'; + f++; + } + } + if (f) + { + out += '</div>'; + } + } + + if (show_replace) + { + out += '<div id="tipue_search_replace">' + tipuesearch_string_2 + ' ' + d + '. ' + tipuesearch_string_3 + ' <a id="tipue_search_replaced">' + d_r + '</a></div>'; } found.sort(function(a, b) { return b.score - a.score } ); var l_o = 0; + + if (set.imageZoom) + { + out += '<div id="tipue_search_image_modal"><div class="tipue_search_image_close">✕</div><div class="tipue_search_image_block"><a id="tipue_search_zoom_url"><img id="tipue_search_zoom_img"></a><div id="tipue_search_zoom_text"></div></div></div>'; + } + for (var i = 0; i < found.length; i++) { if (l_o >= start && l_o < set.show + start) - { + { + out += '<div class="tipue_search_result">'; + out += '<div class="tipue_search_content_title"><a href="' + found[i].url + '"' + tipue_search_w + '>' + found[i].title + '</a></div>'; if (set.debug) @@ -379,16 +380,65 @@ http://www.tipue.com/search if (set.showURL) { var s_u = found[i].url.toLowerCase(); - if(s_u.indexOf('http://') == 0) + if (s_u.indexOf('http://') == 0) { s_u = s_u.slice(7); } out += '<div class="tipue_search_content_url"><a href="' + found[i].url + '"' + tipue_search_w + '>' + s_u + '</a></div>'; } + if (found[i].img) + { + if (set.imageZoom) + { + out += '<div class="tipue_search_image"><img class="tipue_search_img tipue_search_image_zoom" src="' + found[i].img + '" alt="' + found[i].title + '" data-url="' + found[i].url + '"></div>'; + } + else + { + out += '<div class="tipue_search_image"><a href="' + found[i].url + '"' + tipue_search_w + '><img class="tipue_search_img" src="' + found[i].img + '" alt="' + found[i].title + '"></a></div>'; + } + } + if (found[i].desc) { var t = found[i].desc; + + if (set.showContext) + { + d_w = d.split(' '); + var s_1 = found[i].desc.toLowerCase().indexOf(d_w[0]); + if (s_1 > set.contextStart) + { + var t_1 = t.substr(s_1 - set.contextBuffer); + var s_2 = t_1.indexOf(' '); + t_1 = t.substr(s_1 - set.contextBuffer + s_2); + t_1 = $.trim(t_1); + + if (t_1.length > set.contextLength) + { + t = '... ' + t_1; + } + } + } + + if (standard) + { + d_w = d.split(' '); + for (var f = 0; f < d_w.length; f++) + { + if (set.highlightTerms) + { + var patr = new RegExp('(' + d_w[f] + ')', 'gi'); + t = t.replace(patr, "<h0011>$1<h0012>"); + } + } + } + else if (set.highlightTerms) + { + var patr = new RegExp('(' + d + ')', 'gi'); + t = t.replace(patr, "<span class=\"tipue_search_content_bold\">$1</span>"); + } + var t_d = ''; var t_w = t.split(' '); if (t_w.length < set.descriptiveWords) @@ -407,45 +457,61 @@ http://www.tipue.com/search { t_d += ' ...'; } + + t_d = t_d.replace(/h0011/g, 'span class=\"tipue_search_content_bold\"'); + t_d = t_d.replace(/h0012/g, '/span'); + out += '<div class="tipue_search_content_text">' + t_d + '</div>'; } + + if (found[i].note) + { + out += '<div class="tipue_search_note">' + found[i].note + '</div>'; + } + + out += '</div>'; } l_o++; - } - + } + if (c > set.show) { var pages = Math.ceil(c / set.show); var page = (start / set.show); + if (set.footerPages < 3) + { + set.footerPages = 3; + } + out += '<div id="tipue_search_foot"><ul id="tipue_search_foot_boxes">'; if (start > 0) { - out += '<li><a class="tipue_search_foot_box" id="' + (start - set.show) + '_' + replace + '">' + tipuesearch_string_6 + '</a></li>'; + out += '<li role="navigation"><a class="tipue_search_foot_box" accesskey="b" id="' + (start - set.show) + '_' + replace + '">' + tipuesearch_string_6 + '</a></li>'; } if (page <= 2) { var p_b = pages; - if (pages > 3) + if (pages > set.footerPages) { - p_b = 3; + p_b = set.footerPages; } for (var f = 0; f < p_b; f++) { if (f == page) { - out += '<li class="current">' + (f + 1) + '</li>'; + out += '<li class="current" role="navigation">' + (f + 1) + '</li>'; } else { - out += '<li><a class="tipue_search_foot_box" id="' + (f * set.show) + '_' + replace + '">' + (f + 1) + '</a></li>'; + out += '<li role="navigation"><a class="tipue_search_foot_box" id="' + (f * set.show) + '_' + replace + '">' + (f + 1) + '</a></li>'; } } } else { - var p_b = page + 2; + var p_b = page + set.footerPages - 1; if (p_b > pages) { p_b = pages; @@ -454,55 +520,77 @@ http://www.tipue.com/search { if (f == page) { - out += '<li class="current">' + (f + 1) + '</li>'; + out += '<li class="current" role="navigation">' + (f + 1) + '</li>'; } else { - out += '<li><a class="tipue_search_foot_box" id="' + (f * set.show) + '_' + replace + '">' + (f + 1) + '</a></li>'; + out += '<li role="navigation"><a class="tipue_search_foot_box" id="' + (f * set.show) + '_' + replace + '">' + (f + 1) + '</a></li>'; } } } if (page + 1 != pages) { - out += '<li><a class="tipue_search_foot_box" id="' + (start + set.show) + '_' + replace + '">' + tipuesearch_string_7 + '</a></li>'; + out += '<li role="navigation"><a class="tipue_search_foot_box" accesskey="m" id="' + (start + set.show) + '_' + replace + '">' + tipuesearch_string_7 + '</a></li>'; } out += '</ul></div>'; - } + } + } else { - out += '<div id="tipue_search_warning">' + tipuesearch_string_8 + '</div>'; + out += '<div id="tipue_search_error">' + tipuesearch_string_8 + '</div>'; } } else { if (show_stop) { - out += '<div id="tipue_search_warning">' + tipuesearch_string_8 + '. ' + tipuesearch_string_9 + '</div>'; + out += '<div id="tipue_search_error">' + tipuesearch_string_8 + ' ' + tipuesearch_string_9 + '</div>'; } else { - out += '<div id="tipue_search_warning">' + tipuesearch_string_10 + '</div>'; if (set.minimumLength == 1) { - out += '<div id="tipue_search_warning">' + tipuesearch_string_11 + '</div>'; + out += '<div id="tipue_search_error">' + tipuesearch_string_11 + '</div>'; } else { - out += '<div id="tipue_search_warning">' + tipuesearch_string_12 + ' ' + set.minimumLength + ' ' + tipuesearch_string_13 + '</div>'; + out += '<div id="tipue_search_error">' + tipuesearch_string_12 + ' ' + set.minimumLength + ' ' + tipuesearch_string_13 + '</div>'; } } } - $('#tipue_search_content').hide(); - $('#tipue_search_content').html(out); - $('#tipue_search_content').slideDown(200); + $('#tipue_search_content').hide().html(out).slideDown(200); $('#tipue_search_replaced').click(function() { getTipueSearch(0, false); + }); + + $('.tipue_search_related_btn').click(function() + { + $('#tipue_search_input').val($(this).attr('id')); + getTipueSearch(0, true); + }); + + $('.tipue_search_image_zoom').click(function() + { + $('#tipue_search_image_modal').fadeIn(300); + $('#tipue_search_zoom_img').attr('src', this.src); + + var z_u = $(this).attr('data-url'); + $('#tipue_search_zoom_url').attr('href', z_u); + + var z_o = this.alt + '<div class="tipue_search_zoom_options"><a href="' + this.src + '" target="_blank">' + tipuesearch_string_15 + '</a> <a href="' + z_u + '">' + tipuesearch_string_16 + '</a></div>'; + + $('#tipue_search_zoom_text').html(z_o); + }); + + $('.tipue_search_image_close').click(function() + { + $('#tipue_search_image_modal').fadeOut(300); }); $('.tipue_search_foot_box').click(function() diff --git a/pelican-bootstrap3/static/tipuesearch/tipuesearch.min.js b/pelican-bootstrap3/static/tipuesearch/tipuesearch.min.js index 6b69c72..7e8a47e 100644 --- a/pelican-bootstrap3/static/tipuesearch/tipuesearch.min.js +++ b/pelican-bootstrap3/static/tipuesearch/tipuesearch.min.js @@ -1,29 +1,20 @@ -(function($){$.fn.tipuesearch=function(options){var set=$.extend({'show':7,'newWindow':false,'showURL':true,'showTitleCount':true,'minimumLength':3,'descriptiveWords':25,'highlightTerms':true,'highlightEveryTerm':false,'mode':'static','liveDescription':'*','liveContent':'*','contentLocation':'tipuesearch/tipuesearch_content.json','debug':false},options);return this.each(function(){var tipuesearch_in={pages:[]};$.ajaxSetup({async:false});var tipuesearch_t_c=0;if(set.mode=='live') -{for(var i=0;i<tipuesearch_pages.length;i++) -{$.get(tipuesearch_pages[i]).done(function(html) -{var cont=$(set.liveContent,html).text();cont=cont.replace(/\s+/g,' ');var desc=$(set.liveDescription,html).text();desc=desc.replace(/\s+/g,' ');var t_1=html.toLowerCase().indexOf('<title>');var t_2=html.toLowerCase().indexOf('</title>',t_1+7);if(t_1!=-1&&t_2!=-1) -{var tit=html.slice(t_1+7,t_2);} -else -{var tit=tipuesearch_string_1;} -tipuesearch_in.pages.push({"title":tit,"text":desc,"tags":cont,"url":tipuesearch_pages[i]});});}} -if(set.mode=='json') -{$.getJSON(set.contentLocation).done(function(json) -{tipuesearch_in=$.extend({},json);});} -if(set.mode=='static') -{tipuesearch_in=$.extend({},tipuesearch);} -var tipue_search_w='';if(set.newWindow) +(function($){$.fn.tipuesearch=function(options){var set=$.extend({'contextBuffer':60,'contextLength':60,'contextStart':90,'debug':false,'descriptiveWords':25,'footerPages':3,'highlightTerms':true,'imageZoom':true,'minimumLength':3,'newWindow':false,'show':10,'showContext':true,'showRelated':true,'showTime':true,'showTitleCount':true,'showURL':true,'wholeWords':true},options);return this.each(function(){var tipuesearch_t_c=0;var tipue_search_w='';if(set.newWindow) {tipue_search_w=' target="_blank"';} function getURLP(name) -{return decodeURIComponent((new RegExp('[?|&]'+name+'='+'([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g,'%20'))||null;} +{var locSearch=location.search;var splitted=(new RegExp('[?|&]'+name+'='+'([^&;]+?)(&|#|;|$)').exec(locSearch)||[,""]);var searchString=splitted[1].replace(/\+/g,'%20');try +{searchString=decodeURIComponent(searchString);} +catch(e) +{searchString=unescape(searchString);} +return searchString||null;} if(getURLP('q')) {$('#tipue_search_input').val(getURLP('q'));getTipueSearch(0,true);} $(this).keyup(function(event) {if(event.keyCode=='13') {getTipueSearch(0,true);}});function getTipueSearch(start,replace) -{$('#tipue_search_content').hide();$('#tipue_search_content').html('<div class="tipue_search_spinner"><div class="tipue_search_rect1"></div><div class="tipue_search_rect2"></div><div class="rect3"></div></div>');$('#tipue_search_content').show();var out='';var results='';var show_replace=false;var show_stop=false;var standard=true;var c=0;found=[];var d=$('#tipue_search_input').val().toLowerCase();d=$.trim(d);if((d.match("^\"")&&d.match("\"$"))||(d.match("^'")&&d.match("'$"))) +{window.scrollTo(0,0);var out='';var show_replace=false;var show_stop=false;var standard=true;var c=0;var found=[];var d_o=$('#tipue_search_input').val();d_o=d_o.replace(/\+/g,' ').replace(/\s\s+/g,' ');d_o=$.trim(d_o);var d=d_o.toLowerCase();if((d.match("^\"")&&d.match("\"$"))||(d.match("^'")&&d.match("'$"))) {standard=false;} -if(standard) -{var d_w=d.split(' ');d='';for(var i=0;i<d_w.length;i++) +var d_w=d.split(' ');if(standard) +{d='';for(var i=0;i<d_w.length;i++) {var a_w=true;for(var f=0;f<tipuesearch_stop_words.length;f++) {if(d_w[i]==tipuesearch_stop_words[f]) {a_w=false;show_stop=true;}} @@ -44,112 +35,147 @@ var d_t=d;for(var i=0;i<d_w.length;i++) {for(var f=0;f<tipuesearch_stem.words.length;f++) {if(d_w[i]==tipuesearch_stem.words[f].word) {d_t=d_t+' '+tipuesearch_stem.words[f].stem;}}} -d_w=d_t.split(' ');for(var i=0;i<tipuesearch_in.pages.length;i++) -{var score=0;var s_t=tipuesearch_in.pages[i].text;for(var f=0;f<d_w.length;f++) -{var pat=new RegExp(d_w[f],'gi');if(tipuesearch_in.pages[i].title.search(pat)!=-1) -{var m_c=tipuesearch_in.pages[i].title.match(pat).length;score+=(20*m_c);} -if(tipuesearch_in.pages[i].text.search(pat)!=-1) -{var m_c=tipuesearch_in.pages[i].text.match(pat).length;score+=(20*m_c);} -if(set.highlightTerms) -{if(set.highlightEveryTerm) -{var patr=new RegExp('('+d_w[f]+')','gi');} +d_w=d_t.split(' ');for(var i=0;i<tipuesearch.pages.length;i++) +{var score=0;var s_t=tipuesearch.pages[i].text;for(var f=0;f<d_w.length;f++) +{if(set.wholeWords) +{var pat=new RegExp('\\b'+d_w[f]+'\\b','gi');} else -{var patr=new RegExp('('+d_w[f]+')','i');} -s_t=s_t.replace(patr,"<span class=\"h01\">$1</span>");} -if(tipuesearch_in.pages[i].tags.search(pat)!=-1) -{var m_c=tipuesearch_in.pages[i].tags.match(pat).length;score+=(10*m_c);} -if(tipuesearch_in.pages[i].url.search(pat)!=-1) +{var pat=new RegExp(d_w[f],'gi');} +if(tipuesearch.pages[i].title.search(pat)!=-1) +{var m_c=tipuesearch.pages[i].title.match(pat).length;score+=(20*m_c);} +if(tipuesearch.pages[i].text.search(pat)!=-1) +{var m_c=tipuesearch.pages[i].text.match(pat).length;score+=(20*m_c);} +if(tipuesearch.pages[i].tags) +{if(tipuesearch.pages[i].tags.search(pat)!=-1) +{var m_c=tipuesearch.pages[i].tags.match(pat).length;score+=(10*m_c);}} +if(tipuesearch.pages[i].url.search(pat)!=-1) {score+=20;} if(score!=0) {for(var e=0;e<tipuesearch_weight.weight.length;e++) -{if(tipuesearch_in.pages[i].url==tipuesearch_weight.weight[e].url) +{if(tipuesearch.pages[i].url==tipuesearch_weight.weight[e].url) {score+=tipuesearch_weight.weight[e].score;}}} if(d_w[f].match('^-')) -{pat=new RegExp(d_w[f].substring(1),'i');if(tipuesearch_in.pages[i].title.search(pat)!=-1||tipuesearch_in.pages[i].text.search(pat)!=-1||tipuesearch_in.pages[i].tags.search(pat)!=-1) +{pat=new RegExp(d_w[f].substring(1),'i');if(tipuesearch.pages[i].title.search(pat)!=-1||tipuesearch.pages[i].text.search(pat)!=-1||tipuesearch.pages[i].tags.search(pat)!=-1) {score=0;}}} if(score!=0) -{found.push({"score":score,"title":tipuesearch_in.pages[i].title,"desc":s_t,"url":tipuesearch_in.pages[i].url});c++;}}} -else -{for(var i=0;i<tipuesearch_in.pages.length;i++) -{var score=0;var s_t=tipuesearch_in.pages[i].text;var pat=new RegExp(d,'gi');if(tipuesearch_in.pages[i].title.search(pat)!=-1) -{var m_c=tipuesearch_in.pages[i].title.match(pat).length;score+=(20*m_c);} -if(tipuesearch_in.pages[i].text.search(pat)!=-1) -{var m_c=tipuesearch_in.pages[i].text.match(pat).length;score+=(20*m_c);} -if(set.highlightTerms) -{if(set.highlightEveryTerm) -{var patr=new RegExp('('+d+')','gi');} +{found.push({"score":score,"title":tipuesearch.pages[i].title,"desc":s_t,"img":tipuesearch.pages[i].img,"url":tipuesearch.pages[i].url,"note":tipuesearch.pages[i].note});c++;}}} else -{var patr=new RegExp('('+d+')','i');} -s_t=s_t.replace(patr,"<span class=\"h01\">$1</span>");} -if(tipuesearch_in.pages[i].tags.search(pat)!=-1) -{var m_c=tipuesearch_in.pages[i].tags.match(pat).length;score+=(10*m_c);} -if(tipuesearch_in.pages[i].url.search(pat)!=-1) +{for(var i=0;i<tipuesearch.pages.length;i++) +{var score=0;var s_t=tipuesearch.pages[i].text;var pat=new RegExp(d,'gi');if(tipuesearch.pages[i].title.search(pat)!=-1) +{var m_c=tipuesearch.pages[i].title.match(pat).length;score+=(20*m_c);} +if(tipuesearch.pages[i].text.search(pat)!=-1) +{var m_c=tipuesearch.pages[i].text.match(pat).length;score+=(20*m_c);} +if(tipuesearch.pages[i].tags) +{if(tipuesearch.pages[i].tags.search(pat)!=-1) +{var m_c=tipuesearch.pages[i].tags.match(pat).length;score+=(10*m_c);}} +if(tipuesearch.pages[i].url.search(pat)!=-1) {score+=20;} if(score!=0) {for(var e=0;e<tipuesearch_weight.weight.length;e++) -{if(tipuesearch_in.pages[i].url==tipuesearch_weight.weight[e].url) +{if(tipuesearch.pages[i].url==tipuesearch_weight.weight[e].url) {score+=tipuesearch_weight.weight[e].score;}}} if(score!=0) -{found.push({"score":score,"title":tipuesearch_in.pages[i].title,"desc":s_t,"url":tipuesearch_in.pages[i].url});c++;}}} +{found.push({"score":score,"title":tipuesearch.pages[i].title,"desc":s_t,"img":tipuesearch.pages[i].img,"url":tipuesearch.pages[i].url,"note":tipuesearch.pages[i].note});c++;}}} if(c!=0) {if(set.showTitleCount&&tipuesearch_t_c==0) {var title=document.title;document.title='('+c+') '+title;tipuesearch_t_c++;} -if(show_replace==1) -{out+='<div id="tipue_search_warning">'+tipuesearch_string_2+' '+d+'. '+tipuesearch_string_3+' <a id="tipue_search_replaced">'+d_r+'</a></div>';} if(c==1) -{out+='<div id="tipue_search_results_count">'+tipuesearch_string_4+'</div>';} +{out+='<div id="tipue_search_results_count">'+tipuesearch_string_4;} else -{c_c=c.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");out+='<div id="tipue_search_results_count">'+c_c+' '+tipuesearch_string_5+'</div>';} -found.sort(function(a,b){return b.score-a.score});var l_o=0;for(var i=0;i<found.length;i++) +{var c_c=c.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");out+='<div id="tipue_search_results_count">'+c_c+' '+tipuesearch_string_5;} +if(set.showTime) +{var endTimer=new Date().getTime();var time=(endTimer-startTimer)/ 1000;out+=' ('+time.toFixed(2)+' '+tipuesearch_string_14+')';set.showTime=false;} +out+='</div>';if(set.showRelated&&standard) +{f=0;for(var i=0;i<tipuesearch_related.Related.length;i++) +{if(d==tipuesearch_related.Related[i].search) +{if(!f) +{out+='<div class="tipue_search_related">'+tipuesearch_string_10+'</div><div class="tipue_search_related_block">';} +if(show_replace) +{d_o=d;} +if(tipuesearch_related.Related[i].include) +{var r_d=d_o+' '+tipuesearch_related.Related[i].related;} +else +{var r_d=tipuesearch_related.Related[i].related;} +out+='<a class="tipue_search_related_btn" id="'+r_d+'">'+tipuesearch_related.Related[i].related+'</a>';f++;}} +if(f) +{out+='</div>';}} +if(show_replace) +{out+='<div id="tipue_search_replace">'+tipuesearch_string_2+' '+d+'. '+tipuesearch_string_3+' <a id="tipue_search_replaced">'+d_r+'</a></div>';} +found.sort(function(a,b){return b.score-a.score});var l_o=0;if(set.imageZoom) +{out+='<div id="tipue_search_image_modal"><div class="tipue_search_image_close">✕</div><div class="tipue_search_image_block"><a id="tipue_search_zoom_url"><img id="tipue_search_zoom_img"></a><div id="tipue_search_zoom_text"></div></div></div>';} +for(var i=0;i<found.length;i++) {if(l_o>=start&&l_o<set.show+start) -{out+='<div class="tipue_search_content_title"><a href="'+found[i].url+'"'+tipue_search_w+'>'+found[i].title+'</a></div>';if(set.debug) +{out+='<div class="tipue_search_result">';out+='<div class="tipue_search_content_title"><a href="'+found[i].url+'"'+tipue_search_w+'>'+found[i].title+'</a></div>';if(set.debug) {out+='<div class="tipue_search_content_debug">Score: '+found[i].score+'</div>';} if(set.showURL) {var s_u=found[i].url.toLowerCase();if(s_u.indexOf('http://')==0) {s_u=s_u.slice(7);} out+='<div class="tipue_search_content_url"><a href="'+found[i].url+'"'+tipue_search_w+'>'+s_u+'</a></div>';} +if(found[i].img) +{if(set.imageZoom) +{out+='<div class="tipue_search_image"><img class="tipue_search_img tipue_search_image_zoom" src="'+found[i].img+'" alt="'+found[i].title+'" data-url="'+found[i].url+'"></div>';} +else +{out+='<div class="tipue_search_image"><a href="'+found[i].url+'"'+tipue_search_w+'><img class="tipue_search_img" src="'+found[i].img+'" alt="'+found[i].title+'"></a></div>';}} if(found[i].desc) -{var t=found[i].desc;var t_d='';var t_w=t.split(' ');if(t_w.length<set.descriptiveWords) +{var t=found[i].desc;if(set.showContext) +{d_w=d.split(' ');var s_1=found[i].desc.toLowerCase().indexOf(d_w[0]);if(s_1>set.contextStart) +{var t_1=t.substr(s_1-set.contextBuffer);var s_2=t_1.indexOf(' ');t_1=t.substr(s_1-set.contextBuffer+s_2);t_1=$.trim(t_1);if(t_1.length>set.contextLength) +{t='... '+t_1;}}} +if(standard) +{d_w=d.split(' ');for(var f=0;f<d_w.length;f++) +{if(set.highlightTerms) +{var patr=new RegExp('('+d_w[f]+')','gi');t=t.replace(patr,"<h0011>$1<h0012>");}}} +else if(set.highlightTerms) +{var patr=new RegExp('('+d+')','gi');t=t.replace(patr,"<span class=\"tipue_search_content_bold\">$1</span>");} +var t_d='';var t_w=t.split(' ');if(t_w.length<set.descriptiveWords) {t_d=t;} else {for(var f=0;f<set.descriptiveWords;f++) {t_d+=t_w[f]+' ';}} t_d=$.trim(t_d);if(t_d.charAt(t_d.length-1)!='.') {t_d+=' ...';} -out+='<div class="tipue_search_content_text">'+t_d+'</div>';}} +t_d=t_d.replace(/h0011/g,'span class=\"tipue_search_content_bold\"');t_d=t_d.replace(/h0012/g,'/span');out+='<div class="tipue_search_content_text">'+t_d+'</div>';} +if(found[i].note) +{out+='<div class="tipue_search_note">'+found[i].note+'</div>';} +out+='</div>';} l_o++;} if(c>set.show) -{var pages=Math.ceil(c / set.show);var page=(start / set.show);out+='<div id="tipue_search_foot"><ul id="tipue_search_foot_boxes">';if(start>0) -{out+='<li><a class="tipue_search_foot_box" id="'+(start-set.show)+'_'+replace+'">'+tipuesearch_string_6+'</a></li>';} +{var pages=Math.ceil(c / set.show);var page=(start / set.show);if(set.footerPages<3) +{set.footerPages=3;} +out+='<div id="tipue_search_foot"><ul id="tipue_search_foot_boxes">';if(start>0) +{out+='<li role="navigation"><a class="tipue_search_foot_box" accesskey="b" id="'+(start-set.show)+'_'+replace+'">'+tipuesearch_string_6+'</a></li>';} if(page<=2) -{var p_b=pages;if(pages>3) -{p_b=3;} +{var p_b=pages;if(pages>set.footerPages) +{p_b=set.footerPages;} for(var f=0;f<p_b;f++) {if(f==page) -{out+='<li class="current">'+(f+1)+'</li>';} +{out+='<li class="current" role="navigation">'+(f+1)+'</li>';} else -{out+='<li><a class="tipue_search_foot_box" id="'+(f*set.show)+'_'+replace+'">'+(f+1)+'</a></li>';}}} +{out+='<li role="navigation"><a class="tipue_search_foot_box" id="'+(f*set.show)+'_'+replace+'">'+(f+1)+'</a></li>';}}} else -{var p_b=page+2;if(p_b>pages) +{var p_b=page+set.footerPages-1;if(p_b>pages) {p_b=pages;} for(var f=page-1;f<p_b;f++) {if(f==page) -{out+='<li class="current">'+(f+1)+'</li>';} +{out+='<li class="current" role="navigation">'+(f+1)+'</li>';} else -{out+='<li><a class="tipue_search_foot_box" id="'+(f*set.show)+'_'+replace+'">'+(f+1)+'</a></li>';}}} +{out+='<li role="navigation"><a class="tipue_search_foot_box" id="'+(f*set.show)+'_'+replace+'">'+(f+1)+'</a></li>';}}} if(page+1!=pages) -{out+='<li><a class="tipue_search_foot_box" id="'+(start+set.show)+'_'+replace+'">'+tipuesearch_string_7+'</a></li>';} +{out+='<li role="navigation"><a class="tipue_search_foot_box" accesskey="m" id="'+(start+set.show)+'_'+replace+'">'+tipuesearch_string_7+'</a></li>';} out+='</ul></div>';}} else -{out+='<div id="tipue_search_warning">'+tipuesearch_string_8+'</div>';}} +{out+='<div id="tipue_search_error">'+tipuesearch_string_8+'</div>';}} else {if(show_stop) -{out+='<div id="tipue_search_warning">'+tipuesearch_string_8+'. '+tipuesearch_string_9+'</div>';} +{out+='<div id="tipue_search_error">'+tipuesearch_string_8+' '+tipuesearch_string_9+'</div>';} else -{out+='<div id="tipue_search_warning">'+tipuesearch_string_10+'</div>';if(set.minimumLength==1) -{out+='<div id="tipue_search_warning">'+tipuesearch_string_11+'</div>';} +{if(set.minimumLength==1) +{out+='<div id="tipue_search_error">'+tipuesearch_string_11+'</div>';} else -{out+='<div id="tipue_search_warning">'+tipuesearch_string_12+' '+set.minimumLength+' '+tipuesearch_string_13+'</div>';}}} -$('#tipue_search_content').hide();$('#tipue_search_content').html(out);$('#tipue_search_content').slideDown(200);$('#tipue_search_replaced').click(function() -{getTipueSearch(0,false);});$('.tipue_search_foot_box').click(function() -{var id_v=$(this).attr('id');var id_a=id_v.split('_');getTipueSearch(parseInt(id_a[0]),id_a[1]);});}});};})(jQuery); +{out+='<div id="tipue_search_error">'+tipuesearch_string_12+' '+set.minimumLength+' '+tipuesearch_string_13+'</div>';}}} +$('#tipue_search_content').hide().html(out).slideDown(200);$('#tipue_search_replaced').click(function() +{getTipueSearch(0,false);});$('.tipue_search_related_btn').click(function() +{$('#tipue_search_input').val($(this).attr('id'));getTipueSearch(0,true);});$('.tipue_search_image_zoom').click(function() +{$('#tipue_search_image_modal').fadeIn(300);$('#tipue_search_zoom_img').attr('src',this.src);var z_u=$(this).attr('data-url');$('#tipue_search_zoom_url').attr('href',z_u);var z_o=this.alt+'<div class="tipue_search_zoom_options"><a href="'+this.src+'" target="_blank">'+tipuesearch_string_15+'</a> <a href="'+z_u+'">'+tipuesearch_string_16+'</a></div>';$('#tipue_search_zoom_text').html(z_o);});$('.tipue_search_image_close').click(function() +{$('#tipue_search_image_modal').fadeOut(300);});$('.tipue_search_foot_box').click(function() +{var id_v=$(this).attr('id');var id_a=id_v.split('_');getTipueSearch(parseInt(id_a[0]),id_a[1]);});}});};})(jQuery);
\ No newline at end of file diff --git a/pelican-bootstrap3/static/tipuesearch/tipuesearch_content.js b/pelican-bootstrap3/static/tipuesearch/tipuesearch_content.js index 606dd4c..ca3c547 100644 --- a/pelican-bootstrap3/static/tipuesearch/tipuesearch_content.js +++ b/pelican-bootstrap3/static/tipuesearch/tipuesearch_content.js @@ -1,18 +1,18 @@ var tipuesearch = {"pages": [ - {"title": "Tipue", "text": "", "tags": "jQuery HTML5 CSS", "url": "http://www.tipue.com"}, - {"title": "Tipue Search, a site search engine jQuery plugin", "text": "Tipue Search is a site search engine jQuery plugin. It's free, open source, responsive and fast. Tipue Search only needs a browser that supports jQuery. It doesn't need MySQL or similar. In Static mode it doesn't even need a web server.", "tags": "JavaScript", "url": "http://www.tipue.com/search"}, - {"title": "Tipue Search Documentation", "text": "Tipue Search is a site search engine jQuery plugin. It's free, open source and responsive. Tipue Search uses various modes for loading content. Static mode uses a JavaScript object, while JSON mode uses JSON. Live mode grabs content from a list of pages dynamically.", "tags": "docs", "url": "http://www.tipue.com/search/docs"}, - {"title": "Tipue Search Static mode demo", "text": "Tipue Search is a site search engine jQuery plugin. This is a demo of Static mode. Enter tipue into the search box above.", "tags": "", "url": "http://www.tipue.com/search/demos/static"}, - {"title": "Tipue Search Live mode demo", "text": "Tipue Search is a site search engine jQuery plugin. This is a demo of Live mode. Enter tipue into the search box above.", "tags": "", "url": "http://www.tipue.com/search/demos/live"}, - {"title": "Tipue jQuery plugins Support", "text": "If you're stuck we offer a range of flexible support plans for our jQuery plugins.", "tags": "", "url": "http://www.tipue.com/support"}, - {"title": "Tipr, a small and simple jQuery tooltip plugin", "text": "Tipr is a small and simple jQuery tooltip plugin. It's free and open source. Tipr displays attractive tooltips, and it's a shade under 4KB, CSS included.", "tags": "JavaScript", "url": "http://www.tipue.com/tipr"}, - {"title": "The Tipue blog", "text": "An occasional blog covering CSS, web development, etc.", "tags": "HTML5", "url": "http://www.tipue.com/?d=2"}, - {"title": "About Tipue", "text": "Tipue is a small web development studio based in North London. We've been around for well over a decade. We design innovative add-ins, plugins, code and features with heavy-duty Perl, MySQL and jQuery.", "tags": "", "url": "http://www.tipue.com/about"}, - {"title": "The Tipue blog - The complete guide to centering a div", "text": "Every new developer inevitably finds that centering a div isn't as obvious as you'd expect. Centering what's inside a div is easy enough by giving the text-align property a value of center, but then things tend to get a bit sticky. When you get to centering a div vertically, you can end up in a world of CSS hurt.", "tags": "HTML", "url": "http://www.tipue.com/blog/center-a-div"}, - {"title": "The Tipue blog - Native HTML5 autocomplete with input list", "text": "This article shows how with the HTML5 input list attribute and datalist element you can easily set up an input box with a custom autocomplete without jQuery, JavaScript or similar.", "tags": "", "url": "http://www.tipue.com/blog/input-list"}, - {"title": "The Tipue blog - The really simple guide to z-index", "text": "The CSS z-index property often trips up new and even experienced developers. The aim of this article is to boil down a somewhat-complex specification to 3 major points, which should ease most z-index pain.", "tags": "", "url": "http://www.tipue.com/z-index"} + {"title": "Tipue", "text": "Tipue is a small web development studio based in North London.", "url": "http://www.tipue.com"}, + {"title": "Tipue Search, a jQuery Site Search Plugin", "text": "Tipue Search is a site search jQuery plugin. It's free, open source, responsive and fast. Tipue Search only needs a browser that supports jQuery. It doesn't need MySQL or similar. It doesn't even need a web server.", "img": "http://www.tipue.com/img/surface.jpg", "tags": "JavaScript", "url": "http://www.tipue.com/search"}, + {"title": "Tipue Search Help", "text": "Tipue Search help. Tipue Search is a site search jQuery plugin. It's free, open source, responsive and fast. What is Tipue Search? Getting Started. Using Tipue Search. Options.", "img": "http://www.tipue.com/img/elvis.jpg", "url": "http://www.tipue.com/search/help"}, + {"title": "Tipue Search demo", "text": "Tipue Search demo. Try searching for Tipue.", "url": "http://www.tipue.com/search/demo"}, + {"title": "About Tipue", "text": "Tipue is a small web development studio based in North London, founded in 2001. We design innovative and original jQuery plugins and add-in code. We talk to MySQL and similar with heavy-duty Perl. Our work breathes.", "url": "http://www.tipue.com/is"}, + {"title": "Tipr, a Small and Simple jQuery Tooltip Plugin", "text": "Small, simple, flat, cool. Tipr is a jQuery tooltip plugin. It works on almost any element, and it's free and open source. Tipr displays nice tooltips, and it's around 3KB, CSS included. The tooltips can appear on almost any HTML element. Tipr reacts to the size of the viewport.", "img": "http://www.tipue.com/img/glow.jpg", "tags": "JavaScript", "url": "http://www.tipue.com/tipr"}, + {"title": "Tipue Support", "text": "We offer a range of flexible support plans for our jQuery plugins, including free. We hope to continue offering excellent free support. Get it by talking to us on Twitter.", "url": "http://www.tipue.com/support"}, + {"title": "Getting Started with Tipue Search", "text": "Download Tipue Search and copy the tipuesearch folder to your site. You should look at the demo included with Tipue Search. You should first create a search page. The site content is stored in the tipuesearch_content.js file. It contains the search data as a JavaScript object.", "note": "<a href='http://www.tipue.com/search/help/'>From Help</a>", "url": "http://www.tipue.com/search/help/?d=1"}, + {"title": "Content for Tipue Search", "text": "The search data for Tipue Search is contained in the tipuesearch JavaScript object. Usually this is stored in the tipuesearch_content.js file, but it doesn't have to be. You can create a JavaScript object for your website with Beaty.", "note": "<a href='http://www.tipue.com/search/help/'>From Help</a>", "url": "http://www.tipue.com/search/help/?d=2"}, + {"title": "Beaty", "text": "Beaty is a web scraper that grabs content from your website and returns the data as a JavaScript object, JSON or CSV. Beaty is for small to medium websites, and there's a limit of 70 pages. English is the only language supported.", "tags": "Tipue", "url": "http://www.tipue.com/beaty"}, + {"title": "The Complete Guide to Centering a Div", "text": "Every developer inevitably finds that centering a div isn't as obvious as you'd expect. Centering what's inside a div horizontally is easy but then things tend to get a bit sticky. When you get to centering a div vertically, you can end up in a world of CSS hurt.", "tags": "Tipue Features", "url": "http://www.tipue.com/blog/center-a-div"}, + {"title": "Using Vw and Vh", "text": "Viewport width (vw) and viewport height (vh) are viewport-percentage values introduced in CSS3. Given how powerful they are, and with almost complete browser support, they should be everywhere.", "tags": "Tipue Features", "url": "http://www.tipue.com/blog/css3-vw-vh"}, + {"title": "Using CSS Feature Queries", "text": "CSS feature queries are now supported everywhere. They allow you to use cutting edge CSS with subtle and precise feature detection.", "tags": "Tipue Features", "url": "http://www.tipue.com/blog/feature-queries"}, + {"title": "A Very Simple CSS Background Zoom", "text": "A really easy method of creating a CSS background image zoom. Not only is this simple, it comes with wide browser support.", "tags": "Tipue Features", "url": "http://www.tipue.com/blog/css-background-zoom"}, + {"title": "Using Z-index", "text": "The CSS z-index property often trips up both new and experienced developers. The aim of this article is to boil down a somewhat-complex specification to three major points, which should ease most z-index pain.", "tags": "Tipue Features", "url": "http://www.tipue.com/blog/z-index"} ]}; - - - diff --git a/pelican-bootstrap3/static/tipuesearch/tipuesearch_set.js b/pelican-bootstrap3/static/tipuesearch/tipuesearch_set.js index eab3f6e..e3e51e0 100644 --- a/pelican-bootstrap3/static/tipuesearch/tipuesearch_set.js +++ b/pelican-bootstrap3/static/tipuesearch/tipuesearch_set.js @@ -1,7 +1,7 @@ /* -Tipue Search 5.0 -Copyright (c) 2015 Tipue +Tipue Search 7.0 +Copyright (c) 2018 Tipue Tipue Search is released under the MIT License http://www.tipue.com/search */ @@ -12,13 +12,13 @@ Stop words Stop words list from http://www.ranks.nl/stopwords */ -var tipuesearch_stop_words = ["a", "about", "above", "after", "again", "against", "all", "am", "an", "and", "any", "are", "aren't", "as", "at", "be", "because", "been", "before", "being", "below", "between", "both", "but", "by", "can't", "cannot", "could", "couldn't", "did", "didn't", "do", "does", "doesn't", "doing", "don't", "down", "during", "each", "few", "for", "from", "further", "had", "hadn't", "has", "hasn't", "have", "haven't", "having", "he", "he'd", "he'll", "he's", "her", "here", "here's", "hers", "herself", "him", "himself", "his", "how", "how's", "i", "i'd", "i'll", "i'm", "i've", "if", "in", "into", "is", "isn't", "it", "it's", "its", "itself", "let's", "me", "more", "most", "mustn't", "my", "myself", "no", "nor", "not", "of", "off", "on", "once", "only", "or", "other", "ought", "our", "ours", "ourselves", "out", "over", "own", "same", "shan't", "she", "she'd", "she'll", "she's", "should", "shouldn't", "so", "some", "such", "than", "that", "that's", "the", "their", "theirs", "them", "themselves", "then", "there", "there's", "these", "they", "they'd", "they'll", "they're", "they've", "this", "those", "through", "to", "too", "under", "until", "up", "very", "was", "wasn't", "we", "we'd", "we'll", "we're", "we've", "were", "weren't", "what", "what's", "when", "when's", "where", "where's", "which", "while", "who", "who's", "whom", "why", "why's", "with", "won't", "would", "wouldn't", "you", "you'd", "you'll", "you're", "you've", "your", "yours", "yourself", "yourselves"]; +var tipuesearch_stop_words = ["a", "above", "after", "again", "against", "all", "am", "an", "and", "any", "are", "aren't", "as", "at", "be", "because", "been", "before", "being", "below", "between", "both", "but", "by", "can't", "cannot", "could", "couldn't", "did", "didn't", "do", "does", "doesn't", "doing", "don't", "down", "during", "each", "few", "for", "from", "further", "had", "hadn't", "has", "hasn't", "have", "haven't", "having", "he", "he'd", "he'll", "he's", "her", "here", "here's", "hers", "herself", "him", "himself", "his", "how", "how's", "i", "i'd", "i'll", "i'm", "i've", "if", "in", "into", "is", "isn't", "it", "it's", "its", "itself", "let's", "me", "more", "most", "mustn't", "my", "myself", "no", "nor", "not", "of", "off", "on", "once", "only", "or", "other", "ought", "our", "ours", "ourselves", "out", "over", "own", "same", "shan't", "she", "she'd", "she'll", "she's", "should", "shouldn't", "so", "some", "such", "than", "that", "that's", "the", "their", "theirs", "them", "themselves", "then", "there", "there's", "these", "they", "they'd", "they'll", "they're", "they've", "this", "those", "through", "to", "too", "under", "until", "up", "very", "was", "wasn't", "we", "we'd", "we'll", "we're", "we've", "were", "weren't", "what", "what's", "when", "when's", "where", "where's", "which", "while", "who", "who's", "whom", "why", "why's", "with", "won't", "would", "wouldn't", "you", "you'd", "you'll", "you're", "you've", "your", "yours", "yourself", "yourselves"]; // Word replace var tipuesearch_replace = {'words': [ - {'word': 'tipua', 'replace_with': 'tipue'}, + {'word': 'tip', 'replace_with': 'tipue'}, {'word': 'javscript', 'replace_with': 'javascript'}, {'word': 'jqeury', 'replace_with': 'jquery'} ]}; @@ -27,13 +27,14 @@ var tipuesearch_replace = {'words': [ // Weighting var tipuesearch_weight = {'weight': [ - {'url': 'http://www.tipue.com', 'score': 200}, - {'url': 'http://www.tipue.com/search', 'score': 100}, - {'url': 'http://www.tipue.com/about', 'score': 100} + {'url': 'http://www.tipue.com', 'score': 60}, + {'url': 'http://www.tipue.com/search', 'score': 60}, + {'url': 'http://www.tipue.com/tipr', 'score': 30}, + {'url': 'http://www.tipue.com/support', 'score': 20} ]}; -// Stemming +// Illogical stemming var tipuesearch_stem = {'words': [ {'word': 'e-mail', 'stem': 'email'}, @@ -42,6 +43,18 @@ var tipuesearch_stem = {'words': [ ]}; +// Related + +var tipuesearch_related = {'Related': [ + {'search': 'tipue', 'related': 'Search', 'include': 1}, + {'search': 'tipue', 'related': 'jQuery'}, + {'search': 'tipue', 'related': 'Features'}, + {'search': 'tipue', 'related': 'Support'}, + {'search': 'tipue search', 'related': 'Help', 'include': 1}, + {'search': 'tipue search', 'related': 'Support'} +]}; + + // Internal strings var tipuesearch_string_1 = 'No title'; @@ -49,11 +62,23 @@ var tipuesearch_string_2 = 'Showing results for'; var tipuesearch_string_3 = 'Search instead for'; var tipuesearch_string_4 = '1 result'; var tipuesearch_string_5 = 'results'; -var tipuesearch_string_6 = 'Prev'; -var tipuesearch_string_7 = 'Next'; -var tipuesearch_string_8 = 'Nothing found'; -var tipuesearch_string_9 = 'Common words are largely ignored'; -var tipuesearch_string_10 = 'Search too short'; -var tipuesearch_string_11 = 'Should be one character or more'; -var tipuesearch_string_12 = 'Should be'; -var tipuesearch_string_13 = 'characters or more'; +var tipuesearch_string_6 = '<'; +var tipuesearch_string_7 = '>'; +var tipuesearch_string_8 = 'Nothing found.'; +var tipuesearch_string_9 = 'Common words are largely ignored.'; +var tipuesearch_string_10 = 'Related'; +var tipuesearch_string_11 = 'Search too short. Should be one character or more.'; +var tipuesearch_string_12 = 'Search too short. Should be'; +var tipuesearch_string_13 = 'characters or more.'; +var tipuesearch_string_14 = 'seconds'; +var tipuesearch_string_15 = 'Open Image'; +var tipuesearch_string_16 = 'Goto Page'; + + +// Internals + + +// Timer for showTime + +var startTimer = new Date().getTime(); + |