Last active
August 14, 2020 06:46
-
-
Save barmic/6a798f575ac5c656a0d9a0eb9d47a929 to your computer and use it in GitHub Desktop.
userscript
This file contains hidden or 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 AutoFill Push | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://qlf-sun-admin.sfr.com/sun/push/ng/bundles/*/campaigns/add/* | |
// @match https://sun-admin.sfr.com/sun/push/ng/bundles/*/campaigns/add/* | |
// @match https://dev-sun-admin.inovatel.com/sun/push/ng/bundles/*/campaigns/add/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var D=document.forms[0]; | |
D.firstname.value='AAAA'; | |
D.lastname.value='BBBB'; | |
D.birthday.value='01/01/1970'; | |
D.lieunaissance.value='Paris'; | |
D.address.value='55 Rue du Faubourg Saint-Honoré'; | |
D.town.value='Paris'; | |
D.zipcode.value=75008; | |
})(); |
This file contains hidden or 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 DLFPNoKarma | |
// @namespace DLFPNoKarma | |
// @version 0.1 | |
// @description https://linuxfr.org/users/peetah/journaux/plonk | |
// @author You | |
// @match https://linuxfr.org/* | |
// @grant none | |
// @run-at document-body | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let style = document.createElement("style"); | |
style.textContent = ` | |
.details, .vote { | |
display: none !important; | |
} | |
.fold { | |
display: contents !important; | |
} | |
.hidden { | |
display: contents !important; | |
} | |
.score { | |
display: none !important; | |
} | |
`; | |
document.querySelector("head").appendChild(style); | |
// user space | |
let nbVotes = document.getElementById('nb_votes'); | |
if (nbVotes) nbVotes.parentNode.style.display = 'none'; | |
// column notes in board | |
let comments = document.getElementById('my_comments'); | |
if (comments) { | |
for(let myComments of comments.childNodes[1].childNodes) { | |
if (myComments.nodeType === Node.ELEMENT_NODE) { | |
myComments.removeChild(myComments.childNodes[7]); | |
} | |
} | |
} | |
// karma counter in user space | |
for(let userKarma of document.querySelectorAll("#user_recent_contents > ul > li")) { | |
if(userKarma.textContent.includes('Karma')) { | |
userKarma.style.display = 'none' | |
} | |
} | |
// remove notes | |
for(let score of document.querySelectorAll("span.score")) { | |
score.parentNode.childNodes[3].textContent=''; | |
score.parentNode.childNodes[5].textContent=''; | |
} | |
})(); |
This file contains hidden or 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 DLFTags | |
// @namespace DLFTags | |
// @version 0.1 | |
// @author You | |
// @match https://linuxfr.org/* | |
// @grant none | |
// @run-at document-body | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let tags = new Set(['covid-19']); | |
for(let article of document.querySelectorAll("article")) { | |
for(let tag of article.querySelectorAll("a[rel=tag]")) { | |
if (tags.has(tag.textContent)) { | |
article.style.display = 'none'; | |
break; | |
} | |
} | |
} | |
})(); |
This file contains hidden or 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 DLFPlonk | |
// @namespace DLFPlonk | |
// @version 0.1 | |
// @author You | |
// @match https://linuxfr.org/* | |
// @grant GM_setValue | |
// @grant GM_getValue | |
// @grant GM_deleteValue | |
// @run-at document-body | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const storeName = '#stored_plonks'; | |
const storedP = GM_getValue(storeName, ""); | |
let plonks = storedP.split("/"); | |
function hidePlonked() { | |
for(let comment of document.querySelectorAll("span.posted_by_spanblock")) { | |
const auth = comment.querySelector("a[rel=author]").href.split('/'); | |
const author = auth[auth.length - 1]; | |
if (plonks && plonks.includes(author)) { | |
let toBeHide = comment.parentNode.parentNode; | |
if (toBeHide.tagName == 'HEADER') { | |
toBeHide.parentNode.style.display = 'none'; | |
} else { | |
toBeHide.style.display = 'none'; | |
} | |
} | |
} | |
} | |
function plonk(user) { | |
plonks.push(user); | |
GM_setValue(storeName, plonks.join('/')); | |
hidePlonked(); | |
} | |
function unplonk(user) { | |
plonks = plonks.filter((val, idx, arr) => user !== val); | |
GM_setValue(storeName, plonks.join('/')); | |
hidePlonked(); | |
} | |
// effective plonks | |
for(let comment of document.querySelectorAll("span.posted_by_spanblock")) { | |
const auth = comment.querySelector("a[rel=author]").href.split('/'); | |
const author = auth[auth.length - 1]; | |
if (plonks.includes(author)) { | |
let toBeHide = comment.parentNode.parentNode; | |
if (toBeHide.tagName == 'HEADER') { | |
toBeHide.parentNode.style.display = 'none'; | |
} else { | |
toBeHide.style.display = 'none'; | |
} | |
} else { | |
let hide = document.createElement("a"); | |
hide.textContent = '[✖]'; | |
hide.style = 'cursor: pointer'; | |
hide.onclick = (ev) => {plonk(author);}; | |
comment.prepend(hide); | |
} | |
} | |
// list of users plonks | |
const sidebar = document.getElementById('sidebar'); | |
const plonkView = document.createElement('div'); | |
sidebar.append(plonkView); | |
plonkView.id = 'plonks'; | |
plonkView.className = 'box'; | |
const plonkTitle = document.createElement('h1'); | |
plonkView.append(plonkTitle); | |
plonkTitle.textContent = 'Plonks'; | |
const plonkDescription = document.createElement('p'); | |
plonkView.append(plonkDescription); | |
plonkDescription.textContent = 'Liste des utilisateurs plonkés :'; | |
const plonkList = document.createElement('ul'); | |
plonkView.append(plonkList); | |
for(let p of plonks) { | |
const plonkUser = document.createElement('li'); | |
const l = document.createElement('a'); | |
plonkUser.append(l); | |
l.textContent = '[✖] ' + p; | |
l.style = 'cursor: pointer'; | |
l.onclick = (ev) => {unplonk(p);}; | |
plonkList.append(plonkUser); | |
} | |
const plonkClear = document.createElement('a'); | |
plonkView.append(plonkClear); | |
plonkClear.textContent = 'Supprimer la liste'; | |
plonkClear.style = 'cursor: pointer'; | |
plonkClear.onclick = (ev) => { | |
plonks = []; | |
GM_deleteValue(storeName); | |
hidePlonked(); | |
}; | |
})(); |
This file contains hidden or 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 Tarsnap Human Readable | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Tarsnap Human Readable | |
// @author You | |
// @match https://www.tarsnap.com/manage.cgi* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function convert(value) { | |
const units = ['o', 'Kio', 'Mio', 'Gio', 'Tio']; | |
const values = value.split(" "); | |
if (!values || values.length !== 2 || values[1] !== 'bytes') { | |
return value; | |
} | |
var bValue = values[0]; | |
var unitIdx = 0; | |
while (bValue >= 1000) { | |
bValue = bValue / 1024; | |
unitIdx += 1; | |
} | |
return bValue.toFixed(2) + ' ' + units[unitIdx]; | |
} | |
for(let num of document.querySelectorAll("td")) { | |
if (num.textContent.includes(' bytes')) { | |
num.textContent = convert(num.textContent); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment