Last active
April 3, 2021 08:41
-
-
Save Sneezry/ec685a2c9e9c4d32abb3424ef6e5a5b2 to your computer and use it in GitHub Desktop.
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 Azure DevOps E-Ink | |
// @namespace https://lizhe.net/ | |
// @version 0.2 | |
// @description Review code on Azure DevOps in E-Ink mode | |
// @author Zhe Li | |
// @match https://dev.azure.com/* | |
// @match https://*.visualstudio.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.innerHTML = `@font-face { | |
font-family: "Space Diff"; | |
unicode-range: U+20; | |
font-weight: normal; | |
src: url("https://dev.azure.com/zhetest/270f1cc4-0eda-46a2-9ab9-138cb9b220fd/_apis/git/repositories/b960d56b-5c1d-4030-95ff-527ad93a676e/items?path=%2FSpaceDiff.woff2&versionDescriptor%5BversionOptions%5D=0&versionDescriptor%5BversionType%5D=0&versionDescriptor%5Bversion%5D=main&resolveLfs=true&%24format=octetStream&api-version=5.0&download=true") format("woff2"); | |
} | |
.monospaced-text .repos-line-content { | |
font-family: Space Diff,Menlo,Consolas,Courier New,monospace; | |
} | |
.monospaced-text .repos-line-content::before { | |
font-family: Menlo,Consolas,Courier New,monospace; | |
} | |
.repos-summary-diff-container { | |
white-space: pre-wrap!important; | |
} | |
.removed-content, | |
.char-delete { | |
text-decoration-line: line-through; | |
background-color: transparent!important; | |
} | |
.added-content, | |
.char-insert { | |
background-color: rgba(0, 0, 0, 0.2)!important; | |
} | |
.diff-comment, | |
.highlight-discussion-range { | |
border-bottom: none!important; | |
text-decoration-thickness: 1px; | |
text-decoration-style: wavy; | |
text-decoration-line: underline; | |
text-decoration-color: black; | |
background-color: transparent!important; | |
} | |
.repos-diff-contents-row .removed, | |
.line-delete { | |
font-style: italic; | |
background-color: rgba(0, 0, 0, 0.2)!important; | |
} | |
.repos-diff-contents-row .added, | |
.line-insert { | |
background-color: rgba(0, 0, 0, 0.1)!important; | |
}`; | |
document.getElementsByTagName('head')[0].appendChild(style); | |
var run = (url)=> { | |
if (/pullrequest\/.*\?_a=files/.test(url)) { | |
document.body.style.filter = 'grayscale(1) brightness(0.9) sepia(0.2)'; | |
} else { | |
document.body.style.filter = ''; | |
} | |
}; | |
run(location.href); | |
var pS = window.history.pushState; | |
var rS = window.history.replaceState; | |
window.history.pushState = function(a, b, url) { | |
run(url); | |
pS.apply(this, arguments); | |
}; | |
window.history.replaceState = function(a, b, url) { | |
run(url); | |
rS.apply(this, arguments); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment