skytalk
热心会员
热心会员
  • UID32994
  • 注册日期2010-06-06
  • 最后登录2023-07-07
  • 发帖数652
  • 经验1061枚
  • 威望3点
  • 贡献值1292点
  • 好评度154点
  • 社区居民
  • 忠实会员
阅读:3749回复:18

火狐量子v68 手动加入搜索引擎遇到些问题 找后援团求解

楼主#
更多 发布于:2019-07-16 11:07
 

图片: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中.
谷歌大法好
狐狸大王
狐狸大王
  • UID49692
  • 注册日期2015-04-11
  • 最后登录2023-10-15
  • 发帖数344
  • 经验353枚
  • 威望0点
  • 贡献值282点
  • 好评度26点
  • 社区居民
  • 忠实会员
1楼#
发布于:2019-07-16 12:20
search.json.mozlz4  改完了 配置文件夹里删除重新生成下
skytalk
热心会员
热心会员
  • UID32994
  • 注册日期2010-06-06
  • 最后登录2023-07-07
  • 发帖数652
  • 经验1061枚
  • 威望3点
  • 贡献值1292点
  • 好评度154点
  • 社区居民
  • 忠实会员
2楼#
发布于:2019-07-16 21:01
谷歌大法好:search.json.mozlz4  改完了 配置文件夹里删除重新生成下回到原帖
不是这个问题, 不单单改完后清理search.json.mozlz4, 连整个配置文件目录都清空了, 依然只能识别这三个
alanfly
千年狐狸
千年狐狸
  • UID31035
  • 注册日期2009-11-10
  • 最后登录2023-10-31
  • 发帖数2765
  • 经验576枚
  • 威望1点
  • 贡献值128点
  • 好评度98点
  • 社区居民
  • 最爱沙发
  • 忠实会员
3楼#
发布于:2019-07-16 22:28
我用这个脚本导入的,可以批量导入xml格式的搜索引擎。
https://gist.github.com/nohamelin/8e2e1b50dc7d97044992ae981487c6ec
skytalk
热心会员
热心会员
  • UID32994
  • 注册日期2010-06-06
  • 最后登录2023-07-07
  • 发帖数652
  • 经验1061枚
  • 威望3点
  • 贡献值1292点
  • 好评度154点
  • 社区居民
  • 忠实会员
4楼#
发布于:2019-07-17 01:05
alanfly:我用这个脚本导入的,可以批量导入xml格式的搜索引擎。
https://gist.github.com/nohamelin/8e2e1b50dc7d97044992ae981487c6ec
回到原帖
这个扩展我一直都备份着, 57以前的版本偶尔会用到, 但没注意还有这么好的脚本, 超级赞
PS 你说的批量倒入, 我怎么不能实现呢, 我全选了xml, 但却只有被选择的第一个被倒入了, 最后还是一个一个点击倒入
PPS 还是希望能解决顶楼的问题
PPPS 实际上我现在最头痛的是fast search里有百十来个搜索链, 真不知道如何批量倒入到火狐量子里
PPPPS 哈哈...
alanfly
千年狐狸
千年狐狸
  • UID31035
  • 注册日期2009-11-10
  • 最后登录2023-10-31
  • 发帖数2765
  • 经验576枚
  • 威望1点
  • 贡献值128点
  • 好评度98点
  • 社区居民
  • 最爱沙发
  • 忠实会员
5楼#
发布于:2019-07-18 17:58
skytalk:这个扩展我一直都备份着, 57以前的版本偶尔会用到, 但没注意还有这么好的脚本, 超级赞
PS 你说的批量倒入, 我怎么不能实现呢, 我全选了xml, 但却只有被选择的第一个被倒入了, 最后还是一个一个点击倒入
PPS 还是希望能解决顶...
回到原帖
我照脚本里步骤弄的,不知道为什么你那不可以批量导入。
以前都是用searchplugins文件夹内的xml文件自定义搜索引擎,突然发现失效了就去找了找,才发现这个脚本。
skytalk
热心会员
热心会员
  • UID32994
  • 注册日期2010-06-06
  • 最后登录2023-07-07
  • 发帖数652
  • 经验1061枚
  • 威望3点
  • 贡献值1292点
  • 好评度154点
  • 社区居民
  • 忠实会员
6楼#
发布于:2019-07-19 19:08
alanfly:我照脚本里步骤弄的,不知道为什么你那不可以批量导入。
以前都是用searchplugins文件夹内的xml文件自定义搜索引擎,突然发现失效了就去找了找,才发现这个脚本。
回到原帖
我是这样操作的:
devtools.chrome.enabled;true
shift+f4, ctrl+o, 载入xseei.Import.js, ctrl+r, ctrl+a, enter, 结果只载入一个xml...
alanfly
千年狐狸
千年狐狸
  • UID31035
  • 注册日期2009-11-10
  • 最后登录2023-10-31
  • 发帖数2765
  • 经验576枚
  • 威望1点
  • 贡献值128点
  • 好评度98点
  • 社区居民
  • 最爱沙发
  • 忠实会员
7楼#
发布于:2019-07-19 19:55
skytalk:我是这样操作的:
devtools.chrome.enabled;true
shift+f4, ctrl+o, 载入xseei.Import.js, ctrl+r, ctrl+a, enter, 结果只载入一个xml...
回到原帖
新建了个profile试了下,的确不能批量导入了。
可能firefox升级导致的。
lonely_8
非常火狐
非常火狐
  • UID30273
  • 注册日期2009-09-03
  • 最后登录2022-08-09
  • 发帖数733
  • 经验469枚
  • 威望0点
  • 贡献值86点
  • 好评度147点
  • 社区居民
  • 忠实会员
8楼#
发布于:2019-07-19 20:17
alanfly:新建了个profile试了下,的确不能批量导入了。
可能firefox升级导致的。
回到原帖
将脚本中的
searchInstallCallback);
改为
).then(searchInstallCallback.onSuccess, searchInstallCallback.onError);
试试。
alanfly
千年狐狸
千年狐狸
  • UID31035
  • 注册日期2009-11-10
  • 最后登录2023-10-31
  • 发帖数2765
  • 经验576枚
  • 威望1点
  • 贡献值128点
  • 好评度98点
  • 社区居民
  • 最爱沙发
  • 忠实会员
9楼#
发布于:2019-07-19 21:00
lonely_8:将脚本中的
searchInstallCallback);
改为
).then(searchInstallCallback.onSuccess, searchInstallCallback.onError);
试试。
回到原帖
改了后导入失效了。
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);
lonely_8
非常火狐
非常火狐
  • UID30273
  • 注册日期2009-09-03
  • 最后登录2022-08-09
  • 发帖数733
  • 经验469枚
  • 威望0点
  • 贡献值86点
  • 好评度147点
  • 社区居民
  • 忠实会员
10楼#
发布于:2019-07-19 21:34
alanfly:改了后导入失效了。
try {
    Services.search.addEngine(uri,
                              Ci.nsISearchEngine.DATA_XML,
      ...
回到原帖
FF 版本得 67 或以上。
或者你可能导入了一个跟 FF 内置同名的引擎(即使你已经删掉这个内置引擎)
由于脚本中还有一处错误没修过,脚本出错导致全部导入失败:
Ci.nsISearchInstallCallback
改为

Ci.nsISearchService


alanfly
千年狐狸
千年狐狸
  • UID31035
  • 注册日期2009-11-10
  • 最后登录2023-10-31
  • 发帖数2765
  • 经验576枚
  • 威望1点
  • 贡献值128点
  • 好评度98点
  • 社区居民
  • 最爱沙发
  • 忠实会员
11楼#
发布于:2019-07-19 22:24
lonely_8:FF 版本得 67 或以上。
或者你可能导入了一个跟 FF 内置同名的引擎(即使你已经删掉这个内置引擎)
由于脚本中还有一处错误没修过,脚本出错导致全部导入失败:
Ci.nsISearchInstallCallback
改为

...
回到原帖
这个也改了后正常了,可以批量导入。

感谢。






发个完整的修改好的。
// -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();
 
})();
kmc
kmc
管理员
管理员
  • UID165
  • 注册日期2004-11-25
  • 最后登录2022-09-22
  • 发帖数9186
  • 经验397枚
  • 威望1点
  • 贡献值124点
  • 好评度41点
  • 忠实会员
  • 终身成就
  • 社区居民
12楼#
发布于:2019-07-21 07:55
后援团
Waterfox Current和Firefox Nightly都用,逐渐走出XUL扩展依赖
skytalk
热心会员
热心会员
  • UID32994
  • 注册日期2010-06-06
  • 最后登录2023-07-07
  • 发帖数652
  • 经验1061枚
  • 威望3点
  • 贡献值1292点
  • 好评度154点
  • 社区居民
  • 忠实会员
13楼#
发布于:2019-07-24 23:50
kmc:后援团回到原帖
不就是因为这三个字, 版大才进来的吗,
我现在老版本/新版本混着用了, 但还是主用57以前的版本, 不知道你是不是这样
PS v68时不时会备份个人数据, 不知道如何禁止, 在网上也没查到, 火狐量子有点多管闲事了
kmc
kmc
管理员
管理员
  • UID165
  • 注册日期2004-11-25
  • 最后登录2022-09-22
  • 发帖数9186
  • 经验397枚
  • 威望1点
  • 贡献值124点
  • 好评度41点
  • 忠实会员
  • 终身成就
  • 社区居民
14楼#
发布于:2019-07-26 20:27
skytalk:不就是因为这三个字, 版大才进来的吗,
我现在老版本/新版本混着用了, 但还是主用57以前的版本, 不知道你是不是这样
PS v68时不时会备份个人数据, 不知道如何禁止, 在网上也没查到, 火狐量子有点多管闲事了
回到原帖
我投奔Waterfox了。新的Waterfox Alpha我还没怎么测试。
Waterfox Current和Firefox Nightly都用,逐渐走出XUL扩展依赖
上一页
游客

返回顶部