Last active
January 23, 2022 00:04
-
-
Save lylatr/346ddbf6d96fae4536f5aa8e7e12f827 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Curation Tools | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1.1 | |
| // @description Extended curation tools | |
| // @match *://store.steampowered.com/curator/*/admin/* | |
| // @match *://store.steampowered.com/app/* | |
| // @grant GM_addStyle | |
| // @icon https://cdn.discordapp.com/avatars/749437490883985499/7c4053deed909ec48be2656da4b12b76.png | |
| // @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
| // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js | |
| // ==/UserScript== | |
| (()=> | |
| { | |
| 'use strict'; | |
| const curators = ['31507748', '33207241', '34752873', '35709504', '33219357']; | |
| waitForKeyElements ('.post_review_ctn', addDelBtn); | |
| function addDelBtn(jNode) | |
| { | |
| const ctnBtn = document.querySelector('.post_review_ctn'); | |
| const delBtn = addBtn(); | |
| const appid = ctnBtn.parentNode['appid'].value; | |
| if(appid && !delBtn.querySelector('btnDelete')) | |
| { | |
| delBtn.innerHTML = '<span>Delete review</span>'; | |
| delBtn.classList.add('btn_green_white_innerfade', 'btn_medium'); | |
| delBtn.style.marginLeft = '4px'; | |
| ctnBtn.appendChild(delBtn); | |
| delBtn.addEventListener('click', ()=> | |
| { | |
| const modal = ShowConfirmDialog("Delete this review?", `Are you sure you want to delete the review for the AppID: ${appid}?`); | |
| modal.done(() => { | |
| $J.ajax ( { url: g_strCuratorAdminURL + 'ajaxdeletereview/',data: | |
| { appid: appid , sessionid: g_sessionID }, dataType: 'json', type: 'POST'} ) | |
| .done( function ( data ){ | |
| g_PageController.Navigate ( 'reviews_manage/' ); | |
| }).fail( function( data ){ | |
| const response = JSON.parse(data.responseText); | |
| ShowAlertDialog( "Oops!", "We were unable to save your changes ( %1$s )".replace(/%1\$s/, response.success ) ); | |
| }); | |
| }) | |
| }) | |
| } | |
| } | |
| if (window.location.href.includes('store.steampowered.com/app')) | |
| { | |
| const editBtn = addBtn(); | |
| const reviewCtn = document.querySelector('.steam_curators_block > .block_header > .right'); | |
| const curator = document.querySelector('.steam_curator_selected > .steam_curator_icon > a[href*="Scouts"]'); | |
| const curatorSide = document.querySelector('.steam_curators_grid > .steam_curator_icon > a[href*="Scouts"]'); | |
| const ascouts = curator ?? curatorSide; | |
| if(ascouts) | |
| { | |
| const curatorid = getCuratorID(ascouts); | |
| const appid = getAppID(ascouts); | |
| if(curators.includes(curatorid)) | |
| { | |
| editBtn.innerHTML = 'Edit Scouts curation'; | |
| editBtn.href = getLink(curatorid, appid); | |
| editBtn.style.marginRight = '4px'; | |
| reviewCtn.appendChild(editBtn); | |
| } | |
| } | |
| } | |
| for(const c of curators) | |
| { | |
| if(window.location.href.includes(c)) | |
| { | |
| const editBtn = addBtn(); | |
| const reviewCtn = document.querySelector('.discussion_button_ctn'); | |
| const curatorInfo = document.querySelector('.referringSteamCurator > a'); | |
| if(curatorInfo) | |
| { | |
| const appid = curatorInfo.href.match(/(?<=appid=).*/, '')[0]; | |
| editBtn.innerHTML = '<span>Edit curation</span>'; | |
| editBtn.href = getLink(c, appid); | |
| editBtn.classList.add('btn_small_thin', 'btnv6_blue_hoverfade'); | |
| reviewCtn.appendChild(editBtn); | |
| } | |
| } | |
| } | |
| })(); | |
| function addBtn() | |
| { | |
| return document.createElement('a'); | |
| } | |
| function getAppID(c) | |
| { | |
| return c.href.match(/(?<=appid=).*?(?=&)/, '')[0]; | |
| } | |
| function getCuratorID(c) | |
| { | |
| return c.href.match(/(?<=curator\/).*?(?=-)/, '')[0]; | |
| } | |
| function getLink(c, a) | |
| { | |
| return `https://store.steampowered.com/curator/${c}/admin/review_create/${a}`; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment