Замена tipue на search

This commit is contained in:
Andrei Astafev 2023-02-20 16:09:00 +03:00
parent 4168da8468
commit 787901b84c
11 changed files with 270 additions and 1078 deletions

38
static/css/stork-dark.css Normal file
View File

@ -0,0 +1,38 @@
@import url(https://files.stork-search.net/basic.css);
body:not(.stork-multitheme),
.stork-wrapper-dark {
--stork-border-color: hsl(0, 0%, 36%);
--stork-background-color: hsl(0, 0%, 22%);
--stork-accent-color: hsl(194, 90%, 53%);
--stork-input-text-color: white;
--stork-results-hover-color: hsl(210, 83%, 16%);
--stork-results-title-color: white;
--stork-results-excerpt-color: hsla(0, 0%, 80%, 1);
--stork-results-highlight-color: rgb(94, 201, 186);
--stork-results-border-color: hsl(0, 0%, 30%);
}
body:not(.stork-multitheme) .stork-close-button,
.stork-wrapper-dark .stork-close-button {
background: linear-gradient(
to bottom,
hsl(0, 0%, 60%) 0%,
hsl(0, 0%, 50%) 100%
);
border: 1px solid hsla(0, 0%, 50%, 0.8);
color: hsl(0, 0%, 25%);
}
body:not(.stork-multitheme) .stork-close-button:hover,
.stork-wrapper-dark .stork-close-button:hover {
background: hsla(0, 0%, 45%);
cursor: pointer;
}
body:not(.stork-multitheme) .stork-close-button:active,
.stork-wrapper-dark .stork-close-button:active {
background: hsla(0, 0%, 40%);
}

212
static/css/stork.css Normal file
View File

@ -0,0 +1,212 @@
:root {
--stork-border-color: hsl(0, 0%, 65%);
--stork-background-color: hsla(0, 0%, 97%, 1);
--stork-font-family: inherit;
--stork-size-multiplier: 1;
--stork-accent-color: hsl(210, 72%, 45%);
--stork-input-width: 100%;
--stork-input-border-radius: 8px;
--stork-input-text-color: black;
--stork-input-shadow: 1;
--stork-results-width: 100%;
--stork-results-border-radius: 4px;
--stork-results-shadow: 1;
--stork-results-hover-color: hsl(210, 65%, 75%);
--stork-results-title-color: black;
--stork-results-excerpt-color: black;
--stork-results-highlight-color: rgb(245, 230, 26);
--stork-results-border-color: var(--stork-border-color);
}
.stork-wrapper {
position: relative;
font-family: var(--stork-font-family);
box-sizing: border-box;
font-size: 1em * var(--stork-size-multiplier);
}
.stork-wrapper *,
.stork-wrapper *:before,
.stork-wrapper *:after {
box-sizing: border-box;
}
.stork-input {
width: var(--stork-input-width);
height: 2.4em;
font-size: 1em;
padding: 0.4em 0.8em;
position: relative;
box-shadow: inset 0 0.1em 0.3em
hsla(0, 0%, 0%, calc(var(--stork-input-shadow) * 0.25));
border: 1px solid var(--stork-border-color);
border-radius: var(--stork-input-border-radius);
background-color: var(--stork-background-color);
color: var(--stork-input-text-color);
font-family: var(--stork-font-family);
}
.stork-input:focus {
outline: none;
}
.stork-progress {
position: absolute;
display: block;
content: "";
bottom: 1px;
background-color: var(--stork-accent-color);
box-shadow: 0 0 8px var(--stork-accent-color);
height: 1px;
transition: width 0.25s ease, opacity 0.4s ease 0.4s;
}
.stork-output {
position: absolute;
width: var(--stork-results-width);
margin-top: 0.5em;
border-radius: var(--stork-results-border-radius);
display: flex;
flex-direction: column;
z-index: 100;
color: var(--stork-results-title-color);
font-weight: 400;
font-family: var(--stork-font-family);
}
.stork-attribution a:link,
.stork-attribution a:visited {
color: var(--stork-accent-color);
}
.stork-output-visible {
border: 1px solid var(--stork-border-color);
box-shadow: 0px 0px 2.2px
rgba(0, 0, 0, calc(var(--stork-results-shadow) * 0.02)),
0px 0px 5.3px rgba(0, 0, 0, calc(var(--stork-results-shadow) * 0.028)),
0px 0px 10px rgba(0, 0, 0, calc(var(--stork-results-shadow) * 0.035)),
0px 0px 17.9px rgba(0, 0, 0, calc(var(--stork-results-shadow) * 0.042)),
0px 0px 33.4px rgba(0, 0, 0, calc(var(--stork-results-shadow) * 0.05)),
0px 0px 80px rgba(0, 0, 0, calc(var(--stork-results-shadow) * 0.07));
background: var(--stork-background-color);
}
.stork-message {
width: 100%;
padding: 0.5em 1em;
color: var(--stork-results-title-color);
}
.stork-attribution {
width: 100%;
padding: 0.5em 1em;
font-size: 0.8em;
color: var(--stork-results-title-color);
}
.stork-results {
margin: 0;
padding: 0.25em 0;
width: 100%;
list-style-type: none;
max-height: 25em;
overflow-y: scroll;
border-top: 1px solid var(--stork-border-color);
border-bottom: 1px solid var(--stork-border-color);
box-shadow: inset 0em 0.7em 0.7em -0.7em hsla(0, 0%, 0%, calc(var(
--stork-results-shadow
) * 0.34)),
inset 0em -0.7em 0.7em -0.7em
hsl(0, 0%, 0%, calc(var(--stork-results-shadow) * 0.34));
}
.stork-result:not(:last-child) {
border-bottom: 1px solid var(--stork-results-border-color);
}
.stork-result.selected {
background: var(--stork-results-hover-color);
}
.stork-result a:link {
padding: 1em;
display: block;
color: currentcolor;
text-decoration: none;
}
.stork-result p {
margin: 0;
}
.stork-title {
font-weight: bold;
font-size: 0.95em;
margin: 0 0 0.75em 0;
color: var(--stork-results-title-color);
/* Flexbox container for the title and the score, when debugging */
display: flex;
justify-content: space-between;
}
.stork-excerpt {
font-size: 0.8em;
line-height: 1;
margin: 0;
color: var(--stork-results-excerpt-color);
/* Flexbox container for the title and the score, when debugging */
display: flex;
justify-content: space-between;
}
.stork-excerpt:not(:last-of-type) {
margin-bottom: 0.6em;
}
.stork-highlight {
background-color: var(--stork-results-highlight-color);
padding: 0 0.1em;
}
.stork-error {
outline: 2px solid hsl(0, 89%, 46%);
}
.stork-close-button {
position: absolute;
bottom: 0;
right: 0;
margin: 0.3em 0.4em;
height: 1.5em;
width: 1.5em;
padding: 0px;
background: linear-gradient(
to bottom,
hsl(0, 0%, 85%) 0%,
hsl(0, 0%, 75%) 100%
);
border: 1px solid hsla(0, 0%, 50%, 0.8);
font-size: 1.1em;
color: hsl(0, 0%, 45%);
border-radius: 15%;
line-height: 1;
}
.stork-close-button svg {
width: 0.8em;
position: relative;
top: 1px;
}
.stork-close-button:hover {
background: hsla(0, 0%, 70%);
cursor: pointer;
}
.stork-close-button:active {
background: hsla(0, 0%, 65%);
}

2
static/js/stork.js Normal file

File diff suppressed because one or more lines are too long

1
static/js/stork.js.map Normal file

File diff suppressed because one or more lines are too long

BIN
static/js/stork.wasm Normal file

Binary file not shown.

View File

@ -1,280 +0,0 @@
@import url('https://fonts.googleapis.com/css?family=Open+Sans|Source+Code+Pro');
/*
Tipue Search 7.1
Copyright (c) 2019 Tipue
Tipue Search is released under the MIT License
http://www.tipue.com/search
*/
/* search box */
#tipue_search_input
{
float: left;
color: #333;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: #f3f3f3;
border: none;
border-radius: 5px;
-moz-appearance: none;
-webkit-appearance: none;
box-sizing: border-box;
box-shadow: none;
outline: 0;
margin: 0;
}
#tipue_search_input:-webkit-autofill,
#tipue_search_input:-webkit-autofill:hover,
#tipue_search_input:-webkit-autofill:focus
{
-webkit-box-shadow: 0 0 0px 1000px #f3f3f3 inset;
}
.tipue_search_button
{
position: relative;
float: left;
margin-left: -3px;
background-color: #f3f3f3;
border: none;
box-sizing: border-box;
cursor: pointer;
outline: 0;
}
.tipue_search_icon
{
float: left;
font: 24px/1 'Open Sans', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
color: #333;
transform: rotate(-45deg);
-moz-appearance: none;
-webkit-appearance: none;
box-sizing: border-box;
box-shadow: none;
outline: 0;
margin: -1px 0 0 1px;
}
.tipue_search_group:after
{
content: "";
display: table;
clear: both;
}
/* search results */
#tipue_search_content
{
max-width: 100%;
margin: 0;
}
.tipue_search_content_title
{
color: #111;
}
.tipue_search_content_title a
{
color: #111;
text-decoration: none;
}
.tipue_search_content_title a:hover
{
border-bottom: 1px solid #333;
}
.tipue_search_result
{
padding-top: 27px;
}
#tipue_search_results_count, .tipue_search_content_debug
{
font: 13px/1.5 'Source Code Pro', monospace;
text-transform: uppercase;
color: #999;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
#tipue_search_results_count
{
padding-top: 9px;
}
.tipue_search_content_url, .tipue_search_note, .tipue_search_related, #tipue_search_error, #tipue_search_replace
{
color: #666;
padding-top: 7px;
word-wrap: break-word;
hyphens: auto;
}
.tipue_search_content_url a, .tipue_search_note a, .tipue_search_related a, #tipue_search_replace a, #tipue_search_replace a:hover
{
color: #339e41;
text-decoration: none;
}
.tipue_search_content_url a:hover, .tipue_search_note a:hover, .tipue_search_related a:hover
{
color: #666;
}
#tipue_search_replace, .tipue_search_related
{
margin-top: 7px;
}
#tipue_search_error
{
color: #333;
margin-top: 17px;
}
.tipue_search_content_text
{
color: #333;
word-wrap: break-word;
hyphens: auto;
margin-top: 9px;
}
.tipue_search_content_bold
{
font-weight: 400;
color: #333;
}
.tipue_search_content_debug
{
margin: 7px 0 2px 0;
}
/* images */
.tipue_search_image
{
padding: 17px 0 6px 0;
}
.tipue_search_img
{
width: 100%;
max-width: 330px;
height: auto;
transition: 0.5s;
border-radius: 2px;
}
.tipue_search_img:hover
{
opacity: 0.9;
}
#tipue_search_zoom_text
{
font: 12px/1.7 'Source Code Pro', monospace;
color: #ccc;
text-transform: uppercase;
letter-spacing: 1px;
padding-top: 9px;
}
#tipue_search_zoom_text a
{
color: #ccc;
text-decoration: none;
border-bottom: 2px solid #f7f7f7;
}
#tipue_search_zoom_text a:hover
{
border: 0;
}
.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;
font: 22px/1 'Source Code Pro', monospace;
color: #ccc;
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
{
font: 14px 'Source Code Pro', sans-serif;
text-transform: uppercase;
color: #333;
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
{
background-color: #f7f7f7;
color: #666;
padding: 10px 17px 11px 17px;
border-radius: 3px;
margin-right: 7px;
text-decoration: none;
text-align: center;
transition: 0.3s;
}
#tipue_search_foot_boxes li.current
{
background: #252525;
color: #ccc;
padding: 10px 17px 11px 17px;
border-radius: 3px;
margin-right: 7px;
text-align: center;
}
#tipue_search_foot_boxes li a:hover
{
background: #252525;
color: #ccc;
}

View File

@ -1,611 +0,0 @@
/*
Tipue Search 7.1
Copyright (c) 2019 Tipue
Tipue Search is released under the MIT License
http://www.tipue.com/search
*/
(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)
{
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)
{
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;
}
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;
}
}
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.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 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.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.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.pages[i].title,
"desc": s_t,
"img": tipuesearch.pages[i].img,
"url": tipuesearch.pages[i].url,
"note": tipuesearch.pages[i].note
});
c++;
}
}
}
else
{
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.pages[i].url == tipuesearch_weight.weight[e].url)
{
score += tipuesearch_weight.weight[e].score;
}
}
}
if (score != 0)
{
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 (c == 1)
{
out += '<div id="tipue_search_results_count">' + tipuesearch_string_4;
}
else
{
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)
{
var ront = '';
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 + ': ';
}
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;
}
ront += '<a class="tipue_search_related_btn" id="' + r_d + '">' + tipuesearch_related.Related[i].related + '</a>, ';
f++;
}
}
if (f)
{
ront = ront.slice(0, -2);
ront += '.</div>';
out += ront;
}
}
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">&#10005;</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)
{
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;
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 += ' ...';
}
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 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 > set.footerPages)
{
p_b = set.footerPages;
}
for (var f = 0; f < p_b; f++)
{
if (f == page)
{
out += '<li class="current" role="navigation">' + (f + 1) + '</li>';
}
else
{
out += '<li role="navigation"><a class="tipue_search_foot_box" id="' + (f * set.show) + '_' + replace + '">' + (f + 1) + '</a></li>';
}
}
}
else
{
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" role="navigation">' + (f + 1) + '</li>';
}
else
{
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 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_error">' + tipuesearch_string_8 + '</div>';
}
}
else
{
if (show_stop)
{
out += '<div id="tipue_search_error">' + tipuesearch_string_8 + ' ' + tipuesearch_string_9 + '</div>';
}
else
{
if (set.minimumLength == 1)
{
out += '<div id="tipue_search_error">' + tipuesearch_string_11 + '</div>';
}
else
{
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>&nbsp; <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);

View File

@ -1,17 +0,0 @@
var tipuesearch = {"pages": [
{"title": "Tipue", "text": "Tipue is a small web development studio based in North London.", "url": "http://www.tipue.com"},
{"title": "Tipue Search", "text": "Tipue Search. A site search jQuery plugin. It's free, open source and fast. Tipue Search only needs a browser that supports jQuery. It doesn't need MySQL or similar, Tipue Search uses a JavaScript object for content.", "tags": "JavaScript", "url": "http://www.tipue.com/search"},
{"title": "Tipue Slide", "text": "Tipue Slide is a sliding panel site search jQuery plugin. It's free, open source and fast.", "url": "http://www.tipue.com/slide"},
{"title": "About Tipue", "text": "Tipue is a small web development studio based in North London, founded in 2001. We design innovative and original JavaScript and jQuery plugins, which we connect to servers and MySQL databases with fast, heavy-duty Perl.", "url": "http://www.tipue.com/is"},
{"title": "Tipr", "text": "Tipr. A small and simple jQuery tooltip plugin. It's free and open source. Small, simple, flat, cool. Tipr is a jQuery tooltip plugin. It works on almost any element, and reacts to the size of the viewport. Tipr is free and open source.", "tags": "JavaScript", "url": "http://www.tipue.com/tipr"},
{"title": "Tipue Support", "text": "Tipue support. We offer a range of flexible support plans for our products, services and jQuery plugins, including free.", "url": "http://www.tipue.com/support"},
{"title": "Playing with CSS Sticky Positioning", "text": "While the fixed and sticky position elements seems rather similar, the sticky element maintains its position only within its containing block. Sticky is relative, which allows all sorts of potential creativity.", "img": "http://www.tipue.com/img/sony.jpg", "tags": "Tipue Blog", "note": "<a href='http://www.tipue.com/blog/'>More articles</a>", "url": "http://www.tipue.com/blog/css-sticky"},
{"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 Blog", "note": "<a href='http://www.tipue.com/blog/'>More articles</a>", "url": "http://www.tipue.com/blog/center-a-div"},
{"title": "Cool CSS Radio Buttons and Checkboxes", "text": "Hip and easy radio button and checkbox form elements styled with CSS.", "tags": "Tipue Blog", "note": "<a href='http://www.tipue.com/blog/'>More articles</a>", "url": "http://www.tipue.com/blog/radio-checkbox"},
{"title": "Hacking CSS Writing Mode", "text": "The writing-mode CSS property sets horizontal and vertical text direction. While meant for multilingual purposes, it can be exploited for design.", "img": "http://www.tipue.com/img/tran.jpg", "tags": "Tipue Blog", "note": "<a href='http://www.tipue.com/blog/'>More articles</a>", "url": "http://www.tipue.com/blog/css-writing-mode"},
{"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 Blog", "note": "<a href='http://www.tipue.com/blog/'>More articles</a>", "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 Blog", "note": "<a href='http://www.tipue.com/blog/'>More articles</a>", "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 Blog", "note": "<a href='http://www.tipue.com/blog/'>More articles</a>", "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 Blog", "note": "<a href='http://www.tipue.com/blog/'>More articles</a>", "url": "http://www.tipue.com/blog/z-index"}
]};

View File

@ -1,84 +0,0 @@
/*
Tipue Search 7.1
Copyright (c) 2019 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", "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': 'tip', 'replace_with': 'tipue'},
{'word': 'javscript', 'replace_with': 'javascript'},
{'word': 'jqeury', 'replace_with': 'jquery'}
]};
// Weighting
var tipuesearch_weight = {'weight': [
{'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}
]};
// Illogical stemming
var tipuesearch_stem = {'words': [
{'word': 'e-mail', 'stem': 'email'},
{'word': 'javascript', 'stem': 'jquery'},
{'word': 'javascript', 'stem': 'js'}
]};
// Related
var tipuesearch_related = {'Related': [
{'search': 'tipue', 'related': 'Search', 'include': 1},
{'search': 'tipue', 'related': 'jQuery'},
{'search': 'tipue', 'related': 'Blog'},
{'search': 'tipue', 'related': 'Support'},
{'search': 'tipue search', 'related': 'Demo', 'include': 1},
{'search': 'tipue search', 'related': 'Support'}
]};
// 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 = '<';
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 should be one character or more.';
var tipuesearch_string_12 = 'Search 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();

View File

@ -62,10 +62,6 @@
<link href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/font-awesome.min.css" rel="stylesheet">
<link href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/pygments/{{ PYGMENTS_STYLE|default('native') }}.css" type="text/css" rel="stylesheet" />
{% if 'tipue_search' in PLUGINS %}
<link href="{{ SITEURL}}/{{ THEME_STATIC_DIR }}/css/normalize.min.css" type="text/css" rel="stylesheet" />
<link href="{{ SITEURL}}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch.css" type="text/css" rel="stylesheet" />
{% endif %}
{% if DOCUTIL_CSS %}
<link href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/html4css1.css" type="text/css" rel="stylesheet" />
{% endif %}
@ -112,6 +108,9 @@
<link href="{{ SITEURL }}/{{ category_feed_atom }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} {{ category }} ATOM Feed"/>
{%- endif %}
{% if 'search' in PLUGINS %}
<link rel="stylesheet" href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/css/stork.css">
{% endif %}
</head>
<body>
@ -144,68 +143,11 @@
</li>
-->
</ul>
{% if 'tipue_search' in PLUGINS %}
<form class="form-inline my-2 my-lg-0" action="{{ SITEURL }}/search.html">
<div class="tipue_search_group">
<input class="form-control mr-sm-2 search-query" type="text" placeholder="" name="q" id="tipue_search_input" pattern=".{3,}" required>
<button class="btn btn-secondary my-2 my-sm-0 tipue_search_button" type="submit"><div class="tipue_search_icon">&#9906;</div></button>
</div>
</form>
{% if 'search' in PLUGINS %}
Search: <input data-stork="sitesearch" />
<div data-stork="sitesearch-output"></div>
{% endif %}
</div>
<!--
<div class="navbar-header">
{% if MENUITEMS or (pages and DISPLAY_PAGES_ON_MENU) or (categories and DISPLAY_CATEGORIES_ON_MENU) %}
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
{% endif %}
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
{% for title, link in MENUITEMS %}
<li><a href="{{ link }}">{{ title }}</a></li>
{% endfor %}
{% if not PAGES_SORT_ATTRIBUTE -%}
{% set PAGES_SORT_ATTRIBUTE = 'title' %}
{%- endif %}
{% if DISPLAY_PAGES_ON_MENU %}
{% for p in pages | sort(attribute=PAGES_SORT_ATTRIBUTE) %}
{% if p.url %}
<li{% if p == page %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ p.url }}">
{{ p.menulabel|default(p.title) }}
</a></li>
{% endif %}
{% endfor %}
{% endif %}
{% if DISPLAY_CATEGORIES_ON_MENU %}
{% for cat, null in categories %}
<li {% if cat == category %}class="active"{% endif %}>
<a href="{{ SITEURL }}/{{ cat.url }}">{{ cat | capitalize }}</a>
</li>
{% endfor %}
{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% if 'tipue_search' in PLUGINS %}
<li><span>
<form class="navbar-search" action="{{ SEARCH_URL | default('/search.html') }}">
<input type="text" class="search-query" placeholder="_(Search)" name="q" id="tipue_search_input" required>
</form></span>
</li>
{% endif %}
{% if ARCHIVES_SAVE_AS %}
<li><a href="{{ SITEURL }}/{{ ARCHIVES_URL | default('archives.html') }}"><i class="fa fa-th-list"></i><span class="icon-label">{{ _('Archives') }}</span></a></li>
{% endif %}
</ul>
</div>
-->
</div>
</div>
@ -275,6 +217,15 @@
{% include 'includes/liquid_tags_nb_footer.html' %}
{% endif %}
{% block scripts %}{% endblock %}
{% block scripts %}
{% if 'search' in PLUGINS %}
<script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/js/stork.js"></script>
<script>
stork.initialize("{{ SITEURL }}/{{ THEME_STATIC_DIR }}/js/stork.wasm")
stork.downloadIndex("sitesearch", "{{ SITEURL }}/search-index.st")
stork.attach("sitesearch")
</script>
{% endif %}
{% endblock %}
</body>
</html>

View File

@ -4,26 +4,6 @@
{{ _('Search') }} - {{ super() }}
{% endblock %}
{% block scripts %}
{% if 'assets' in PLUGINS %}
{% include 'includes/minify_tipuesearch.html' with context %}
{% else %}
<script type="text/javascript" src="{{ SITEURL }}/tipuesearch_content.js" encoding="UTF-8"></script>
<script type="text/javascript" src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch_set.js"></script>
<script type="text/javascript" src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/tipuesearch/tipuesearch.min.js"></script>
{% endif %}
<script>
$(document).ready(function() {
$('#tipue_search_input').tipuesearch({
'show': 10,
'wholeWords': false,
'highlightTerms': true,
'newWindow': false
});
});
</script>
{% endblock %}
{% block content %}
<div id="tipue_search_content"></div>
<div data-stork="sitesearch-output"></div>
{% endblock %}