Skip to content

Instantly share code, notes, and snippets.

@JasonHenriksen
Last active April 1, 2019 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JasonHenriksen/e1ff2e30d8af858024639717a6a9ce3b to your computer and use it in GitHub Desktop.
Save JasonHenriksen/e1ff2e30d8af858024639717a6a9ce3b to your computer and use it in GitHub Desktop.
This is the TamperMonkey script that highlights data-sqa-id attributes. TamperMonkey is a chrome extension.
// ==UserScript==
// @name ShowCC Component
// @match https://qa.clearcollateral.com/*
// @match https://qa2.clearcollateral.com/*
// @match https://demo1.clearcollateral.com/*
// @match https://uat.clearcollateral.com/*
// @match https://cte.clearcollateral.com/*
// @match https://clearcollateral.com/*
// @match http://localhost:3000/*
// ==/UserScript==
(function() {
'use strict';
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
console.log('cctm Start');
addGlobalStyle('*[data-sqa-component-name] { outline:1px dashed orange !important;border:1px dashed orange !important; } '+
'*[data-sqa-component-name]:hover::after {all:initial;position:fixed; right:0px; clear:both; display:block;background-color:black; z-index:1000; -webkit-user-select: all; content:attr(data-sqa-component-name); color:orange; '+
' font-family: monospace; transition: all .05s ease-in-out; }');
// I have to scale these to defeat the 'minimum text font' bugs that chrome currently has.
addGlobalStyle('*[data-sqa-id] { outline:1px dashed green !important; } '+
'*[data-sqa-id]:hover::after {all:initial;position:relative; right:0px; clear:both; '+
'display:block;background-color:black; z-index:1000; -webkit-user-select: all; content:attr(data-sqa-id); color:green; '+
'font-family: monospace; transition: all .05s ease-in-out; }');
addGlobalStyle('*[dataSqaId] { outline:1px dashed green !important; } '+
'*[dataSqaId]:hover::after {all:initial;position:relative; right:0px; clear:both; '+
'display:block;background-color:black; z-index:1000; -webkit-user-select: all; content:attr(data-sqa-id); color:green; '+
'font-family: monospace; transition: all .05s ease-in-out; }');
// I have to scale these to defeat the 'minimum text font' bugs that chrome currently has.
addGlobalStyle('[class*="SQA"] { outline:1px dashed green !important; } '+
'[class*="SQA"]:hover::after {all:initial;position:relative; right:0px; clear:both; '+
'display:block;background-color:black; z-index:1000; -webkit-user-select: all; content:attr("search class attribute"); color:green; '+
'font-family: monospace; transition: all .05s ease-in-out; }');
console.log('cctm End');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment