|
| 1 | +var UI = { |
| 2 | + |
| 3 | + dim: function(callback) { |
| 4 | + if (!Data.state.dimmed) { |
| 5 | + Data.ui.dim.fadeIn(Data.config.uiSpeed, callback); |
| 6 | + } |
| 7 | + }, |
| 8 | + |
| 9 | + unDim: function(callback) { |
| 10 | + if (!Data.state.dimmed) { |
| 11 | + Data.ui.dim.fadeOut(Data.config.uiSpeed, callback); |
| 12 | + } |
| 13 | + |
| 14 | + return UI; |
| 15 | + }, |
| 16 | + |
| 17 | + startSpin: function () { |
| 18 | + Data.ui.bottomMenu_spinner |
| 19 | + .fadeIn(Data.config.uiSpeed*4); |
| 20 | + }, |
| 21 | + |
| 22 | + stopSpin: function () { |
| 23 | + Data.ui.bottomMenu_spinner |
| 24 | + .fadeOut(Data.config.uiSpeed*4); |
| 25 | + }, |
| 26 | + |
| 27 | + registerEventHandlers: function () { |
| 28 | + Data.ui.topMenu_clipboard.on('click', $.proxy(UI.tabClick, null, "clipboard")); |
| 29 | + Data.ui.topMenu_logs.on('click', $.proxy(UI.tabClick, null, "logs")); |
| 30 | + Data.ui.bottomMenu_menu.on('click', $.proxy(UIPanels.showMenuPanel, null, false)); |
| 31 | + UI.update_scrollables(); |
| 32 | + }, |
| 33 | + |
| 34 | + update_scrollables: function() { |
| 35 | + Data.ui.clipboard_list.slimScroll({height: 'auto', color: '#ffcc2a', alwaysVisible: true}); |
| 36 | + Data.ui.logs_list.slimScroll({height: 'auto', color: '#ffcc2a', alwaysVisible: true}); |
| 37 | + }, |
| 38 | + |
| 39 | + showAlert: function (event) { |
| 40 | + var alert = $(Data.templates.alert(event)); |
| 41 | + |
| 42 | + alert.on('mouseover',function () { |
| 43 | + alert.stop(true, true); |
| 44 | + }).on('mouseout',function () { |
| 45 | + UI.idleAlert(alert); |
| 46 | + }); |
| 47 | + |
| 48 | + Data.ui.alertContainer.append(alert); |
| 49 | + |
| 50 | + alert.fadeIn(Data.config.uiSpeed, function () { |
| 51 | + UI.idleAlert(alert); |
| 52 | + }); |
| 53 | + }, |
| 54 | + |
| 55 | + idleAlert: function (alert) { |
| 56 | + alert.delay(Data.config.alertStay) |
| 57 | + .fadeOut(Data.config.uiSpeed, function() { |
| 58 | + alert.remove(); |
| 59 | + }); |
| 60 | + }, |
| 61 | + |
| 62 | + tabClick: function (tab) { |
| 63 | + if ($('#'+tab).hasClass('active')) return; |
| 64 | + |
| 65 | + $('#content-wrapper').fadeOut('fast',function(){ |
| 66 | + $('.main-content.active, .menu-button.active ').removeClass('active'); |
| 67 | + $('.menu-button.' + tab + ', #' + tab).addClass('active'); |
| 68 | + $('.menu-button.' + tab).removeClass('blink'); |
| 69 | + $('#content-wrapper').fadeIn('fast'); |
| 70 | + }); |
| 71 | + }, |
| 72 | + |
| 73 | + blinkTab: function (tab) { |
| 74 | + if ($('#'+tab).hasClass('active')) return; |
| 75 | + $('.menu-button.' + tab).addClass('blink'); |
| 76 | + }, |
| 77 | + |
| 78 | + getLoadingText: function () { |
| 79 | + var msgs = [ |
| 80 | + "Hull tanking", |
| 81 | + "EFT warrioring", |
| 82 | + "Smacktalking", |
| 83 | + "Shitpoasting", |
| 84 | + "Lemming'ing", |
| 85 | + "Clicking jump instead of bridge", |
| 86 | + "Overheating guns", |
| 87 | + "Bumping the titan", |
| 88 | + "Fitting a windicator", |
| 89 | + "Burning point", |
| 90 | + "Posting gudfites", |
| 91 | + "Z0r", |
| 92 | + "Whoring on the pod" |
| 93 | + ]; |
| 94 | + return msgs[Math.floor(Math.random()*msgs.length)] + "..."; |
| 95 | + } |
| 96 | +} |
0 commit comments