Skip to content
Dither edited this page Feb 4, 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://(www\\\\.)?test\\.net/(test1|test2)\\\\.php",
"nextLink":"//div[@class=\\"test-pager\\"]/a[.=\\"\\u00bb\\" or contains(., \\"Next\\")]"
},
...
]
Clone this wiki locally