Created
April 8, 2022 14:46
-
-
Save sam2332/cba94e278f48fa7e6bc3d51eaaf864e5 to your computer and use it in GitHub Desktop.
Make fun of everything in redmine support
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 Redmine - SpongeMock | |
// @match https://*.*.*/issues/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var letters = "abcdefghijklmnopqrstuvwxyz" | |
function mocking(text){ | |
let out = ""; | |
for (let letter_index = 0; letter_index < text.length; letter_index++){ | |
if (letters.indexOf(text[letter_index]) ==-1){ | |
out+=text[letter_index] | |
}else{ | |
if (Math.random()*100 >=50){ | |
out+=text[letter_index].toLowerCase(); | |
}else{ | |
out+=text[letter_index].toUpperCase() | |
} | |
} | |
} | |
return out | |
} | |
function replaceAll(str, find, replace) { | |
return str.replace(new RegExp(find, 'g'), replace); | |
} | |
function nl2br(text){ | |
return replaceAll(text,"\n","<br>") | |
} | |
let subject = $('.subject'); | |
subject.html(nl2br(mocking(subject.text()))) | |
let users = $('.user'); | |
for (let user_index = 0; user_index < users.length; user_index++) | |
{ | |
let user = $(users[user_index]); | |
user.html(nl2br(mocking(user.text()))) | |
} | |
let description = $('.description .wiki') | |
description.html(nl2br(mocking(description.text()))) | |
$('.journal').each(function(index,ele){ | |
ele = $(ele) | |
let id = ele.prop('id').split('-')[1] | |
if (ele.hasClass('has-notes')){ | |
let notes = $('#journal-'+id+'-notes') | |
notes.html(nl2br(mocking(notes.text()))) | |
} | |
}) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment