diff --git a/app/safari/img/360.png b/app/safari/img/360.png
new file mode 100644
index 0000000..a392761
Binary files /dev/null and b/app/safari/img/360.png differ
diff --git a/app/safari/img/favicon.ico b/app/safari/img/favicon.ico
new file mode 100644
index 0000000..71ad5f3
Binary files /dev/null and b/app/safari/img/favicon.ico differ
diff --git a/app/safari/img/ico_360.ico b/app/safari/img/ico_360.ico
new file mode 100644
index 0000000..023f5f2
Binary files /dev/null and b/app/safari/img/ico_360.ico differ
diff --git a/app/safari/img/ico_sogou.png b/app/safari/img/ico_sougou.png
similarity index 100%
rename from app/safari/img/ico_sogou.png
rename to app/safari/img/ico_sougou.png
diff --git a/app/safari/img/sogou.png b/app/safari/img/sougou.png
similarity index 100%
rename from app/safari/img/sogou.png
rename to app/safari/img/sougou.png
diff --git a/app/safari/index.html b/app/safari/index.html
index f88cb15..58762e1 100644
--- a/app/safari/index.html
+++ b/app/safari/index.html
@@ -1,32 +1,35 @@
+
-
-仿浏览器主页搜索
-
+
+
+
+ 浏览器主页搜索
+
+
+
+
+
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/safari/js/index.js b/app/safari/js/index.js
index 7b38b0e..163075a 100644
--- a/app/safari/js/index.js
+++ b/app/safari/js/index.js
@@ -5,11 +5,38 @@ var helangSearch = {
color: ['#ff2c00', '#ff5a00', '#ff8105', '#fd9a15', '#dfad1c', '#6bc211', '#3cc71e', '#3cbe85', '#51b2ef', '#53b0ff'],
list: ['木子的忧伤', 'macUI', '猿码云', 'apecloud.cn', 'win10ui', 'https://github.com/1099438829/macUI']
},
- searchArr : [
- 'https://www.baidu.com/s?ie=UTF-8&wd=',//百度
- 'https://www.sogou.com/web?query=', //搜狗
- 'https://cn.bing.com/search?q=', //必应
- 'https://www.google.com/search?q=',//谷歌
+ searchObj : [
+ //废弃百度,百度不允许iframe
+ // {
+ // logo : 'img/baidu.png',
+ // ico : 'img/ico_baidu.png',
+ // title : '百度',
+ // url : 'https://www.baidu.com/s?wd=',
+ // },
+ {
+ logo : 'img/sougou.png',
+ ico : 'img/ico_sougou.png',
+ title : '搜狗',
+ url : 'https://www.sogou.com/web?query=',
+ },
+ {
+ logo : 'img/360.png',
+ ico : 'img/ico_360.ico',
+ title : '360',
+ url : 'https://www.so.com/s?ie=utf-8&q=',
+ },
+ {
+ logo : 'img/bing.png',
+ ico : 'img/ico_bing.png',
+ title : '必应',
+ url : 'https://cn.bing.com/search?q=',
+ },
+ {
+ logo : 'img/google.png',
+ ico : 'img/ico_google.ico',
+ title : '谷歌',
+ url : 'https://www.google.com/search?q=',
+ },
],
init: function() {
var _this = this;
@@ -21,13 +48,29 @@ var helangSearch = {
input: $("#search-input"),
button: $(".search")
};
- this.els.hotList.html(function() {
+ function renderHotList(){
+ _this.els.hotList.html(function() {
+ var str = '';
+ $.each(_this.hot.list, function(index, item) {
+ str += '' + '' + (index + 1) + '
' + '' + item + '
' + '';
+ });
+ return str;
+ });
+ };
+ this.els.pickerList.html(function() {
var str = '';
- $.each(_this.hot.list, function(index, item) {
- str += '' + '' + (index + 1) + '
' + '' + item + '
' + '';
+ $.each(_this.searchObj, function(index,item) {
+ str += '' + item.title + '';
});
return str;
});
+ var firstSearchObj = _this.searchObj[0];
+ this.els.logo.css("background-image",'url('+ firstSearchObj.logo +')');
+ this.els.pickerBtn.text(function() {
+ renderHotList();
+ return firstSearchObj.title;
+ });
+
this.els.pickerBtn.click(function() {
if (_this.els.pickerList.is(':hidden')) {
setTimeout(function() {
@@ -36,9 +79,10 @@ var helangSearch = {
}
});
this.els.pickerList.on("click", ">li", function() {
- _this.els.logo.css("background-image", ('url(img/' + $(this).data("logo") + ')'));
+ _this.els.logo.css("background-image", ('url(' + $(this).data("logo") + ')'));
_this.searchIndex = $(this).index();
- _this.els.pickerBtn.html($(this).html())
+ _this.els.pickerBtn.html($(this).html());
+ renderHotList();
});
this.els.input.click(function() {
if (!$(this).val()) {
@@ -53,7 +97,7 @@ var helangSearch = {
}
});
this.els.button.click(function() {
- location.href = _this.searchArr[_this.searchIndex] + _this.els.input.val();
+ location.href = _this.searchObj[_this.searchIndex].url + _this.els.input.val();
});
$(document).click(function() {
_this.els.pickerList.hide();
diff --git a/demo.html b/demo.html
index a94ffff..e2da102 100644
--- a/demo.html
+++ b/demo.html
@@ -20,9 +20,6 @@
@@ -38,6 +35,11 @@
OS官网
+
+

+
safari
+

@@ -139,21 +141,17 @@
diff --git a/img/icon/safari.png b/img/icon/safari.png
new file mode 100644
index 0000000..cd174de
Binary files /dev/null and b/img/icon/safari.png differ
diff --git a/index.html b/index.html
index cce12ae..18a91a3 100644
--- a/index.html
+++ b/index.html
@@ -19,7 +19,6 @@