|
328 | 328 | } |
329 | 329 |
|
330 | 330 | var start = ''; |
331 | | - var domains = ['emupedia.net', 'emupedia.org', 'emupedia.games', 'emuos.net', 'emuos.org', 'emuos.games']; |
332 | | - var frontend = ~domains.indexOf(window.location.hostname) ? 'https://emuchat.' + domains[domains.indexOf(window.location.hostname)] + '/' : 'https://emuchat.emupedia.net/'; |
333 | | - var chat = null; |
334 | 331 |
|
335 | 332 | if (typeof self.options.start !== 'undefined') { |
336 | 333 | start = '<ul data-menu-lang="*" data-menu-type="start">'; |
|
518 | 515 | }).off('dblclick').on('dblclick', function() { |
519 | 516 | // noinspection JSUnfilteredForInLoop,JSReferencingMutableVariableFromClosure |
520 | 517 | if (typeof $(this).data('link') !== 'undefined') { |
521 | | - if ($(this).data('name') === 'EmuChat') { |
522 | | - if (typeof $(this).data('singleinstance') !== 'undefined') { |
523 | | - // noinspection DuplicatedCode |
524 | | - if ($(this).data('singleinstance') && self.$body.find('[id="' + $(this).data('name') + '"]').length === 0) { |
525 | | - // noinspection JSUnfilteredForInLoop,JSReferencingMutableVariableFromClosure |
526 | | - self.iframe({ |
527 | | - title: $(this).data('name'), |
528 | | - credits: $(this).data('credits'), |
529 | | - icon: $(this).data('icon'), |
530 | | - src: frontend, |
531 | | - newtab: $(this).data('newtab'), |
532 | | - width: $(this).data('width'), |
533 | | - height: $(this).data('height') |
534 | | - }); |
535 | | - } |
536 | | - } else { |
537 | | - // noinspection JSUnfilteredForInLoop,JSReferencingMutableVariableFromClosure |
538 | | - self.iframe({ |
539 | | - title: $(this).data('name'), |
540 | | - icon: $(this).data('icon'), |
541 | | - src: frontend, |
542 | | - newtab: $(this).data('newtab'), |
543 | | - width: $(this).data('width'), |
544 | | - height: $(this).data('height'), |
545 | | - credits: $(this).data('credits') |
546 | | - }); |
547 | | - } |
548 | | - } |
549 | | - |
550 | 518 | if (typeof ga === 'function') { |
551 | 519 | ga('send', { |
552 | 520 | hitType: 'pageview', |
|
709 | 677 | toggleFullscreen: true, |
710 | 678 | networkMonitor: true, |
711 | 679 | clock: true, |
712 | | - buttons: { |
713 | | - chat: { |
714 | | - label: 'Chat', |
715 | | - text: false, |
716 | | - icons: { |
717 | | - primary: 'ui-icon-comment' |
718 | | - } |
719 | | - } |
720 | | - }, |
721 | 680 | systemButtonsOrder: [ |
722 | | - 'chat', |
723 | 681 | 'languageSelect', |
724 | 682 | 'networkMonitor', |
725 | 683 | 'toggleFullscreen', |
|
970 | 928 | } |
971 | 929 | } |
972 | 930 |
|
973 | | - self.$window.one('keydown', function (e) { |
974 | | - // noinspection JSRedundantSwitchStatement |
975 | | - switch (e.keyCode) { |
976 | | - case 192: |
977 | | - if (!chat) { |
978 | | - // noinspection HtmlDeprecatedAttribute,HtmlUnknownTarget |
979 | | - chat = self.widget({ |
980 | | - title: 'Chat', |
981 | | - hidden: true, |
982 | | - width: 640, |
983 | | - height: 350, |
984 | | - right: '0px', |
985 | | - bottom: '28px', |
986 | | - content: '<iframe id="Chat" width="100%" height="100%" src="' + frontend + '" frameborder="0" allowTransparency="true" allow="autoplay; fullscreen; accelerometer; gyroscope; geolocation; microphone; camera; midi; encrypted-media; clipboard-read; clipboard-write" sandbox="allow-forms allow-downloads allow-modals allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts allow-top-navigation-by-user-activation"></iframe>' |
987 | | - }); |
988 | | - |
989 | | - chat.find('iframe').one('load', function() { |
990 | | - chat.slideDown(300); |
991 | | - }); |
992 | | - |
993 | | - e.preventDefault(); |
994 | | - return false; |
995 | | - } |
996 | | - } |
997 | | - }); |
998 | | - |
999 | | - self.$taskbar.taskbar('option', 'buttons.chat').$element.one('click', function() { |
1000 | | - if (!chat) { |
1001 | | - // noinspection HtmlDeprecatedAttribute,HtmlUnknownTarget |
1002 | | - chat = self.widget({ |
1003 | | - title: 'Chat', |
1004 | | - hidden: true, |
1005 | | - width: 640, |
1006 | | - height: 350, |
1007 | | - right: '0px', |
1008 | | - bottom: '28px', |
1009 | | - content: '<iframe id="Chat" width="100%" height="100%" src="' + frontend + '" frameborder="0" allowTransparency="true" allow="autoplay; fullscreen; accelerometer; gyroscope; geolocation; microphone; camera; midi; encrypted-media; clipboard-read; clipboard-write" sandbox="allow-forms allow-downloads allow-modals allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts allow-top-navigation-by-user-activation"></iframe>' |
1010 | | - }); |
1011 | | - |
1012 | | - chat.find('iframe').one('load', function() { |
1013 | | - chat.slideDown(300); |
1014 | | - }); |
1015 | | - } |
1016 | | - }); |
1017 | | - |
1018 | 931 | self.$html.contextmenu({ |
1019 | 932 | delegate: '.emuos-desktop, .emuos-taskbar', |
1020 | 933 | menu: [{ |
|
1212 | 1125 | self.$body.append(widget); |
1213 | 1126 | self.$taskbar = $('.taskbar').first(); |
1214 | 1127 |
|
1215 | | - widget.find('iframe').off('load').on('load', function() { |
1216 | | - if (title === 'Chat') { |
1217 | | - var net = {}; |
1218 | | - |
1219 | | - net.badge = 0; |
1220 | | - |
1221 | | - net.show = function() { |
1222 | | - if (typeof window['NETWORK_CONNECTION'] !== 'undefined') { |
1223 | | - if (typeof window['NETWORK_CONNECTION']['socket'] !== 'undefined') { |
1224 | | - // noinspection JSUnresolvedVariable |
1225 | | - if (typeof window['NETWORK_CONNECTION']['socket']['emit_event'] === 'function') { |
1226 | | - // noinspection JSUnresolvedFunction |
1227 | | - window['NETWORK_CONNECTION']['socket']['emit_event']('chat.show', {}); |
1228 | | - } |
1229 | | - } |
1230 | | - } |
1231 | | - |
1232 | | - widget.slideDown(300); |
1233 | | - net.badge = 0; |
1234 | | - var $icon = self.$body.find('.emuos-desktop-icon span:contains("EmuChat")').siblings('i.icon').first(); |
1235 | | - $icon.attr('class', 'icon badge'); |
1236 | | - }; |
1237 | | - |
1238 | | - net.hide = function() { |
1239 | | - if (typeof window['NETWORK_CONNECTION'] !== 'undefined') { |
1240 | | - if (typeof window['NETWORK_CONNECTION']['socket'] !== 'undefined') { |
1241 | | - // noinspection JSUnresolvedVariable |
1242 | | - if (typeof window['NETWORK_CONNECTION']['socket']['emit_event'] === 'function') { |
1243 | | - // noinspection JSUnresolvedFunction |
1244 | | - window['NETWORK_CONNECTION']['socket']['emit_event']('chat.hide', {}); |
1245 | | - } |
1246 | | - } |
1247 | | - } |
1248 | | - |
1249 | | - widget.slideUp(300); |
1250 | | - }; |
1251 | | - |
1252 | | - net.toggle = function() { |
1253 | | - if (widget.is(':hidden')) { |
1254 | | - net.badge = 0; |
1255 | | - var $icon = self.$body.find('.emuos-desktop-icon span:contains("EmuChat")').siblings('i.icon').first(); |
1256 | | - $icon.attr('class', 'icon badge'); |
1257 | | - |
1258 | | - if (typeof window['NETWORK_CONNECTION'] !== 'undefined') { |
1259 | | - if (typeof window['NETWORK_CONNECTION']['socket'] !== 'undefined') { |
1260 | | - // noinspection JSUnresolvedVariable |
1261 | | - if (typeof window['NETWORK_CONNECTION']['socket']['emit_event'] === 'function') { |
1262 | | - // noinspection JSUnresolvedFunction |
1263 | | - window['NETWORK_CONNECTION']['socket']['emit_event']('chat.show', {}); |
1264 | | - } |
1265 | | - } |
1266 | | - } |
1267 | | - } else { |
1268 | | - if (typeof window['NETWORK_CONNECTION'] !== 'undefined') { |
1269 | | - if (typeof window['NETWORK_CONNECTION']['socket'] !== 'undefined') { |
1270 | | - // noinspection JSUnresolvedVariable |
1271 | | - if (typeof window['NETWORK_CONNECTION']['socket']['emit_event'] === 'function') { |
1272 | | - // noinspection JSUnresolvedFunction |
1273 | | - window['NETWORK_CONNECTION']['socket']['emit_event']('chat.hide', {}); |
1274 | | - } |
1275 | | - } |
1276 | | - } |
1277 | | - } |
1278 | | - |
1279 | | - widget.slideToggle(300); |
1280 | | - }; |
1281 | | - |
1282 | | - self.$taskbar.taskbar('option', 'buttons.chat').$element.off('click').on('click', function() { |
1283 | | - net.toggle(); |
1284 | | - }); |
1285 | | - |
1286 | | - self.$window.off('keydown').on('keydown', function (e) { |
1287 | | - // noinspection JSRedundantSwitchStatement |
1288 | | - switch (e.keyCode) { |
1289 | | - case 192: |
1290 | | - net.toggle(); |
1291 | | - e.preventDefault(); |
1292 | | - return false; |
1293 | | - } |
1294 | | - }); |
1295 | | - |
1296 | | - var $icon = self.$body.find('.emuos-desktop-icon span:contains("EmuChat")').siblings('i.icon').first(); |
1297 | | - $icon.attr('class', 'icon badge'); |
1298 | | - |
1299 | | - if (typeof window['NETWORK_CONNECTION'] !== 'undefined') { |
1300 | | - // noinspection JSUnresolvedVariable |
1301 | | - if (typeof window['NETWORK_CONNECTION'].register_iframe === 'function') { |
1302 | | - // noinspection JSUnresolvedVariable,JSUnresolvedFunction |
1303 | | - window['NETWORK_CONNECTION'].register_iframe(title); |
1304 | | - } |
1305 | | - } |
1306 | | - } |
1307 | | - }); |
1308 | | - |
1309 | 1128 | return widget; |
1310 | 1129 | }; |
1311 | 1130 |
|
|
1402 | 1221 |
|
1403 | 1222 | self.$body.append(win); |
1404 | 1223 |
|
1405 | | - win.find('iframe').off('load').on('load', function() { |
1406 | | - var $el = $(this); |
1407 | | - |
1408 | | - if (title === 'EmuChat') { |
1409 | | - var net = window['NETWORK_CONNECTION']; |
1410 | | - |
1411 | | - if (typeof net !== 'undefined') { |
1412 | | - // noinspection JSUnresolvedVariable |
1413 | | - if (typeof net.register_iframe === 'function') { |
1414 | | - // noinspection JSUnresolvedFunction |
1415 | | - net.register_iframe(title); |
1416 | | - net.badge = 0; |
1417 | | - var $icon = self.$body.find('.emuos-desktop-icon span:contains("EmuChat")').siblings('i.icon').first(); |
1418 | | - $icon.attr('class', 'icon badge'); |
1419 | | - } |
1420 | | - } |
1421 | | - } |
1422 | | - |
1423 | | - $el.focus(); |
1424 | | - $el.get(0).focus(); |
1425 | | - $el.get(0).contentWindow.focus(); |
1426 | | - |
1427 | | - if (typeof window['NETWORK_CONNECTION'] !== 'undefined') { |
1428 | | - if (typeof window['NETWORK_CONNECTION']['socket'] !== 'undefined') { |
1429 | | - // noinspection JSUnresolvedVariable |
1430 | | - if (typeof window['NETWORK_CONNECTION']['socket']['emit_event'] === 'function') { |
1431 | | - // noinspection JSUnresolvedFunction |
1432 | | - window['NETWORK_CONNECTION']['socket']['emit_event']('chat.show', {}); |
1433 | | - } |
1434 | | - } |
1435 | | - } |
1436 | | - }); |
1437 | | - |
1438 | 1224 | // noinspection JSValidateTypes |
1439 | 1225 | win.window({ |
1440 | 1226 | help: credits, |
|
0 commit comments