var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push({
    name:'eBay',
    version:'0.4',
    prepareImgLinks:function (callback) {
        var res = [];
        var appId = 'RomainVa-3007-4951-b943-aaedf0d9af84';
        var requestUrlBase = 'http://open.api.ebay.com/shopping?appid=' + appId + '&version=687&siteid=0&callname=GetMultipleItems&responseencoding=JSON&ItemID=';
        var itemIndex = 0;
        var hzItems = [], itemIds = [];
        //var cachePrefix = 'cache_eBayItem_' + (options.showHighRes ? 'hi' : 'lo') + '_';

        function getIdFromURL(url) {
            if (!url) {
                return false;
            }
            var reg = url.match(/\d{9,12}/);
            if (!reg) {
                return false;
            }
            return reg[0];
        }

        // First we gather all the products on the page and we store their eBay ID and
        // the link that will receive the 'hoverZoomSrc' data.
        $('div[itemscope] img[src*="i.ebayimg.com"]').each(function () {
            var img = $(this);
            var item = { thumb: this, id: '' },
                link = img.parents('div[itemscope]');
            item.id = getIdFromURL(link.data('href'));
            if (item.id) {
                itemIds.push(item.id);
                hzItems.push(item);
            }
        });
        $('a img[src*="i.ebayimg.com"], a img[src*="thumbs.ebaystatic.com"]').each(function () {
            var img = $(this);
            var item = { thumb: this, id: '' },
                link = img.parents('a');
            item.id = getIdFromURL(link.attr('href'));
            if (item.id) {
                itemIds.push(item.id);
                hzItems.push(item);
            }
        });

        // Check if some urls were stored
        //for (var i = 0; i < hzItems.length; i++) {
        //    var storedItem = localStorage[cachePrefix + hzItems[i].id];
        //    if (storedItem) {
        //        storedItem = JSON.parse(storedItem);
        //        var thumb = $(hzItems[i].thumb), data = thumb.data();
        //        data.hoverZoomSrc = [storedItem.pictureUrl];
        //        data.hoverZoomCaption = storedItem.title;
        //        res.push(thumb);
        //        hzItems.splice(i, 1);
        //        i--;
        //    }
        //}
        //if (res.length > 0) {
        //    callback($(res));
        //    res = [];
        //}

        // Then we make calls to the eBay API to get details on the items
        // using the IDs we found
        function getItems() {

            // Each call can get a maximum number of 20 items, so we have to iterate
            var indexEnd = Math.min(itemIndex + 20, itemIds.length);
            var itemBunch = itemIds.slice(itemIndex, indexEnd);
            itemIndex = indexEnd;
            var requestUrl = requestUrlBase + itemBunch.join(',');
            //console.log('requestUrl: ' + requestUrl);

            // Ajax calls are made through the background page (not possible from a content script)
            chrome.runtime.sendMessage({action:'ajaxGet', url:requestUrl}, function (data) {
                //console.log(data);
                var getMultipleItemsResponse = JSON.parse(data);
                if (getMultipleItemsResponse.Errors)
                    return;
                for (var i = 0; i < getMultipleItemsResponse.Item.length; i++) {
                    var item = getMultipleItemsResponse.Item[i];
                    //console.log(item);
                    for (var j = 0; j < hzItems.length; j++) {
                        if (hzItems[j].id == item.ItemID && item.PictureURL && item.PictureURL.length > 0) {
                            var thumb = $(hzItems[j].thumb), data = thumb.data();//, url = item.PictureURL[0].replace(/~~(\d+)?_\d+\./, '~~$1_32.');
                            if (item.PictureURL.length == 1) {
                                var url = item.PictureURL[0];
                                data.hoverZoomSrc = [url];
                                data.hoverZoomCaption = item.Title;
                            } else {
                                data.hoverZoomGallerySrc = [];
                                data.hoverZoomGalleryCaption = [];
                                for (var k = 0; k < item.PictureURL.length; k++) {
                                    var url = item.PictureURL[k];
                                    data.hoverZoomGallerySrc.push([url]);
                                    data.hoverZoomGalleryCaption.push(item.Title);
                                }
                            }
                            //console.log(thumb);
                            res.push(thumb);

                            // Items are stored to lessen API calls
                            //localStorage[cachePrefix + item.ItemID] = JSON.stringify({pictureUrl:url, title:item.Title});
                        }
                    }
                }
                callback($(res));
                res = [];
                if (itemIndex < itemIds.length) {
                    // Continue with the next 20 items
                    getItems();
                }
            });
        }

        if (hzItems.length > 0) {
            getItems();
        }
    }
});

@@ -96,17 +96,17 @@
 sion:'0.
-4
+5
 ',%0A    p
@@ -454,24 +454,25 @@
 s = %5B%5D;%0A
+%0A
         
 //var ca
@@ -467,89 +467,155 @@
     
-//var cachePrefix = 'cache_eBayItem_' + (options.showHighRes ? 'hi' : 'lo') + '_'
+hoverZoom.urlReplace(res,%0A            'img%5Bsrc%5D',%0A            /%5C/s-l%5Cd+%5C./,%0A            '/s-l1600.'%0A        );%0A%0A        callback($(res), this.name)
 ;%0A%0A 
@@ -1400,32 +1400,41 @@
   %7D%0A        %7D);%0A
+        %0A
         $('a img
@@ -1817,25 +1817,24 @@
     %7D);%0A
-%0A
         
 // Check
@@ -1829,677 +1829,8 @@
     
-// Check if some urls were stored%0A        //for (var i = 0; i %3C hzItems.length; i++) %7B%0A        //    var storedItem = localStorage%5BcachePrefix + hzItems%5Bi%5D.id%5D;%0A        //    if (storedItem) %7B%0A        //        storedItem = JSON.parse(storedItem);%0A        //        var thumb = $(hzItems%5Bi%5D.thumb), data = thumb.data();%0A        //        data.hoverZoomSrc = %5BstoredItem.pictureUrl%5D;%0A        //        data.hoverZoomCaption = storedItem.title;%0A        //        res.push(thumb);%0A        //        hzItems.splice(i, 1);%0A        //        i--;%0A        //    %7D%0A        //%7D%0A        //if (res.length %3E 0) %7B%0A        //    callback($(res));%0A        //    res = %5B%5D;%0A        //%7D%0A
 %0A   
@@ -2299,53 +2299,8 @@
     
- //console.log('requestUrl: ' + requestUrl);%0A
 %0A   
@@ -2509,28 +2509,8 @@
     
-//console.log(data);
 %0A   
@@ -2822,28 +2822,8 @@
     
-//console.log(item);
 %0A   
@@ -3076,75 +3076,8 @@
 a();
-//, url = item.PictureURL%5B0%5D.replace(/~~(%5Cd+)?_%5Cd+%5C./, '~~$1_32.');
 %0A   
@@ -3894,29 +3894,8 @@
     
-//console.log(thumb);
 %0A   
@@ -4187,32 +4187,32 @@
               %7D%0A
-
                 
@@ -4226,16 +4226,27 @@
 k($(res)
+, this.name
 );%0A     

Fix for ebay plug-in