Skip to content

Instantly share code, notes, and snippets.

@GlaceCoding
Last active October 25, 2021 13:07
Show Gist options
  • Save GlaceCoding/c70f68d4ecfa5877936d74eef13ebd49 to your computer and use it in GitHub Desktop.
Save GlaceCoding/c70f68d4ecfa5877936d74eef13ebd49 to your computer and use it in GitHub Desktop.
Select 42cursus
// ==UserScript==
// @name 42cursus
// @namespace https://gist.github.com/GlaceCoding/c70f68d4ecfa5877936d74eef13ebd49
// @version 0.2
// @description Select 42cursus
// @author GlaceCoding
// @match https://profile.intra.42.fr/
// @match https://profile.intra.42.fr/users/*
// @icon https://www.google.com/s2/favicons?domain=42.fr
// @downloadURL https://gist.github.com/GlaceCoding/c70f68d4ecfa5877936d74eef13ebd49/raw/42cursus.user.js
// @updateURL https://gist.github.com/GlaceCoding/c70f68d4ecfa5877936d74eef13ebd49/raw/42cursus.user.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
const $ = window.$
let element;
element = $("span.user-cursus > select > option[value=42cursus]")[0]
if (element) {
element.selected = true
$('span.user-cursus > select').change()
}
element = $("select.cursus-user-select > option[value=42cursus]")[0]
if (element) {
element.selected = true
$('select.cursus-user-select').change()
}
//document.querySelector('span.user-cursus > select > option:nth-child(2)').selected = true
//var evt = document.createEvent('HTMLEvents')
//evt.initEvent('change', false, true)
//document.querySelector('span.user-cursus > select').dispatchEvent(evt)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment