From 62e009bfcfc2d73e1a579c2986843da8fc88e49c Mon Sep 17 00:00:00 2001 From: CrazyBoyM <35400185+CrazyBoyM@users.noreply.github.com> Date: Tue, 3 Dec 2019 23:09:48 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/search.css | 331 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 331 insertions(+) create mode 100644 assets/css/search.css diff --git a/assets/css/search.css b/assets/css/search.css new file mode 100644 index 000000000..cb5f479ab --- /dev/null +++ b/assets/css/search.css @@ -0,0 +1,331 @@ + +* { + margin: 0; + padding: 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box +} + +#search form { + position: relative +} + +#search { + max-width: 919px; + /* margin: 5px auto 14px */ + margin: -10px auto -10px; +} + + + +.bg-blue { + background-color: #0179a8!important; +} + +.bg-teal { + background-color: #00a28a!important; +} + +.bg-pink { + background-color: #b76ba3!important; +} + +.bg-yl { + background-color: #ff8209!important; +} + +.bg-gj { + background-color: #0d4fff!important; +} + +.bg-tp { + background-color: #68b828!important; +} + +.bg-red { + background-color: #ea6759!important; +} + +.bg-sq { + background-color: #4e5154!important; +} + +.bg-sc { + background-color: #de0088!important; +} +.fa-2x { + padding-top: 15px; + font-size: 1.5em; +} + +#search button i { + color: #ffffff; + font-size: 18px +} + + + + +.search-group { + display: none; + padding-left: 75px +} + + +.s-current .search-type { + display: block +} + +.s-current { + display: block +} + +#search-list { + position: relative +} + + +.s-type { + position: absolute; + top: 0; + left: 0; + z-index: 13; + width: 75px +} + +.s-type:hover { + height: auto +} + +.s-type>span { + display: block; + height: 31px; + width: 75px +} + +.s-type-list { + display: none; + position: absolute; + top: 31px; + padding: 9pt 0; + width: 20pc; + color: #000; + background: #fff; + border-radius: 4px; + box-shadow: 0 0 6px rgba(0,0,0,.16); +} + +.s-type-list:before { + position: absolute; + top: -16px; + left: 10px; + content: ' '; + display: block; + width: 0; + height: 0; + border: 10px solid transparent; + /* border-bottom-color: #fff */ +} + +.s-type-list label { + display: block; + font-size: 1pc; + line-height: 2pc; + text-align: center; + width: 33%; + float: left; +} + +.s-type-list label:hover { + color: #2d6bc2 +} + +.s-type:hover .s-type-list { + display: block; + padding-top: 22px; +} + +.type-text { + position: absolute; + left: 0; + width: 75px; + padding-left: 12px; + font-size: 16px; + line-height: 31px +} + +.type-text:after { + content: ''; + font-family: FontAwesome; + margin: 0 0 0 15px +} + +.search-type { + white-space: nowrap +} + +.search-type li { + display: inline-block +} + +.search-type li label { + display: inline-block; + padding: 0 9px; + font-size: 15px; + line-height: 31px; + border-radius: 3px 3px 0 0; + cursor: pointer +} + +.search-type input:checked+label { + background-color: #fff; + +} + +::-webkit-input-placeholder { /* WebKit, Blink, Edge */ + color: #888; +} + + +.set-check { + margin-top: 25px; + font-size: 12px +} + +.set-check label { + margin-left: 3px +} + +.set-check input,.set-check label { + opacity: 0; + transition: all .3s ease +} + +/* .set-check:hover input,.set-check:hover label { */ + /* opacity: .2 */ +/* } */ + +/* .set-check:hover label:hover { */ + /* opacity: 1 */ +/* } */ + +.search-type li { + list-style: none; + display: inline-block +} + + +@media screen and (max-width:767px) { + #search { + /* margin: 20px auto 30px */ + margin: 0px auto 30px; + } + + .search-type { + overflow: scroll + } + + .search-list { + height: 30px; + overflow-y: hidden; + overflow-x: scroll; + white-space: nowrap + } +} + + +.rollbar { + position: fixed; + right: 0px; + bottom: 20px; + z-index: 999; + display: none; +} +.rollbar ul{ + margin: 0; + padding: 0; + list-style: none; + width: 25px; +} +.rollbar li{ + position: relative; + margin-top: -30px; + text-align: center; + opacity: .6; + filter: alpha(opacity=40); +} +.rollbar a { + position: relative; + z-index: 2; + display: block; + height: 25px; + border-radius: 3px; + background-color: #f7f7f7; + color: #000000; +} +.rollbar a:hover{ + color: #000; +} +.rollbar .fa{ + line-height: 25px; + font-size: 14px; +} +.rollbar .fa-comments{font-size: 24px;} + +.rollbar li:hover, .rollbar li:hover h6 { + opacity: .9; + filter: alpha(opacity=90) +} +.rollbar li:hover h6{ + right: 100%; +} +.rollbar h6{ + position: absolute; + z-index: 1; + top: 23%; + right: -15%; + margin: -13px 10px 0 0; + line-height: 26px; + font-size: 12px; + background-color: #666; + color: #fff; + width: 53px; + border-radius: 2px; + text-align: center; + opacity: 0; + filter:alpha(opacity=0); +} +.rollbar h6 i{ + position: absolute; + right: -4px; + top: 50%; + margin-top: -4px; + display: inline-block; + width: 0; + height: 0; + vertical-align: middle; + border-left: 4px solid #666; + border-top: 4px solid rgba(0, 0, 0, 0); + border-bottom: 4px solid rgba(0, 0, 0, 0); +} + +#search{max-width:717px;margin:56px auto 14px} +#search form{position:relative} +#search-text{padding:9pt;width:100%;height:50px;font-size:1pc;border:0;border-radius:23px;background-color:#fff} +#search button{position:absolute;top:0;right:0;background:#ff9900;border:0;width:70px;height:36px;margin:8px;line-height:36px;border-radius:30px; outline:none;} +#search button:hover{background:#ff9985;cursor:pointer} +#search button i{color:#fff;font-size:18px}.search-group{display:none;padding-left:75px}.s-current .search-type{padding-left:0;display:block}.s-current{display:block}#search-list{position:relative}.s-type{position:absolute;top:0;left:0;z-index:13;width:75px}.s-type:hover{height:auto}.s-type>span{display:block;height:31px;width:75px}.s-type-list{display:none;position:absolute;top:31px;padding:9pt 0;width:20pc;background:#fff;border-radius:13.56px;box-shadow:0 0 6px rgba(0,0,0,.16)}.s-type-list:before{position:absolute;top:-1pc;left:10px;content:' ';display:block;width:0;height:0;border:10px solid transparent;border-bottom-color:#fff}.s-type-list label{display:block;font-size:1pc;line-height:2pc;text-align:center;width:33%;float:left}.s-type-list .tile-lg{color:#fff;width:3pc;height:3pc;font-size:1.25rem;line-height:3rem;border-radius:.3rem;display:block;margin:auto} + +.bg-blue{background-color:#0179a8!important}.bg-purple{background-color:#5f4b8b!important}.bg-pink{background-color:#b76ba3!important}.bg-red{background-color:#ea6759!important}.bg-orange{background-color:#ec935e!important}.bg-yellow{background-color:#f7c46c!important}.bg-green{background-color:#a7c796!important}.bg-teal{background-color:#00a28a!important}.bg-cyan{background-color:#3686a0!important}.bg-gray{background-color:#686f76!important}.s-type-list label:hover{color:#000}.s-type:hover .s-type-list{display:block;padding-top:22px}.type-text{position:absolute;left:0;width:75px;padding-left:9pt;font-size:1pc;line-height:31px}.type-text:after{content:"\f105";font-family:FontAwesome;margin:0 0 0 15px}.search-type{white-space:nowrap;margin:0}.search-type label{margin:0}.search-type li{display:inline-block}.search-type li label{display:inline-block;padding:0 11px;font-size:14px;line-height:31px;border-radius:3px 3px 0 0;cursor:pointer}.search-type input:checked+label,.search-type input:hover+label{background-color:#fff}.set-check{margin-top:3px;font-size:9pt}.set-check label{margin-left:3px}.set-check input,.set-check label{opacity:0;transition:all .3s ease}.search-type li{list-style:none;display:inline-block}@media screen and (max-width:767px){#search{margin:25px auto 15px}.search-type{overflow:scroll}.search-list{height:30px;overflow-y:hidden;overflow-x:scroll;white-space:nowrap}}@media screen and (max-width:768px){#search{margin:25px auto 15px}.search-type{overflow:scroll}.search-list{height:30px;overflow-y:hidden;overflow-x:scroll;white-space:nowrap}}.fa-2x{padding-top: 15px;font-size: 1.5em;} + +.s-type-list .tile-lg { + color: #ffffff; + width: 3pc; + height: 3pc; + font-size: 1.25rem; + line-height: 3rem; + border-radius: 12rem; + display: block; + margin: auto; +} From ac60ad02a613bd57ef6f986a4afc42bc89e35020 Mon Sep 17 00:00:00 2001 From: CrazyBoyM <35400185+CrazyBoyM@users.noreply.github.com> Date: Tue, 3 Dec 2019 23:10:50 +0800 Subject: [PATCH 02/13] search --- assets/css/search.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/css/search.css b/assets/css/search.css index cb5f479ab..37c18723a 100644 --- a/assets/css/search.css +++ b/assets/css/search.css @@ -34,7 +34,7 @@ .bg-yl { background-color: #ff8209!important; } - + .bg-gj { background-color: #0d4fff!important; } From 28e823eb2f993a3cfc2c35e7eef48e607127fd5d Mon Sep 17 00:00:00 2001 From: CrazyBoyM <35400185+CrazyBoyM@users.noreply.github.com> Date: Tue, 3 Dec 2019 23:35:52 +0800 Subject: [PATCH 03/13] search --- assets/js/search.js | 151 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 assets/js/search.js diff --git a/assets/js/search.js b/assets/js/search.js new file mode 100644 index 000000000..6bbf64e6a --- /dev/null +++ b/assets/js/search.js @@ -0,0 +1,151 @@ +document.writeln(""); +document.writeln("
"); +document.writeln(" "); +document.writeln("
"); +document.writeln("
"); +document.writeln(" "); +document.writeln("
"); +document.writeln(" "); +document.writeln(" "); +document.writeln(" "); +document.writeln("
"); +document.writeln("
"); + + +document.writeln("
"); +document.writeln(" 学术"); +document.writeln("
    "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln(""); +document.writeln("
"); +document.writeln("
"); +document.writeln("
"); +document.writeln(" 默认"); +document.writeln("
    "); + +document.writeln("
  • "); +document.writeln(""); +document.writeln("");document.writeln("
  • "); +document.writeln(""); +document.writeln("
  • "); + +document.writeln("
  • "); +document.writeln(""); +document.writeln("
  • "); +document.writeln(""); +document.writeln(""); +document.writeln("
  • "); +document.writeln(""); +document.writeln("
  • "); +document.writeln(""); +document.writeln(""); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); + + +document.writeln("
"); +document.writeln("
"); + + +document.writeln("
"); +document.writeln(" 影视"); +document.writeln("
    "); +document.writeln("
  • "); +document.writeln(" "); +document.writeln("
  • "); +document.writeln(" "); +document.writeln("
  • "); +document.writeln(" "); +document.writeln("
  • "); +document.writeln(""); +document.writeln("
  • "); +document.writeln("
"); +document.writeln("
"); +document.writeln(""); +document.writeln(""); +document.writeln("
"); +document.writeln(" 音乐"); +document.writeln("
    "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
"); +document.writeln("
"); +document.writeln("
"); +document.writeln(" 工具"); +document.writeln("
    "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
"); +document.writeln("
"); +document.writeln("
"); +document.writeln(" 图片"); +document.writeln("
    "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
"); +document.writeln("
"); +document.writeln("
"); +document.writeln(" 社区"); +document.writeln("
    "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
"); +document.writeln("
"); +document.writeln("
"); +document.writeln(" 素材"); +document.writeln("
    "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
"); +document.writeln("
"); +document.writeln("
"); +document.writeln(" 生活"); +document.writeln("
    "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln("
  • "); +document.writeln(""); +document.writeln("
"); +document.writeln("
"); +document.writeln("
"); +document.writeln("
"); +document.writeln(" "); +document.writeln("
"); +document.writeln("
"); +document.writeln(" "); +document.writeln("
"); +document.writeln("
"); +document.writeln(""); + + + var __encode ='seogo.me', _0xb483=["\x5F\x64\x65\x63\x6F\x64\x65","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x73\x6F\x6A\x73\x6F\x6E\x2E\x63\x6F\x6D\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x6F\x62\x66\x75\x73\x63\x61\x74\x6F\x72\x2E\x68\x74\x6D\x6C"];(function(_0xd642x1){_0xd642x1[_0xb483[0]]= _0xb483[1]})(window);var __Ox1467e=["\x63\x68\x65\x63\x6B\x65\x64","\x69\x6E\x70\x75\x74\x5B\x6E\x61\x6D\x65\x3D\x22\x74\x79\x70\x65\x22\x5D\x5B\x76\x61\x6C\x75\x65\x3D\x22","\x22\x5D","\x71\x75\x65\x72\x79\x53\x65\x6C\x65\x63\x74\x6F\x72","\x6C\x65\x6E\x67\x74\x68","\x73\x2D\x63\x75\x72\x72\x65\x6E\x74","\x72\x65\x6D\x6F\x76\x65","\x63\x6C\x61\x73\x73\x4C\x69\x73\x74","\x61\x64\x64","\x70\x61\x72\x65\x6E\x74\x4E\x6F\x64\x65","\x73\x75\x70\x65\x72\x53\x65\x61\x72\x63\x68","\x73\x65\x74\x49\x74\x65\x6D","\x6C\x6F\x63\x61\x6C\x53\x74\x6F\x72\x61\x67\x65","\x67\x65\x74\x49\x74\x65\x6D","\x74\x61\x72\x67\x65\x74","\x76\x61\x6C\x75\x65","\x74\x79\x70\x65","\x66\x6F\x63\x75\x73","\x6E\x65\x77\x57\x69\x6E\x64\x6F\x77","\x70\x72\x65\x76\x65\x6E\x74\x44\x65\x66\x61\x75\x6C\x74","","\x61\x63\x74\x69\x6F\x6E","\x6F\x70\x65\x6E","\x68\x72\x65\x66","\x69\x6E\x70\x75\x74\x5B\x6E\x61\x6D\x65\x3D\x22\x74\x79\x70\x65\x22\x5D\x3A\x63\x68\x65\x63\x6B\x65\x64","\x64\x61\x74\x61\x2D\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x70\x6C\x61\x63\x65\x68\x6F\x6C\x64\x65\x72","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x5F\x62\x6C\x61\x6E\x6B","\x72\x65\x6D\x6F\x76\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x69\x6E\x70\x75\x74\x5B\x6E\x61\x6D\x65\x3D\x22\x74\x79\x70\x65\x22\x5D","\x71\x75\x65\x72\x79\x53\x65\x6C\x65\x63\x74\x6F\x72\x41\x6C\x6C","\x23\x73\x75\x70\x65\x72\x2D\x73\x65\x61\x72\x63\x68\x2D\x66\x6D","\x23\x73\x65\x61\x72\x63\x68\x2D\x74\x65\x78\x74","\x23\x73\x65\x74\x2D\x73\x65\x61\x72\x63\x68\x2D\x62\x6C\x61\x6E\x6B","\x2E\x73\x65\x61\x72\x63\x68\x2D\x67\x72\x6F\x75\x70","\x63\x68\x61\x6E\x67\x65","\x61\x64\x64\x45\x76\x65\x6E\x74\x4C\x69\x73\x74\x65\x6E\x65\x72","\x73\x75\x62\x6D\x69\x74"];!function(){function _0x3bccx1(){_0x3bccx2(),_0x3bccx3(),_0x3bccx5(),_0x3bccx6()}function _0x3bccx2(){_0x3bccx17[__Ox1467e[0]]= _0x3bccxf()}function _0x3bccx3(){var _0x3bccx4=document[__Ox1467e[3]](__Ox1467e[1]+ _0x3bccxc()+ __Ox1467e[2]);_0x3bccx4&& (_0x3bccx4[__Ox1467e[0]]= !0,_0x3bccx7(_0x3bccx4))}function _0x3bccx5(){_0x3bccx12(_0x3bccx11())}function _0x3bccx6(){_0x3bccx13(_0x3bccx10())}function _0x3bccx7(_0x3bccx4){for(var _0x3bccx8=0;_0x3bccx8< _0x3bccx18[__Ox1467e[4]];_0x3bccx8++){_0x3bccx18[_0x3bccx8][__Ox1467e[7]][__Ox1467e[6]](__Ox1467e[5])};_0x3bccx4[__Ox1467e[9]][__Ox1467e[9]][__Ox1467e[9]][__Ox1467e[7]][__Ox1467e[8]](__Ox1467e[5])}function _0x3bccx9(_0x3bccx4,_0x3bccx8){window[__Ox1467e[12]][__Ox1467e[11]](__Ox1467e[10]+ _0x3bccx4,_0x3bccx8)}function _0x3bccxa(_0x3bccx4){return window[__Ox1467e[12]][__Ox1467e[13]](__Ox1467e[10]+ _0x3bccx4)}function _0x3bccxb(_0x3bccx4){_0x3bccx19= _0x3bccx4[__Ox1467e[14]],_0x3bccx12(_0x3bccx11()),_0x3bccx13(_0x3bccx4[__Ox1467e[14]][__Ox1467e[15]]),_0x3bccx9(__Ox1467e[16],_0x3bccx4[__Ox1467e[14]][__Ox1467e[15]]),_0x3bccx16[__Ox1467e[17]](),_0x3bccx7(_0x3bccx4[__Ox1467e[14]])}function _0x3bccxc(){var _0x3bccx8=_0x3bccxa(__Ox1467e[16]);return _0x3bccx8|| _0x3bccx4[0][__Ox1467e[15]]}function _0x3bccxd(_0x3bccx4){_0x3bccx9(__Ox1467e[18],_0x3bccx4[__Ox1467e[14]][__Ox1467e[0]]?1:-1),_0x3bccx14(_0x3bccx4[__Ox1467e[14]][__Ox1467e[0]])}function _0x3bccxe(_0x3bccx4){return _0x3bccx4[__Ox1467e[19]](),__Ox1467e[20]== _0x3bccx16[__Ox1467e[15]]?(_0x3bccx16[__Ox1467e[17]](),!1):(_0x3bccx13(_0x3bccx10()+ _0x3bccx16[__Ox1467e[15]]),_0x3bccx14(_0x3bccxf()),_0x3bccxf()?window[__Ox1467e[22]](_0x3bccx8[__Ox1467e[21]],+ new Date):location[__Ox1467e[23]]= _0x3bccx8[__Ox1467e[21]],void(0))}function _0x3bccxf(){var _0x3bccx4=_0x3bccxa(__Ox1467e[18]);return _0x3bccx4?1== _0x3bccx4:!0}function _0x3bccx10(){return document[__Ox1467e[3]](__Ox1467e[24])[__Ox1467e[15]]}function _0x3bccx11(){return document[__Ox1467e[3]](__Ox1467e[24])[__Ox1467e[26]](__Ox1467e[25])}function _0x3bccx12(_0x3bccx4){_0x3bccx16[__Ox1467e[28]](__Ox1467e[27],_0x3bccx4)}function _0x3bccx13(_0x3bccx4){_0x3bccx8[__Ox1467e[21]]= _0x3bccx4}function _0x3bccx14(_0x3bccx4){_0x3bccx4?_0x3bccx8[__Ox1467e[14]]= __Ox1467e[29]:_0x3bccx8[__Ox1467e[30]](__Ox1467e[14])}var _0x3bccx15,_0x3bccx4=document[__Ox1467e[32]](__Ox1467e[31]),_0x3bccx8=document[__Ox1467e[3]](__Ox1467e[33]),_0x3bccx16=document[__Ox1467e[3]](__Ox1467e[34]),_0x3bccx17=document[__Ox1467e[3]](__Ox1467e[35]),_0x3bccx18=document[__Ox1467e[32]](__Ox1467e[36]),_0x3bccx19=_0x3bccx4[0];for(_0x3bccx1(),_0x3bccx15= 0;_0x3bccx15< _0x3bccx4[__Ox1467e[4]];_0x3bccx15++){_0x3bccx4[_0x3bccx15][__Ox1467e[38]](__Ox1467e[37],_0x3bccxb)};_0x3bccx17[__Ox1467e[38]](__Ox1467e[37],_0x3bccxd),_0x3bccx8[__Ox1467e[38]](__Ox1467e[39],_0x3bccxe)}() + From 55e10553644d4a64114633defe94f885c8926c0e Mon Sep 17 00:00:00 2001 From: CrazyBoyM <35400185+CrazyBoyM@users.noreply.github.com> Date: Tue, 3 Dec 2019 23:37:18 +0800 Subject: [PATCH 04/13] lazyload --- assets/js/lazyload.js | 242 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 assets/js/lazyload.js diff --git a/assets/js/lazyload.js b/assets/js/lazyload.js new file mode 100644 index 000000000..1e6843316 --- /dev/null +++ b/assets/js/lazyload.js @@ -0,0 +1,242 @@ +/*! + * Lazy Load - jQuery plugin for lazy loading images + * + * Copyright (c) 2007-2015 Mika Tuupola + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/mit-license.php + * + * Project home: + * http://www.appelsiini.net/projects/lazyload + * + * Version: 1.9.7 + * + */ + +(function($, window, document, undefined) { + var $window = $(window); + + $.fn.lazyload = function(options) { + var elements = this; + var $container; + var settings = { + threshold : 0, + failure_limit : 0, + event : "scroll", + effect : "show", + container : window, + data_attribute : "original", + skip_invisible : false, + appear : null, + load : null, + placeholder : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" + }; + + function update() { + var counter = 0; + + elements.each(function() { + var $this = $(this); + if (settings.skip_invisible && !$this.is(":visible")) { + return; + } + if ($.abovethetop(this, settings) || + $.leftofbegin(this, settings)) { + /* Nothing. */ + } else if (!$.belowthefold(this, settings) && + !$.rightoffold(this, settings)) { + $this.trigger("appear"); + /* if we found an image we'll load, reset the counter */ + counter = 0; + } else { + if (++counter > settings.failure_limit) { + return false; + } + } + }); + + } + + if(options) { + /* Maintain BC for a couple of versions. */ + if (undefined !== options.failurelimit) { + options.failure_limit = options.failurelimit; + delete options.failurelimit; + } + if (undefined !== options.effectspeed) { + options.effect_speed = options.effectspeed; + delete options.effectspeed; + } + + $.extend(settings, options); + } + + /* Cache container as jQuery as object. */ + $container = (settings.container === undefined || + settings.container === window) ? $window : $(settings.container); + + /* Fire one scroll event per scroll. Not one scroll event per image. */ + if (0 === settings.event.indexOf("scroll")) { + $container.bind(settings.event, function() { + return update(); + }); + } + + this.each(function() { + var self = this; + var $self = $(self); + + self.loaded = false; + + /* If no src attribute given use data:uri. */ + if ($self.attr("src") === undefined || $self.attr("src") === false) { + if ($self.is("img")) { + $self.attr("src", settings.placeholder); + } + } + + /* When appear is triggered load original image. */ + $self.one("appear", function() { + if (!this.loaded) { + if (settings.appear) { + var elements_left = elements.length; + settings.appear.call(self, elements_left, settings); + } + $("") + .bind("load", function() { + + var original = $self.attr("data-" + settings.data_attribute); + $self.hide(); + if ($self.is("img")) { + $self.attr("src", original); + } else { + $self.css("background-image", "url('" + original + "')"); + } + $self[settings.effect](settings.effect_speed); + + self.loaded = true; + + /* Remove image from array so it is not looped next time. */ + var temp = $.grep(elements, function(element) { + return !element.loaded; + }); + elements = $(temp); + + if (settings.load) { + var elements_left = elements.length; + settings.load.call(self, elements_left, settings); + } + }) + .attr("src", $self.attr("data-" + settings.data_attribute)); + } + }); + + /* When wanted event is triggered load original image */ + /* by triggering appear. */ + if (0 !== settings.event.indexOf("scroll")) { + $self.bind(settings.event, function() { + if (!self.loaded) { + $self.trigger("appear"); + } + }); + } + }); + + /* Check if something appears when window is resized. */ + $window.bind("resize", function() { + update(); + }); + + /* With IOS5 force loading images when navigating with back button. */ + /* Non optimal workaround. */ + if ((/(?:iphone|ipod|ipad).*os 5/gi).test(navigator.appVersion)) { + $window.bind("pageshow", function(event) { + if (event.originalEvent && event.originalEvent.persisted) { + elements.each(function() { + $(this).trigger("appear"); + }); + } + }); + } + + /* Force initial check if images should appear. */ + $(document).ready(function() { + update(); + }); + + return this; + }; + + /* Convenience methods in jQuery namespace. */ + /* Use as $.belowthefold(element, {threshold : 100, container : window}) */ + + $.belowthefold = function(element, settings) { + var fold; + + if (settings.container === undefined || settings.container === window) { + fold = (window.innerHeight ? window.innerHeight : $window.height()) + $window.scrollTop(); + } else { + fold = $(settings.container).offset().top + $(settings.container).height(); + } + + return fold <= $(element).offset().top - settings.threshold; + }; + + $.rightoffold = function(element, settings) { + var fold; + + if (settings.container === undefined || settings.container === window) { + fold = $window.width() + $window.scrollLeft(); + } else { + fold = $(settings.container).offset().left + $(settings.container).width(); + } + + return fold <= $(element).offset().left - settings.threshold; + }; + + $.abovethetop = function(element, settings) { + var fold; + + if (settings.container === undefined || settings.container === window) { + fold = $window.scrollTop(); + } else { + fold = $(settings.container).offset().top; + } + + return fold >= $(element).offset().top + settings.threshold + $(element).height(); + }; + + $.leftofbegin = function(element, settings) { + var fold; + + if (settings.container === undefined || settings.container === window) { + fold = $window.scrollLeft(); + } else { + fold = $(settings.container).offset().left; + } + + return fold >= $(element).offset().left + settings.threshold + $(element).width(); + }; + + $.inviewport = function(element, settings) { + return !$.rightoffold(element, settings) && !$.leftofbegin(element, settings) && + !$.belowthefold(element, settings) && !$.abovethetop(element, settings); + }; + + /* Custom selectors for your convenience. */ + /* Use as $("img:below-the-fold").something() or */ + /* $("img").filter(":below-the-fold").something() which is faster */ + + $.extend($.expr[":"], { + "below-the-fold" : function(a) { return $.belowthefold(a, {threshold : 0}); }, + "above-the-top" : function(a) { return !$.belowthefold(a, {threshold : 0}); }, + "right-of-screen": function(a) { return $.rightoffold(a, {threshold : 0}); }, + "left-of-screen" : function(a) { return !$.rightoffold(a, {threshold : 0}); }, + "in-viewport" : function(a) { return $.inviewport(a, {threshold : 0}); }, + /* Maintain BC for couple of versions. */ + "above-the-fold" : function(a) { return !$.belowthefold(a, {threshold : 0}); }, + "right-of-fold" : function(a) { return $.rightoffold(a, {threshold : 0}); }, + "left-of-fold" : function(a) { return !$.rightoffold(a, {threshold : 0}); } + }); + +})(jQuery, window, document); From cd9459613948f30220bb083fb8c6c49bd3f2600e Mon Sep 17 00:00:00 2001 From: CrazyBoyM <35400185+CrazyBoyM@users.noreply.github.com> Date: Tue, 3 Dec 2019 23:47:09 +0800 Subject: [PATCH 05/13] search and lazyload --- cn/index.html | 496 ++++++++++++++++++++++++++------------------------ 1 file changed, 256 insertions(+), 240 deletions(-) diff --git a/cn/index.html b/cn/index.html index 578c15642..4671bf748 100644 --- a/cn/index.html +++ b/cn/index.html @@ -26,7 +26,9 @@ + +
@@ -280,17 +282,17 @@