Skip to content

Instantly share code, notes, and snippets.

@seanstickle
Created February 19, 2019 14:49
Show Gist options
  • Select an option

  • Save seanstickle/3dedd489031f3be251b6e84e30b60ab2 to your computer and use it in GitHub Desktop.

Select an option

Save seanstickle/3dedd489031f3be251b6e84e30b60ab2 to your computer and use it in GitHub Desktop.

Revisions

  1. seanstickle created this gist Feb 19, 2019.
    20 changes: 20 additions & 0 deletions fix-business-voiceedge-dropdowns.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    // ==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;
    });
    })();