|
阅读:5912回复:18
火狐量子v68 手动加入搜索引擎遇到些问题 找后援团求解图片:screenshot_292_02-5021.png 图片:screenshot_292_02-5022.png
图片:screenshot_292_02-5023.png 图片:screenshot_292_02-5026.png
图片:screenshot_292_02-4319.png
手动加入搜索引擎到omni.ja中, fx死活只能识别其中的3个... 难道json有问题? 仔细检查了的啊. 应该如何解决呢 PS 知道Add custom search engine, mozlz4-edit, 但出于使用习惯, 只想添加引擎到omni.ja中. |
|
|
1楼#
发布于:2019-07-16 12:20
search.json.mozlz4 改完了 配置文件夹里删除重新生成下
|
|
|
2楼#
发布于:2019-07-16 21:01
|
|
|
3楼#
发布于:2019-07-16 22:28
我用这个脚本导入的,可以批量导入xml格式的搜索引擎。
https://gist.github.com/nohamelin/8e2e1b50dc7d97044992ae981487c6ec |
|
|
4楼#
发布于:2019-07-17 01:05
alanfly:我用这个脚本导入的,可以批量导入xml格式的搜索引擎。这个扩展我一直都备份着, 57以前的版本偶尔会用到, 但没注意还有这么好的脚本, 超级赞 PS 你说的批量倒入, 我怎么不能实现呢, 我全选了xml, 但却只有被选择的第一个被倒入了, 最后还是一个一个点击倒入 PPS 还是希望能解决顶楼的问题 PPPS 实际上我现在最头痛的是fast search里有百十来个搜索链, 真不知道如何批量倒入到火狐量子里 PPPPS 哈哈... |
|
|
5楼#
发布于:2019-07-18 17:58
|
|
|
6楼#
发布于:2019-07-19 19:08
|
|
|
7楼#
发布于:2019-07-19 19:55
|
|
|
8楼#
发布于:2019-07-19 20:17
|
|
|
9楼#
发布于:2019-07-19 21:00
lonely_8:将脚本中的改了后导入失效了。 try {
Services.search.addEngine(uri,
Ci.nsISearchEngine.DATA_XML,
"", // iconURL
false, // confirm
).then(searchInstallCallback.onSuccess, searchInstallCallback.onError);
} catch (e) {
// Try again without type parameter for Firefox 64+ (bug 1481199)
Services.search.addEngine(uri,
"", // iconURL
false, // confirm
).then(searchInstallCallback.onSuccess, searchInstallCallback.onError); |
|
|
10楼#
发布于:2019-07-19 21:34
|
|
|
11楼#
发布于:2019-07-19 22:24
lonely_8:FF 版本得 67 或以上。这个也改了后正常了,可以批量导入。 感谢。
发个完整的修改好的。 // -sp-context: browser
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*
* xseei.import.js
* ===============
* code-revision 2
* https://gist.github.com/nohamelin/8e2e1b50dc7d97044992ae981487c6ec
*
* ABOUT
* -----
* It's a minimal no-configurable no-localized single-file re-package of the
* "Import Search Engines from local OpenSearch XML File(s)" feature of the
* "XML Search Engines Exporter/Importer" (XSEEI) legacy add-on for Mozilla
* Firefox:
* https://addons.mozilla.org/firefox/addon/search-engines-export-import/
*
* ...to be used in those Firefox builds not supporting anymore legacy add-ons
* (i.e. Firefox 57 and later versions), where the unique system available
* to create extensions (called "WebExtensions") doesn't let to implement this
* functionality.
* As a bonus, it supports Gecko-comparable releases of the SeaMonkey suite
* too, that did not receive any official compatible release of the add-on.
*
* COMPATIBILITY
* -------------
* It has been checked to work with:
* - Firefox 57 to 64
* - Firefox ESR 60.0
* - SeaMonkey 2.49.1
*
* HOW TO RUN
* ----------
* It's expected to be run via the Javascript Scratchpad tool:
* https://developer.mozilla.org/en-US/docs/Tools/Scratchpad
*
* 1) Ensure you have enabled "Enable browser chrome and add-on debugging
* toolboxes" in the Developer Tools settings, or, alternatively, ensure
* that the preference *devtools.chrome.enabled* is true in about:config.
*
* 2) Open a *stand-alone* Scratchpad window, either using the Shift+F4
* keyboard shortcut or from the Web Developer submenu of the main
* Firefox menu.
* Using the embedded Scratchpad tab in the developer toolbox is NOT
* recommended: its behaviour is dependent of the type of content open
* in the active browser tab (web content will make this script to fail).
*
* 3) Use the "Open File..." command in the Scratchpad to load this file.
* A "This scratchpad executes in the Browser context" warning should be
* shown on top of the contents of the file. Otherwise, go to the
* "Environment" menu and ensure that "Browser" is selected.
*
* 4) Make sure there is no selected text in the editor, and use the command
* "Run". A file dialog will be open, to select one or more XML files in
* the OpenSearch format to be selected. After picking them, a Javascript
* dialog will be shown to confirm you the successful importing task.
* Otherwise, check the Browser Console by any related error messages.
*
* CONTACT
* -------
* You can use any of the provided support channels for the source add-on:
* https://github.com/nohamelin/xseei
* http://forums.mozillazine.org/viewtopic.php?f=48&t=3020165
*
* SEE ALSO
* --------
* xseei.export-all.js:
* https://gist.github.com/nohamelin/6af8907ca2dd90a9c870629c396c9521
*/
(function() {
"use strict";
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/osfile.jsm");
function importEnginesFromFiles() {
let fp = Cc["@mozilla.org/filepicker;1"]
.createInstance(Ci.nsIFilePicker);
fp.init(window,
"Select XML Search Engine Files",
Ci.nsIFilePicker.modeOpenMultiple);
fp.appendFilters(Ci.nsIFilePicker.filterXML);
fp.open({
done: result => {
if (result === Ci.nsIFilePicker.returnCancel)
return;
let xmlFiles = [];
let files = fp.files;
while (files.hasMoreElements()) {
let file = files.getNext().QueryInterface(Ci.nsIFile);
xmlFiles.push(file);
}
let importedEngines = [];
// The use of this empty promise lets us to run sequentially
// a group of promises, one for each engine. This process is
// not stopped if one or more promises are rejected in between.
let sequence = Promise.resolve();
xmlFiles.forEach(file => {
sequence = sequence.then(() => {
return addEngineFromXmlFile(file);
}).then(engine => {
importedEngines.push(engine);
}).catch(err => { // Each engine is reported separately
Cu.reportError(
"Import of a search engine from the file '" +
file.leafName + "' failed: " + err.message || err);
});
});
sequence.then(() => {
if (importedEngines.length > 0) {
if (xmlFiles.length === importedEngines.length) {
alert("Successful import");
} else {
alert(importedEngines.length + " of " + xmlFiles.length
+ " import tasks were successful");
}
}
}).catch(Cu.reportError);
}
});
}
function addEngineFromXmlFile(file) {
return new Promise((resolve, reject) => {
let uri = OS.Path.toFileURI(file.path);
let searchInstallCallback = {
onSuccess: engine => {
resolve(engine);
},
onError: errorCode => {
switch (errorCode) {
case Ci.nsISearchService.ERROR_DUPLICATE_ENGINE:
reject(Error("a search engine with the included " +
"name already exists"));
break;
case Ci.nsISearchService.ERROR_UNKNOWN_FAILURE:
default:
reject(Error("unknown error"));
break;
}
}
};
try {
Services.search.addEngine(uri,
Ci.nsISearchEngine.DATA_XML,
"", // iconURL
false, // confirm
).then(searchInstallCallback.onSuccess, searchInstallCallback.onError);
} catch (e) {
// Try again without type parameter for Firefox 64+ (bug 1481199)
Services.search.addEngine(uri,
"", // iconURL
false, // confirm
).then(searchInstallCallback.onSuccess, searchInstallCallback.onError);
}
});
}
// Run
importEnginesFromFiles();
})(); |
|
|
12楼#
发布于:2019-07-21 07:55
|
|
|
|
13楼#
发布于:2019-07-24 23:50
|
|
|
14楼#
发布于:2019-07-26 20:27
|
|
|
上一页
下一页
