PageSourceSearch

https://www.topseos.com/js/frontend.js?v=1

js topseos.com collected 2026-10-02 14:38:08 UTC 25,650 bytes, 624 lines download raw bytes

1var monthNames = [
2    "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
3];
4
5jQuery(function($) {
6
7    // Event tracking
8    // $('.track-click').gaTrackEventUnobtrusive({
9    //     useEvent:true,
10    //     useLabel:true,
11    //     event: 'click'
12    // });
13
14    if ( $('#ucompare').length > 0 ) {
15        $( "#ucompare" ).autocomplete({
16            source: ajaxurl + "?action=ucompare",
17            minLength: 3,
18            select: function( event, ui ) {
19                var _link = ui.item.link;
20                if ( _link ) {
21                    window.location.href = _link + "#feedback";
22                }
23            }
24        });
25    }
26
27    var imgUnveil = $("img.unveil");
28    if (imgUnveil.length > 0) {
29        imgUnveil.unveil(100);
30    }
31
32    $('.ranking_criteria').next().next().addClass('border_up');
33
34    $('.criteria_tooltip').tooltipster({
35    	position: 'bottom',
36        theme: 'tooltipster-borderless',
37        maxWidth: '250'
38    });
39
40    // hide all panel
41    function hideTabContent() {
42        $(".tab-content").hide()
43    }
44
45    function hideAndShowTabContent( tab_content ) {
46        var tab_content_sel = $("#" + tab_content);
47
48        hideTabContent();
49        $("#" + tab_content + " img.unveil").trigger("unveil");
50        $(".viewsnapshot_panel", tab_content_sel).show( "slow", function() {
51            // load wave chart
52            var _id = $("#" + tab_content + " .wave_chart").data('id');
53            var _ids = $("#" + tab_content + " .wave_chart").data('ids');
54            $.get(
55                ajaxurl,
56                { 'action': 'all_chart', 'id': _id, 'ids': _ids, 'chart_only': 'wave', cid: 1 },
57                function( response ) {
58                    var data = JSON.parse( response );
59                    $("#" + tab_content + " .wave_chart").html(data.wavechart);
60                }
61            );
62        });
63        $(".quicklink_panel", tab_content_sel).hide();
64        tab_content_sel.show();
65    }
66
67    $('.close_cross').on('click', function(){
68        $(this).parent().parent().hide();
69    });
70
71    // Ranking rollover effect
72    var delay = 250;
73    $('.ranktable_1').hover(function(){
74        $(this).find('.row_4').stop(true, true).fadeIn(delay);
75    },function(){
76        $(this).find('.row_4').stop(true, true).fadeOut(delay);
77    });
78
79    // Ranking clickable row
80    $('.ranktable_1').click(function(el){
81        if ( !$(el.target).is('.row_4 *') && !$(el.target).is('a') ) {
82            var _el = $(this).closest('.row_1').next('.tab-content');
83            _el.show();
84            hideAndShowTabContent( _el.attr('id') );
85        }
86    });
87
88    if ( $('.viewsnapshot_panel .wave_chart').length > 0 ) {
89        $('.viewsnapshot_panel .wave_chart').popover({
90            trigger: "hover",
91            placement: "left",
92            html: true,
93            title: 'Rankings Wave Chart',
94            content: function() {
95                var _popover_handler = $(this);
96                var _div_id = "div-id-wave";
97                var _id = _popover_handler.data('id');
98                var _ids = _popover_handler.data('ids');
99                var _time = $.now();
100                $.get(
101                    ajaxurl,
102                    { 'action': 'wave_chart_popover', 'id': _id, 'ids': _ids, 'unique_id' : _time },
103                    function( response ) {
104                        $('#' + _div_id).html(response).promise().done(function(){
105                            $(".wcp_" + _time).parents(".popover").css('top', -100);
106                            var _pi = parseInt($(".wcp_" + _time).parents(".popover").css('left').replace('px',''));
107                            $(".wcp_" + _time).parents(".popover").css('left', _pi - 520);
108                            $(".wcp_" + _time + " .close").on('click', function(){
109                                _popover_handler.popover('hide');
110                            });
111                        });
112                    }
113                );
114                return '<div class="wave_chart_container" id="' + _div_id + '">Loading...</div>'
115            },
116            delay: { show: 100, hide: 6000 }
117        });
118    }
119
120    var $panel_radarChart = $('.viewsnapshot_panel .radar_chart');
121    if ($panel_radarChart.length > 0) {
122        $panel_radarChart.popover({
123            trigger: "hover",
124            placement: "left",
125            html: true,
126            title: 'Rankings Criteria',
127            content: function() {
128                var _popover_handler = $(this);
129                var _div_id = "div-id-chart";
130                var _time = $.now();
131                var _score = _popover_handler.data('value').split(',');
132                var _d = Array();
133                $.each( _score, function( i, l ){
134                    _d.push(parseInt(l));
135                });
136                $.get(
137                    ajaxurl,
138                    { 'action': 'radar_chart_popover', 'id': _popover_handler.data('postid'), 'unique_id' : _time },
139                    function( response ) {
140                        $('#' + _div_id).html(response).promise().done(function(){
141                            $(".rcp_" + _time).parents(".popover").css('top', -50);
142                            var _pi = parseInt($(".rcp_" + _time).parents(".popover").css('left').replace('px',''));
143                            $(".rcp_" + _time).parents(".popover").css('left', _pi + 75);
144                            $(".rcp_" + _time + " .close").on('click', function(){
145                                _popover_handler.popover('hide');
146                            });
147
148                            new Highcharts.Chart({
149                                credits: false,
150                                chart: { renderTo: 'canvas_' + _time, polar: true, backgroundColor: 'transparent' },
151                                title: false,
152                                pane: { size: '100%' },
153                                xAxis: { categories: ['', '', '', '', ''], tickmarkPlacement: 'on', lineWidth: 0 },
154                                yAxis: { gridLineInterpolation: 'polygon', lineWidth: 0, min: 80, max: 100, tickInterval: 5 },
155                                tooltip: false, legend: false,
156                                series: [{
157                                    name: 'Rankings Criteria',
158                                    data: _d,
159                                    pointPlacement: 'on'
160                                }]
161                            });
162                        });
163                    }
164                );
165                return '<div class="radar_chart_container" id="' + _div_id + '">Loading...</div>'
166            },
167            delay: { show: 100, hide: 6000 }
168        });
169    }
170
171    function IsJsonString(str) {
172        try {
173            JSON.parse(str);
174        } catch (e) {
175            console.log('Invalid json object');
176            return false;
177        }
178        return true;
179    }
180
181    $('body').on( 'click', '.mod-request-quote', function() {
182        $('#mod-request-quote .confirmation_message').remove();
183        $('#mod-request-quote .gform_wrapper').removeClass('hidden');
184        var data = $("#tab-content-" + $(this).data('cid')).attr('data-company');
185        if (!IsJsonString(data)) {
186            return false;
187        }
188
189        $(this).colorbox({
190            inline: true,
191            onLoad: function() {
192                var decoded = JSON.parse(data);
193                $('#mod-request-quote .company_name').html(decoded.company_name);
194                $('#mod-request-quote .logo').attr('data-src', decoded.logo);
195                $('#mod-request-quote .address').html(decoded.address);
196                $('#mod-request-quote .city').html(decoded.city);
197                $('#mod-request-quote .state').html(decoded.state);
198                $('#mod-request-quote .zip').html(decoded.zip);
199                $('#mod-request-quote .country').html(decoded.country);
200                $('#mod-request-quote .phone').html(decoded.phone);
201                $('#mod-request-quote .website').html(decoded.website);
202                $('#mod-request-quote .website').attr('href', decoded.website_link);
203                $('#mod-request-quote input[type="text"].company_ID').attr('value', decoded.company_ID);
204                $('#mod-request-quote input[type="text"].company_NAME').attr('value', decoded.company_name);
205                $('#mod-request-quote input[type="text"].category_ID').attr('value', decoded.category_ID);
206                $('#mod-request-quote input[type="text"].category_NAME').attr('value', decoded.category_NAME);
207                $('#mod-request-quote input[type="text"].rp_ID').attr('value', decoded.rp_ID);
208
209                // window._izq.push(["event","form_submitted",
210                // 	{ "form_title":"Request Quote", "company_name":decoded.company_name }
211                // ]);
212            },
213            onComplete: function() {
214                $.colorbox.resize();
215                var $img = $('#colorbox img');
216                if ($img.length > 0) {
217                    $img.attr('src', $img.attr('data-src'));
218                }
219            },
220            onCleanup: function() {
221                // refresh the page after submission
222                if ( $("#mod-request-quote .gform_confirmation_message").length > 0 ) {
223                    location.reload();
224                }
225            }
226        });
227    });
228
229    $('body').on( 'click', '.mod-request-call', function() {
230        $('#mod-request-call .confirmation_message').remove();
231        $('#mod-request-call .gform_wrapper').removeClass('hidden');
232        var data = $("#tab-content-" + $(this).data('cid')).attr('data-company');
233        if (!IsJsonString(data)) {
234            return false;
235        }
236
237        $(this).colorbox({
238            inline: true,
239            onLoad: function(){
240                var decoded = JSON.parse(data);
241                $('#mod-request-call .company_name').html(decoded.company_name);
242                $('#mod-request-call .logo').attr('data-src', decoded.logo);
243                $('#mod-request-call .address').html(decoded.address);
244                $('#mod-request-call .city').html(decoded.city);
245                $('#mod-request-call .state').html(decoded.state);
246                $('#mod-request-call .zip').html(decoded.zip);
247                $('#mod-request-call .country').html(decoded.country);
248                $('#mod-request-call .phone').html(decoded.phone);
249                $('#mod-request-call .website').html(decoded.website);
250                $('#mod-request-call .website').attr('href', decoded.website_link);
251                $('#mod-request-call input[type="text"].company_ID').attr('value', decoded.company_ID);
252                $('#mod-request-call input[type="text"].company_NAME').attr('value', decoded.company_name);
253                $('#mod-request-call input[type="text"].category_ID').attr('value', decoded.category_ID);
254                $('#mod-request-call input[type="text"].category_NAME').attr('value', decoded.category_NAME);
255                $('#mod-request-call input[type="text"].rp_ID').attr('value', decoded.rp_ID);
256
257                // window._izq.push(["event","form_submitted",
258                // 	{ "form_title":"Request Quote", "company_name":decoded.company_name }
259                // ]);
260            },
261            onComplete: function() {
262                $.colorbox.resize();
263                var $img = $('#colorbox img');
264                if ($img.length > 0) {
265                    $img.attr('src', $img.attr('data-src'));
266                }
267            },
268            onCleanup: function() {
269                // refresh the page after submission
270                if ( $("#mod-request-call .gform_confirmation_message").length > 0 ) {
271                    location.reload();
272                }
273            }
274        });
275    });
276
277    $('body').on( 'click', '.mod-schedule-visit', function() {
278        $('#mod-schedule-visit .confirmation_message').remove();
279        $('#mod-request-visit .gform_wrapper').removeClass('hidden');
280        var data = $("#tab-content-" + $(this).data('cid')).attr('data-company');
281        if (!IsJsonString(data)) {
282            return false;
283        }
284
285        $(this).colorbox({
286            inline: true,
287            onLoad: function(){
288                var decoded = JSON.parse(data);
289                $('#mod-schedule-visit .company_name').html(decoded.company_name);
290                $('#mod-schedule-visit .logo').attr('data-src', decoded.logo);
291                $('#mod-schedule-visit .address').html(decoded.address);
292                $('#mod-schedule-visit .city').html(decoded.city);
293                $('#mod-schedule-visit .state').html(decoded.state);
294                $('#mod-schedule-visit .zip').html(decoded.zip);
295                $('#mod-schedule-visit .country').html(decoded.country);
296                $('#mod-schedule-visit .phone').html(decoded.phone);
297                $('#mod-schedule-visit .website').html(decoded.website);
298                $('#mod-schedule-visit .website').attr('href', decoded.website_link);
299                $('#mod-schedule-visit input[type="text"].company_ID').attr('value', decoded.company_ID);
300                $('#mod-schedule-visit input[type="text"].company_NAME').attr('value', decoded.company_name);
301                $('#mod-schedule-visit input[type="text"].category_ID').attr('value', decoded.category_ID);
302                $('#mod-schedule-visit input[type="text"].category_NAME').attr('value', decoded.category_NAME);
303                $('#mod-schedule-visit input[type="text"].rp_ID').attr('value', decoded.rp_ID);
304
305                // window._izq.push(["event","form_submitted",
306                // 	{ "form_title":"Request Quote", "company_name":decoded.company_name }
307                // ]);
308            },
309            onComplete: function() {
310                $.colorbox.resize();
311                var $img = $('#colorbox img');
312                if ($img.length > 0) {
313                    $img.attr('src', $img.attr('data-src'));
314                }
315            },
316            onCleanup: function() {
317                // refresh the page after submission
318                if ( $("#mod-schedule-visit .gform_confirmation_message").length > 0 ) {
319                    location.reload();
320                }
321            }
322        });
323    });
324
325    $('body').on( 'click', '.mod-contact', function(){
326        var data = $("#tab-content-" + $(this).data('cid')).attr('data-company');
327        if (!IsJsonString(data)) {
328            return false;
329        }
330
331        $(this).colorbox({
332            inline: true,
333            onLoad: function(){
334                var decoded = JSON.parse(data);
335                $('#mod-contact .company_name').html(decoded.company_name);
336                $('#mod-contact .logo').attr('data-src', decoded.logo);
337                $('#mod-contact .address').html(decoded.address);
338                $('#mod-contact .city').html(decoded.city);
339                $('#mod-contact .state').html(decoded.state);
340                $('#mod-contact .zip').html(decoded.zip);
341                $('#mod-contact .country').html(decoded.country);
342                $('#mod-contact .phone').html(decoded.phone);
343                $('#mod-contact .website').html(decoded.website);
344                $('#mod-contact .website').attr('href', decoded.website_link);
345                $('#mod-contact .company_ID input[type="text"]').attr('value', decoded.company_ID);
346                $('#mod-contact .company_NAME input[type="text"]').attr('value', decoded.company_name);
347            },
348            onComplete: function() {
349                $.colorbox.resize();
350                var $img = $('#colorbox img');
351                if ($img.length > 0) {
352                    $img.attr('src', $img.attr('data-src'));
353                }
354            },
355            onCleanup: function() {
356                // refresh the page after submission
357                if ( $("#mod-contact .gform_confirmation_message").length > 0 ) {
358                    location.reload();
359                }
360            }
361        });
362    });
363
364    // International Contact Us
365    $('body').on( 'click', '.mod-international-request', function(){
366        $(this).colorbox({
367            inline: true,
368            onLoad: function(){
369                var _term = $(this).data('term');
370                $('#mod-international-request .country_NAME input[type="text"]').attr('value', _term);
371            },
372            onComplete: function() {
373                $.colorbox.resize();
374            }
375        });
376    });
377
378    $(".mod-snapshot").on('click', function(){
379        var data_id = $(this).attr('data-id');
380        var tab_content = "tab-content-" + data_id;
381        hideAndShowTabContent(tab_content);
382        return false;
383    });
384
385    $('body').on('click', ".mod-representative", function(){
386        $(this).colorbox({
387            inline: true,
388            onComplete: function () {
389                $.colorbox.resize();
390            }
391        });
392    });
393
394    if (typeof mCustomScrollbar !== 'undefined') {
395        $(".content_scrollbar, #content_1, #content_2, #content_3, #content_4, #content_5, #content_6, #content_7").mCustomScrollbar({
396            scrollButtons:{
397                enable:true
398            }
399        });
400    }
401
402    $(".watch-video").colorbox({
403        iframe:true,
404        innerWidth:640,
405        innerHeight:390
406    });
407
408    $(".group-photos").colorbox({
409        rel:'group-photos',
410        transition:"fade",
411        scrolling:false,
412        className:'photos'
413    });
414
415    if ( $('.comparison_chart .category_ID').length > 0 ) {
416        $('.comparison_chart .category_ID').on('change', function(){
417            var _this = $(this);
418            $.get(
419                ajaxurl,
420                { 'action': 'all_chart', 'id': _this.data('id'), 'cid': _this.val(), 'ids': '' },
421                function( response ) {
422                    var data = JSON.parse( response );
423                    $("#side_rating_table .bar_chart").html(data.barchart);
424                    $("#chart-box .wave_chart").html(data.wavechart);
425                    $("#chart-box .radar_chart").html(data.radarchart).promise().done(function(){
426                        var _d = Array();
427                        $.each( $("#canvas_" + _this.data('id')).data('value').split(","), function( i, l ){
428                            _d.push(parseInt(l));
429                        });
430                        chartOptions = {
431                            credits: false,
432                            chart: { renderTo: 'canvas_' + _this.data('id'), polar: true, backgroundColor: 'transparent' },
433                            title: false,
434                            pane: { size: '100%' },
435                            xAxis: { categories: ['', '', '', '', ''], tickmarkPlacement: 'on', lineWidth: 0 },
436                            yAxis: { gridLineInterpolation: 'polygon', lineWidth: 0, min: 80, max: 100, tickInterval: 5 },
437                            tooltip: false,
438                            legend: false,
439                            series: [{
440                                name: 'Rankings Criteria',
441                                data: _d,
442                                pointPlacement: 'on'
443                            }]
444                        };
445                        new Highcharts.Chart(chartOptions);
446                    });
447                }
448            );
449        });
450
451        // trigger change on the first load
452        $('.comparison_chart .category_ID').trigger('change');
453    }
454
455    $('body').on( 'mouseover', '.missing_el', function(){
456        $(this).popover({
457            html: true,
458            placement: 'right',
459            trigger: 'hover',
460            delay: { hide:10000 },
461            content: function() {
462                return $('#popover_content_wrapper2').html();
463            }
464        });
465    });
466
467    // Review avg score calculation
468    $('.review-score').on('change', function(){
469        var score = parseInt($('input[name="score_0"]:checked').val()) +
470            parseInt($('input[name="score_1"]:checked').val()) +
471            parseInt($('input[name="score_2"]:checked').val()) +
472            parseInt($('input[name="score_3"]:checked').val()) +
473            parseInt($('input[name="score_4"]:checked').val());
474        var avg = (score/5);
475        $('.rating_result span').html(avg.toFixed(1));
476        $('.rating_wrapper').html(getRatingHtml(avg));
477    });
478
479    $('div.oveall-rate-wrapper').each( function(){
480        var visual = getRatingHtml($(this).data('avg'));
481        $(this).html(visual);
482        $(this).find('i').removeClass('half_rating').removeClass('full_rating');
483    });
484
485    $('.rating-search').each(function(){
486        var avg = $(this).data('avg');
487        var visualRating = '';
488        if (avg < 1 && avg > 0) { visualRating += '<i class="halfrating">&nbsp;</i>'; } else if (avg >= 1) { visualRating += '<i class="fullrating">&nbsp;</i>'; }
489        if (avg < 2 && avg > 1) { visualRating += '<i class="halfrating">&nbsp;</i>'; } else if (avg >= 2) { visualRating += '<i class="fullrating">&nbsp;</i>'; }
490        if (avg < 3 && avg > 2) { visualRating += '<i class="halfrating">&nbsp;</i>'; } else if (avg >= 3) { visualRating += '<i class="fullrating">&nbsp;</i>'; }
491        if (avg < 4 && avg > 3) { visualRating += '<i class="halfrating">&nbsp;</i>'; } else if (avg >= 4) { visualRating += '<i class="fullrating">&nbsp;</i>'; }
492        if (avg < 5 && avg > 4) { visualRating += '<i class="halfrating">&nbsp;</i>'; } else if (avg == 5) { visualRating += '<i class="fullrating">&nbsp;</i>">&nbsp;</i>'; }
493
494        // @todo: .norating == #50: Missing image for overall rating (empty star)
495        avg = 5 - avg;
496
497        if (avg > 1)  { visualRating += '<i class="norating">&nbsp;</i>'; }
498        if (avg > 2)  { visualRating += '<i class="norating">&nbsp;</i>'; }
499        if (avg > 3)  { visualRating += '<i class="norating">&nbsp;</i>'; }
500        if (avg > 4)  { visualRating += '<i class="norating">&nbsp;</i>'; }
501        if (avg == 5)  { visualRating += '<i class="norating">&nbsp;</i>'; }
502
503        $(this).find('span').html(visualRating);
504    });
505
506    $('.flag-offensive').on('click', function(){
507        var _container = $(this);
508        $.post(
509            ajaxurl,
510            { 'action': 'profile_comments', 'review_ID': $(this).data('rid'), 'h': -1 },
511            function( response ) {
512                _container.replaceWith(response);
513            }
514        );
515
516        return false;
517    });
518
519    $('.flag-helpful').on('click', function(){
520        var _container = $(this);
521        $.post(
522            ajaxurl,
523            { 'action': 'profile_comments', 'review_ID': $(this).data('rid'), 'h': 1 },
524            function( response ) {
525                console.log($(this).parents('.helpful-box'));
526                _container.parents('.helpful-box').html(response);
527            }
528        );
529
530        return false;
531    });
532
533    $('.flag-not-helpful').on('click', function(){
534        var _container = $(this);
535        $.post(
536            ajaxurl,
537            { 'action': 'profile_comments', 'review_ID': $(this).data('rid'), 'h': 0 },
538            function( response ) {
539                _container.parents('.helpful-box').html(response);
540            }
541        );
542
543        return false;
544    });
545
546    if ( $('.element-stats').length !== 0 ) {
547        $.get(
548            ajaxurl,
549            { 'action': 'profile_load_sidebar_stats', 'id': $('.profile_page .ranking-listbox').attr('data-id') },
550            function( response ) {
551                $('.element-stats').append(response);
552            }
553        );
554    }
555
556    // Downloads
557    $(".dl_link").on('click', function(){
558        var _container = $(this);
559        var _cid = $(this).data('cid');
560        var _rpid = $(this).data('rpid');
561        $.post(
562            ajaxurl,
563            { 'action': 'load_seal', 'c_ID': _cid, 'rp_ID': _rpid },
564            function( response ) {
565                $("#sealdownload-box").html(response);
566            }
567        );
568
569        return false;
570    });
571
572    $('body').on('click', ".mod-ranking-page-video", function(){
573        var data = $('#ranking-page-video-content .ranking-for-best-companies-video').html();
574        var title = $('#ranking-page-video-content .video-caption').html();
575        $('#mod-ranking-page-video .pop-title').html(title);
576        $('#mod-ranking-page-video .mod-content').html(data);
577        $(this).colorbox({
578            inline: true,
579            onComplete: function () {
580                $.colorbox.resize();
581            },
582            onClosed: function () {
583                $('#mod-ranking-page-video .mod-content').empty();
584            }
585        });
586    });
587
588});
589
590function getRatingHtml(avg) {
591    var visualRating = '';
592    if (avg < 1) {
593        visualRating += '<i class="left_rating half_rating">&nbsp;</i>';
594    } else if (avg >= 1) {
595        visualRating += '<i class="left_rating full_rating">&nbsp;</i>';
596    }
597
598    if (avg < 2 && avg > 1) {
599        visualRating += '<i class="half_rating">&nbsp;</i>';
600    } else if (avg >= 2) {
601        visualRating += '<i>&nbsp;</i>';
602    }
603
604    if (avg < 3 && avg > 2) {
605        visualRating += '<i class="half_rating">&nbsp;</i>';
606    } else if (avg >= 3) {
607        visualRating += '<i>&nbsp;</i>';
608    }
609
610    if (avg < 4 && avg > 3) {
611        visualRating += '<i class="half_rating">&nbsp;</i>';
612    } else if (avg >= 4) {
613        visualRating += '<i>&nbsp;</i>';
614    }
615
616    if (avg < 5 && avg > 4) {
617        visualRating += '<i class="marginright half_rating">&nbsp;</i>';
618    } else if (avg == 5) {
619        visualRating += '<i class="marginright full_rating">&nbsp;</i>';
620    }
621
622    return visualRating;
623}
624

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.