MyEbay Watcher

Show new views and observer in my ebay selling overview

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         MyEbay Watcher
// @version      0.1
// @description  Show new views and observer in my ebay selling overview
// @author       Sebastian Löscher
// @match        http*://my.ebay.de/*MyeBayNextSelling*
// @grant        none
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js
// @namespace https://greasyfork.org/users/159643
// ==/UserScript==

$(function() {
    $(".my_itl-iT tbody tr.my_itl-itR").each(function() {
        var articleId = $(this).find('input').get(0).value;
        var articleViews = $(this).children('td:nth-child(4)').children('p:first-child').text();
        var articleObserver = $(this).children('td:nth-child(4)').children('p:nth-child(2)').text();

        var loadedArticle = null;
        if (typeof GM_getValue == "function") {
            loadedArticle = GM_getValue('ebaywatcher_' + articleId);
        }

        if (window.chrome) {
            loadedArticle = $.parseJSON(localStorage.getItem('ebaywatcher_' + articleId));
        }

        var currentArticle = {
          'id': articleId,
          'views': articleViews,
          'observer': articleObserver,
        };

        if( loadedArticle !== null && loadedArticle !== 'undefined' ) {
            if( loadedArticle.views != currentArticle.views ) {
                $(this).children('td:nth-child(4)').children('p:first-child').css({
                    "border": "1px solid #75a478",
                    "background-color": "#a5d6a7"
                });
            }

            if( loadedArticle.observer != currentArticle.observer ) {
                $(this).children('td:nth-child(4)').children('p:nth-child(2)').css({
                    "border": "1px solid " + ((loadedArticle.observer > currentArticle.observer) ? "#ba6b6c" : "#75a478"),
                    "background-color": ((loadedArticle.observer > currentArticle.observer) ? "#ef9a9a" : "#a5d6a7")
                });
            }
        }

        if (typeof GM_setValue == "function") {
            GM_setValue('ebaywatcher_' + articleId, JSON.stringify(currentArticle));
        }

        if (window.chrome) {
			localStorage.setItem('ebaywatcher_' + articleId, JSON.stringify(currentArticle));
		}
    });
});