hpsu / nzbget-chrome

Google chrome extension to interact with nzbget
28 stars 23 forks source link

Add Binsearch and NzbIndex.com #32

Closed Diak closed 8 years ago

Diak commented 9 years ago

Hi,

This extension lacks of two main indexer websites integration :

These two indexer are promoted by Better Usenet extension so it would be great to have the integration in nzbget-chrome extension :)

Diak commented 9 years ago

I modified some files to be compatible with nzbindex.com and to add the functionality for binsearch.

manifest.json :

{
    "background": {
        "scripts": [ "js/nzbget.js", "js/utilities.js" ]
    },
    "description": "Interact with and send NZB-files to NZBGet",
    "icons": {
        "16": "img/icon16.png"
        ,"19": "img/icon19.png"
        ,"38": "img/icon38.png"
        ,"48": "img/icon48.png"
    },
    "manifest_version": 2,
    "web_accessible_resources": [
        "img/icon16.png"
        ,"img/nzbget-arrow.svg"
    ],
    "name": "nzbget-chrome",
    "options_page": "options.html",
    "permissions": [ "*://*/", "contextMenus", "tabs", "notifications", "storage", "background" ],
    "version": "1.2.1",
    "browser_action": {
        "default_icon": "img/icon38.png",
        "default_popup": "popup.html"
    },
    "content_scripts": [
        {
            "matches": [ "*://*.feedly.com/*" ]
            ,"js": [ "sites/common.js", "sites/feedly.js" ]
            ,"css": [ "sites/common.css" ]
        },{
            "matches": [ "*://*.nzbclub.com/*" ]
            ,"js": [ "sites/common.js", "sites/nzbclub.js" ]
            ,"css": [ "sites/common.css" ]
        },{
            "matches": [ "*://*.nzbindex.nl/*" ]
            ,"js": [ "sites/common.js", "sites/nzbindex.js" ]
            ,"css": [ "sites/common.css" ]
        },{
            "matches": [ "*://*.nzbindex.com/*" ]
            ,"js": [ "sites/common.js", "sites/nzbindex.js" ]
            ,"css": [ "sites/common.css" ]
        },{
            "matches": [ "*://*.fanzub.com/*" ]
            ,"js": [ "sites/common.js", "sites/fanzub.js" ]
            ,"css": [ "sites/common.css" ]
        },{
            "matches": [ "*://*.dognzb.cr/*" ]
            ,"js": [ "sites/common.js", "sites/dognzb.js" ]
            ,"css": [ "sites/common.css" ]
        },{
            "matches": [ "*://*.binsearch.info/*" ]
            ,"js": [ "sites/common.js", "sites/binsearch.js" ]
            ,"css": [ "sites/common.css" ]
        }
    ]
}

binsearch.js :

/**
 * Inject nzbgc-markup to binsearch.info
 */

var chks = document.getElementsByTagName('input');
var l = chks.length;

for (var i=0, m=chks.length; i<m; i++)
{
    var chb = chks[i];
    var category = '', lid = '';
    if (chb.type == 'checkbox' && !isNaN(chb.name))
    {       
        if(chb.value) lid = chb.name;

        newitem = createNgIcon(
            lid+'_nzbgc',
            'https://www.binsearch.info/?action=nzb&' + lid + '=1', 
            category
        );

        newitem.style.verticalAlign='middle';
        newitem.style.paddingRight='4px';

        var bf = chb.parentNode.parentNode.getElementsByTagName('input');

        if (bf.length)
        {
            bf[0].parentNode.insertBefore(newitem, bf[0]);
        }
    }
}
Diak commented 9 years ago

The problem i still have is that i use better-usenet extension too and on binsearch.info, i cannot click on the nzbget-chrome icon to download because better-usenet extension check the checkbox and don't let the icon be clickable. Maybe you will find a solution to this problem.

hpsu commented 9 years ago

I recently implemented binsearch support personal use, before seeing your code. commit 8a319594571e52a77ada8ad081b97037996a1eb5

Please check if my implementation solves your issue.

Diak commented 9 years ago

Unfortunately, your implementation suffers the same problem. Associated with better usenet 1.934 extension, i cannot click on download button because it checks the line instead of clocking on your button.

Don't hesitate to tell me if you want me to test and thanks for the job by the way :)

hpsu commented 8 years ago

Better usenet hijacks the table row click event and prevents upward bubbling on all elements except links.

2b987481c75a785a287591536f5d10cf13257d04 should work around the problem by wrapping the icon in an a-element.