components.js 3.4 KB

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