pixelfed/resources/assets/js/components.js

180 lines
4.6 KiB
JavaScript
Raw Normal View History

2018-11-09 03:43:32 +00:00
window.Vue = require('vue');
import BootstrapVue from 'bootstrap-vue'
2018-12-02 04:03:27 +00:00
import InfiniteLoading from 'vue-infinite-loading';
import Loading from 'vue-loading-overlay';
2018-12-25 06:00:50 +00:00
import VueTimeago from 'vue-timeago';
2019-01-05 07:10:15 +00:00
//import {Howl, Howler} from 'howler';
2018-12-02 04:03:27 +00:00
2018-11-09 03:43:32 +00:00
Vue.use(BootstrapVue);
2018-12-02 04:03:27 +00:00
Vue.use(InfiniteLoading);
Vue.use(Loading);
2018-12-09 22:59:29 +00:00
Vue.use(VueTimeago);
2018-11-09 03:43:32 +00:00
2018-11-13 19:43:46 +00:00
pixelfed.readmore = () => {
2018-11-29 02:27:38 +00:00
$('.read-more').each(function(k,v) {
2018-11-13 19:43:46 +00:00
let el = $(this);
let attr = el.attr('data-readmore');
if(typeof attr !== typeof undefined && attr !== false) {
return;
}
el.readmore({
collapsedHeight: 44,
heightMargin: 20,
moreLink: '<a href="#" class="font-weight-bold small">Read more</a>',
lessLink: '<a href="#" class="font-weight-bold small">Hide</a>',
});
});
};
try {
document.createEvent("TouchEvent");
$('body').addClass('touch');
} catch (e) {
}
2018-11-09 03:43:32 +00:00
window.InfiniteScroll = require('infinite-scroll');
window.filesize = require('filesize');
2018-11-30 20:36:05 +00:00
window.Plyr = require('plyr');
2018-11-09 03:43:32 +00:00
import swal from 'sweetalert';
2018-11-09 03:26:47 +00:00
require('./components/localstorage');
require('./components/likebutton');
require('./components/commentform');
require('./components/searchform');
require('./components/bookmarkform');
require('./components/statusform');
2018-12-25 06:00:50 +00:00
//require('./components/embed');
//require('./components/notifications');
2018-11-09 03:26:47 +00:00
// import Echo from "laravel-echo"
// window.io = require('socket.io-client');
// window.pixelfed.bootEcho = function() {
// window.Echo = new Echo({
// broadcaster: 'socket.io',
// host: window.location.hostname + ':2096',
// auth: {
// headers: {
// Authorization: 'Bearer ' + token.content,
// },
// },
// });
// }
2018-12-25 21:59:32 +00:00
// Initialize Notification Helper
2018-11-13 04:48:48 +00:00
window.pixelfed.n = {};
Vue.component(
'photo-presenter',
2019-01-05 07:10:15 +00:00
require('./components/presenter/PhotoPresenter.vue').default
);
Vue.component(
'video-presenter',
2019-01-05 07:10:15 +00:00
require('./components/presenter/VideoPresenter.vue').default
);
Vue.component(
'photo-album-presenter',
2019-01-05 07:10:15 +00:00
require('./components/presenter/PhotoAlbumPresenter.vue').default
);
Vue.component(
'video-album-presenter',
2019-01-05 07:10:15 +00:00
require('./components/presenter/VideoAlbumPresenter.vue').default
);
Vue.component(
'mixed-album-presenter',
2019-01-05 07:10:15 +00:00
require('./components/presenter/MixedAlbumPresenter.vue').default
);
2018-12-25 06:00:50 +00:00
// Vue.component(
// 'micro',
2019-01-05 07:10:15 +00:00
// require('./components/Micro.vue').default
2018-12-25 06:00:50 +00:00
// );
2018-11-09 03:26:47 +00:00
Vue.component(
'follow-suggestions',
2019-01-05 07:10:15 +00:00
require('./components/FollowSuggestions.vue').default
2018-11-09 03:26:47 +00:00
);
Vue.component(
'discover-component',
2019-01-05 07:10:15 +00:00
require('./components/DiscoverComponent.vue').default
2018-11-09 03:26:47 +00:00
);
2019-01-05 07:10:15 +00:00
// Vue.component(
// 'profile',
// require('./components/Profile.vue').default
// );
2018-11-09 03:26:47 +00:00
// Vue.component(
// 'circle-panel',
// require('./components/CirclePanel.vue')
// );
Vue.component(
'post-component',
2019-01-05 07:10:15 +00:00
require('./components/PostComponent.vue').default
2018-11-09 03:26:47 +00:00
);
Vue.component(
'post-comments',
2019-01-05 07:10:15 +00:00
require('./components/PostComments.vue').default
2018-11-09 03:26:47 +00:00
);
2018-12-09 22:59:29 +00:00
Vue.component(
'timeline',
2019-01-05 07:10:15 +00:00
require('./components/Timeline.vue').default
2018-12-09 22:59:29 +00:00
);
2019-01-05 07:10:15 +00:00
// Vue.component(
// 'passport-clients',
// require('./components/passport/Clients.vue').default
// );
2018-11-09 03:26:47 +00:00
2019-01-05 07:10:15 +00:00
// Vue.component(
// 'passport-authorized-clients',
// require('./components/passport/AuthorizedClients.vue').default
// );
2018-11-09 03:26:47 +00:00
2019-01-05 07:10:15 +00:00
// Vue.component(
// 'passport-personal-access-tokens',
// require('./components/passport/PersonalAccessTokens.vue').default
// );
2018-11-09 03:26:47 +00:00
2019-01-05 07:10:15 +00:00
//import 'promise-polyfill/src/polyfill';
// window.pixelfed.copyToClipboard = (str) => {
// const el = document.createElement('textarea');
// el.value = str;
// el.setAttribute('readonly', '');
// el.style.position = 'absolute';
// el.style.left = '-9999px';
// document.body.appendChild(el);
// const selected =
// document.getSelection().rangeCount > 0
// ? document.getSelection().getRangeAt(0)
// : false;
// el.select();
// document.execCommand('copy');
// document.body.removeChild(el);
// if (selected) {
// document.getSelection().removeAllRanges();
// document.getSelection().addRange(selected);
// }
// };
2018-11-09 03:26:47 +00:00
$(document).ready(function() {
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
2018-11-22 20:21:36 +00:00
});
const warningTitleCSS = 'color:red; font-size:60px; font-weight: bold; -webkit-text-stroke: 1px black;';
const warningDescCSS = 'font-size: 18px;';
console.log('%cStop!', warningTitleCSS);
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);