Created
February 19, 2019 14:49
-
-
Save seanstickle/3dedd489031f3be251b6e84e30b60ab2 to your computer and use it in GitHub Desktop.
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 Fix Business VoiceEdge Dropdowns | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @author Seán Stickle | |
// @match https://voiceedge.comcast.com/HuntGroup* | |
// @require http://code.jquery.com/jquery-3.3.1.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var $ = window.jQuery; | |
var options = $('#ddHGHuntGroupIDs option'); | |
var arr = options.map(function(_, o) { return { t: $(o).text(), v: o.value, s: o.selected } ; }).get(); | |
arr.sort(function(o1, o2) { return o1.t > o2.t ? 1 : o1.t < o2.t ? -1 : 0; }); | |
options.each(function(i, o) { | |
o.value = arr[i].v; | |
$(o).text(arr[i].t); | |
o.selected = arr[i].s; | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment