Created
November 12, 2021 10:26
-
-
Save Foso/5c793a99bc2e1ac37b6811a932adefa2 to your computer and use it in GitHub Desktop.
add syntax highlighting to Qase
This file contains 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 Qase Gherkin | |
// @version 0.1 | |
// @description add syntax highlighting to Qase | |
// @author github.com/foso | |
// @match https://app.qase.io/run/* | |
// @match https://app.qase.io/case/* | |
// @match https://app.qase.io/project/APP20* | |
// @icon https://qase.io/favicon.png | |
// @grant none | |
// ==/UserScript== | |
var oldText = ""; | |
var observer = new MutationObserver(function (mutations, me) { | |
var editorContent = document.querySelector('.toastui-editor-contents'); | |
if (editorContent) { | |
var newText = editorContent.innerHTML; | |
if(newText !=oldText){ | |
editorContent.innerHTML = editorContent.innerHTML | |
.replaceAll("And ","<span style=\"color:blue;font-weight:bold\">And</span> ") | |
.replaceAll("But ","<span style=\"color:blue;font-weight:bold\">But</span> ") | |
.replaceAll("When ","<b>When</b> ") | |
.replaceAll("Given ","<b>Given</b> ") | |
.replaceAll("Then ","<b>Then</b> ") | |
.replaceAll("Scenario: ","<b>Scenario:</b> "); | |
oldText = newText; | |
} | |
return; | |
} | |
}); | |
// start observing | |
observer.observe(document, { | |
childList: true, | |
subtree: true | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment