Skip to content
DitherSky edited this page Mar 29, 2017 · 27 revisions

AutoPatchWork Mod Wiki

Пример интеграции с другими скриптами:
Scripts integration example:

Новый метод (первый - отдельный скрипт, второй в поле jsPatch в менеджере SITEINFO):
Newer method (first separate script secod using jsPatch in SITEINFO manager):

// ==UserScript==
// @include https://example.com/*
// ==/UserScript==

function handleNewPageLoad(event) {
    /* your code parsing event.detail.url or event.detail.htmlDoc or neither but before page appending*/
}
document.addEventListener('AutoPatchWork.load', handleNewPageLoad, false);
document.addEventListener('AutoPatchWork.pageloaded', function (event) { siteObject.loadThumbnails(); }, false);

Формат своих паттернов аналогичен оригинальному массиву SIEINFO в JSON:
Custom patterns are in JSON format that's similar to original SIEINFO array:

[
...
{
"pageElement":"id('test')/div[2]/table//tr",
"removeElement":"//nav[contains(concat(' ', @class, ' '), ' advertis ')]",
"url":"^http://test\\.net/(pages|catalog)/",
"nextLink":"//div[@class='test-pager']/a[text()='\\u00bb' or contains(., 'Next')]", 
"prevLink":"//div[@class='test-pager']/a[contains(text(), 'Previous')]", 
"alternatively_to_nextLink_-_nextMask": "http://test.net/pages/|1",
"disableSeparator":"true",
"forceAddressChange_comment":"this parameter inverts extension's global setting",
"forceAddressChange":true,
"forceIframe":false,
"paused": true,
"id": "1000000009",
"id_comment": "unique id is required for paused/reversed to work",
"reversed": true,
"cssPatch": ".page img { min-height:500px; }",
"jsPatch": "document.addEventListener('AutoPatchWork.pageloaded', function (event) { updThumbs(); }, false);"
},
...
]

FAQ

Q: Why there are multiple URL access permissions in the manifest file?
A: All of those sites are possible sources of SITEINFO database with the autopager patterns. They were added in case one of the sources goes offline. You can remove unused ones as well as clipboardWrite manually without losing any actual functionality.

Q: Some site is not working, what to do?
A: Check if SITEINFO database accessible from the provided DB URLs then verify if rule for the site is present in it and that the rule is correct for the current version of the site.

Clone this wiki locally