URI: 
       view_results.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_results.coffee (2326B)
       ---
            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 results for this job."
           17         "sAjaxSource":      resultsPath
           18         "aaSorting":      [[1, 'asc']]
           19         "aoColumns": [
           20           {"mDataProp": "checkbox", "bSortable": false}
           21           {"mDataProp": "number"}
           22           {"mDataProp": "caller_id"}
           23           {"mDataProp": "provider"}
           24           {"mDataProp": "answered"}
           25           {"mDataProp": "busy"}
           26           {"mDataProp": "audio_length"}
           27           {"mDataProp": "ring_length"}
           28         ]
           29         "fnServerData": ( sSource, aoData, fnCallback ) ->
           30           $.getJSON sSource, aoData, (json) ->
           31             fnCallback(json)
           32             $(".xtooltip").tooltip('fixTitle')
           33             $(".xpopover").popover
           34               html: true
           35               placement: 'right'
           36               trigger: 'hover'
           37               delay: { show: 300, hide: 300 }
           38               animation: false
           39 
           40     # Gray out the table during loads.
           41     $("#results-table_processing").watch 'visibility', ->
           42       if $(this).css('visibility') == 'visible'
           43         $resultsTable.css opacity: 0.6
           44       else
           45         $resultsTable.css opacity: 1
           46 
           47     # Display the search bar when the search icon is clicked
           48     $('.button .search').click (e) ->
           49       $filter = $('.dataTables_filter')
           50       $input = $('.dataTables_filter input')
           51       if $filter.css('bottom').charAt(0) == '-' # if (css matches -42px)
           52         # input box is visible, hide it
           53         # only allow user to hide if there is no search string
           54         if !$input.val() || $input.val().length < 1
           55           $filter.css('bottom', '99999999px')
           56       else # input box is invisible, display it
           57         $filter.css('bottom', '-42px')
           58         $input.focus()  # auto-focus input
           59       e.preventDefault()
           60 
           61     searchVal = $('.dataTables_filter input').val()
           62     $('.button .search').click() if searchVal && searchVal.length > 0