JSFiddle - React, Tailwind, and code Playground

by Puddster

JavaScript

// ==UserScript==
// @name         POE Trade
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Enhances the on page functions of poe.trade search results.
// @author       You
// @match        http://poe.trade/search/*
// @grant        none
// ==/UserScript==
/* jshint -W097 */
'use strict';

(function($) {
    var pluginName = "PuddsPOETrade",
        provider = '.search-results-block',
        plugin = function(el) {
            this.el = $(el);
            this.init();
        },
        page = {
            action: {
                hide: '[data-pudd-action="hide"]',
                nextPage: '[data-pudd-action="nextPage"]',
                prevPage: '[data-pudd-action="prevPage"]',
                compare: '[data-pudd-action="addToCompare"]'
            },
            structure: {
                item: {
                    title: '.title',
                    requirements: '.requirements'
                },
                pages: 'div[id*=search-results-]',
                result: '.item',
                results: '.search-results-block',
                thirdCell: '.third-cell'
            },
            class: {
                button: 'puddButton',
                float: 'puddFloat'
            },
            data: {
                currentPage: 0,
                items: []
            },
        };

        plugin.prototype = {
            /* Initialisers */
            init: function() {
                this.drawControls();
                this.paginate.init();
                this.bindEvents();
                this.doItWithStyle();
            },
            bindEvents: function() {
                this.el.on('click', page.action.hide, $.proxy(this.hideResult, this));
                this.el.on('click', page.action.nextPage, $.proxy(this.paginate.next, this));
                this.el.on('click', page.action.prevPage, $.proxy(this.paginate.previous, this));
                this.el.on('click', page.action.compare,...