-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEPFL_EPNET.user.js
More file actions
33 lines (30 loc) · 1.11 KB
/
EPFL_EPNET.user.js
File metadata and controls
33 lines (30 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// ==UserScript==
// @name EPNET
// @namespace EPFL
// @description A script to improve browsing on network.epfl.ch
// @include https://network.epfl.ch/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @author ponsfrilus
// @downloadURL https://raw.githubusercontent.com/ponsfrilus/EPFL_EPNET_UserScript/master/EPFL_EPNET.user.js
// @version 0.0.1
// ==/UserScript==
// Avoid conflicts
this.$ = this.jQuery = jQuery.noConflict(true);
$(document).ready( function() {
console.log("EPNET User script");
// Insert the lookup field
$( '[name="inst"]' ).before( '<input type="text" name="lookup" value="" placeholder="Unit search" /><br />' );
// Makes the lookup filter
$( '[name="lookup"]' ).keyup( function () {
$lookup = $( this ).val().toUpperCase();
if ($lookup.length > 2) {
$( '[name="inst"] > option' ).each( function( index ) {
if ($( this ).text().includes($lookup)) {
$( this ).css( "color", "green" ).show();
} else {
$( this ).css( "color", "black" ).hide();
}
});
}
})
});