diff --git a/assets/media/gridea-search/ejs.min.js b/assets/media/gridea-search/ejs.min.js new file mode 100644 index 0000000..9e86b96 --- /dev/null +++ b/assets/media/gridea-search/ejs.min.js @@ -0,0 +1 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ejs=f()}})(function(){var define,module,exports;return function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o1;if(options.cache){if(!filename){throw new Error("cache option requires a filename")}func=exports.cache.get(filename);if(func){return func}if(!hasTemplate){template=fileLoader(filename).toString().replace(_BOM,"")}}else if(!hasTemplate){if(!filename){throw new Error("Internal EJS error: no file name or template "+"provided")}template=fileLoader(filename).toString().replace(_BOM,"")}func=exports.compile(template,options);if(options.cache){exports.cache.set(filename,func)}return func}function tryHandleCache(options,data,cb){var result;if(!cb){if(typeof exports.promiseImpl=="function"){return new exports.promiseImpl(function(resolve,reject){try{result=handleCache(options)(data);resolve(result)}catch(err){reject(err)}})}else{throw new Error("Please provide a callback function")}}else{try{result=handleCache(options)(data)}catch(err){return cb(err)}cb(null,result)}}function fileLoader(filePath){return exports.fileLoader(filePath)}function includeFile(path,options){var opts=utils.shallowCopy({},options);opts.filename=getIncludePath(path,opts);return handleCache(opts)}function rethrow(err,str,flnm,lineno,esc){var lines=str.split("\n");var start=Math.max(lineno-3,0);var end=Math.min(lines.length,lineno+3);var filename=esc(flnm);var context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" >> ":" ")+curr+"| "+line}).join("\n");err.path=filename;err.message=(filename||"ejs")+":"+lineno+"\n"+context+"\n\n"+err.message;throw err}function stripSemi(str){return str.replace(/;(\s*$)/,"$1")}exports.compile=function compile(template,opts){var templ;if(opts&&opts.scope){if(!scopeOptionWarned){console.warn("`scope` option is deprecated and will be removed in EJS 3");scopeOptionWarned=true}if(!opts.context){opts.context=opts.scope}delete opts.scope}templ=new Template(template,opts);return templ.compile()};exports.render=function(template,d,o){var data=d||{};var opts=o||{};if(arguments.length==2){utils.shallowCopyFromList(opts,data,_OPTS_PASSABLE_WITH_DATA)}return handleCache(opts,template)(data)};exports.renderFile=function(){var args=Array.prototype.slice.call(arguments);var filename=args.shift();var cb;var opts={filename:filename};var data;var viewOpts;if(typeof arguments[arguments.length-1]=="function"){cb=args.pop()}if(args.length){data=args.shift();if(args.length){utils.shallowCopy(opts,args.pop())}else{if(data.settings){if(data.settings.views){opts.views=data.settings.views}if(data.settings["view cache"]){opts.cache=true}viewOpts=data.settings["view options"];if(viewOpts){utils.shallowCopy(opts,viewOpts)}}utils.shallowCopyFromList(opts,data,_OPTS_PASSABLE_WITH_DATA_EXPRESS)}opts.filename=filename}else{data={}}return tryHandleCache(opts,data,cb)};exports.Template=Template;exports.clearCache=function(){exports.cache.reset()};function Template(text,opts){opts=opts||{};var options={};this.templateText=text;this.mode=null;this.truncate=false;this.currentLine=1;this.source="";options.client=opts.client||false;options.escapeFunction=opts.escape||opts.escapeFunction||utils.escapeXML;options.compileDebug=opts.compileDebug!==false;options.debug=!!opts.debug;options.filename=opts.filename;options.openDelimiter=opts.openDelimiter||exports.openDelimiter||_DEFAULT_OPEN_DELIMITER;options.closeDelimiter=opts.closeDelimiter||exports.closeDelimiter||_DEFAULT_CLOSE_DELIMITER;options.delimiter=opts.delimiter||exports.delimiter||_DEFAULT_DELIMITER;options.strict=opts.strict||false;options.context=opts.context;options.cache=opts.cache||false;options.rmWhitespace=opts.rmWhitespace;options.root=opts.root;options.outputFunctionName=opts.outputFunctionName;options.localsName=opts.localsName||exports.localsName||_DEFAULT_LOCALS_NAME;options.views=opts.views;options.async=opts.async;options.destructuredLocals=opts.destructuredLocals;options.legacyInclude=typeof opts.legacyInclude!="undefined"?!!opts.legacyInclude:true;if(options.strict){options._with=false}else{options._with=typeof opts._with!="undefined"?opts._with:true}this.opts=options;this.regex=this.createRegex()}Template.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"};Template.prototype={createRegex:function(){var str=_REGEX_STRING;var delim=utils.escapeRegExpChars(this.opts.delimiter);var open=utils.escapeRegExpChars(this.opts.openDelimiter);var close=utils.escapeRegExpChars(this.opts.closeDelimiter);str=str.replace(/%/g,delim).replace(//g,close);return new RegExp(str)},compile:function(){var src;var fn;var opts=this.opts;var prepended="";var appended="";var escapeFn=opts.escapeFunction;var ctor;if(!this.source){this.generateSource();prepended+=' var __output = "";\n'+" function __append(s) { if (s !== undefined && s !== null) __output += s }\n";if(opts.outputFunctionName){prepended+=" var "+opts.outputFunctionName+" = __append;"+"\n"}if(opts.destructuredLocals&&opts.destructuredLocals.length){var destructuring=" var __locals = ("+opts.localsName+" || {}),\n";for(var i=0;i0){destructuring+=",\n "}destructuring+=name+" = __locals."+name}prepended+=destructuring+";\n"}if(opts._with!==false){prepended+=" with ("+opts.localsName+" || {}) {"+"\n";appended+=" }"+"\n"}appended+=" return __output;"+"\n";this.source=prepended+this.source+appended}if(opts.compileDebug){src="var __line = 1"+"\n"+" , __lines = "+JSON.stringify(this.templateText)+"\n"+" , __filename = "+(opts.filename?JSON.stringify(opts.filename):"undefined")+";"+"\n"+"try {"+"\n"+this.source+"} catch (e) {"+"\n"+" rethrow(e, __lines, __filename, __line, escapeFn);"+"\n"+"}"+"\n"}else{src=this.source}if(opts.client){src="escapeFn = escapeFn || "+escapeFn.toString()+";"+"\n"+src;if(opts.compileDebug){src="rethrow = rethrow || "+rethrow.toString()+";"+"\n"+src}}if(opts.strict){src='"use strict";\n'+src}if(opts.debug){console.log(src)}if(opts.compileDebug&&opts.filename){src=src+"\n"+"//# sourceURL="+opts.filename+"\n"}try{if(opts.async){try{ctor=new Function("return (async function(){}).constructor;")()}catch(e){if(e instanceof SyntaxError){throw new Error("This environment does not support async/await")}else{throw e}}}else{ctor=Function}fn=new ctor(opts.localsName+", escapeFn, include, rethrow",src)}catch(e){if(e instanceof SyntaxError){if(opts.filename){e.message+=" in "+opts.filename}e.message+=" while compiling ejs\n\n";e.message+="If the above error is not helpful, you may want to try EJS-Lint:\n";e.message+="https://github.com/RyanZim/EJS-Lint";if(!opts.async){e.message+="\n";e.message+="Or, if you meant to create an async function, pass `async: true` as an option."}}throw e}var returnedFn=opts.client?fn:function anonymous(data){var include=function(path,includeData){var d=utils.shallowCopy({},data);if(includeData){d=utils.shallowCopy(d,includeData)}return includeFile(path,opts)(d)};return fn.apply(opts.context,[data||{},escapeFn,include,rethrow])};if(opts.filename&&typeof Object.defineProperty==="function"){var filename=opts.filename;var basename=path.basename(filename,path.extname(filename));try{Object.defineProperty(returnedFn,"name",{value:basename,writable:false,enumerable:false,configurable:true})}catch(e){}}return returnedFn},generateSource:function(){var opts=this.opts;if(opts.rmWhitespace){this.templateText=this.templateText.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")}this.templateText=this.templateText.replace(/[ \t]*<%_/gm,"<%_").replace(/_%>[ \t]*/gm,"_%>");var self=this;var matches=this.parseTemplateText();var d=this.opts.delimiter;var o=this.opts.openDelimiter;var c=this.opts.closeDelimiter;if(matches&&matches.length){matches.forEach(function(line,index){var closing;if(line.indexOf(o+d)===0&&line.indexOf(o+d+d)!==0){closing=matches[index+2];if(!(closing==d+c||closing=="-"+d+c||closing=="_"+d+c)){throw new Error('Could not find matching close tag for "'+line+'".')}}self.scanLine(line)})}},parseTemplateText:function(){var str=this.templateText;var pat=this.regex;var result=pat.exec(str);var arr=[];var firstPos;while(result){firstPos=result.index;if(firstPos!==0){arr.push(str.substring(0,firstPos));str=str.slice(firstPos)}arr.push(result[0]);str=str.slice(result[0].length);result=pat.exec(str)}if(str){arr.push(str)}return arr},_addOutput:function(line){if(this.truncate){line=line.replace(/^(?:\r\n|\r|\n)/,"");this.truncate=false}if(!line){return line}line=line.replace(/\\/g,"\\\\");line=line.replace(/\n/g,"\\n");line=line.replace(/\r/g,"\\r");line=line.replace(/"/g,'\\"');this.source+=' ; __append("'+line+'")'+"\n"},scanLine:function(line){var self=this;var d=this.opts.delimiter;var o=this.opts.openDelimiter;var c=this.opts.closeDelimiter;var newLineCount=0;newLineCount=line.split("\n").length-1;switch(line){case o+d:case o+d+"_":this.mode=Template.modes.EVAL;break;case o+d+"=":this.mode=Template.modes.ESCAPED;break;case o+d+"-":this.mode=Template.modes.RAW;break;case o+d+"#":this.mode=Template.modes.COMMENT;break;case o+d+d:this.mode=Template.modes.LITERAL;this.source+=' ; __append("'+line.replace(o+d+d,o+d)+'")'+"\n";break;case d+d+c:this.mode=Template.modes.LITERAL;this.source+=' ; __append("'+line.replace(d+d+c,d+c)+'")'+"\n";break;case d+c:case"-"+d+c:case"_"+d+c:if(this.mode==Template.modes.LITERAL){this._addOutput(line)}this.mode=null;this.truncate=line.indexOf("-")===0||line.indexOf("_")===0;break;default:if(this.mode){switch(this.mode){case Template.modes.EVAL:case Template.modes.ESCAPED:case Template.modes.RAW:if(line.lastIndexOf("//")>line.lastIndexOf("\n")){line+="\n"}}switch(this.mode){case Template.modes.EVAL:this.source+=" ; "+line+"\n";break;case Template.modes.ESCAPED:this.source+=" ; __append(escapeFn("+stripSemi(line)+"))"+"\n";break;case Template.modes.RAW:this.source+=" ; __append("+stripSemi(line)+")"+"\n";break;case Template.modes.COMMENT:break;case Template.modes.LITERAL:this._addOutput(line);break}}else{this._addOutput(line)}}if(self.opts.compileDebug&&newLineCount){this.currentLine+=newLineCount;this.source+=" ; __line = "+this.currentLine+"\n"}}};exports.escapeXML=utils.escapeXML;exports.__express=exports.renderFile;exports.VERSION=_VERSION_STRING;exports.name=_NAME;if(typeof window!="undefined"){window.ejs=exports}},{"../package.json":6,"./utils":2,fs:3,path:4}],2:[function(require,module,exports){"use strict";var regExpChars=/[|\\{}()[\]^$+*?.]/g;exports.escapeRegExpChars=function(string){if(!string){return""}return String(string).replace(regExpChars,"\\$&")};var _ENCODE_HTML_RULES={"&":"&","<":"<",">":">",'"':""","'":"'"};var _MATCH_HTML=/[&<>'"]/g;function encode_char(c){return _ENCODE_HTML_RULES[c]||c}var escapeFuncStr="var _ENCODE_HTML_RULES = {\n"+' "&": "&"\n'+' , "<": "<"\n'+' , ">": ">"\n'+' , \'"\': """\n'+' , "\'": "'"\n'+" }\n"+" , _MATCH_HTML = /[&<>'\"]/g;\n"+"function encode_char(c) {\n"+" return _ENCODE_HTML_RULES[c] || c;\n"+"};\n";exports.escapeXML=function(markup){return markup==undefined?"":String(markup).replace(_MATCH_HTML,encode_char)};exports.escapeXML.toString=function(){return Function.prototype.toString.call(this)+";\n"+escapeFuncStr};exports.shallowCopy=function(to,from){from=from||{};for(var p in from){to[p]=from[p]}return to};exports.shallowCopyFromList=function(to,from,list){for(var i=0;i=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i1){for(var i=1;i (http://fleegix.org)",license:"Apache-2.0",main:"./lib/ejs.js",repository:{type:"git",url:"git://github.com/mde/ejs.git"},bugs:"https://github.com/mde/ejs/issues",homepage:"https://github.com/mde/ejs",dependencies:{},devDependencies:{browserify:"^13.1.1",eslint:"^4.14.0","git-directory-deploy":"^1.5.1",jake:"^10.3.1",jsdoc:"^3.4.0","lru-cache":"^4.0.1",mocha:"^5.0.5","uglify-js":"^3.3.16"},engines:{node:">=0.10.0"},scripts:{test:"mocha",postinstall:"node --harmony ./postinstall.js"}}},{}]},{},[1])(1)}); diff --git a/assets/media/gridea-search/fuse.basic.min.js b/assets/media/gridea-search/fuse.basic.min.js new file mode 100644 index 0000000..2307c53 --- /dev/null +++ b/assets/media/gridea-search/fuse.basic.min.js @@ -0,0 +1,9 @@ +/** + * Fuse.js v6.4.1 - Lightweight fuzzy-search (http://fusejs.io) + * + * Copyright (c) 2020 Kiro Risk (http://kiro.me) + * All Rights Reserved. Apache Software License 2.0 + * + * http://www.apache.org/licenses/LICENSE-2.0 + */ +var e,t;e=this,t=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:3,t=new Map;return{get:function(n){var r=n.match(w).length;if(t.has(r))return t.get(r);var i=parseFloat((1/Math.sqrt(r)).toFixed(e));return t.set(r,i),i},clear:function(){t.clear()}}}var _=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.getFn,i=void 0===r?x.getFn:r;t(this,e),this.norm=L(3),this.getFn=i,this.isCreated=!1,this.setIndexRecords()}return r(e,[{key:"setSources",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setIndexRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=t,this._keysMap={},t.forEach((function(t,n){e._keysMap[t.id]=n}))}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,u(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();u(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?x.getFn:r,o=new _({getFn:i});return o.setKeys(e.map(b)),o.setSources(t),o.create(),o}function O(e,t){var n=e.matches;t.matches=[],f(n)&&n.forEach((function(e){if(f(e.indices)&&e.indices.length){var n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.src),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function A(e,t){t.score=e.score}function j(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,i=t.currentLocation,o=void 0===i?0:i,c=t.expectedLocation,a=void 0===c?0:c,s=t.distance,h=void 0===s?x.distance:s,u=t.ignoreLocation,l=void 0===u?x.ignoreLocation:u,d=r/e.length;if(l)return d;var f=Math.abs(a-o);return h?d+f/h:f?1:d}function E(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:x.minMatchCharLength,n=[],r=-1,i=-1,o=0,c=e.length;o=t&&n.push([r,i]),r=-1)}return e[o-1]&&o-r>=t&&n.push([r,o-1]),n}function I(e){for(var t={},n=0,r=e.length;n1&&void 0!==arguments[1]?arguments[1]:{},o=i.location,c=void 0===o?x.location:o,a=i.threshold,s=void 0===a?x.threshold:a,h=i.distance,u=void 0===h?x.distance:h,l=i.includeMatches,d=void 0===l?x.includeMatches:l,f=i.findAllMatches,v=void 0===f?x.findAllMatches:f,y=i.minMatchCharLength,g=void 0===y?x.minMatchCharLength:y,p=i.isCaseSensitive,m=void 0===p?x.isCaseSensitive:p,b=i.ignoreLocation,k=void 0===b?x.ignoreLocation:b;if(t(this,e),this.options={location:c,threshold:s,distance:u,includeMatches:d,findAllMatches:v,minMatchCharLength:g,isCaseSensitive:m,ignoreLocation:k},this.pattern=m?n:n.toLowerCase(),this.chunks=[],this.pattern.length){var M=function(e,t){r.chunks.push({pattern:e,alphabet:I(e),startIndex:t})},w=this.pattern.length;if(w>32){for(var L=0,_=w%32,S=w-_;L3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,o=void 0===i?x.location:i,c=r.distance,a=void 0===c?x.distance:c,s=r.threshold,h=void 0===s?x.threshold:s,u=r.findAllMatches,l=void 0===u?x.findAllMatches:u,d=r.minMatchCharLength,f=void 0===d?x.minMatchCharLength:d,v=r.includeMatches,y=void 0===v?x.includeMatches:v,p=r.ignoreLocation,m=void 0===p?x.ignoreLocation:p;if(t.length>32)throw new Error(g(32));for(var b,k=t.length,M=e.length,w=Math.max(0,Math.min(o,M)),L=h,_=w,S=f>1||y,O=S?Array(M):[];(b=e.indexOf(t,_))>-1;){var A=j(t,{currentLocation:b,expectedLocation:w,distance:a,ignoreLocation:m});if(L=Math.min(A,L),_=b+k,S)for(var I=0;I=J;U-=1){var q=U-1,B=n[e.charAt(q)];if(S&&(O[q]=+!!B),T[U]=(T[U+1]<<1|1)&B,$&&(T[U]|=(F[U+1]|F[U])<<1|1|F[U+1]),T[U]&N&&(C=j(t,{errors:$,currentLocation:q,expectedLocation:w,distance:a,ignoreLocation:m}))<=L){if(L=C,(_=q)<=w)break;J=Math.max(1,2*w-_)}}var V=j(t,{errors:$+1,currentLocation:w,expectedLocation:w,distance:a,ignoreLocation:m});if(V>L)break;F=T}var G={isMatch:_>=0,score:Math.max(.001,C)};if(S){var H=E(O,f);H.length?y&&(G.indices=H):G.isMatch=!1}return G}(e,n,i,{location:c+o,distance:s,threshold:h,findAllMatches:u,minMatchCharLength:l,includeMatches:r,ignoreLocation:d}),m=p.isMatch,b=p.score,k=p.indices;m&&(y=!0),v+=b,m&&k&&(f=[].concat(a(f),a(k)))}));var p={isMatch:y,score:y?v/this.chunks.length:1};return y&&r&&(p.indices=f),p}}]),e}(),C=[];function P(e,t){for(var n=0,r=C.length;n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(t(this,e),this.options=c({},x,{},r),this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new m(this.options.keys),this.setCollection(n,i)}return r(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof _))throw new Error("Incorrect 'index' type");this._myIndex=t||S(this.options.keys,this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){f(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"remove",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!1},t=[],n=0,r=this._docs.length;n1&&void 0!==arguments[1]?arguments[1]:{},n=t.limit,r=void 0===n?-1:n,i=this.options,o=i.includeMatches,c=i.includeScore,a=i.shouldSort,s=i.sortFn,h=i.ignoreFieldNorm,d=u(e)?u(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return $(d,{ignoreFieldNorm:h}),a&&d.sort(s),l(r)&&r>-1&&(d=d.slice(0,r)),D(d,this._docs,{includeMatches:o,includeScore:c})}},{key:"_searchStringList",value:function(e){var t=P(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,i=e.i,o=e.n;if(f(n)){var c=t.searchIn(n),a=c.isMatch,s=c.score,h=c.indices;a&&r.push({item:n,idx:i,matches:[{score:s,value:n,norm:o,indices:h}]})}})),r}},{key:"_searchLogical",value:function(e){throw new Error("Logical search is not available")}},{key:"_searchObjectList",value:function(e){var t=this,n=P(e,this.options),r=this._myIndex,i=r.keys,o=r.records,c=[];return o.forEach((function(e){var r=e.$,o=e.i;if(f(r)){var s=[];i.forEach((function(e,i){s.push.apply(s,a(t._findMatches({key:e,value:r[i],searcher:n})))})),s.length&&c.push({idx:o,item:r,matches:s})}})),c}},{key:"_findMatches",value:function(e){var t=e.key,n=e.value,r=e.searcher;if(!f(n))return[];var i=[];if(h(n))n.forEach((function(e){var n=e.v,o=e.i,c=e.n;if(f(n)){var a=r.searchIn(n),s=a.isMatch,h=a.score,u=a.indices;s&&i.push({score:h,key:t,value:n,idx:o,norm:c,indices:u})}}));else{var o=n.v,c=n.n,a=r.searchIn(o),s=a.isMatch,u=a.score,l=a.indices;s&&i.push({score:u,key:t,value:o,norm:c,indices:l})}return i}}]),e}();function $(e,t){var n=t.ignoreFieldNorm,r=void 0===n?x.ignoreFieldNorm:n;e.forEach((function(e){var t=1;e.matches.forEach((function(e){var n=e.key,i=e.norm,o=e.score,c=n?n.weight:null;t*=Math.pow(0===o&&c?Number.EPSILON:o,(c||1)*(r?1:i))})),e.score=t}))}function D(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?x.includeMatches:r,o=n.includeScore,c=void 0===o?x.includeScore:o,a=[];return i&&a.push(O),c&&a.push(A),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return a.length&&a.forEach((function(t){t(e,r)})),r}))}return N.version="6.4.1",N.createIndex=S,N.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?x.getFn:n,i=e.keys,o=e.records,c=new _({getFn:r});return c.setKeys(i),c.setIndexRecords(o),c},N.config=x,N},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Fuse=t(); \ No newline at end of file diff --git a/assets/media/gridea-search/gridea-search.js b/assets/media/gridea-search/gridea-search.js new file mode 100644 index 0000000..3f0bc96 --- /dev/null +++ b/assets/media/gridea-search/gridea-search.js @@ -0,0 +1,227 @@ +/** + * https://github.com/tangkaichuan/gridea-search + */ + +(function () { + //获取url参数 + function getParam(url, param) { + if (url.indexOf('?') > -1) { + var urlSearch = url.split('?'); + var paramList = urlSearch[1].split('&'); + for (var i = paramList.length - 1; i >= 0; i--) { + var temp = paramList[i].split('='); + if (temp[0] === param) { + return temp[1]; + } + } + } + } + + //获取解码后的搜索词 + function getQueryPhrase() { + var phrase = getParam(window.location.href, 'q'); + var queryPhrase = decodeURIComponent(phrase.replace(/\+/g, ' ')); + return queryPhrase; + } + + //填充搜索输入框 + function fillSearchInput() { + var searchForm = document.getElementById('gridea-search-form'); + var searchInput = searchForm.getElementsByTagName('input')[0]; + searchInput.value = getQueryPhrase(); + } + + //Ajax异步GET请求 + function ajax(obj) { + var xhr = new XMLHttpRequest(); + xhr.open('get', obj.url, true); + xhr.send(null); + xhr.onreadystatechange = function () { + //异步请求:响应状态为4,数据加载完毕 + if (xhr.readyState === 4) { + if (xhr.status === 200) { + obj.success(xhr.responseText); + } else { + obj.error(xhr.status); + } + } + } + } + + //模糊搜索 https://github.com/krisk/fuse + function fuzzySearch(data, phrase) { + var options = { + includeMatches: true, + ignoreLocation: true, + keys: [ + 'title', + 'content' + ] + }; + var fuse = new Fuse(data, options); + var fuzzyResult = fuse.search(phrase); + return fuzzyResult; + } + + //检查缓存是否最新 + function checkCache() { + var caches = {}; + caches.infos = JSON.parse(localStorage.getItem('InfosCache')); + caches.contents = JSON.parse(localStorage.getItem('ContentsCache')); + if (caches.infos && caches.contents) { + var cachedTime = caches.infos.utils.now.toString(); + var updateTime = document.getElementById('gridea-search-result').getAttribute('data-update'); + if (cachedTime === updateTime) { + return caches; + } + } + localStorage.removeItem('InfosCache'); + localStorage.removeItem('ContentsCache'); + return false; + } + + //获取博客全文api + function getContents(callback) { + var caches = checkCache(); + if (caches) { + callback(caches.contents); + } + else { + ajax({ + url: '../api-content/index.html' + "?_=" + Date.now(), + success: function (data) { + callback(JSON.parse(data)); + localStorage.setItem('ContentsCache', data); + } + }); + } + } + + //获取博客信息api + function getInfos(callback) { + var caches = checkCache(); + if (caches) { + callback(caches.infos); + } + else { + ajax({ + url: '../api-info/index.html' + "?_=" + Date.now(), + success: function (data) { + callback(JSON.parse(data)); + localStorage.setItem('InfosCache', data); + } + }); + } + } + + //根据一段文本调用模糊搜索 + function searchBy(phrase, callback) { + var result = ''; + var getFuzzyResult = function (data) { + result = fuzzySearch(data.posts, phrase); + callback(result); + } + //根据全文内容获取搜索结果 + getContents(getFuzzyResult); + } + + //显示无搜索结果 + function showNoResult() { + var resultDIV = document.getElementById('gridea-search-result'); + var noResult = resultDIV.getElementsByClassName('no-result')[0]; + noResult.style.display = 'block'; + resultDIV.innerHTML = noResult.outerHTML; + } + + //根据解码后的搜索词执行搜索 + function searchByPhrase(resultHandler) { + var queryPhrase = getQueryPhrase(); + if (queryPhrase === '' || typeof (queryPhrase) === 'undefined') { + showNoResult(); + } else { + searchBy(queryPhrase, resultHandler); + } + } + + //获取搜索结果列表模板的URL + function getTemplateURL() { + var scripts = document.getElementsByTagName('script'); + var templateURL = ''; + for (var i = 0; i < scripts.length; i++) { + if (scripts[i].type === 'text/ejs') { + templateURL = scripts[i].src; + return templateURL; + } + } + } + + //渲染搜索结果列表ejs https://github.com/mde/ejs + function renderResult(searchedInfos) { + if (searchedInfos.posts.length > 0) { + ajax({ + url: getTemplateURL(), + success: function (data) { + var resultDIV = document.getElementById('gridea-search-result'); + resultDIV.innerHTML = ejs.compile(data)(searchedInfos); + } + }); + } else { + showNoResult(); + } + } + + //搜索结果关键字高亮 + function keywordHighlight(searchedContent) { + var searchedPostContent = searchedContent.item.content;//搜索结果内容预览 + var preview = ''; + for (var i = 0; i < searchedContent.matches.length; i++) { + if (searchedContent.matches[i].key === 'content') {//如果匹配到文章内容,截取关键字 + var indices = searchedContent.matches[i].indices[0]; + var beforeKeyword = searchedPostContent.substring(indices[0] - 10, indices[0]);//关键字前10字 + var keyword = searchedPostContent.substring(indices[0], indices[1] + 1);//关键字 + var afterKeyword = searchedPostContent.substring(indices[1] + 1, indices[1] + 70);//关键字后70字 + preview = beforeKeyword + '' + + keyword + '' + afterKeyword; + } else {//没有匹配到文章内容,则是标题,直接截取前80字 + preview = searchedPostContent.substring(0, 80); + } + } + return preview + '...'; + } + + //循环匹配搜索到的内容与展示信息 + function getResult(infos, searchedContents) { + var searchedInfos = JSON.parse(JSON.stringify(infos));//对象深拷贝 + searchedInfos.posts = []; + for (var i = 0; i < searchedContents.length; i++) { + for (var j = 0; j < infos.posts.length; j++) { + if (searchedContents[i].item.link === infos.posts[j].link) { + infos.posts[j].searchedPreview = keywordHighlight(searchedContents[i]);//预览关键字高亮 + infos.posts[j].content = searchedContents[i].item.content;//content注入 + searchedInfos.posts.push(infos.posts[j]);//push到所需结果中 + } + } + } + return searchedInfos; + } + + //主方法 + function grideaSearch() { + //搜索结果回调 + var resultHandler = function (searchedContents) { + getInfos(function (infos) { + //console.log(infos); + //console.log(searchedContents); + var searchedInfos = getResult(infos, searchedContents); + renderResult(searchedInfos); + }); + } + searchByPhrase(resultHandler); + } + + //页面加载完执行 + window.onload = function () { + fillSearchInput(); + grideaSearch(); + } +})(); \ No newline at end of file diff --git a/assets/media/gridea-search/result-template.ejs b/assets/media/gridea-search/result-template.ejs new file mode 100644 index 0000000..f359ecd --- /dev/null +++ b/assets/media/gridea-search/result-template.ejs @@ -0,0 +1,26 @@ +
+ <% posts.forEach(function(post) { %> +
+ +

<%= post.title %>

+
+ + <% if (themeConfig.showFeatureImage && post.feature) { %> + + + <% } %> +
+ <%- post.searchedPreview %> +
+
+ <% }); %> +
diff --git a/assets/media/images/custom-array-friends-1595866692623-siteLogo.jpg b/assets/media/images/custom-array-friends-1595866692623-siteLogo.jpg new file mode 100644 index 0000000..792ad20 Binary files /dev/null and b/assets/media/images/custom-array-friends-1595866692623-siteLogo.jpg differ diff --git a/assets/media/images/custom-array-friends-1595867038172-siteLogo.png b/assets/media/images/custom-array-friends-1595867038172-siteLogo.png new file mode 100644 index 0000000..2530372 Binary files /dev/null and b/assets/media/images/custom-array-friends-1595867038172-siteLogo.png differ diff --git a/assets/styles/components/archives.less b/assets/styles/components/archives.less index 3e62c8c..28661ad 100644 --- a/assets/styles/components/archives.less +++ b/assets/styles/components/archives.less @@ -12,12 +12,15 @@ } .post { + float:left; padding: 16px 0; .post-title { + float:left; font-size: 16px; small { + float:left; font-size: 80%; } } diff --git a/assets/styles/components/friends.less b/assets/styles/components/friends.less index 3554878..bd852ba 100644 --- a/assets/styles/components/friends.less +++ b/assets/styles/components/friends.less @@ -21,7 +21,7 @@ a { font-size: 18px; color: #000 !important; - background: linear-gradient(180deg, transparent 75%, RGBA(116,192,252,0.4) 0);// !important; + background: linear-gradient(180deg, transparent 75%, RGBA(252,229,226,1) 0);// !important; margin-bottom: 10px; } .flink-info-desc { diff --git a/assets/styles/main.less b/assets/styles/main.less index 295fc07..545d878 100644 --- a/assets/styles/main.less +++ b/assets/styles/main.less @@ -196,6 +196,26 @@ ul { flex-direction: column; } +.search-input { + position: relative; + left: -2px; + width: 180px; + height: 26px; + padding: 0 0 2px 27px; + font-size: 14px; + background: url(https://i.loli.net/2020/01/12/X3cnLxGjo7Wb8Jk.png) 6px 3px no-repeat; + background-color: #F3F3F3 !important; + background-size: 20px; + border: 0; + border-radius: 15px; + border-bottom-color: currentcolor; + border-bottom-style: none; + border-bottom-width: medium; + outline: 0; + color: #495057; + border-bottom: 2px #495057; + transition: border-color .2s +} //.gt-bg-theme-color-first { // background: @theme-color-first; diff --git a/templates/api-content.ejs b/templates/api-content.ejs new file mode 100644 index 0000000..d360132 --- /dev/null +++ b/templates/api-content.ejs @@ -0,0 +1,24 @@ +<%- outputContent();%><% -%> +<% +function refineContent(str){ + return str.replace(/(<(\/?)(\w+)[^>]*>)|()/g ,'')//去除html标签如

和注释 + .replace(/\s+/g,' ')//压缩空格换行等只保留一个空格 +} + +function outputContent(){ +let articlesContent={ + posts:[] +}; +site.posts.forEach(function(post, index){ + if(!post.hideInList){ + let postContent={ + title:post.title, + content:refineContent(post.content), + link:post.link + }; + articlesContent.posts.push(postContent); + } +}) +return JSON.stringify(articlesContent); +} +%> \ No newline at end of file diff --git a/templates/api-info.ejs b/templates/api-info.ejs new file mode 100644 index 0000000..d71ee58 --- /dev/null +++ b/templates/api-info.ejs @@ -0,0 +1,42 @@ +<%- outputInfo();%><% -%> +<% +function refineInfo(str){ + return str.replace(/(<(\/?)(\w+)[^>]*>)|()/g ,'')//去除html标签如

和注释 + .replace(/\s+/g,' ')//压缩空格换行等只保留一个空格 +} + +function outputInfo(){ + //全站信息 + let siteInfo={ + posts:[],//必选,不可更改 + tags:site.tags, + menus:site.menus, + themeConfig:site.themeConfig, + customConfig:site.customConfig, + utils:site.utils//必选,不可更改 + }; +site.posts.forEach(function(post, index){ + if(!post.hideInList){//排除隐藏文章 + //文章信息 + let postInfo={ + //content:post.content,//防止文件过大,尽量不选,在./api-content.ejs中已包含 + fileName:post.fileName, + abstract:post.abstract, + description:refineInfo(post.description), + title:post.title, + tags:post.tags, + feature:post.feature, + link:post.link, + stats:post.stats, + isTop:post.isTop, + toc:post.toc, + date:post.date, + dateFormat:post.dateFormat + }; + siteInfo.posts.push(postInfo); + } +}) + +return JSON.stringify(siteInfo); +} +%> diff --git a/templates/archives.ejs b/templates/archives.ejs index 3e56a97..5cb57e8 100644 --- a/templates/archives.ejs +++ b/templates/archives.ejs @@ -6,11 +6,16 @@
<%- include('./includes/header') %> - +
+
+
+

归档

<%- include('./includes/post-list-archives') %> <%- include('./includes/pagination') %> - +
+
+
<%- include('./includes/footer') %>
diff --git a/templates/friends.ejs b/templates/friends.ejs index 48a7c9d..38478ae 100644 --- a/templates/friends.ejs +++ b/templates/friends.ejs @@ -11,7 +11,7 @@
-

友情链接

+

以下是我的朋友们呀,很高兴遇见你们!🤝

@@ -20,7 +20,13 @@
\ No newline at end of file diff --git a/templates/search.ejs b/templates/search.ejs new file mode 100644 index 0000000..d55e4d2 --- /dev/null +++ b/templates/search.ejs @@ -0,0 +1,39 @@ + + + + + <%- include('./includes/head', { siteTitle: themeConfig.siteName }) %> + + + + + + + + + +
+ <%- include('./includes/header') %> +
+
+
+

搜索结果

+
+
+
搜索中......
+ +
+
+
+
+
+
+
+ <%- include('./includes/footer') %> + + + \ No newline at end of file diff --git a/templates/tags.ejs b/templates/tags.ejs index 6e85c34..9bbdcbf 100644 --- a/templates/tags.ejs +++ b/templates/tags.ejs @@ -6,14 +6,19 @@
<%- include('./includes/header') %> - +
+
+ +
+
<%- include('./includes/footer') %>