From 3ea29f66bf0a01be9fc16084dfcb41994dd8f9fc Mon Sep 17 00:00:00 2001 From: mengkunsoft <1163540807@qq.com> Date: Mon, 22 Jun 2020 18:51:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E7=BC=96=E7=A0=81=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 IE9、IE10 无法正常生成链接的 BUG 其它细节优化 --- README.md | 4 ++-- css/style.css | 4 +++- index.html | 4 +++- js/script.js | 17 +++++++++++------ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 947be86..1300344 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

-让我帮你百度一下 +让我帮你百度一下

@@ -43,7 +43,7 @@ ----- #### 2020/6/21 -- 重构项目,风格与新版百度 UI 适配。 **注意:本版本修改了参数的获取方式,与旧版不兼容!如果你曾经使用了旧版,那么不要替换为新版,否则以前生成的网址全部会失效** +- 重构项目,风格与新版百度 UI 适配。 **注意:本版本修改了参数的获取方式,与旧版不兼容!如果你曾经使用了旧版,那么不要替换为新版,否则以前生成的链接都会失效!** - 移除短网址模块 - 增加点击指示特效 - 增加“我是自己人”按钮,防止自己人被“带跑” diff --git a/css/style.css b/css/style.css index 6db4f7a..922f8b8 100644 --- a/css/style.css +++ b/css/style.css @@ -1,3 +1,5 @@ +@charset "utf-8"; + html, body, div, section, header, footer, button, input, textarea, @@ -114,7 +116,7 @@ html, body { #function { position: absolute; width: 100%; - top: 40%; + min-height: 220px; text-align: center; margin-top: 80px; } diff --git a/index.html b/index.html index f214b4f..2580066 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,7 @@ + @@ -9,6 +10,7 @@ 让我帮你百度一下 | Let Me Baidu That For You + @@ -63,4 +65,4 @@
- + \ No newline at end of file diff --git a/js/script.js b/js/script.js index 6c1e6ef..d4cac1f 100644 --- a/js/script.js +++ b/js/script.js @@ -2,15 +2,20 @@ * 让我帮你百度一下【重制版】 * GitHub 开源地址:https://github.com/mengkunsoft/lmbtfy ** - * 原始版本来自 bangbang(http://lmbtfy.cn/),mengkun(https://mkblog.cn) 在原作的基础上进行了重置,风格变更为新版百度 UI,并适配了移动端 + * 原始版本来自 bangbang(http://lmbtfy.cn/),mengkun(https://mkblog.cn) 在原作的基础上进行了重制,风格变更为新版百度 UI,并适配了移动端 * 交互效果参考了 不会百度么?(http://buhuibaidu.me/) ** * 转载或使用时,还请保留以上信息,谢谢! */ +/* 低版本 IE polyfill */ +if(!window.location.origin) { + window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port: ''); +} + /* 扩展一个getUrlParam的方法 */ -$.getUrlParam = function(name){ - var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); +$.getUrlParam = function(name) { + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r !== null) return unescape(r[2]); return null; }; @@ -35,6 +40,7 @@ $(function() { } } + /* 有参数,启动百度教程 */ if(!!query) { $tips.html('让我来教你正确的打开方式'); $stop.fadeIn(); @@ -59,7 +65,7 @@ $(function() { clearInterval(typeInterval); $tips.html('3、点击下“百度一下”按钮'); - $arrow.removeClass('active').show().animate({ + $arrow.removeClass('active').fadeIn().animate({ left: $searchSubmit.offset().left + $searchSubmit.width() / 2 + 'px', top: $searchSubmit.offset().top + $searchSubmit.height() / 2 + 'px' }, 1000, function () { @@ -94,11 +100,10 @@ $(function() { var question = $.trim($kw.val()); if(!question) { - $kw.val(''); $tips.html('搜了个寂寞?'); + $kw.val(''); } else { $tips.html('↓↓↓ 复制下面的链接,教伸手党使用百度'); - $('#output').fadeIn(); $urlOutput.val(window.location.origin + window.location.pathname + '?q=' + Base64.encode(question)).focus().select(); }