components.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. window.Vue = require('vue');
  2. import BootstrapVue from 'bootstrap-vue'
  3. import InfiniteLoading from 'vue-infinite-loading';
  4. import Loading from 'vue-loading-overlay';
  5. import VueTimeago from 'vue-timeago';
  6. import VueTouch from 'vue-touch';
  7. //import {Howl, Howler} from 'howler';
  8. Vue.use(BootstrapVue);
  9. Vue.use(InfiniteLoading);
  10. Vue.use(Loading);
  11. Vue.use(VueTimeago);
  12. Vue.use(VueTouch, { name: 'v-touch' })
  13. VueTouch.registerCustomEvent('doubletap', {
  14. type: 'tap',
  15. taps: 2
  16. })
  17. pixelfed.readmore = () => {
  18. $('.read-more').each(function(k,v) {
  19. let el = $(this);
  20. let attr = el.attr('data-readmore');
  21. if(typeof attr !== typeof undefined && attr !== false) {
  22. return;
  23. }
  24. el.readmore({
  25. collapsedHeight: 45,
  26. heightMargin: 48,
  27. moreLink: '<a href="#" class="d-block small text-muted text-center">Read more ...</a>',
  28. lessLink: '<a href="#" class="d-block small text-muted text-center">Hide</a>',
  29. });
  30. });
  31. };
  32. try {
  33. document.createEvent("TouchEvent");
  34. $('body').addClass('touch');
  35. } catch (e) {
  36. }
  37. window.filesize = require('filesize');
  38. // window.Plyr = require('plyr');
  39. import swal from 'sweetalert';
  40. // require('./components/localstorage');
  41. // require('./components/commentform');
  42. //require('./components/searchform');
  43. // require('./components/bookmarkform');
  44. // require('./components/statusform');
  45. //require('./components/embed');
  46. //require('./components/notifications');
  47. // import Echo from "laravel-echo"
  48. // window.io = require('socket.io-client');
  49. // window.pixelfed.bootEcho = function() {
  50. // window.Echo = new Echo({
  51. // broadcaster: 'socket.io',
  52. // host: window.location.hostname + ':2096',
  53. // auth: {
  54. // headers: {
  55. // Authorization: 'Bearer ' + token.content,
  56. // },
  57. // },
  58. // });
  59. // }
  60. // Initialize Notification Helper
  61. window.pixelfed.n = {};
  62. // Vue.component(
  63. // 'search-results',
  64. // require('./components/SearchResults.vue').default
  65. // );
  66. // Vue.component(
  67. // 'photo-presenter',
  68. // require('./components/presenter/PhotoPresenter.vue').default
  69. // );
  70. // Vue.component(
  71. // 'video-presenter',
  72. // require('./components/presenter/VideoPresenter.vue').default
  73. // );
  74. // Vue.component(
  75. // 'photo-album-presenter',
  76. // require('./components/presenter/PhotoAlbumPresenter.vue').default
  77. // );
  78. // Vue.component(
  79. // 'video-album-presenter',
  80. // require('./components/presenter/VideoAlbumPresenter.vue').default
  81. // );
  82. // Vue.component(
  83. // 'mixed-album-presenter',
  84. // require('./components/presenter/MixedAlbumPresenter.vue').default
  85. // );
  86. // Vue.component(
  87. // 'post-menu',
  88. // require('./components/PostMenu.vue').default
  89. // );
  90. // Vue.component(
  91. // 'passport-clients',
  92. // require('./components/passport/Clients.vue').default
  93. // );
  94. // Vue.component(
  95. // 'passport-authorized-clients',
  96. // require('./components/passport/AuthorizedClients.vue').default
  97. // );
  98. // Vue.component(
  99. // 'passport-personal-access-tokens',
  100. // require('./components/passport/PersonalAccessTokens.vue').default
  101. // );
  102. // Vue.component(
  103. // 'follow-suggestions',
  104. // require('./components/FollowSuggestions.vue').default
  105. // );
  106. // Vue.component(
  107. // 'circle-panel',
  108. // require('./components/CirclePanel.vue')
  109. // );
  110. // Vue.component(
  111. // 'story-compose',
  112. // require('./components/StoryCompose.vue').default
  113. // );
  114. //import 'promise-polyfill/src/polyfill';
  115. // window.pixelfed.copyToClipboard = (str) => {
  116. // const el = document.createElement('textarea');
  117. // el.value = str;
  118. // el.setAttribute('readonly', '');
  119. // el.style.position = 'absolute';
  120. // el.style.left = '-9999px';
  121. // document.body.appendChild(el);
  122. // const selected =
  123. // document.getSelection().rangeCount > 0
  124. // ? document.getSelection().getRangeAt(0)
  125. // : false;
  126. // el.select();
  127. // document.execCommand('copy');
  128. // document.body.removeChild(el);
  129. // if (selected) {
  130. // document.getSelection().removeAllRanges();
  131. // document.getSelection().addRange(selected);
  132. // }
  133. // };
  134. $(document).ready(function() {
  135. $(function () {
  136. $('[data-toggle="tooltip"]').tooltip()
  137. });
  138. });
  139. const warningTitleCSS = 'color:red; font-size:60px; font-weight: bold; -webkit-text-stroke: 1px black;';
  140. const warningDescCSS = 'font-size: 18px;';
  141. console.log('%cStop!', warningTitleCSS);
  142. console.log("%cThis is a browser feature intended for developers. If someone told you to copy and paste something here to enable a Pixelfed feature or \"hack\" someone's account, it is a scam and will give them access to your Pixelfed account.", warningDescCSS);