js.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <script>
  2. function bx_mobile_apps_show_main_menu () {
  3. if ('__main_menu__' == 'default') {
  4. if ($('.bx-pt-application #toggleSidebarMobile').size() && $(window).width() < 1280)
  5. $('#toggleSidebarMobile').trigger('click');
  6. else if ($('.bx-pt-application #toggleSidebar').size() && $(window).width() >= 1280)
  7. $('#toggleSidebar').trigger('click');
  8. else if ($('.bx-sidebar-site-trigger').size())
  9. bx_sidebar_toggle('site');
  10. else if ($('.cd-dropdown-trigger').size())
  11. $('.cd-dropdown-trigger').click();
  12. else if ($('.cd-side-nav').size())
  13. $([$('.cd-side-nav'), $('.cd-nav-trigger')]).toggleClass('nav-is-visible');
  14. else
  15. bx_menu_slide_inline('#bx-sliding-menu-sys_site', null, 'site');
  16. }
  17. else {
  18. bx_menu_popup('__main_menu__');
  19. }
  20. }
  21. function bx_mobile_apps_show_profile_menu () {
  22. if ($('.bx-sidebar-account-trigger').size())
  23. bx_sidebar_toggle('account');
  24. else
  25. bx_menu_slide_inline('#bx-sliding-menu-account', null, 'site');
  26. }
  27. function bx_mobile_apps_show_add_menu () {
  28. if ('undefined' !== typeof(oBxArtificerUtils))
  29. $('#bx-sliding-menu-sys_add_content').css({visibility:'visible', top:'0'});
  30. bx_menu_slide_inline('#bx-sliding-menu-sys_add_content', null, 'site');
  31. }
  32. function bx_mobile_apps_show_notifications_menu () {
  33. bx_menu_slide('bx_notifications_preview', null, 'site', {id:{value:'bx_notifications_preview', force:1}});
  34. }
  35. function bx_mobile_apps_show_messenger_menu () {
  36. document.location = sUrlRoot + 'page.php?i=messenger';
  37. }
  38. function bx_mobile_apps_home () {
  39. if (window.history.length > 1)
  40. window.history.go(-(window.history.length - 1));
  41. }
  42. function bx_mobile_apps_close_sliding_menus () {
  43. if ($('.bx-sliding-menu-main:visible').size()) // hide sliding menu if they are open
  44. bx_menu_slide_inline('.bx-sliding-menu-main');
  45. }
  46. function bx_mobile_apps_video_terminated (e) {
  47. if (typeof window.glBxVideoCallTerminated !== 'undefined' && window.glBxVideoCallTerminated instanceof Array) {
  48. for (let i = 0; i < window.glBxVideoCallTerminated.length; i++)
  49. if (typeof window.glBxVideoCallTerminated[i] === "function")
  50. window.glBxVideoCallTerminated[i](e);
  51. }
  52. }
  53. function bx_mobile_apps_video_joined (e) {
  54. if (typeof window.glBxVideoCallJoined !== 'undefined' && window.glBxVideoCallJoined instanceof Array) {
  55. for (let i = 0; i < window.glBxVideoCallJoined.length; i++)
  56. if (typeof window.glBxVideoCallJoined[i] === "function")
  57. window.glBxVideoCallJoined[i](e);
  58. }
  59. }
  60. function bx_mobile_apps_video_will_join (e) {
  61. if (typeof window.glBxVideoCallWillJoin !== 'undefined' && window.glBxVideoCallWillJoin instanceof Array) {
  62. for (let i = 0; i < window.glBxVideoCallWillJoin.length; i++)
  63. if (typeof window.glBxVideoCallWillJoin[i] === "function")
  64. window.glBxVideoCallWillJoin[i](e);
  65. }
  66. }
  67. function bx_mobile_apps_post_message (oJSON) {
  68. var sMsg = JSON.stringify(oJSON);
  69. if ('undefined' !== typeof(window.ReactNativeWebView))
  70. window.ReactNativeWebView.postMessage(sMsg);
  71. else
  72. window.postMessage(sMsg, '*');
  73. }
  74. bx_mobile_apps_post_message (__msg__);
  75. if (window && window.process && window.process.type) { // if run in electron
  76. const { ipcRenderer, shell } = require('electron')
  77. // send all notification badges
  78. ipcRenderer.send('message', __msg__);
  79. // send messenger badge
  80. if (typeof window.glBxMessengerOnNotificationChange === 'undefined')
  81. window.glBxMessengerOnNotificationChange = [];
  82. window.glBxMessengerOnNotificationChange.push(function (iNewNumberOfUnreadChats) {
  83. sMsg = {
  84. 'bubbles': {
  85. 'notifications-messenger': iNewNumberOfUnreadChats,
  86. },
  87. };
  88. ipcRenderer.send('message', sMsg);
  89. });
  90. if ($.cookie('memberID')) {
  91. // force links to open in external browser in electron
  92. $(document).ready(function () {
  93. document.querySelector('body').addEventListener('click', event => {
  94. let link = event.target.href;
  95. if (event.target.tagName.toLowerCase() !== 'a')
  96. return;
  97. event.preventDefault();
  98. shell.openExternal(link);
  99. });
  100. });
  101. }
  102. }
  103. // pull to refresh
  104. $(document).ready(function () {
  105. /*
  106. if ($('.bx-messenger-block-lots').length)
  107. glBxMobileDisablePullToRefresh = true;
  108. if ('undefined' === typeof glBxMobileDisablePullToRefresh || false === glBxMobileDisablePullToRefresh) {
  109. PullToRefresh.init({
  110. instructionsPullToRefresh: '__txt_pull_to_refresh__',
  111. instructionsReleaseToRefresh: '__txt_release_to_refresh__',
  112. instructionsRefreshing: '__txt_refreshing__',
  113. onRefresh() {
  114. window.location.reload();
  115. },
  116. });
  117. }
  118. */
  119. bx_mobile_apps_post_message({stop_loading: 1});
  120. });
  121. </script>