-
-
Save cosmo0/1154d158f9dc1f3b7f5fe841079b0cf0 to your computer and use it in GitHub Desktop.
| // ==UserScript== | |
| // @name Better Dekudeals | |
| // @namespace http://dekudeals.com/ | |
| // @version 1.2 | |
| // @description Various improvements to Dekudeals | |
| // @author cosmo0 | |
| // @match https://www.dekudeals.com/* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=dekudeals.com | |
| // @require https://code.jquery.com/jquery-3.6.0.min.js | |
| // @downloadURL https://gist.githubusercontent.com/cosmo0/1154d158f9dc1f3b7f5fe841079b0cf0/raw/dekudeals.user.js | |
| // @updateURL https://gist.githubusercontent.com/cosmo0/1154d158f9dc1f3b7f5fe841079b0cf0/raw/dekudeals.user.js | |
| // @grant GM.registerMenuCommand | |
| // @grant GM_registerMenuCommand | |
| // @grant GM_setClipboard | |
| // @grant GM.setClipboard | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| const $ = jQuery; | |
| const items = $('.search-main > .browse-cards > .row > .col'); | |
| // Create GM menus | |
| const gmClip = GM.setClipboard || GM_setClipboard; | |
| console.log('initializing Better DekuDeals'); | |
| // styling | |
| $('head').append(`<style type="text/css"> | |
| .better-dekudeal .btn { color: #343a40; } | |
| body[data-theme='dark'] .better-dekudeal .btn { color: #dddddd; } | |
| .better-dekudeal .btn:hover { background: none; color: #6c757d; } | |
| body[data-theme='dark'] .better-dekudeal .btn:hover { color: #999999; } | |
| </style>`); | |
| // move "hide" button outside the dropdown | |
| console.log(items.length + ' items to process'); | |
| items.each((idx, item) => { | |
| const hideform = $(item).find('form[action$="/hide"]'); | |
| hideform.removeClass('btn-group'); | |
| const addToBtn = $(item).find('.watch-area'); | |
| hideform.insertAfter(addToBtn); | |
| }); | |
| // create side menu container | |
| const card = $('<div class="search-facet card hide-tail search-left-item better-dekudeal"><h6 class="card-header">Better DekuDeals</h6><div class="card-body p-2"></div></div>'); | |
| card.insertBefore($('#search-left-content .search-facet').first()); | |
| const container = card.find('.card-body'); | |
| const btn = $('<button type="button" class="btn btn-outline-secondary mb-2 w-100 text-left p-0 border-0" style="white-space: normal;"></button>'); | |
| // "hide all" button | |
| const hideAll = btn.clone().text('Hide all on current page'); | |
| hideAll.on('click', () => { | |
| $('.search-main form[action$="/hide"] .watch-button').each((idx, item) => { | |
| $(item).click(); | |
| }); | |
| }); | |
| container.append(hideAll); | |
| // copy only names | |
| const gamesNamesButton = btn.clone().text('Copy only names'); | |
| gamesNamesButton.on('click', () => { | |
| get_games(false, false); | |
| }); | |
| container.append(gamesNamesButton); | |
| // copy names and prices | |
| const gamesButton = btn.clone().text('Copy names and price'); | |
| gamesButton.on('click', () => { | |
| get_games(true, false); | |
| }); | |
| container.append(gamesButton); | |
| // copy only discounted | |
| const discountButton = btn.clone().text('Copy only discounted'); | |
| discountButton.on('click', () => { | |
| get_games(true, true); | |
| }); | |
| container.append(discountButton); | |
| /* | |
| * Lists all games | |
| */ | |
| function get_games(withPrice, onlyDiscounted) { | |
| let text = ''; | |
| items.each((_, c) => { | |
| c = $(c); | |
| const title = c.find('.main-link h6').text().trim(), | |
| price = c.find('.d-flex.align-items-center.text-tight strong').text(), | |
| discount = c.find('.badge-danger').text(), | |
| lowest = c.find('.badge-warning').text(), | |
| unavailable = c.find('.text-muted').text(); | |
| if (onlyDiscounted && discount) { | |
| text += title + ' : ' + price + ' (' + discount + (lowest ? (' - ' + lowest) : '') + ')\n'; | |
| } | |
| else if (!onlyDiscounted) { | |
| text += title | |
| if (withPrice) { | |
| text += ' : ' + (price || unavailable); | |
| if (discount) { | |
| text += ' (' + discount + (lowest ? (' - ' + lowest) : '') + ')'; | |
| } | |
| } | |
| text += '\n'; | |
| } | |
| }); | |
| console.log(text); | |
| gmClip(text); | |
| alert('Games list copied to clipboard'); | |
| } | |
| })(); |
Thanks for the heads up! I'll check it out asap - I can't live without my little script, it's so useful for hiding all those sh*t games!
It's incredibly useful!
Some people in the dekudeals discord are complaining about the redesign and the dev seems to be considering further changes. Just a heads up that you might have to update more than once or just wait until the dust settles before you bother.
@valzi It's now updated.
Thanks!
Updated - thanks!
Sorry to be a bother, but I installed tampermonkey to chrome, and installed this code via the "Raw" button on this site, but I am not seeing a "Hide All" button anywhere on the DekuDeals site. Did I miss a step, or am I not looking in the right place, or did DekuDeals push an update to thier site that messed with this code? Any help would be greatly appreciated!

Hello
You have to activate developer mode in Chrome extensions - it's due to Tampermonkey, and not related to this script.
https://www.tampermonkey.net/faq.php?locale=en#Q209

Hi! I've been loving this, but DekuDeals just updated their site, which broke the script. I'd love an update if you feel like it. Thanks for it regardless.