Skip to content
Dither edited this page Mar 2, 2012 · 27 revisions

AutoPatchWork for Opera Wiki

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

var onLoad = function(node) {
 ... here we have newly loaded page as "node" ...
var exampleSelQuery = node.querySelectorAll(selectors);
var exampleXPath = document.evaluate('//body/*[@class="sexy"]', node, null, 9, null);
 ... fixing something on that page ...
}
// Let's parse auto-added pages with our script
window.addEventListener('AutoPatchWork.DOMNodeInserted', function (e) { 
    onLoad(e.target); 
}, false);

Формат своих паттернов аналогичен оригинальному массиву в JSON:
Patterns are in JSON array format:

[
...
{
"pageElement":"id(\\"test\\")/div[2]/table//tr",
"url":"^http://test\\.net/(pages|catalog)/",
"nextLink":"//div[@class=\\"test-pager\\"]/a[.=\\"\\u00bb\\" or contains(., \\"Next\\")]", or "nextMask": "http://test.net/pages/|1",
"disableSeparator":"true",
"forceAddressChange":"true"
},
...
]
Clone this wiki locally