Skip to content

Instantly share code, notes, and snippets.

View alejandrocoding's full-sized avatar
🏠
Working from home

Alejandro Lora alejandrocoding

🏠
Working from home
View GitHub Profile
@alejandrocoding
alejandrocoding / angular.json5
Created June 24, 2020 17:19
Angular json file adding contentStyle scss to bundle as a separate css file (extracted)
...
"extractCss": true,
"vendorChunk": false,
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
],
"styles": [
"src/styles.scss",
@alejandrocoding
alejandrocoding / contentScript.ts
Created June 24, 2020 17:55
Content Script adding button to GitHub UI with link to Google
const anchorMyBtn = document.createElement('a');
anchorMyBtn.innerText = 'MY BUTTON';
anchorMyBtn.classList.add('btn', 'ml-2');
anchorMyBtn.href = 'https://google.es/';
anchorMyBtn.target = '_blank';
@alejandrocoding
alejandrocoding / contentScript.ts
Last active June 24, 2020 18:11
Content script adding p element to show latest commit
try {
const authorAnchor = document.querySelector('.commit-author') as HTMLAnchorElement;
const commit = (authorAnchor.nextElementSibling as HTMLAnchorElement).href.split('commit/')[1];
const p = document.createElement('p');
p.classList.add('my-commit-msg');
p.innerText = `Latest commit was: ${commit}`;
anchorMyBtn.parentNode.parentNode.prepend(p);
} catch {