components.js 3.3 KB

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