Skip to content

Instantly share code, notes, and snippets.

@seanstickle
Created February 19, 2019 14:49
Show Gist options
  • Save seanstickle/3dedd489031f3be251b6e84e30b60ab2 to your computer and use it in GitHub Desktop.
Save seanstickle/3dedd489031f3be251b6e84e30b60ab2 to your computer and use it in GitHub Desktop.
// ==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