# Search Plugins
Locale-based search engines are imported from the Android l10n repos. To import the latest set of plugins, execute the `./scrape_plugins.py` script.
*Do not make changes to `SearchPlugins.plist` -- these changes will be overwritten on the next import!* If you need to make changes to search plugins, you have the following options (in preferred order):
1. Update the plugin directly in the Android l10n repos. This is preferred if your changes apply to both platforms. Since the iOS engines are imported from Android, any changes to the Android l10n repos will be picked up here when the import script is run.
2. Define an overlay. Overlays allow local, iOS-specific modifications to be applied after the files are imported.
## Overlays
### Background
For the most part, the engines are the same on both platforms. There are, however, certain iOS-specific changes that we want to make to some of the engines. Previously, we would modify the engine XML files directly, but this made it difficult to re-import the engines from Android without losing our local changes.
To address this, we've added support for search engine overlays. These are XML files located in the `SearchOverlays` directory that contain document transformations to be applied after each import.
#### Usage
To add an overlay, append the overlay definition to the corresponding XML file (or create it if it doesn't exist) in the search engine in the `SearchOverlays` directory. The overlay file name is based on the plugin file name used in `list.json`; for example, to create a Yahoo overlay, we would add an overlay to `SearchOverlays/yahoo.xml`.
Overlay files have the following structure:
```
<SearchOverlay>
<append parent="//search:Url[@type='text/html']">
<!-- Child node to append -->
</append>
<replace target="//search:Image">
<!-- Replacement node -->
</append>
</SearchOverlay>
```
The root node of an overlay document must be a `SearchOverlay` element. It can have any number of `<append>` or `<replace>` nodes, which will perform those respective actions on the engine matching this file.
### API
##### append
* Node name: `append`
* Required attribute: `parent` - The value for `parent` is an XPath expression identifying elements in the search plugin XML. Note that all nodes must be prefixed by the `search` namespace.
* Children: `append` must have exactly one child element; the element may have any number of children. This element will be appended to any elements matching the `parent` XPath expression.
##### replace
* Node name: `replace`
* Required attribute: `target` - The value for `target` is an XPath expression identifying elements in the search plugin XML. Note that all nodes must be prefixed by the `search` namespace.
* Children: `replace` must have exactly one child element; the element may have any number of children. This element will replace any elements matching the `target` XPath expression.
### Tests
Execute `./run_tests.py` to run tests. This uses test files in the `Tests` directory to check overlay behavior.
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
_Firefox_Focus_(iOS)_has_moved_to_a_new_ (1537个子文件)
CODEOWNERS 1KB
style.css 212B
Dangerfile 2KB
effective_tld_names.dat 158KB
Dockerfile 1KB
Focus.entitlements 350B
FocusIntentExtension.entitlements 350B
Klar.entitlements 349B
FocusEnterprise.entitlements 315B
KlarEnterprise.entitlements 314B
Gemfile 204B
.gitignore 789B
.gitignore 126B
.gitignore 56B
.gitmodules 0B
Deferred.h 496B
XCUITests-Bridging-Header.h 469B
gpl.html 37KB
licenses.html 20KB
errorPage.html 1KB
requirements.in 168B
Intents.intentdefinition 2KB
FindInPage.js 10KB
MetadataHelper.js 7KB
Ads.js 2KB
preload.js 2KB
FullScreen.js 2KB
postload.js 645B
disconnect-content.json 868KB
disconnect-advertising.json 381KB
disconnect-analytics.json 62KB
disconnect-social.json 57KB
list.json 20KB
Contents.json 3KB
Contents.json 3KB
Contents.json 3KB
Contents.json 3KB
Contents.json 1KB
Contents.json 1KB
Contents.json 1KB
Contents.json 695B
Contents.json 695B
Contents.json 692B
Contents.json 692B
Contents.json 692B
Contents.json 692B
Contents.json 692B
Contents.json 692B
Contents.json 692B
Contents.json 692B
Contents.json 692B
Contents.json 692B
Contents.json 692B
Contents.json 692B
Contents.json 689B
Contents.json 689B
Contents.json 689B
Contents.json 689B
Contents.json 689B
Contents.json 689B
Contents.json 689B
Contents.json 689B
Contents.json 689B
Contents.json 689B
Contents.json 488B
Contents.json 488B
Contents.json 465B
Contents.json 463B
Contents.json 462B
Contents.json 457B
Contents.json 455B
Contents.json 453B
Contents.json 443B
Contents.json 442B
Contents.json 440B
Contents.json 435B
Contents.json 433B
Contents.json 433B
Contents.json 433B
Contents.json 432B
Contents.json 432B
Contents.json 432B
Contents.json 432B
Contents.json 431B
Contents.json 431B
Contents.json 431B
Contents.json 431B
Contents.json 431B
Contents.json 431B
Contents.json 430B
Contents.json 429B
Contents.json 429B
Contents.json 429B
Contents.json 429B
Contents.json 428B
Contents.json 427B
Contents.json 427B
Contents.json 427B
Contents.json 426B
Contents.json 426B
共 1537 条
- 1
- 2
- 3
- 4
- 5
- 6
- 16
资源评论
好家伙VCC
- 粉丝: 2103
- 资源: 9145
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功