view.coffee - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
HTML git clone git://jay.scot/warvox
DIR Log
DIR Files
DIR Refs
DIR README
---
view.coffee (2191B)
---
1 jQuery ($) ->
2 $ ->
3 resultsPath = $('#results-path').html()
4 $resultsTable = $('#results-table')
5
6 # Enable DataTable for the results list.
7 $resultsDataTable = $resultsTable.table
8 analysisTab: true
9 controlBarLocation: $('.analysis-control-bar')
10 searchInputHint: 'Search Calls'
11 searchable: true
12 datatableOptions:
13 "sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
14 "sPaginationType": "bootstrap",
15 "oLanguage":
16 "sEmptyTable": "No analysis results."
17 "sAjaxSource": resultsPath
18 "aaSorting": [[1, 'asc']]
19 "aoColumns": [
20 {"mDataProp": "checkbox", "bSortable": false, "sWidth": "22px"}
21 {"mDataProp": "number"}
22 {"mDataProp": "line_type"}
23 {"mDataProp": "signal"}
24 ]
25 "fnServerData": ( sSource, aoData, fnCallback ) ->
26 $.getJSON sSource, aoData, (json) ->
27 fnCallback(json)
28 $(".xtooltip").tooltip('fixTitle')
29 $(".xpopover").popover
30 html: true
31 placement: 'right'
32 trigger: 'hover'
33 delay: { show: 300, hide: 300 }
34 animation: false
35
36 # Gray out the table during loads.
37 $("#results-table_processing").watch 'visibility', ->
38 if $(this).css('visibility') == 'visible'
39 $resultsTable.css opacity: 0.6
40 else
41 $resultsTable.css opacity: 1
42
43 # Display the search bar when the search icon is clicked
44 $('.button .search').click (e) ->
45 $filter = $('.dataTables_filter')
46 $input = $('.dataTables_filter input')
47 if $filter.css('bottom').charAt(0) == '-' # if (css matches -42px)
48 # input box is visible, hide it
49 # only allow user to hide if there is no search string
50 if !$input.val() || $input.val().length < 1
51 $filter.css('bottom', '99999999px')
52 else # input box is invisible, display it
53 $filter.css('bottom', '-42px')
54 $input.focus() # auto-focus input
55 e.preventDefault()
56
57 searchVal = $('.dataTables_filter input').val()
58 $('.button .search').click() if searchVal && searchVal.length > 0