PageSourceSearch

https://kavahq.com/static/js/eta.js?ver=2

js kavahq.com collected 2026-09-30 10:14:21 UTC 3,593 bytes, 144 lines download raw bytes

1/**
2 * JavaScript code related to ETA elements.
3 *
4 * Requirements
5 * ============
6 *
7 * * jQuery_ 1.3.2 or later
8 *
9 * Installation
10 * ============
11 *
12 * Done for Kavyarnya with adding::
13 *
14 *     <script src="{{ MEDIA_URL }}js/eta.js" type="text/javascript"></script>
15 *
16 * to base template after loading jQuery_.
17 *
18 * .. _jQuery: http://jquery.com/
19 *
20 */
21window.gettingETAs = false
22
23
24/**
25 * Init code to ColorBox ETA links, like "Add new ETA" or "Add comment".
26 *
27 * Usage
28 * =====
29 *
30 * Just add call this function to ``$(document).ready`` at necessary page,
31 * like::
32 *
33 *    $(document).ready(initETAColorbox);
34 *
35 * or::
36 *
37 *    $(document).ready(function() {
38 *        initETAColorbox();
39 *    });
40 *
41 */
42var initETAColorbox = function () {
43    smartHeight = function() {
44        $this = $(this);
45        value = ($this.attr("id") == "eta-link" || $this.hasClass("done") || $this.hasClass("edit")) ? 380 : 283;
46        return ($.browser.safari || $.browser.webkit) ? value - 10 : value;
47    }
48
49    smartWidth = function() {
50        $this = $(this);
51        return ($this.attr("id") == "eta-link" || $this.hasClass("done") || $this.hasClass("edit")) ? 600 : 500;
52    }
53    $(".eta-link").click(function() {
54        $this = $(this);
55        href = $this.attr("href");
56        title = $(this).attr("title");
57
58        if (href.indexOf("ajax=1") == -1) {
59            if (href.indexOf("?") == -1) {
60                href += "?ajax=1";
61            }
62            else {
63                href += "&ajax=1";
64            }
65
66            $this.attr("href", href);
67        }
68
69        if (!title) {
70            $this.attr("title", $this.text());
71        }
72    });
73
74    $(".eta-link").colorbox({
75        height: smartHeight, initialHeight: smartHeight, innerHeight: smartHeight,
76        width: smartWidth, initialWidth: smartWidth, innerWidth: smartWidth,
77        iframe: true,
78        opacity: 0.2,
79        onClosed:function(){
80            location.reload();
81        }
82    });
83    $(document).bind('cbox_complete', function(){
84        $('#colorbox').fadeIn('fast');
85    });
86    //$(document).bind('cbox_closed', function(){
87    //    location.reload();
88    //});
89}
90
91
92var updateETATableLink = null;
93var updateETATable = function() {
94    if (!updateETATableLink) return;
95
96	$("#loading").show();
97
98    $.get(updateETATableLink, function(data) {
99        if (!data) {
100            $("#loading").hide();
101            return;
102        }
103
104        data = $("<div>" + data + "</div>");
105        $("table.etas tbody").html($("table.etas tbody", data).html());
106        $('table.etas tr:last').after(uploaded_html);
107
108        onlineUsers = $("ul.online-users", data).html();
109
110        onlineUsersElem = $("ul.online-users");
111        onlineUsersElem.html(onlineUsers);
112
113        if (onlineUsers) {
114            onlineUsersElem.show();
115        }
116        else {
117            onlineUsersElem.hide();
118        }
119
120        initETAColorbox();
121
122        $("#loading").hide();
123    });
124
125};
126
127function load_etas_buttons(sender, url){
128    id_eta = parseInt(sender.id.split("_")[1]);
129    $("#buttons-div-eta_"+id_eta).html("<small> Checking permissions... </small>");
130    $("#buttons-div-eta_"+id_eta).load(url, initETAColorbox);
131    $(sender).hide();
132}
133
134var uploaded_html = "";
135function getLatterETA() {
136    if (isScrolledIntoView($('tr.eta-past').last()[0]) && ! window.gettingETAs) {
137        window.gettingETAs = true;
138        $.get( "eta_activity/list/get-older/", function( data ) {
139            $('table.etas:first tr:last').after(data);
140            uploaded_html += data;
141            window.gettingETAs = false;
142        });
143    }
144}

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.