diff --git a/packages/shell-chrome/assets/js/advanced-search/background.js b/packages/shell-chrome/assets/js/advanced-search/background.js
index 44a63e8..062479b 100644
--- a/packages/shell-chrome/assets/js/advanced-search/background.js
+++ b/packages/shell-chrome/assets/js/advanced-search/background.js
@@ -43,186 +43,6 @@ chrome.contextMenus.create({
-/**
- * ****************************************************************************************
- *
- * app.js/base.js
- *
- * ****************************************************************************************
- */
-// 'use strict';
-
-const app = {};
-window.app = app;
-
-/* runtime */
-app.runtime = {
- on(e, callback) {
- if (e === 'start') {
- chrome.runtime.onStartup.addListener(callback);
- chrome.runtime.onInstalled.addListener(callback);
- }
- },
- get manifest() {
- return chrome.runtime.getManifest();
- },
- connect(tabId, connectInfo) {
- let port;
- if (typeof tabId === 'object') {
- port = chrome.runtime.connect(tabId);
- }
- else {
- port = chrome.tabs.connect(tabId, connectInfo);
- }
- return {
- on(e, callback) {
- if (e === 'message') {
- port.onMessage.addListener(callback);
- }
- },
- post(msg) {
- port.postMessage(msg);
- }
- };
- }
-};
-
-// /* storage */
-// app.storage = {
-// get(prefs, type = 'managed') {
-// return new Promise(resolve => {
-// if (type === 'managed') {
-// chrome.storage.managed.get(prefs, ps => {
-// chrome.storage.local.get(chrome.runtime.lastError ? prefs : ps || prefs, resolve);
-// });
-// }
-// else {
-// chrome.storage[type].get(prefs, resolve);
-// }
-// });
-// },
-// set(prefs, type = 'managed') {
-// return new Promise(resolve => {
-// chrome.storage[type === 'remote' ? 'remote' : 'local'].set(prefs, resolve);
-// });
-// },
-// on(e, callback) {
-// if (e === 'changed') {
-// chrome.storage.onChanged.addListener(callback);
-// }
-// }
-// };
-
-// /* button */
-// app.button = {
-// set({
-// popup
-// }, tabId) {
-// if (popup !== undefined) {
-// chrome.browserAction.setPopup({
-// tabId,
-// popup
-// });
-// }
-// },
-// on(e, callback) {
-// if (e === 'clicked') {
-// chrome.browserAction.onClicked.addListener(callback);
-// }
-// }
-// };
-
-// /* tab */
-// app.tabs = {
-// open({
-// url
-// }) {
-// return new Promise(resolve => chrome.tabs.create({ url }, resolve));
-// },
-// current() {
-// return new Promise(resolve => chrome.tabs.query({
-// active: true,
-// currentWindow: true
-// }, (tabs = []) => resolve(tabs[0])));
-// },
-// inject: {
-// js(tabId, details) {
-// if (typeof tabId === 'object') {
-// details = tabId;
-// tabId = undefined;
-// }
-// return new Promise((resolve, reject) => {
-// chrome.tabs.executeScript(tabId, Object.assign({
-// runAt: 'document_start'
-// }, details), results => {
-// const lastError = chrome.runtime.lastError;
-// if (lastError) {
-// reject(lastError);
-// }
-// else {
-// resolve(results);
-// }
-// });
-// });
-// },
-// css(tabId, details) {
-// if (typeof tabId === 'object') {
-// details = tabId;
-// tabId = undefined;
-// }
-// return new Promise((resolve, reject) => {
-// chrome.tabs.insertCSS(tabId, Object.assign({
-// runAt: 'document_start'
-// }, details), results => {
-// const lastError = chrome.runtime.lastError;
-// if (lastError) {
-// reject(lastError);
-// }
-// else {
-// resolve(results);
-// }
-// });
-// });
-// }
-// }
-// };
-
-// /* window */
-// app.windows = {
-// open({url, left, top, width, height, type}) {
-// width = width || 700;
-// height = height || 500;
-// if (left === undefined) {
-// left = screen.availLeft + Math.round((screen.availWidth - width) / 2);
-// }
-// if (top === undefined) {
-// top = screen.availTop + Math.round((screen.availHeight - height) / 2);
-// }
-// return new Promise(resolve => chrome.windows.create(
-// {url, width, height, left, top, type: type || 'popup'},
-// resolve
-// ));
-// }
-// };
-
-// /* menus */
-// app.menus = {
-// add(...items) {
-// for (const item of items) {
-// chrome.contextMenus.create(Object.assign({
-// contexts: item.contexts || ['browser_action']
-// }, item));
-// }
-// },
-// on(e, callback) {
-// if (e === 'clicked') {
-// chrome.contextMenus.onClicked.addListener(callback);
-// }
-// }
-// };
-
-
-
/**
* ****************************************************************************************
*
@@ -1005,7 +825,12 @@ function updateDefaultSuggestion(text) {
}
description.push(' ] ');
- description[2] = isPlaintext ? ('' + text.trim() + '') : ('' + omniboxSearchModes[0].showText + '');
+ if (text.trim().length != 0) {
+ description[2] = isPlaintext ? ('' + omniboxSearchModes[0].showText + ':' + text.trim() + '') : ('' + omniboxSearchModes[0].showText + '');
+ } else {
+ // 用户什么也没输入时,就高亮显示文字搜索关键字
+ description[2] = '' + omniboxSearchModes[0].showText + '';
+ }
console.log("[更新下拉框提示开始]");
console.log(" text:", text);
@@ -1037,44 +862,3 @@ function updateDefaultSuggestion(text) {
// description: description
// });
}
-
-
-// /**
-// * 执行搜索
-// * @param {*} query
-// * @param {*} callback
-// * @returns
-// */
-// function search(query, callback) {
-
-// var url = "https://code.google.com/p/chromium/codesearch#search/&type=cs&q=" + query +
-// "&exact_package=chromium&type=cs";
-// var req = new XMLHttpRequest();
-// req.open("GET", url, true);
-// req.setRequestHeader("GData-Version", "2");
-// req.onreadystatechange = function () {
-// if (req.readyState == 4) {
-// callback(req.responseXML);
-// }
-// }
-// req.send(null);
-// return req;
-// }
-
-
-/**
- * ****************************************************************************************
- *
- * 测试代码及其他
- *
- * ****************************************************************************************
- */
-
-/*
-先抛砖。未来在 Chrome 中输入:Chrome 过去1年最重要的变化? 知乎(或者zh)我们将带你进入问题页面,如果没有类似问题,就会直接提问。这个东西带来的想象力是,你可以用浏览器简单快捷的做不少事情,比如发微博,就输入「wb 知乎很给力」,京东购物,就输入「jd买 iPhone 4」。但很可能是一个相对小众的工具。
-
-作者:李申申
-链接:https://www.zhihu.com/question/19565733/answer/12236808
-来源:知乎
-著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
- */