components.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. Vue.use(BootstrapVue);
  7. Vue.use(InfiniteLoading);
  8. Vue.use(Loading);
  9. Vue.use(VueTimeago);
  10. pixelfed.readmore = () => {
  11. $('.read-more').each(function(k,v) {
  12. let el = $(this);
  13. let attr = el.attr('data-readmore');
  14. if(typeof attr !== typeof undefined && attr !== false) {
  15. return;
  16. }
  17. el.readmore({
  18. collapsedHeight: 44,
  19. heightMargin: 20,
  20. moreLink: '<a href="#" class="font-weight-bold small">Read more</a>',
  21. lessLink: '<a href="#" class="font-weight-bold small">Hide</a>',
  22. });
  23. });
  24. };
  25. try {
  26. document.createEvent("TouchEvent");
  27. $('body').addClass('touch');
  28. } catch (e) {
  29. return false;
  30. }
  31. window.InfiniteScroll = require('infinite-scroll');
  32. window.filesize = require('filesize');
  33. window.Plyr = require('plyr');
  34. import swal from 'sweetalert';
  35. require('./components/localstorage');
  36. require('./components/likebutton');
  37. require('./components/commentform');
  38. require('./components/searchform');
  39. require('./components/bookmarkform');
  40. require('./components/statusform');
  41. //require('./components/embed');
  42. //require('./components/notifications');
  43. // import Echo from "laravel-echo"
  44. // window.io = require('socket.io-client');
  45. // window.pixelfed.bootEcho = function() {
  46. // window.Echo = new Echo({
  47. // broadcaster: 'socket.io',
  48. // host: window.location.hostname + ':2096',
  49. // auth: {
  50. // headers: {
  51. // Authorization: 'Bearer ' + token.content,
  52. // },
  53. // },
  54. // });
  55. // }
  56. // Initalize Notification Helper
  57. window.pixelfed.n = {};
  58. Vue.component(
  59. 'photo-presenter',
  60. require('./components/presenter/PhotoPresenter.vue')
  61. );
  62. Vue.component(
  63. 'video-presenter',
  64. require('./components/presenter/VideoPresenter.vue')
  65. );
  66. Vue.component(
  67. 'photo-album-presenter',
  68. require('./components/presenter/PhotoAlbumPresenter.vue')
  69. );
  70. Vue.component(
  71. 'video-album-presenter',
  72. require('./components/presenter/VideoAlbumPresenter.vue')
  73. );
  74. Vue.component(
  75. 'mixed-album-presenter',
  76. require('./components/presenter/MixedAlbumPresenter.vue')
  77. );
  78. // Vue.component(
  79. // 'micro',
  80. // require('./components/Micro.vue')
  81. // );
  82. Vue.component(
  83. 'follow-suggestions',
  84. require('./components/FollowSuggestions.vue')
  85. );
  86. Vue.component(
  87. 'discover-component',
  88. require('./components/DiscoverComponent.vue')
  89. );
  90. // Vue.component(
  91. // 'circle-panel',
  92. // require('./components/CirclePanel.vue')
  93. // );
  94. Vue.component(
  95. 'post-component',
  96. require('./components/PostComponent.vue')
  97. );
  98. Vue.component(
  99. 'post-comments',
  100. require('./components/PostComments.vue')
  101. );
  102. Vue.component(
  103. 'timeline',
  104. require('./components/Timeline.vue')
  105. );
  106. Vue.component(
  107. 'passport-clients',
  108. require('./components/passport/Clients.vue')
  109. );
  110. Vue.component(
  111. 'passport-authorized-clients',
  112. require('./components/passport/AuthorizedClients.vue')
  113. );
  114. Vue.component(
  115. 'passport-personal-access-tokens',
  116. require('./components/passport/PersonalAccessTokens.vue')
  117. );
  118. window.pixelfed.copyToClipboard = (str) => {
  119. const el = document.createElement('textarea');
  120. el.value = str;
  121. el.setAttribute('readonly', '');
  122. el.style.position = 'absolute';
  123. el.style.left = '-9999px';
  124. document.body.appendChild(el);
  125. const selected =
  126. document.getSelection().rangeCount > 0
  127. ? document.getSelection().getRangeAt(0)
  128. : false;
  129. el.select();
  130. document.execCommand('copy');
  131. document.body.removeChild(el);
  132. if (selected) {
  133. document.getSelection().removeAllRanges();
  134. document.getSelection().addRange(selected);
  135. }
  136. };
  137. $(document).ready(function() {
  138. $(function () {
  139. $('[data-toggle="tooltip"]').tooltip()
  140. });
  141. });
  142. const warningTitleCSS = 'color:red; font-size:60px; font-weight: bold; -webkit-text-stroke: 1px black;';
  143. const warningDescCSS = 'font-size: 18px;';
  144. console.log('%cStop!', warningTitleCSS);
  145. 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);