Untitled

 avatar
unknown
plain_text
2 years ago
2.7 kB
2
Indexable
// ==UserScript==
// @name         Telus->RaterHub Task List Inclusivity Mod v2
// @namespace    Scripts->Foundation->Raters
// @version      1.0.2.2022.12.22
// @original_version      1.0.0.2021.12.28
// @description  Try for some side channel information leakage
// @author       Midnight Runner
// @include      https://www.raterhub.com/evaluation/rater/task/index
// @include      https://www.raterhub.com/evaluation/rater
// ==/UserScript==
/* jshint esnext: true */
const domReady = cb=>{(document.readyState === "interactive" || document.readyState === "complete") ? cb() : document.addEventListener("DOMContentLoaded", cb);};

const suTextColor = "#c2bebe"; // superscript color

/* iconMap Array format: Default glyph, Default Glpyh Color, Adult glyph, Adult Glyph Color, Audio glyph, Audio Glyph Color, UO glyph, UO Glpyh Color */
const iconMap = {
0 : [ "❓", "#f31d1d", "❓" ,"#d76cc0", "❓", "#287f3a", "❓", "#9500ae"], // default if we haven't done it yet.
376 : [ "🗻", "#f31d1d", "🍣" ,"00ae3d", "🎵", "#9e8f02", "❓", "#9500ae"], //mountain, sushi, musical note
396 : [ "🗽", "#76D7C4", "🌹" ,"#c01501", "🎧 ", "#277e46", "🐱", "#c67b97"], // liberty, rose , headphones, cat
420 : [ "🍁", "#5DADE2", "🎣" ,"#307287", "🎸", "#cb5723", "👿", "#954db3"], // leaf, pole, guitar, imp
440 : [ "🐢", "#0f8d1d", "🍆" ,"#e79ce1", "❓", "#287f3a", "❓", "#9500ae"], // turtle, eggplant
460 : [ "🎲", "#3816b7", "❓" ,"#d76cc0", "❓", "#287f3a", "❓", "#9500ae"] // dice
}
domReady(()=>{
   console.info(`${GM_info.script.name} ${GM_info.script.version}`);
   let base = document.querySelectorAll('.ewok-rater-task-option>li');
   if (base.length) {
      base.forEach(q=>{
         let sc = q.childNodes[0].href?.length, idx =( iconMap[sc]) ? sc : 0, offset = 0, ot = q.firstChild?.textContent;
         if (q.childNodes.length >= 2) { // run sub checks
            let i = q.lastChild?.textContent;
            offset = i.includes("Adult") ? 2 : i.includes("Head") ? 4 : i.includes("Offensive") ? 6 : offset;
         }
         q.firstChild.innerHTML = `<span style="font-size: x-small; color: ${suTextColor}; writing-mode: tb; vertical-align: middle;">${sc}</span>
         <span style="color: ${iconMap[idx][offset+1]}; font-size: x-large; vertical-align: text-bottom; padding: 2px;">${iconMap[idx][offset]}</span> ${ot}`
         // Numbers as subscript:
         /*q.firstChild.innerHTML = `<span style="color: ${iconMap[idx][offset+1]}; font-size: x-large; vertical-align: text-bottom; padding: 2px; font-family: 'Segoe UI Symbol' !important;">
         <sub style="font-size: x-small; color: ${suTextColor};">${sc}</sub>`*/
        });
    }
});