Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Greasemonkey Search Provider Script for XG 2 #48

Open
Freedos opened this issue Apr 12, 2014 · 2 comments
Open

Greasemonkey Search Provider Script for XG 2 #48

Freedos opened this issue Apr 12, 2014 · 2 comments

Comments

@Freedos
Copy link

Freedos commented Apr 12, 2014

I found this great Greasemonkey userscript fpr XG 2:
http://userscripts.org/scripts/show/187324

I didn't modified it for XG 3 since 3 isn't working on my setup but maybe Lars wants to add it in his next version?

I also added ixIRC to it and fixed some bugs:

SearchProvider.Create("XDCC Finder", "http://www.xdccfinder.com/results.php?kw={0}&bt=&ch=&nw=&order=2&s={1}", function(self, responseDoc)
{
    var table = responseDoc.getElementById("tables");
    var results = [];
    for(var i = 1; i < table.rows.length; i += 2)
    {
        var tr = table.rows[i];
        results.push(new XGDownloadLink(
            tr.cells[5].children[0].href.substr(6, tr.cells[5].children[0].href.lastIndexOf("/")-5),
            tr.cells[1].children[0].textContent,
            tr.cells[2].children[0].textContent,
            tr.nextSibling.cells[0].children[2].children[1].textContent,
            tr.cells[5].children[0].textContent,
            tr.cells[0].children[0].title,
            tr.cells[3].textContent));  
    }
    return { items: results, pageCount: 10 }; responseDoc.getElementById("pagination").lastChild.previousSibling.textContent.trim()
}, function(page)
{
    return (page - 1) * 20;
});

SearchProvider.Create("ixIRC", "http://ixirc.com/?q={0}&pn={1}", function(self, responseDoc)
{
    var table = responseDoc.getElementById("results-table");
    var results = [];
    for(var i = 1; i < table.rows.length; i += 2)
    {
        var tr = table.rows[i];
        results.push(new XGDownloadLink(
            tr.cells[0].children[0].href.substr(6, tr.cells[0].children[0].href.lastIndexOf("/")-5),
            tr.cells[1].children[0].textContent,
            tr.cells[2].children[0].textContent,
            tr.cells[3].children[0].textContent,
            tr.cells[4].textContent,
            tr.cells[0].children[1].textContent,
            tr.cells[6].textContent));  
    }
    return { items: results, pageCount: 10}; //responseDoc.getElementsByClassName("page-numbers").lastChild.textContent -1
});
@lformella
Copy link
Owner

Is http://www.xdccfinder.com down / for sale?

@lformella
Copy link
Owner

It would be better to update the already embedded xg.bitpir.at service to use other search engines, too. If some engine goes down or there is a new one, you just have to add them in one place and all XG versions out there can use the updated engines.

You just have to patch the external function in the search controller (https://github.com/lformella/xg.bitpir.at/blob/master/XG/Classes/Controller/Search.php). Maybe there should be an extra function to get all engines and be able to select one when searching. Unfortunately some engines do not support sort by and to control the number of results. So there should be a possibility to disable this if it is not supported with your selected engine.

Do you know PHP? It would be great if somebody could develop the xg.bitpir.at part :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants