PageSourceSearch

https://core.surpasshosting.com/js/plugins/bootstrap-layout.js

js surpasshosting.com collected 2026-10-02 07:07:11 UTC 9,028 bytes, 240 lines download raw bytes

1var tableopts;
2
3Core = function($) {
4    return {
5        initDataTables: function(){
6
7            /*if ($.inArray($("#current_lang").val(), ['pt_BR', 'es_MX']) !== -1) {
8                langOptions = {
9                    sUrl: '/js/dataTableTranslations/'+$("#current_lang").val()+'.json'
10                };
11            } else {
12                langOptions = {
13                    oPaginate: {
14                        sFirst: 'First',
15                        sPrevious: 'Prev',
16                        sNext: 'Next',
17                        sLast: 'Last'
18                    },
19                    sSearch: 'Search: '
20                };
21            }*/
22
23            tableopts = {
24                "paging":   true,
25                "ordering": true,
26                "info":     false,
27                "sDom":     "<'row'<'col-sm-6'><'col-sm-6'f>r>" + "t" + "<'row'<'col-sm-6'i><'col-sm-6'p>>"
28            };
29
30            $.fn.dataTableExt.sErrMode = 'throw';
31
32            // Tablesorter
33            $(".sortable").each(function(){
34                if (!$.fn.dataTable.isDataTable( this )) {
35                    if ($('tbody tr td', this).length < $('th', this).length)
36                        return;
37
38                    var columns = [];
39                    var sort = [];
40                    $('th', this).each(function() {
41                        var column = {};
42
43                        if ($(this).is('[data-sort]'))
44                        {
45                            if ($(this).attr('data-sort') == "none")
46                                column['bSortable'] = false;
47                            else
48                                sort.push([$(this).index(), $(this).attr('data-sort')]);
49                        }
50
51                        columns.push(column);
52                    });
53
54                    if ($(this).hasClass('sortonly'))
55                        tableSettings['bPaginate'] = false;
56
57                    tableopts.aaSorting = sort;
58                    tableopts.aoColumns = columns;
59
60                    if ($(this).hasClass('no-default-sort'))
61                        tableopts.aaSorting = [];
62
63                    $(this).DataTable(tableopts);
64                }
65            });
66
67            $('[data-paginate-toggle]').each(function(){
68                var button = $(this);
69                var table = $(button.attr('data-paginate-toggle'));
70
71                // Only display button for DataTables
72                if($.fn.DataTable.isDataTable(table[0])) {
73                    var total_rows = table.dataTable().fnSettings().fnRecordsTotal();
74                    var rows_per_page = $.fn.dataTable.defaults.iDisplayLength;
75
76                    if (total_rows > rows_per_page) {
77                        button.click(function(e) {
78                            e.preventDefault();
79
80                            var tableOptions = JSON.parse(JSON.stringify(tableopts));
81
82                            table.DataTable().destroy()
83                            tableOptions.bPaginate = false;
84                            table.DataTable(tableOptions);
85
86                            var display_length = table.DataTable().page.info().recordsDisplay;
87
88                            if(display_length == -1) { // If pagination is off
89                                // e.g. Limit {{n}} Per Page
90                                var template = _.template(button.attr('data-txt-off'));
91                                button.text( template({n: rows_per_page}) );
92                            } else {
93                                // e.g. Show All
94                                button.text( button.attr('data-txt-on') );
95                            }
96                        });
97                    } else {
98                        button.hide();
99                    }
100                } else {
101                    button.hide();
102                }
103            });
104
105        },
106
107        initTooltips: function(){
108            $("[data-toggle='tooltip']").tooltip({html: true});
109        },
110
111        guid: function() {
112          var s4 = function() {
113            return Math.floor((1 + Math.random()) * 0x10000)
114                       .toString(16)
115                       .substring(1);
116          };
117            return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
118                   s4() + '-' + s4() + s4() + s4();
119        },
120
121        showDialog: function(path,title,height) {
122
123            unique_id = Core.guid();
124
125            var compiled_html = '<div class="modal" role="dialog" id="' + unique_id + '">'
126                              + '<div class="modal-dialog modal-lg">'
127                              + '<div class="modal-content">'
128                              + '<div class="modal-header">'
129                              + '<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>'
130                              + '<h4 class="modal-title">' + title + '</h4></div>'
131                              + '<div class="modal-body"><div class="text-center"><i class="fa fa-spinner fa-spin fa-3x" style="color:#FF822C"></i></div></div>'
132                              + '<div class="modal-footer"><button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times fa-fw"></i> Close</button></div>'
133                              + '</div></div></div>'
134
135            // Append model html to body
136            $('body').append(compiled_html);
137
138            // Set height if needed
139            if (height)
140                $('.modal-body').css('height',height);
141
142            // Set z-index of background to cover <nav>
143            $('.modal').on('shown.bs.modal', function( event ) {
144                //$('.modal-backdrop').css('z-index', 1039);
145            });
146
147            // Delete html from <body> after close
148            $('.modal').on('hidden.bs.modal', function( event ) {
149                $('#'+unique_id).remove();
150            });
151
152            // Display model
153            $('#'+unique_id).modal({backdrop: 'static', keyboard: false});
154
155            // Ajax model content
156            $.get(path, function(data) {
157                $('#'+unique_id+' .modal-body').html(data);
158            });
159
160        },
161
162        initDialogs: function(){
163            $('a.showdialog').click(function(event){
164                event.preventDefault();
165                event.stopPropagation();
166
167                var original_title = $(this).attr('data-original-title');
168
169                var title = (original_title !== undefined && original_title !== false) ? $(this).attr('data-original-title') : $(this).attr('title');
170                Core.showDialog($(this).attr('href'), title);
171            });
172        },
173
174        initDatePicker: function(){
175            $('input.datepicker').parent('div').find('.form-control-feedback').remove();
176            $('input.datepicker').parent('div').addClass('has-feedback');
177            $('input.datepicker').after('<span class="form-control-feedback"><i class="fa fa-calendar"></i></span>');
178            $('input.datepicker.dropdown-menu').remove();
179            $('input.datepicker').datepicker({format: "yyyy-mm-dd", weekStart: 0, autoclose: true});
180        },
181
182        ajaxTab: function(tab){
183            var loadurl = tab.attr('href'),
184                targ = tab.attr('data-target');
185
186            var title = tab.html();
187            tab.html('<i class="fa fa-circle-o-notch fa-spin"></i> Loading');
188
189            $.get(loadurl, function(data) {
190                $(targ).html(data);
191                $(targ + ' .nav-tabs li:first').find('a').each(function(){
192                    if($(this).attr('data-toggle') == 'tabajax')
193                        $(this).trigger('click');
194                });
195            })
196            .fail(function(error){
197                switch(error.status) {
198                    case 403: errmsg = 'Permission Denied'; break;
199                    case 404: errmsg = 'Requested URL not found: ' + loadurl; break;
200                    case 500: errmsg = 'Internal server error'; break;
201                    default:  errmsg = 'Error ' + error.status; break;
202                }
203                $(targ).html('<div class="alert alert-danger mb0" role="alert"><b>' + errmsg + '</b></div>');
204            })
205            .always(function(){
206                tab.html(title);
207                tab.tab('show');
208            });
209        }
210    };
211}(jQuery);
212
213$(function(){
214    try {
215        Core.initDataTables();
216    } catch (err) {
217        console.log(err);
218    }
219  Core.initDialogs();
220  Core.initDatePicker();
221  // iOS slider style checkboxes
222  if ($.fn.bootstrapSwitch) {
223    $.fn.bootstrapSwitch.defaults.onColor = 'success';
224    $.fn.bootstrapSwitch.defaults.offColor = 'danger';
225    $.fn.bootstrapSwitch.defaults.size = 'small';
226    $(".ios-switch").bootstrapSwitch();
227  }
228});
229
230$(window).bind("load ajaxComplete", function() {
231    Core.initTooltips();
232    Core.initDatePicker();
233});
234
235$(document).on('click', '[data-toggle="tabajax"]', function(e) {
236    Core.ajaxTab($(this));
237    return false;
238});
239
240

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.