Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name FreePBX
- // @namespace @bgm-freepbx
- // @description freepbx interface mods
- // @include http://YOUR_SERVER_HERE/admin/*
- // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
- // @version 1
- // @grant GM_addStyle
- // @run-at document-end
- // ==/UserScript==
- //v 1.0 November 29, 2014 - initial release\
- GM_addStyle("#footer {display:none; }");
- GM_addStyle(".rnav { width:250px; }");
- GM_addStyle(".rnav ul { max-height:70em;}"); //set the height of the right-nav
- //add the filterbox and a button to clear the filter
- $("div.rnav").prepend("<div id='FilterTable' style='display:block;'> <table> <tr> <td width='125px'><input type='text' id='filterInput'></td> <td><input id='ClearFilterInput' type='button' value='Clear' style='height:20px; line-height:8pt;' /></td></tr></table> </div>");
- //attach a function to the keyup event on the filter box so we can filter in live fashion
- $('#filterInput').keyup(function() {
- DynamicFilter($('#filterInput').val() );
- });
- //attach a function to the ClearFilter button; clear the filter and unfilter the list
- $('#ClearFilterInput').click(function() {
- $('#filterInput').val("");
- DynamicFilter($('#filterInput').val() );
- });
- function DynamicFilter(whattext){
- whattext = whattext.toLowerCase();
- var thisrow = $('.rnav li.ui-menu-item');
- thisrow.find('a').each(function(index, thiselement){
- var source = $(this).text().toLowerCase();
- //now check to see if the filter text exists in the remaining text
- if (source.indexOf(whattext) < 0){
- $(this).parent().hide(); //hide the row if it doesn't contain the text
- } else {
- $(this).parent().show(); //otherwise show it
- };
- });
- };
Add Comment
Please, Sign In to add comment