From b679f9feea94a5bacf32673a1d485c6339b0f633 Mon Sep 17 00:00:00 2001 From: xiaoz Date: Sun, 20 Dec 2020 11:59:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=BB=E9=A2=98=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B9=A6=E7=AD=BE=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/index.php | 16 ++++++++++++- templates/default/index.php | 17 +++++++++++--- templates/default/static/embed.js | 37 ++++++++++++++++++++++++++++++ templates/default/static/holmes.js | 1 + templates/default/static/style.css | 3 +++ version.txt | 2 +- 6 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 templates/default/static/holmes.js diff --git a/controller/index.php b/controller/index.php index 7e4f818..d358c65 100644 --- a/controller/index.php +++ b/controller/index.php @@ -62,7 +62,18 @@ function getIP() { $ip = $_SERVER['REMOTE_ADDR']; } return $ip; - } + } +//获取版本号 +function get_version(){ + if( file_exists('version.txt') ) { + $version = @file_get_contents('version.txt'); + return $version; + } + else{ + $version = 'null'; + return $version; + } +} //判断用户是否已经登录 function is_login(){ $key = md5(USER.PASSWORD.getIP().'onenav'); @@ -90,6 +101,9 @@ function base64($url){ $new_url = $scheme.$host.$port; return base64_encode($new_url); } + +//获取版本号 +$version = get_version(); // 载入前台首页模板 require('templates/'.TEMPLATE.'/index.php'); ?> \ No newline at end of file diff --git a/templates/default/index.php b/templates/default/index.php index 63076ad..4263b9f 100644 --- a/templates/default/index.php +++ b/templates/default/index.php @@ -10,7 +10,7 @@ - + @@ -26,7 +26,7 @@ @@ -77,6 +77,16 @@
+ +
+
+
+ + +
+
+
+
- + + diff --git a/templates/default/static/embed.js b/templates/default/static/embed.js index 259398e..5cd026d 100644 --- a/templates/default/static/embed.js +++ b/templates/default/static/embed.js @@ -1,4 +1,41 @@ function gotop(){ $("html,body").animate({scrollTop: '0px'}, 600); } +$(".search").blur(function(data,status){ + var keywords = $(".search").val(); + console.log(keywords); + if( keywords == ''){ + $(".mdui-typo-title").removeClass("mdui-hidden"); + } + +}); +var h = holmes({ + input: '.search', + find: '.link-space', + placeholder: '

未搜索到匹配结果!

', + mark: false, + hiddenAttr: true, + // 找到了就添加visible类,没找到添加mdui-hidden + class: { + visible: 'visible', + hidden: 'mdui-hidden' + }, + onHidden(el) { + // console.log('hidden', el); + + }, + onFound(el) { + // console.log('found', el); + $(".mdui-typo-title").addClass("mdui-hidden"); + }, + onInput(el) { + $(".mdui-typo-title").addClass("mdui-hidden"); + }, + onVisible(el) { + $(".mdui-typo-title").removeClass("mdui-hidden"); + }, + onEmpty(el) { + $(".mdui-typo-title").removeClass("mdui-hidden"); + } + }); //鼠标移动到链接修改为原始URL diff --git a/templates/default/static/holmes.js b/templates/default/static/holmes.js new file mode 100644 index 0000000..f794bbd --- /dev/null +++ b/templates/default/static/holmes.js @@ -0,0 +1 @@ +(function(a,b){'object'==typeof exports&&'undefined'!=typeof module?module.exports=b():'function'==typeof define&&define.amd?define(b):a.holmes=b()})(this,function(){'use strict';var f='undefined'==typeof window?global:window,g=function(c,a){return-1!==c.indexOf(a)},h='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a},i=function(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')},b=function(){function a(a,b){for(var c,d=0;d or contenteditable.',optionsObject:'The options need to be given inside an object like this:\n\nnew Holmes({\n find:".result"\n});\n\nsee also https://haroen.me/holmes/doc/holmes.html',findOption:'A find argument is needed. That should be a querySelectorAll for each of the items you want to match individually. You should have something like:\n\nnew Holmes({\n find:".result"\n});\n\nsee also https://haroen.me/holmes/doc/holmes.html',noInput:'Your Holmes.input didn\'t match a querySelector',impossiblePlaceholder:'The Holmes placeholder couldn\'t be put; the elements had no parent.'},a=function(){function f(a){var k=this;i(this,f);var c=!1;if('object'!==('undefined'==typeof a?'undefined':h(a)))throw new Error(j.optionsObject);if('string'!=typeof a.find)throw new Error(j.findOption);var d={input:'input[type=search]',find:'',placeholder:void 0,mark:!1,class:{visible:void 0,hidden:'hidden'},dynamic:!1,minCharacters:0,hiddenAttr:!1,shouldShow:g,onHidden:void 0,onVisible:void 0,onEmpty:void 0,onFound:void 0,onInput:void 0};this.options=Object.assign({},d,a),this.options.class=Object.assign({},d.class,a.class),this.hidden=0,this.running=!1,window.addEventListener('DOMContentLoaded',function(){return k.start()}),this.search=function(){k.running=!0;var d=!1;k.searchString=k.inputString(),k.options.minCharacters&&0!==k.searchString.length&&k.options.minCharacters>k.searchString.length||(k.options.dynamic&&(k.elements=document.querySelectorAll(k.options.find),k.elementsLength=k.elements.length,k.elementsArray=Array.prototype.slice.call(k.elements)),k.options.mark&&(k._regex=new RegExp('('+k.searchString+')(?![^<]*>)','gi')),k.elementsArray.forEach(function(a){k.options.shouldShow(a.textContent.toLowerCase(),k.searchString)?(k._showElement(a),c&&'function'==typeof k.options.onFound&&k.options.onFound(k.placeholderNode),d=!0):k._hideElement(a)}),'function'==typeof k.options.onInput&&k.options.onInput(k.searchString),d?k.options.placeholder&&k._hideElement(k.placeholderNode):(k.options.placeholder&&k._showElement(k.placeholderNode),!1==c&&(c=!0,'function'==typeof k.options.onEmpty&&k.options.onEmpty(k.placeholderNode))))}}return b(f,[{key:'_hideElement',value:function(b){this.options.class.visible&&b.classList.remove(this.options.class.visible),b.classList.contains(this.options.class.hidden)||(b.classList.add(this.options.class.hidden),this.hidden++,'function'==typeof this.options.onHidden&&this.options.onHidden(b)),this.options.hiddenAttr&&b.setAttribute('hidden','true'),this.options.mark&&(b.innerHTML=b.innerHTML.replace(/<\/?mark>/g,''))}},{key:'_showElement',value:function(b){this.options.class.visible&&b.classList.add(this.options.class.visible),b.classList.contains(this.options.class.hidden)&&(b.classList.remove(this.options.class.hidden),this.hidden--,'function'==typeof this.options.onVisible&&this.options.onVisible(b)),this.options.hiddenAttr&&b.removeAttribute('hidden'),this.options.mark&&(b.innerHTML=b.innerHTML.replace(/<\/?mark>/g,''),this.searchString.length&&(b.innerHTML=b.innerHTML.replace(this._regex,'$1')))}},{key:'_inputHandler',value:function(){console.warn('You can now directly call .search() to refresh the results'),this.search()}},{key:'inputString',value:function(){if(this.input instanceof HTMLInputElement)return this.input.value.toLowerCase();if(this.input.isContentEditable)return this.input.textContent.toLowerCase();throw new Error(j.invalidInput)}},{key:'setInput',value:function(b){if(this.input instanceof HTMLInputElement)this.input.value=b;else if(this.input.isContentEditable)this.input.textContent=b;else throw new Error(j.invalidInput)}},{key:'start',value:function(){var d=document.querySelector(this.options.input);if(d instanceof HTMLElement)this.input=d;else throw new Error(j.noInput);if('string'==typeof this.options.find)this.elements=document.querySelectorAll(this.options.find);else throw new Error(j.findOption);if(this.elementsLength=this.elements.length,this.elementsArray=Array.prototype.slice.call(this.elements),this.hidden=0,'string'==typeof this.options.placeholder){var a=this.options.placeholder;if(this.placeholderNode=document.createElement('div'),this.placeholderNode.id='holmes-placeholder',this._hideElement(this.placeholderNode),this.placeholderNode.innerHTML=a,this.elements[0].parentNode instanceof Element)this.elements[0].parentNode.appendChild(this.placeholderNode);else throw new Error(j.impossiblePlaceholder)}if(this.options.class.visible){var b=this.options.class.visible;this.elementsArray.forEach(function(c){c.classList.add(b)})}this.input.addEventListener('input',this.search)}},{key:'stop',value:function(){var d=this;return new Promise(function(a,b){try{d.input.removeEventListener('input',d.search),d.options.placeholder&&(d.placeholderNode.parentNode?d.placeholderNode.parentNode.removeChild(d.placeholderNode):b(new Error(j.impossiblePlaceholder))),d.options.mark&&d.elementsArray.forEach(function(b){b.innerHTML=b.innerHTML.replace(/<\/?mark>/g,'')}),d.running=!1,a('This instance of Holmes has been stopped.')}catch(c){b(c)}})}},{key:'clear',value:function(){var c=this;this.setInput(''),this.elementsArray.forEach(function(a){c._showElement(a)}),this.options.placeholder&&this._hideElement(this.placeholderNode),this.hidden=0}},{key:'count',value:function(){return{all:this.elementsLength,hidden:this.hidden,visible:this.elementsLength-this.hidden}}}]),f}(),c=function(g){var a=function(){for(var a,b=arguments.length,c=Array(b),d=0;d