PageSourceSearch

https://dota2lounge.com/scripts/chat.js?1635434646

js dota2lounge.com collected 2026-10-02 05:12:50 UTC 29,010 bytes, 795 lines download raw bytes

1/* jquery.resizableChat */
2!function(e,n){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e,n){function t(n,t){return n&&">"===n.trim()[0]?(n=n.trim().replace(/^>\s*/,""),t.find(n)):n?e(n):t}e.fn.resizableChat||(e.fn.resizableChat=function(n){var o={handleSelector:null,resizeWidth:!0,resizeHeight:!0,resizeWidthFrom:"right",resizeHeightFrom:"bottom",onDragStart:null,onDragEnd:null,onDrag:null,touchActionNone:!0};return"object"==typeof n&&(o=e.extend(o,n)),this.each(function(){function n(e){e.stopPropagation(),e.preventDefault()}function i(t){t.preventDefault&&t.preventDefault(),s=c(t),s.width=parseInt(d.width(),10),s.height=parseInt(d.height(),10),a=d.css("transition"),d.css("transition","none"),o.onDragStart&&o.onDragStart(t,d,o)===!1||(o.dragFunc=r,e(document).bind("mousemove.rsz",o.dragFunc),e(document).bind("mouseup.rsz",u),(window.Touch||navigator.maxTouchPoints)&&(e(document).bind("touchmove.rsz",o.dragFunc),e(document).bind("touchend.rsz",u)),e(document).bind("selectstart.rsz",n))}function r(e){var n,t,i=c(e);n="left"===o.resizeWidthFrom?s.width-i.x+s.x:s.width+i.x-s.x,t="top"===o.resizeHeightFrom?s.height-i.y+s.y:s.height+i.y-s.y,o.onDrag&&o.onDrag(e,d,n,t,o)===!1||(o.resizeHeight&&d.height(t),o.resizeWidth&&d.width(n))}function u(t){return t.stopPropagation(),t.preventDefault(),e(document).unbind("mousemove.rsz",o.dragFunc),e(document).unbind("mouseup.rsz",u),(window.Touch||navigator.maxTouchPoints)&&(e(document).unbind("touchmove.rsz",o.dragFunc),e(document).unbind("touchend.rsz",u)),e(document).unbind("selectstart.rsz",n),d.css("transition",a),o.onDragEnd&&o.onDragEnd(t,d,o),!1}function c(e){var n={x:0,y:0,width:0,height:0};if("number"==typeof e.clientX)n.x=e.clientX,n.y=e.clientY;else{if(!e.originalEvent.touches)return null;n.x=e.originalEvent.touches[0].clientX,n.y=e.originalEvent.touches[0].clientY}return n}var s,a,d=e(this),h=t(o.handleSelector,d);o.touchActionNone&&h.css("touch-action","none"),d.addClass("resizableChat"),h.bind("mousedown.rsz touchstart.rsz",i)})})});
3
4
5function ResizableBlock() {
6  var createBlock = function (type) {
7    var resizeBlock = {};
8    if (type === 'chat') {
9      resizeBlock = createChat();
10    } else if (type === 'stream') {
11      resizeBlock = createStreamBlock();
12    }
13    return resizeBlock;
14
15  }
16  return {
17    createBlock: createBlock
18  }
19}
20function startMove(e, type, block) {
21  var elem = block.container;
22  if (e.which != 1) {
23    return;
24  }
25  if (block.container.hasClass(type + '_dragged')) {
26      block.pointX = e.pageX - elem.offset().left;
27      block.pointY = e.pageY - elem.offset().top;
28      block.dragging = true;
29      e.preventDefault();
30  }
31}
32function move(e, type, block) {
33  if (!block.dragging) return;
34  if (type === 'stream') {
35    block.container.addClass('stream-block_moving');
36  } else if (type === 'chat') {
37    block.container.addClass('chat_dragged');
38  }
39
40  var scroll = $(window).scrollTop();
41
42  var topPosition = e.pageY - scroll - block.pointY;
43  var leftPosition = e.pageX - block.pointX;
44
45  if (!(leftPosition > 0 && topPosition > 0)) {
46      if(leftPosition <= 0){
47        leftPosition = 0;
48      }
49      if(topPosition <= 0){
50        topPosition = 0;
51      }
52  } else {
53      rightPosition = 'auto';
54      bottomPosition = 'auto';
55  }
56  block.container.css({
57    'top' : topPosition,
58    'left' : leftPosition
59  });
60  e.preventDefault();
61}
62function endMove(type, block) {
63  if (block.dragging) {
64    block.dragging = false;
65    localStorage.setItem(type + "-position-left", block.container.css("left"));
66    localStorage.setItem(type + "-position-top", block.container.css("top"));
67    if (type === 'stream') block.container.removeClass('stream-block_moving');
68  }
69}
70function createStreamBlock() {
71  return {
72    dragging: false,
73    pointX: 0,
74    pointY: 0,
75    container: null,
76    streamBlock: null,
77    isAttached: localStorage.getItem('stream-attached') == "1",
78    initStream: function(block, match) {
79      var that = this;
80      if (!match.stream.length) return;
81      if (block.hasClass('stream-opened')) {
82          return;
83      }
84
85      $(".sys-betting").removeClass('stream-opened');
86      block.addClass('stream-opened');
87
88      that.streamBlock = $('.sys-block-stream');
89      that.streamBlock.html('');
90
91      that.streamBlock.tmpl('sidebar_stream', {
92          match: match,
93          isAttached: this.isAttached,
94          langSelector: match.stream.length > 1
95      });
96      that.container = $('.sys-streamside-block');
97
98      if (!this.isAttached) {
99        that.container.css({
100              "top":    localStorage.getItem('stream-position-top') || 100,
101              "left":   localStorage.getItem('stream-position-left') || 100,
102              "height": localStorage.getItem('stream-size-height'),
103              "width":  localStorage.getItem('stream-size-width')
104          })
105      }
106      that.streamBlock.find('.sys-player').tmpl('stream', match.stream[0]);
107      that.container.resizableChat({
108        handleSelector: '.stream-block__resize',
109        onDragEnd: function() {
110          that.container.removeClass('stream-block_resizing');
111          localStorage.setItem("stream-size-width",  that.container.width());
112          localStorage.setItem("stream-size-height", that.container.height());
113        }
114      });
115    },
116    bindEvents: function() {
117      var that = this;
118      that.container.on("mousedown",".sys-resize-block", function() {
119        that.container.addClass('stream-block_resizing');
120      });
121      that.container.on("click", ".sys-attach-stream", function() {
122        if (that.container.hasClass('stream-block_dragged')) {
123
124          that.container.css({
125              "top": '',
126              "left": '',
127              "height": '',
128              "width": ''
129          });
130
131          that.container.removeClass('stream-block_dragged');
132
133          localStorage.setItem('stream-attached', "1");
134        } else {
135            that.container.addClass('stream-block_dragged');
136
137            that.container.css({
138                "top":    localStorage.getItem('stream-position-top') || 100,
139                "left":   localStorage.getItem('stream-position-left') || 100,
140                "height": localStorage.getItem('stream-size-height'),
141                "width":  localStorage.getItem('stream-size-width')
142            });
143
144            localStorage.setItem('stream-attached', "0");
145        }
146      });
147      that.container.on("click", '.sys-close-stream', function() {
148        $(".sys-betting").removeClass('stream-opened');
149        that.streamBlock.html('');
150      });
151      that.container.on("click", ".sys-reopen-stream", function() {
152        var $e = $(this);
153        if (
154            !$(".sys-stream-change-lang").hasClass('active')
155            || $e.hasClass('active')
156        ) {
157            return;
158        }
159
160        that.streamBlock.find('.sys-reopen-stream').removeClass('active');
161        $e.addClass('active');
162        that.streamBlock.find('.sys-player').html('').tmpl('stream', $e.data('info'));
163      });
164      that.container.on("mousedown", '.sys-stream-header', function(e) {
165        startMove(e, 'stream-block', that);
166      });
167      that.container.on("mousemove", function(e) {
168        move(e, 'stream', that);
169      });
170      that.container.on("mouseup", function() {
171        endMove('stream', that);
172      });
173      that.container.on("click", ".sys-stream-change-lang", function() {
174        $(this).toggleClass('active');
175      });
176    }
177  }
178}
179
180function createChat() {
181  return {
182    messageTimeout: 7000,
183    myLastMessageTimestamp: 0,
184    myLastMessageValue: '',
185    globLastMessageValue: '',
186    bannedUsersNames: [],
187    sending:  false,
188    dragging: false,
189    pointX: 0,
190    pointY: 0,
191    scroller: null,
192    language: 'ru',
193    callAppendMessagesCounter: 0,
194    chatSubscribeInterval: null,
195    isCanReported: true,
196
197    getAvailableChats: function () {
198      var items = this.container.find('.chat-langs-item');
199      var chats = [];
200      $.each(items, function (i, e) {
201        chats.push($(e).data('chat-lang'));
202      });
203
204      return chats;
205    },
206    initOnlineSocket: function () {
207      var that = this;
208
209      wsRegisterHandler("online:" + getProjectGame(), function(data) {
210        that.setOnline(data.users, 'total');
211      });
212
213      $.each(that.getAvailableChats(), function (i, e) {
214        var chatType = "chat" + e.toString();
215        if (!wsIssetHandler("online:" + chatType)) {
216          wsRegisterHandler("online:" + chatType, function(data) {
217            that.setOnline(data.users, e);
218          });
219        }
220      });
221    },
222    initChatSocket: function(chatId) {
223        var that = this;
224        var chatType = "chat" + chatId.toString();
225
226        wsSubscribe(chatType);
227
228        if (that.chatSubscribeInterval !== null) {
229          clearInterval(that.chatSubscribeInterval);
230        }
231        that.chatSubscribeInterval = window.setInterval(function () {
232            wsSubscribe(chatType);
233        }, 60000);
234
235        if (!wsIssetHandler("chat")) {
236            wsRegisterHandler("chat", function(data) {
237                that.appendMessages([data]);
238            });
239        }
240
241        if (!wsIssetHandler("pin")) {
242            wsRegisterHandler("pin", function(data) {
243                that.appendPinMessage(data);
244            });
245        }
246    },
247    init: function(obj) {
248      var that = this;
249      this.container = obj;
250      this.chat      = obj.find(".chat-messages");
251      this.chattext  = obj.find(".chat-form__textarea TEXTAREA");
252
253      this.initOnlineSocket();
254      this.initChatSocket(chatID);
255
256      that.container.on("click", ".chat-message__user-name", function(){
257        that.answer($(this));
258      });
259
260      that.container.resizableChat({
261        handleSelector: '.chat__resize',
262        onDragEnd: function() {
263          setCookie("chat-size-width",  that.container.width(), 365);
264          setCookie("chat-size-height", that.container.height(), 365);
265        }
266      });
267
268      that.scroller = that.container.find('.baron').baron({
269        root: '.baron',
270        scroller: '.baron__scroller',
271        bar: '.baron__bar',
272        scrollingCls: '_scrolling',
273        draggingCls: '_dragging'
274      });
275
276      // open/close chat trigger
277      that.container.on("click", '.chat-header-controls__item_collapse', function(e){
278        that.container.toggleClass('chat_collapsed');
279        setCookie("chat-opened", (getCookie("chat-opened")==="1")?"0":"1", 365);
280      });
281
282      that.container.on("click", '.chat-dropdown', function(e){
283        $(this).toggleClass('active');
284        e.stopPropagation();
285      });
286
287      that.container.on("click", '.chat-dropdown__dropdown', function(e){
288        e.stopPropagation();
289      });
290
291      $(window).click(function() {
292        $('.chat-dropdown').removeClass('active');
293      });
294
295      that.container.on("click", '.chat-settings-colors__color', function(e){
296        setCookie("chat-namecolor", $(this).data("color"), 365);
297      });
298
299      that.container.on("click", '#newnicklink', function(e){
300        e.stopPropagation();
301        e.preventDefault();
302      });
303
304      that.container.on("click", '.chat-settings-nick-change__submit', function(e){
305        that.setName();
306        e.stopPropagation();
307        e.preventDefault();
308      });
309
310      that.container.find('.chat-settings-nick-change__input').keypress(function(e){
311        var key=e.keyCode || e.which;
312        if (key == 13){
313          that.setName();
314          e.stopPropagation();
315          e.preventDefault();
316        }
317      });
318
319      that.chat.on("mouseenter mouseleave", function(event){
320        if (event.type == "mouseenter") {
321          var remW = $("body").width()+"px";
322          var remM = $("body").offset().left+"px";
323          $("body").css({"margin-left": remM, "width": remW, "overflow": "hidden"});
324        } else {
325          $("body").css({"margin-left": "auto", "width": "auto", "overflow": "auto"});
326        }
327      });
328
329      if (isMobile()){
330        setCookie("chat-detached", "0", 365);
331        that.attach();
332        that.container.addClass("chat_mobile");
333      } else {
334        // attach/detach
335        if (getCookie("chat-detached") === "0"){
336          that.attach();
337        } else {
338          that.detach();
339        }
340
341        that.container.find('.chat-header-controls__item_position-reset').on("click",function(event){
342          event.stopPropagation();
343          that.attach();
344          setCookie("chat-detached", "0", 365);
345        });
346
347        that.container.find('.chat-header-controls__item_unplug').on("click",function(event){
348          event.stopPropagation();
349          that.detach();
350          setCookie("chat-detached", "1", 365);
351        });
352      }
353
354      that.container.find('.chat-header').mousedown(function(e){
355        startMove(e, 'chat', that);
356      });
357
358      $(document).mousemove(function(e){
359        //scroller.update();
360        move(e, 'chat', that);
361      });
362
363      $(document).mouseup(function(){
364        endMove('chat', that);
365      });
366
367      that.container.on("click", "#chatRules", function(e) {
368        setTimeout(function(){
369          setCookie("chat-hiderules", "1", 365);
370          $(".chat-rules").slideUp();
371        }, 400);
372      });
373
374
375      that.chattext.keypress(function(e){
376        var key=e.keyCode || e.which;
377        if (key == 13){
378          that.sendMessage();
379          e.stopPropagation();
380          e.preventDefault();
381        }
382      });
383
384      that.container.on("click", ".chat-form-buttons__button_send", function(e){
385        that.sendMessage();
386        e.stopPropagation();
387      });
388
389      that.container.on("click", ".chat-message__report", function(e){
390        var $self = $(this);
391        var cid = $self.data("cid");
392
393        $.post(PATH+"chat/", {complain:"complain", cid:cid}, function(data) {
394
395          if (data) {
396            if (data.success=="ALL_OK"){
397              data.success = Lang("Спасибо!");
398            } else if (data.success=="already_reported"){
399              data.success = Lang("Этот человек уже отмечен.");
400            } else if (data.success=="insufficient_reports"){
401              data.success = Lang("Недостаточно репортов");
402            } else if (data.success=="ERROR"){
403              data.success = Lang("Произошла ошибка!");
404            }
405
406            if (data.remain==0) {
407              data.remain = "";
408            } else {
409              data.remain = Lang('Осталось репортов - :num', {num: data.remain});
410            }
411
412            $self.html(data.success+" "+data.remain);
413          }
414        },"JSON");
415      });
416
417      that.container.find('.baron__scroller').scroll( that.scrollChat.bind(that) );
418      that.appendMessages(initial_messages || []);
419      that.appendPinMessage(pin_message);
420
421      that.container.find('.baron__scroller').scrollTop(that.container.find('.baron__scroller').innerHeight());
422
423      if (ChatIsUser)
424        that.inlineInfo.init();
425    },
426    scrollBottom: function() {
427      this.container.find('.baron__scroller').scrollTop(1000000);
428    },
429    renderMessage: function(message) {
430      var colors = ["#000000", "#96BF24", "#1E66AD", "#870FE6", "#FF7035", "#20AE82", "#BF248F"];
431
432      var coolClass = '';
433
434      if (typeof ChatUserNick != "undefined" && ChatUserNick){
435        if (message[2].indexOf(ChatUserNick+",") >=0 && message[2].indexOf(ChatUserNick+",") < 3) {
436          message[2] = message[2].replace(ChatUserNick+",", "<div class='chat-message__user-name_direct'>"+ChatUserNick+",</div>");
437          coolClass += "chat-message_direct ";
438        }
439      }
440
441      message[3] = parseInt(message[3], 10);
442
443      switch (message[3]) {
444        case 100:
445          coolClass += 'chat-message_system ';
446          break;
447        case 90:
448          coolClass += 'chat-message_admin ';
449          break;
450        case 70:
451          coolClass += 'chat-message_moderator ';
452          break;
453        case 30:
454          coolClass += 'chat-message_vip ';
455          break;
456      }
457
458      var chatMessageClass = (message[3] > 0)?'chat-message__user-name_'+message[3]:'';
459
460
461      var text = ' \
462        <div class="chat-messages__item"> \
463          <div class="chat-message '+coolClass+'"> \
464      ';
465      //      <div class="chat-message__user-img"> \
466      //        <img src="https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/7e/7eff790a8426fb999ec862a83e1c2a0f3f7a2311_full.jpg" alt=""> \
467      //      </div> \
468
469      var messageUserName = message[1];
470      if (messageUserName === false) {
471        if (this.language === 'ru') {
472          messageUserName = 'Система';
473        } else {
474          messageUserName = 'System';
475        }
476      }
477
478      text += ' \
479            <div class="chat-message__text"> \
480              <div class="chat-message__user-name '+chatMessageClass+'">
480'+messageUserName+'</div> \
481              <div class="chat-message__message">'+message[2]+'</div> \
482      ';
483      if (message[3] < 50 && this.isCanReported) {
484        text += ' \
485                <div class="chat-message__report" data-cid="'+message[0]+'">Report</div> \
486        ';
487      }
488      text += ' \
489            </div> \
490          </div> \
491        </div> \
492      ';
493      return text;
494    },
495    prependMessages: function(messages) {
496      var arrayLength = messages.length;
497      var text = '';
498
499      for (var i = 0; i < arrayLength; i++) {
500        text = this.renderMessage(messages[i]) + text;
501      }
502
503      this.container.find(".chat-loader").after(text);
504    },
505    appendMessages: function(messages) {
506      var arrayLength = messages.length;
507      var text = '';
508      for (var i = 0; i < arrayLength; i++) {
509        if (this.globLastMessageValue != messages[i][2] && this.bannedUsersNames.indexOf(messages[i][1]) === -1) {
510          this.globLastMessageValue = messages[i][2];
511          text += this.renderMessage(messages[i]);
512
513          // боремся с эффектом "курицы без головы", когда юзер постит после бана
514          if (typeof messages[i][4] !== 'undefined') {
515            if (messages[i][4] === "ban") {
516
517              this.bannedUsersNames.push(messages[i][5]);
518
519              // удалим его из списка через несколько секунд (сборка мусора)
520              setTimeout(function(namesList, nickname) {
521                for (var i in namesList){
522                  if (namesList[i] == nickname){
523                    namesList.splice(i, 1);
524                    break;
525                  }
526                }
527              }.bind(this, this.bannedUsersNames, messages[i][5]), 20000);
528            }
529          }
530        }
531      }
532
533      if (!text.length)
534        return;
535
536      this.chat.append(text);
537
538      if (this.container.find('.baron__scroller').prop('scrollHeight') - this.container.find('.baron__scroller').scrollTop() - this.container.find('.baron__scroller').outerHeight() < 50 || !this.container.mouseIsOver()){
539        this.container.find('.baron__scroller').scrollTop(1000000); // Scroll only if the chat is near the bottom
540        this.sliceChat();
541      }
542    },
543    appendPinMessage: function(message) {
544      if (!message) {
545          this.container.find('.chat-attached-msg .chat-message').html('');
546          this.container.find('.chat-attached-msg').hide();
547      } else {
548          this.container.find('.chat-attached-msg .chat-message').html(message);
549          this.container.find('.chat-attached-msg').show();
550      }
551    },
552    sliceChat: function() {
553      this.callAppendMessagesCounter++;
554
555      if (this.callAppendMessagesCounter < 100) {
556        return false;
557      }
558
559      this.callAppendMessagesCounter = 0;
560
561      this.chat.find('.chat-messages__item').slice(0, -90).remove();
562    },
563
564    scrollChat: function() {
565      var that = this;
566
567      if (that.sending) return;
568
569      if (that.container.find('.baron__scroller').scrollTop() < 30) {
570
571        that.sending = true;
572
573        that.container.find(".chat-loader").addClass("active");
574
575        jQuery.ajax({
576          url: PATH+'chat/?getchat='+current_id+'&chatid='+chatID.toString(),
577          cache: false
578        }).done(function( html ) {
579          try {
580            var data = JSON.parse(html);
581            var old_height = that.chatGetHeight();
582
583            text = that.prependMessages(data[1]);
584
585            current_id = parseInt(data[0]);
586            that.container.find('.baron__scroller').scrollTop(that.chatGetHeight() - old_height);
587          } catch(jQuerye) {
588            that.chat.html("<center>" + Lang('Ошибка загрузки') + "</center>" + that.chat.html());
589          }
590        }).fail(function(jqXHR, textStatus) {
591          that.chat.html("<center>" + Lang('Ошибка загрузки') + "</center>" + that.chat.html());
592        }).always(function(){
593          that.sending = false;
594          that.container.find(".chat-loader").removeClass("active");
595        });
596      }
597    },
598    sendMessage: function(){
599      var val  = this.chattext.val();
600      var that = this;
601
602      if (this.sending || !val) return;
603
604      var color = parseInt(getCookie("chat-namecolor") || 0, 10);
605      var currentTime = new Date().getTime();
606
607      if (this.myLastMessageValue === val && currentTime - this.myLastMessageTimestamp < this.messageTimeout) {
608        this.appendMessages([[chatID, ChatUserNick, val, color]]);
609        return;
610      }
611
612      this.sending = true;
613      this.myLastMessageValue = val;
614      this.myLastMessageTimestamp = currentTime;
615
616
617      $.ajax({
618        url: PATH+'chat/'+GetSessionToken+'/?chat='+encodeURIComponent(val)+'&chatid='+chatID.toString()+"&color="+color,
619        cache: false
620      }).done(function( html ) {
621        that.chattext.val("");
622      }).fail(function(jqXHR, textStatus) {
623        alert( "Request failed: " + textStatus );
624      }).always(function(){
625        that.sending = false;
626      });
627
628      this.chattext.focus();
629      return false;
630    },
631    setName: function() {
632      var that = this;
633      var name    = $(".chat-settings-nick-change__input").val().trim();
634      var session = $(".chat-settings-nick-change__input").data("session");
635
636      $(".chat-settings-nick-change").removeClass("chat-settings-nick-change_info chat-settings-nick-change_good " +
637          "chat-settings-nick-change_bad");
638
639      if (name == '') {
640          $(".chat-settings-nick-change").addClass("chat-settings-nick-change_bad");
641          return false;
642      }
643
644      $.ajax({
645        url: PATH+'chat/setnick/' + encodeURIComponent(name)+'/'+session+'/',
646        cache: false
647      }).done(function( data ) {
648        data = JSON.parse(data);
649        if (data.success){
650          $(".chat-settings-nick-change").removeClass("chat-settings-nick-change_info chat-settings-nick-change_bad").addClass("chat-settings-nick-change_good");
651          $(".chat-settings-nick-change-first").remove();
652          $(".chat-form").show();
653          that.scrollBottom();
654        }
655        else {
656          $(".chat-settings-nick-change").removeClass("chat-settings-nick-change_good chat-settings-nick-change_info").addClass("chat-settings-nick-change_bad");
657        }
658      });
659    },
660    answer: function(t) {
661      var text = this.chattext;
662      text.focus().val(htmlspecialchars_decode($(t).html()) + ", " + text.val());
663      return false;
664    },
665    chatGetHeight: function() {
666      var contents = this.chat.wrapInner('<div>').children(); // wrap a div around the contents
667      var height = contents.outerHeight(); // read the inner divs height
668      contents.replaceWith( contents.html() );
669      return height;
670    },
671    setOnline: function(cnt, chatId) {
672      if (chatId == 'total') {
673        this.container.find(".chat-header-info__online SPAN").html(cnt);
674      } else {
675        this.container.find('.chat-langs-item[data-chat-lang="' + chatId + '"] .chat-langs-item__text').text(cnt);
676      }
677    },
678    attach: function(){
679      this.container.attr('style', '').removeClass('chat_dragged');
680    },
681    detach: function(){
682      // initialize chat variables
683      this.container.addClass('chat_dragged');
684
685      this.container.css({
686        "right":"5px",
687        "bottom":"0px",
688        "position":"fixed",
689        "height":"auto",
690        "z-index":"1000"
691      });
692
693      var padding_right = 10, padding_bottom = 30,
694        chat_body_border_size = 2,
695        chat_width = ( getCookie("chat-size-width")===false ? 380 : parseInt(getCookie("chat-size-width"),10) ),
696        chat_height = ( getCookie("chat-size-height")===false ? 400 : parseInt(getCookie("chat-size-height") ,10) ),
697        chat_position_left = localStorage.getItem('chat-position-left'),
698        chat_position_top = localStorage.getItem('chat-position-top'),
699        chat_header_height = $("[name=chat-header]").height(),
700        frame_height;
701
702      // initialize size
703      if (chat_width !== false){
704        if (chat_width > window.innerWidth - 2*padding_right){
705          chat_width = window.innerWidth - 2*padding_right;
706        }
707
708        this.container.find("#chat-body").width(chat_width);
709        this.container.width((chat_width+chat_body_border_size)+"px");
710
711        /*if (chat_height + chat_header_height > window.innerHeight - 2*padding_bottom){
712          chat_height = window.innerHeight - 2*padding_bottom;
713        }*/
714
715        this.container.find("#chat-body").height(chat_height+"px");
716      } else {
717        chat_width  = this.container.width();
718        chat_height = ( getCookie("chat-opened")==="0" ? 25 : 270 );
719      }
720
721      //frame_height = chat_height - 44;
722
723      this.container.css({
724        "height": chat_height+"px"
725      });
726
727      // initialize position
728      chat_height = parseInt(( getCookie("chat-opened")==="0" ? 25 : chat_height),10);
729      if (chat_position_left===false){
730          chat_position_left = window.innerWidth - chat_width - padding_right + "px";
731          chat_position_top = window.innerHeight - chat_height - padding_bottom + "px";
732      } else {
733        chat_position_left = (parseInt(chat_position_left,10) < 0 ? 1 : chat_position_left);
734        chat_position_top = (parseInt(chat_position_top,10) < 0 ? 1 : chat_position_top);
735        if (parseInt(chat_position_left, 10) + chat_width >= window.innerWidth ) {
736          chat_position_left = window.innerWidth - chat_width - padding_right + "px";
737          setCookie("chat-position-left",chat_position_left,365);
738        };
739        if (parseInt(chat_position_top, 10) + chat_height >= window.innerHeight ) {
740          chat_position_top = window.innerHeight - chat_height - padding_bottom + "px";
741          setCookie("chat-position-top",chat_position_top,365);
742        };
743      }
744
745      this.container.css({
746        "top" : chat_position_top,
747        "left" : chat_position_left,
748      });
749    },
750    inlineInfo: {
751      hash: "",
752      init: function() {
753        var self = this;
754
755        $(document).on("mouseenter", '.chat-item', function(e){
756          if ($(this).find(".chat-item__dropdown").length)
757            return;
758
759          var url = $(this).attr("href").split("/")[2];
760          var h = url.toString().split("-");
761          var name = url.replace(h[0]+"-"+h[1]+"-","");
762          if(!h[1]) return;
763          var url = CDN_PATH+"item/"+name+"/100.png";
764
765          self.loadPrice(h[0], h[1], $(this));
766
767          var html = ' \
768            <div class="chat-item__dropdown"> \
769              <div class="chat-item__img" style="background-image: url('+url+')"></div> \
770              <div class="chat-item__price"></div> \
771            </div>';
772
773          $(this).append(html);
774        });
775      },
776
777      loadPrice: function(classid, instanceid, obj){
778        var self = this;
779
780        var hash = classid+"_"+instanceid;
781
782        $.getJSON("/chat/GetPrice/"+self.hash+"/"+hash, function(data){
783          if(data.success && data.price) {
784            var price = (data.price/100).toFixed(1);
785
786            obj.find(".chat-item__price").addClass("cy").html(price);
787          }
788          else  {
789            obj.find(".chat-item__price").removeClass("cy").css("font-weight", "normal").html("Нет в продаже");
790          }
791        });
792      },
793    }
794  }
795}

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.