From 5a2f1e0809d28224dc7af00357c5daccb238b2a7 Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Tue, 4 Aug 2015 17:08:25 -0400 Subject: [PATCH] Upgrade Tipue Search to v5.0 - New JS and CSS files for Tipue Search v5.0. - LateTask to create "search.html" page to use for search entries --- .../files/assets/css/img/search.png | Bin 0 -> 368 bytes .../files/assets/css/tipuesearch.css | 203 +++++++ v7/localsearch/files/assets/js/tipuesearch.js | 520 ++++++++++++++++++ .../files/assets/js/tipuesearch_set.js | 59 ++ v7/localsearch/localsearch.plugin | 2 +- .../__init__.py => localsearch.py} | 64 ++- .../files/assets/css/img/loader.gif | Bin 4178 -> 0 bytes .../files/assets/css/img/search.png | Bin 315 -> 0 bytes .../files/assets/css/tipuesearch.css | 159 ------ .../files/assets/js/tipuesearch.js | 384 ------------- .../files/assets/js/tipuesearch_set.js | 21 - .../localsearch/files/tipue_search.html | 30 - v7/localsearch/templates/mako/search.tmpl | 28 + 13 files changed, 864 insertions(+), 606 deletions(-) create mode 100755 v7/localsearch/files/assets/css/img/search.png create mode 100755 v7/localsearch/files/assets/css/tipuesearch.css create mode 100644 v7/localsearch/files/assets/js/tipuesearch.js create mode 100644 v7/localsearch/files/assets/js/tipuesearch_set.js rename v7/localsearch/{localsearch/__init__.py => localsearch.py} (67%) delete mode 100644 v7/localsearch/localsearch/files/assets/css/img/loader.gif delete mode 100644 v7/localsearch/localsearch/files/assets/css/img/search.png delete mode 100644 v7/localsearch/localsearch/files/assets/css/tipuesearch.css delete mode 100644 v7/localsearch/localsearch/files/assets/js/tipuesearch.js delete mode 100644 v7/localsearch/localsearch/files/assets/js/tipuesearch_set.js delete mode 100644 v7/localsearch/localsearch/files/tipue_search.html create mode 100644 v7/localsearch/templates/mako/search.tmpl diff --git a/v7/localsearch/files/assets/css/img/search.png b/v7/localsearch/files/assets/css/img/search.png new file mode 100755 index 0000000000000000000000000000000000000000..8c6943d42ab8e861373162f11056f1d198146ebf GIT binary patch literal 368 zcmV-$0gwKPP)7K``wv zphx>2{0_r#5g#iG#&nVEgc=X!FGs?cTA62~5l& zE5XM}PVJ65P%pNIM82yJAK#80@CP~In49nwXo}dj4c`pfmG1%#c=QkCE2g|7f{hjc O0000 div +{ + 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; +} +.tipue_search_spinner .tipue_search_rect2 +{ + -webkit-animation-delay: -1.1s; + animation-delay: -1.1s; +} +.tipue_search_spinner .tipue_search_rect3 +{ + -webkit-animation-delay: -1.0s; + animation-delay: -1.0s; +} +@-webkit-keyframes stretchdelay +{ + 0%, 40%, 100% + { + -webkit-transform: scaleY(0.4) + } + 20% + { + -webkit-transform: scaleY(1.0) + } +} +@keyframes stretchdelay +{ + 0%, 40%, 100% + { + transform: scaleY(0.4); + -webkit-transform: scaleY(0.4); + } + 20% + { + transform: scaleY(1.0); + -webkit-transform: scaleY(1.0); + } +} + + + + + + diff --git a/v7/localsearch/files/assets/js/tipuesearch.js b/v7/localsearch/files/assets/js/tipuesearch.js new file mode 100644 index 00000000..60e52811 --- /dev/null +++ b/v7/localsearch/files/assets/js/tipuesearch.js @@ -0,0 +1,520 @@ + +/* +Tipue Search 5.0 +Copyright (c) 2015 Tipue +Tipue Search is released under the MIT License +http://www.tipue.com/search +*/ + + +(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(''); + var t_2 = html.toLowerCase().indexOf('', 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) + { + tipue_search_w = ' target="_blank"'; + } + + function getURLP(name) + { + return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20')) || 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('
'); + $('#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("'$"))) + { + standard = false; + } + + if (standard) + { + var d_w = d.split(' '); + 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; + } + } + if (a_w) + { + d = d + ' ' + d_w[i]; + } + } + d = $.trim(d); + d_w = d.split(' '); + } + else + { + d = d.substring(1, d.length - 1); + } + + if (d.length >= set.minimumLength) + { + if (standard) + { + if (replace) + { + var d_r = d; + for (var i = 0; i < d_w.length; i++) + { + for (var f = 0; f < tipuesearch_replace.words.length; f++) + { + if (d_w[i] == tipuesearch_replace.words[f].word) + { + d = d.replace(d_w[i], tipuesearch_replace.words[f].replace_with); + show_replace = true; + } + } + } + d_w = d.split(' '); + } + + 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'); + } + else + { + var patr = new RegExp('(' + d_w[f] + ')', 'i'); + } + s_t = s_t.replace(patr, "$1"); + } + + 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) + { + 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) + { + 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) + { + 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'); + } + else + { + var patr = new RegExp('(' + d + ')', 'i'); + } + s_t = s_t.replace(patr, "$1"); + } + + 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) + { + 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) + { + 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++; + } + } + } + + 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 += '
' + tipuesearch_string_2 + ' ' + d + '. ' + tipuesearch_string_3 + ' ' + d_r + '
'; + } + if (c == 1) + { + out += '
' + tipuesearch_string_4 + '
'; + } + else + { + c_c = c.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); + out += '
' + c_c + ' ' + tipuesearch_string_5 + '
'; + } + + found.sort(function(a, b) { return b.score - a.score } ); + + var l_o = 0; + for (var i = 0; i < found.length; i++) + { + if (l_o >= start && l_o < set.show + start) + { + out += ''; + + if (set.debug) + { + out += '
Score: ' + found[i].score + '
'; + } + + if (set.showURL) + { + var s_u = found[i].url.toLowerCase(); + if(s_u.indexOf('http://') == 0) + { + s_u = s_u.slice(7); + } + out += ''; + } + + if (found[i].desc) + { + var t = found[i].desc; + 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 += '
' + t_d + '
'; + } + } + l_o++; + } + + if (c > set.show) + { + var pages = Math.ceil(c / set.show); + var page = (start / set.show); + out += '
    '; + + if (start > 0) + { + out += '
  • ' + tipuesearch_string_6 + '
  • '; + } + + if (page <= 2) + { + var p_b = pages; + if (pages > 3) + { + p_b = 3; + } + for (var f = 0; f < p_b; f++) + { + if (f == page) + { + out += '
  • ' + (f + 1) + '
  • '; + } + else + { + out += '
  • ' + (f + 1) + '
  • '; + } + } + } + else + { + var p_b = page + 2; + if (p_b > pages) + { + p_b = pages; + } + for (var f = page - 1; f < p_b; f++) + { + if (f == page) + { + out += '
  • ' + (f + 1) + '
  • '; + } + else + { + out += '
  • ' + (f + 1) + '
  • '; + } + } + } + + if (page + 1 != pages) + { + out += '
  • ' + tipuesearch_string_7 + '
  • '; + } + + out += '
'; + } + } + else + { + out += '
' + tipuesearch_string_8 + '
'; + } + } + else + { + if (show_stop) + { + out += '
' + tipuesearch_string_8 + '. ' + tipuesearch_string_9 + '
'; + } + else + { + out += '
' + tipuesearch_string_10 + '
'; + if (set.minimumLength == 1) + { + out += '
' + tipuesearch_string_11 + '
'; + } + else + { + out += '
' + tipuesearch_string_12 + ' ' + set.minimumLength + ' ' + tipuesearch_string_13 + '
'; + } + } + } + + $('#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); diff --git a/v7/localsearch/files/assets/js/tipuesearch_set.js b/v7/localsearch/files/assets/js/tipuesearch_set.js new file mode 100644 index 00000000..eab3f6e9 --- /dev/null +++ b/v7/localsearch/files/assets/js/tipuesearch_set.js @@ -0,0 +1,59 @@ + +/* +Tipue Search 5.0 +Copyright (c) 2015 Tipue +Tipue Search is released under the MIT License +http://www.tipue.com/search +*/ + + +/* +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"]; + + +// Word replace + +var tipuesearch_replace = {'words': [ + {'word': 'tipua', 'replace_with': 'tipue'}, + {'word': 'javscript', 'replace_with': 'javascript'}, + {'word': 'jqeury', 'replace_with': 'jquery'} +]}; + + +// 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} +]}; + + +// Stemming + +var tipuesearch_stem = {'words': [ + {'word': 'e-mail', 'stem': 'email'}, + {'word': 'javascript', 'stem': 'jquery'}, + {'word': 'javascript', 'stem': 'js'} +]}; + + +// Internal strings + +var tipuesearch_string_1 = 'No title'; +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'; diff --git a/v7/localsearch/localsearch.plugin b/v7/localsearch/localsearch.plugin index 38dcaf7d..64b082fc 100644 --- a/v7/localsearch/localsearch.plugin +++ b/v7/localsearch/localsearch.plugin @@ -4,7 +4,7 @@ Module = localsearch [Documentation] Author = Roberto Alsina -Version = 0.1 +Version = 0.2 Website = http://plugins.getnikola.com/#localsearch Description = Create data files for local search via Tipue diff --git a/v7/localsearch/localsearch/__init__.py b/v7/localsearch/localsearch.py similarity index 67% rename from v7/localsearch/localsearch/__init__.py rename to v7/localsearch/localsearch.py index 887352f3..15926140 100644 --- a/v7/localsearch/localsearch/__init__.py +++ b/v7/localsearch/localsearch.py @@ -25,6 +25,7 @@ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. from __future__ import unicode_literals +from copy import copy import codecs import json import os @@ -32,7 +33,7 @@ from doit.tools import result_dep from nikola.plugin_categories import LateTask -from nikola.utils import config_changed, copy_tree, makedirs +from nikola.utils import config_changed, copy_tree, makedirs, LocaleBorg # This is what we need to produce: # var tipuesearch = {"pages": [ @@ -40,17 +41,17 @@ # Search is a site search engine jQuery plugin. It's free for both commercial and # non-commercial use and released under the MIT License. Tipue Search includes # features such as word stemming and word replacement.", "tags": "JavaScript", -# "loc": "http://www.tipue.com/search"}, +# "url": "http://www.tipue.com/search"}, # {"title": "Tipue Search demo", "text": "Tipue Search demo. Tipue Search is -# a site search engine jQuery plugin.", "tags": "JavaScript", "loc": +# a site search engine jQuery plugin.", "tags": "JavaScript", "url": # "http://www.tipue.com/search/demo"}, # {"title": "About Tipue", "text": "Tipue is a small web development/design # studio based in North London. We've been around for over a decade.", "tags": "", -# "loc": "http://www.tipue.com/about"} +# "url": "http://www.tipue.com/about"} # ]}; -class Tipue(LateTask): +class TipueSearch(LateTask): """Render the blog posts as JSON data.""" name = "local_search" @@ -64,7 +65,7 @@ def gen_tasks(self): } posts = self.site.timeline[:] - dst_path = os.path.join(kw["output_folder"], "assets", "js", + dst_json_path = os.path.join(kw["output_folder"], "assets", "js", "tipuesearch_content.json") def save_data(): @@ -81,17 +82,17 @@ def save_data(): data["title"] = post.title(lang) data["text"] = text data["tags"] = ",".join(post.tags) - data["loc"] = post.permalink(lang) + data["url"] = post.permalink(lang) pages.append(data) output = json.dumps({"pages": pages}, indent=2) - makedirs(os.path.dirname(dst_path)) - with codecs.open(dst_path, "wb+", "utf8") as fd: + makedirs(os.path.dirname(dst_json_path)) + with codecs.open(dst_json_path, "wb+", "utf8") as fd: fd.write(output) yield { "basename": str(self.name), - "name": dst_path, - "targets": [dst_path], + "name": dst_json_path, + "targets": [dst_json_path], "actions": [(save_data, [])], 'uptodate': [config_changed(kw), result_dep('sitemap')] } @@ -104,3 +105,44 @@ def save_data(): for task in copy_tree(asset_folder, kw["output_folder"]): task["basename"] = str(self.name) yield task + + +# class TipueSearchHTML(LateTask): +# """Render the blog posts as JSON data.""" + +# name = "local_search_html" + +# def gen_tasks(self): +# self.site.scan_posts() + +# kw = { +# "translations": self.site.config['TRANSLATIONS'], +# "output_folder": self.site.config['OUTPUT_FOLDER'], +# } + + # FIXME: use a setting to define the path + dst_html_path = os.path.join(kw["output_folder"], "search.html") + + def create_html(): + context = copy(self.site.GLOBAL_CONTEXT) + context.update({ + 'lang': LocaleBorg().current_lang, + 'title': 'Search', + 'permalink': '/search.html', + }) + + # from doit.tools import set_trace; set_trace() + output = self.site.template_system.render_template( + 'search.tmpl', None, context + ) + makedirs(os.path.dirname(dst_html_path)) + with codecs.open(dst_html_path, "wb+", "utf8") as fd: + fd.write(output) + + yield { + "basename": str(self.name), + "name": dst_html_path, + "targets": [dst_html_path], + "actions": [(create_html, [])], + 'uptodate': [config_changed(kw)] + } diff --git a/v7/localsearch/localsearch/files/assets/css/img/loader.gif b/v7/localsearch/localsearch/files/assets/css/img/loader.gif deleted file mode 100644 index 9c97738a27ad26d4e63494485484f1b5e4a5c73a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4178 zcmd7VSy&VI-Usl>tjSCgCNLmNf(amEL=GZapzSeaVU36gNGn#*C`v(A6;at20Ywn3 z3Z+J5iFjmjK|ItF3@9Kw0*Y2pam9tj9_dk!C-$}PO`rF@>P7#Tb1^f|=lTA=zZq9| z7YD~+KEMZl0e}x5KKS|hy?y(3czF2Lt5>gIzaAYORjE{sjg7OjvoBx1eE05MeSLj( zb@jx=L{CpoQ&ZFQ^mJQW+vCTN6A}_~b8`y|3o9!tTUuIXW@a)nGQR)*`@q0J?LF__ zy*n~8GCn>Y9UWazP_Sjomdwn|j*brCPd$SF7)zoz1;=hu@ON&F-NFwJ4UP+o2v*o^ z-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_ diff --git a/v7/localsearch/localsearch/files/assets/css/img/search.png b/v7/localsearch/localsearch/files/assets/css/img/search.png deleted file mode 100644 index 9ab0f2c1a9f40c054fed086a64cb2ab7ba724761..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 315 zcmV-B0mS}^P)|UX@)ym@P)sFZqOjDlbtD@DH35!L1E2W_&u0{f_NIL zil}i$KwUj4H1diKK%czE_aH>)*yp84^_$axL=!|BBHien5w*%bq5-K29(cfItiOr|LBuI+Y9Z% zMNiSzqlrARG8;`wev05vGw%A&4>=;%)S@d*Bl6!wb&1HoRGM-|PTrska!4noh06c{ N002ovPDHLkV1n?|fk*%V diff --git a/v7/localsearch/localsearch/files/assets/css/tipuesearch.css b/v7/localsearch/localsearch/files/assets/css/tipuesearch.css deleted file mode 100644 index 22301936..00000000 --- a/v7/localsearch/localsearch/files/assets/css/tipuesearch.css +++ /dev/null @@ -1,159 +0,0 @@ - -/* -Tipue Search 3.0.1 -Copyright (c) 2013 Tipue -Tipue Search is released under the MIT License -http://www.tipue.com/search -*/ - - -#tipue_search_input -{ - font: 12px/1.7 'open sans', sans-serif; - color: #333; - padding: 7px; - width: 150px; - border: 1px solid #e2e2e2; - border-radius: 0; - -moz-appearance: none; - -webkit-appearance: none; - box-shadow: none; - outline: 0; - margin: 0; -} -#tipue_search_input:focus -{ - border: 1px solid #ccc; -} -#tipue_search_button -{ - width: 70px; - height: 36px; - border: 0; - border-radius: 1px; - background: #5193fb url('img/search.png') no-repeat center; - outline: none; -} -#tipue_search_button:hover -{ - background-color: #4589fb; -} - -#tipue_search_content -{ - clear: left; - max-width: 650px; - padding: 25px 0 13px 0; - margin: 0; -} -#tipue_search_loading -{ - padding-top: 60px; - background: #fff url('img/loader.gif') no-repeat left; -} - -#tipue_search_warning_head -{ - font: 300 16px/1.6 'open sans', sans-serif; - color: #333; -} -#tipue_search_warning -{ - font: 12px/1.6 'open sans', sans-serif; - color: #333; - margin: 7px 0; -} -#tipue_search_warning a -{ - color: #3f72d8; - text-decoration: none; -} -#tipue_search_warning a:hover -{ - padding-bottom: 1px; - border-bottom: 1px solid #ccc; -} -#tipue_search_results_count -{ - font: 13px/1.6 'open sans', sans-serif; - color: #333; -} -.tipue_search_content_title -{ - font: 300 23px/1.6 'open sans', sans-serif; - margin-top: 31px; -} -.tipue_search_content_title a -{ - color: #3f72d8; - text-decoration: none; -} -.tipue_search_content_title a:hover -{ - padding-bottom: 1px; - border-bottom: 1px solid #ccc; -} -.tipue_search_content_text -{ - font: 12px/1.7 'open sans', sans-serif; - color: #333; - padding: 13px 0; -} -.tipue_search_content_loc -{ - font: 300 13px/1.7 'open sans', sans-serif; - overflow: auto; -} -.tipue_search_content_loc a -{ - color: #555; - text-decoration: none; -} -.tipue_search_content_loc a:hover -{ - padding-bottom: 1px; - border-bottom: 1px solid #ccc; -} -#tipue_search_foot -{ - margin: 51px 0 21px 0; -} -#tipue_search_foot_boxes -{ - padding: 0; - margin: 0; - font: 12px/1 'open sans', sans-serif; -} -#tipue_search_foot_boxes li -{ - list-style: none; - margin: 0; - padding: 0; - display: inline; -} -#tipue_search_foot_boxes li a -{ - padding: 7px 13px 8px 13px; - background-color: #f1f1f1; - border: 1px solid #dcdcdc; - border-radius: 1px; - color: #333; - margin-right: 7px; - text-decoration: none; - text-align: center; -} -#tipue_search_foot_boxes li.current -{ - padding: 7px 13px 8px 13px; - background: #fff; - border: 1px solid #dcdcdc; - border-radius: 1px; - color: #333; - margin-right: 7px; - text-align: center; -} -#tipue_search_foot_boxes li a:hover -{ - border: 1px solid #ccc; - background-color: #f3f3f3; -} diff --git a/v7/localsearch/localsearch/files/assets/js/tipuesearch.js b/v7/localsearch/localsearch/files/assets/js/tipuesearch.js deleted file mode 100644 index a9982cd6..00000000 --- a/v7/localsearch/localsearch/files/assets/js/tipuesearch.js +++ /dev/null @@ -1,384 +0,0 @@ - -/* -Tipue Search 3.0.1 -Copyright (c) 2013 Tipue -Tipue Search is released under the MIT License -http://www.tipue.com/search -*/ - - -(function($) { - - $.fn.tipuesearch = function(options) { - - var set = $.extend( { - - 'show' : 7, - 'newWindow' : false, - 'showURL' : true, - 'minimumLength' : 3, - 'descriptiveWords' : 25, - 'highlightTerms' : true, - 'highlightEveryTerm' : false, - 'mode' : 'static', - 'liveDescription' : '*', - 'liveContent' : '*', - 'contentLocation' : 'tipuesearch/tipuesearch_content.json' - - }, options); - - return this.each(function() { - - var tipuesearch_in = { - pages: [] - }; - $.ajaxSetup({ - async: false - }); - - if (set.mode == 'live') - { - for (var i = 0; i < tipuesearch_pages.length; i++) - { - $.get(tipuesearch_pages[i], '', - 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(''); - var t_2 = html.toLowerCase().indexOf('', t_1 + 7); - if (t_1 != -1 && t_2 != -1) - { - var tit = html.slice(t_1 + 7, t_2); - } - else - { - var tit = 'No title'; - } - - tipuesearch_in.pages.push({ - "title": tit, - "text": desc, - "tags": cont, - "loc": tipuesearch_pages[i] - }); - } - ); - } - } - - if (set.mode == 'json') - { - $.getJSON(set.contentLocation, - function(json) - { - tipuesearch_in = $.extend({}, json); - } - ); - } - - if (set.mode == 'static') - { - tipuesearch_in = $.extend({}, tipuesearch); - } - - 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; - } - if (getURLP('q')) - { - $('#tipue_search_input').val(getURLP('q')); - getTipueSearch(0, true); - } - - $('#tipue_search_button').click(function() - { - getTipueSearch(0, true); - }); - $(this).keyup(function(event) - { - if(event.keyCode == '13') - { - getTipueSearch(0, true); - } - }); - - function getTipueSearch(start, replace) - { - $('#tipue_search_content').hide(); - var out = ''; - var results = ''; - var show_replace = false; - var show_stop = false; - - var d = $('#tipue_search_input').val().toLowerCase(); - d = $.trim(d); - var d_w = d.split(' '); - 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; - } - } - if (a_w) - { - d = d + ' ' + d_w[i]; - } - } - d = $.trim(d); - d_w = d.split(' '); - - if (d.length >= set.minimumLength) - { - if (replace) - { - var d_r = d; - for (var i = 0; i < d_w.length; i++) - { - for (var f = 0; f < tipuesearch_replace.words.length; f++) - { - if (d_w[i] == tipuesearch_replace.words[f].word) - { - d = d.replace(d_w[i], tipuesearch_replace.words[f].replace_with); - show_replace = true; - } - } - } - d_w = d.split(' '); - } - - 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(' '); - - var c = 0; - found = new Array(); - for (var i = 0; i < tipuesearch_in.pages.length; i++) - { - var score = 1000000000; - var s_t = tipuesearch_in.pages[i].text; - for (var f = 0; f < d_w.length; f++) - { - var pat = new RegExp(d_w[f], 'i'); - if (tipuesearch_in.pages[i].title.search(pat) != -1) - { - score -= (200000 - i); - } - if (tipuesearch_in.pages[i].text.search(pat) != -1) - { - score -= (150000 - i); - } - - if (set.highlightTerms) - { - if (set.highlightEveryTerm) - { - var patr = new RegExp('(' + d_w[f] + ')', 'gi'); - } - else - { - var patr = new RegExp('(' + d_w[f] + ')', 'i'); - } - s_t = s_t.replace(patr, "$1"); - } - if (tipuesearch_in.pages[i].tags.search(pat) != -1) - { - score -= (100000 - i); - } - - } - if (score < 1000000000) - { - found[c++] = score + '^' + tipuesearch_in.pages[i].title + '^' + s_t + '^' + tipuesearch_in.pages[i].loc; - } - } - - if (c != 0) - { - if (show_replace == 1) - { - out += '
Showing results for ' + d + '
'; - out += '
Search for ' + d_r + '
'; - } - if (c == 1) - { - out += '
1 result
'; - } - else - { - c_c = c.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); - out += '
' + c_c + ' results
'; - } - - found.sort(); - var l_o = 0; - for (var i = 0; i < found.length; i++) - { - var fo = found[i].split('^'); - if (l_o >= start && l_o < set.show + start) - { - out += ''; - - var t = fo[2]; - 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 += '
' + t_d + '
'; - - if (set.showURL) - { - t_url = fo[3]; - if (t_url.length > 45) - { - t_url = fo[3].substr(0, 45) + ' ...'; - } - out += ''; - } - } - l_o++; - } - - if (c > set.show) - { - var pages = Math.ceil(c / set.show); - var page = (start / set.show); - out += '
    '; - - if (start > 0) - { - out += '
  • Prev
  • '; - } - - if (page <= 2) - { - var p_b = pages; - if (pages > 3) - { - p_b = 3; - } - for (var f = 0; f < p_b; f++) - { - if (f == page) - { - out += '
  • ' + (f + 1) + '
  • '; - } - else - { - out += '
  • ' + (f + 1) + '
  • '; - } - } - } - else - { - var p_b = page + 3; - if (p_b > pages) - { - p_b = pages; - } - for (var f = page; f < p_b; f++) - { - if (f == page) - { - out += '
  • ' + (f + 1) + '
  • '; - } - else - { - out += '
  • ' + (f + 1) + '
  • '; - } - } - } - - if (page + 1 != pages) - { - out += '
  • Next
  • '; - } - - out += '
'; - } - } - else - { - out += '
Nothing found
'; - } - } - else - { - if (show_stop) - { - out += '
Nothing found
Common words are largely ignored
'; - } - else - { - out += '
Search too short
'; - if (set.minimumLength == 1) - { - out += '
Should be one character or more
'; - } - else - { - out += '
Should be ' + set.minimumLength + ' characters or more
'; - } - } - } - - $('#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); diff --git a/v7/localsearch/localsearch/files/assets/js/tipuesearch_set.js b/v7/localsearch/localsearch/files/assets/js/tipuesearch_set.js deleted file mode 100644 index 8493ec1f..00000000 --- a/v7/localsearch/localsearch/files/assets/js/tipuesearch_set.js +++ /dev/null @@ -1,21 +0,0 @@ - -/* -Tipue Search 3.0.1 -Copyright (c) 2013 Tipue -Tipue Search is released under the MIT License -http://www.tipue.com/search -*/ - - -var tipuesearch_stop_words = ["and", "be", "by", "do", "for", "he", "how", "if", "is", "it", "my", "not", "of", "or", "the", "to", "up", "what", "when"]; - -var tipuesearch_replace = {"words": [ - {"word": "tipua", replace_with: "tipue"}, - {"word": "javscript", replace_with: "javascript"} -]}; - -var tipuesearch_stem = {"words": [ - {"word": "e-mail", stem: "email"}, - {"word": "javascript", stem: "script"}, - {"word": "javascript", stem: "js"} -]}; diff --git a/v7/localsearch/localsearch/files/tipue_search.html b/v7/localsearch/localsearch/files/tipue_search.html deleted file mode 100644 index eb6a15ee..00000000 --- a/v7/localsearch/localsearch/files/tipue_search.html +++ /dev/null @@ -1,30 +0,0 @@ - - - -Tipue Search - - - - - - - - - - - -
-
-
- - - - - diff --git a/v7/localsearch/templates/mako/search.tmpl b/v7/localsearch/templates/mako/search.tmpl new file mode 100644 index 00000000..e6dfae8e --- /dev/null +++ b/v7/localsearch/templates/mako/search.tmpl @@ -0,0 +1,28 @@ +## -*- coding: utf-8 -*- +<%inherit file="base.tmpl"/> +<%block name="extra_head"> + ${parent.extra_head()} + + + +<%block name="content"> +
+
+
+ + +<%block name="extra_body_end"> + ${parent.extra_body_end()} + + + + +