Skip to content

Instantly share code, notes, and snippets.

@jdayllon
Last active June 6, 2024 05:41
Show Gist options
  • Save jdayllon/cd0c14b520cfa49695e2eba18a1c3bd3 to your computer and use it in GitHub Desktop.
Save jdayllon/cd0c14b520cfa49695e2eba18a1c3bd3 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Abrir enlaces externos en nueva pestaña
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Abre enlaces externos en una nueva pestaña
// @author Microsoft Copilot
// @match https://hgp.sandetel.es/issues/*
// @match https://redmine-attgap.juntadeandalucia.es/issues/*
// @grant none
// @uploadURL https://gist.github.com/jdayllon/cd0c14b520cfa49695e2eba18a1c3bd3/raw/hgp-add-blank.js
// @downloadURL https://gist.github.com/jdayllon/cd0c14b520cfa49695e2eba18a1c3bd3/raw/hgp-add-blank.js
// ==/UserScript==
(function() {
'use strict';
// Obtiene todos los enlaces de la página
var enlaces = document.getElementsByTagName('a');
for (var i = 0; i < enlaces.length; i++) {
var enlace = enlaces[i];
// Comprueba si el enlace es externo
if (enlace.hostname !== window.location.hostname) {
// Si es externo, abre en una nueva pestaña
enlace.target = '_blank';
}
}
})();
// ==UserScript==
// @name Tacha lineas con TD
// @namespace http://tampermonkey.net/
// @version 2024-05-16
// @description try to take over the world!
// @author You
// @match https://hgp.sandetel.es/projects/sds-hgp-01911-6/issues?query_id=*
// @icon https://www.google.com/s2/favicons?sz=64&domain=sandetel.es
// @uploadURL https://gist.githubusercontent.com/jdayllon/cd0c14b520cfa49695e2eba18a1c3bd3/raw/hgp-tacha-fin-tampermoney.js
// @downloadURL https://gist.githubusercontent.com/jdayllon/cd0c14b520cfa49695e2eba18a1c3bd3/raw/hgp-tacha-fin-tampermoney.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Función para tachar el texto de una fila
function tacharTexto(fila) {
var celdas = fila.getElementsByTagName('td');
for (var i = 0; i < celdas.length; i++) {
celdas[i].style.textDecoration = 'line-through';
}
}
// Buscar todas las filas de la tabla
var filas = document.getElementsByTagName('tr');
// Recorrer todas las filas
for (var i = 0; i < filas.length; i++) {
var fila = filas[i];
var celdas = fila.getElementsByTagName('td');
// Recorrer todas las celdas de la fila
for (var j = 0; j < celdas.length; j++) {
var celda = celdas[j];
// Si la celda tiene la clase 'status' y su texto es 'Final', tachar el texto de la fila
if (celda.className === 'status' && celda.textContent.trim() === 'Final') {
tacharTexto(fila);
break;
}
}
}
})();
// ==UserScript==
// @name Marcado de tareas con emojis
// @namespace http://tampermonkey.net/
// @version 2024-05-16
// @description try to take over the world!
// @author You
// @match https://hgp.sandetel.es/projects/sds-hgp-01911-6/issues?query_id=*
// @match https://hgp.sandetel.es/projects/sds-hgp-01911-6/issues?per_page=*&query_id=11986
// @icon https://www.google.com/s2/favicons?sz=64&domain=sandetel.es
// @uploadURL https://gist.githubusercontent.com/jdayllon/cd0c14b520cfa49695e2eba18a1c3bd3/raw/hgp-tags-emojis-tampermoney.js
// @downloadURL https://gist.githubusercontent.com/jdayllon/cd0c14b520cfa49695e2eba18a1c3bd3/raw/hgp-tags-emojis-tampermoney.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
var rows = document.querySelectorAll('tr');
rows.forEach(function(row) {
var spentHoursCell = row.querySelector('.spent_hours');
var estimatedHoursCell = row.querySelector('.estimated_hours');
var dateCell = row.querySelector('.cf_43.date');
if (estimatedHoursCell && spentHoursCell) {
var spentHours = parseFloat(spentHoursCell.innerText);
var estimatedHours = parseFloat(estimatedHoursCell.innerText);
if (isNaN(estimatedHours)) {
estimatedHoursCell.innerHTML += ' 💣';
} else if (spentHours > estimatedHours) {
spentHoursCell.innerHTML += ' 🔴'; // Emoji de pelota roja
} else if (spentHours / estimatedHours >= 0.8) {
spentHoursCell.innerHTML += ' 🟡'; // Emoji de pelota amarilla
} else {
spentHoursCell.innerHTML += ' 🟢'; // Emoji de pelota verde
}
}
if (dateCell) {
var dateValue = new Date(dateCell.innerText);
var now = new Date();
var oneWeekLater = new Date();
oneWeekLater.setDate(now.getDate() + 7);
if (isNaN(dateValue.getTime())) {
dateCell.innerHTML += ' 💣';
} else if (dateValue < oneWeekLater) {
dateCell.innerHTML += ' 🏁';
}
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment