1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 09:17:03 +00:00
pixelfed/resources/assets/js/bootstrap.js

113 lines
3 KiB
JavaScript
Raw Normal View History

2018-04-15 23:56:48 +00:00
window._ = require('lodash');
window.Popper = require('popper.js').default;
2018-08-10 03:50:09 +00:00
import swal from 'sweetalert';
2018-10-22 01:48:57 +00:00
window.pixelfed = {};
window.$ = window.jQuery = require('jquery');
require('bootstrap');
window.Vue = require('vue');
import BootstrapVue from 'bootstrap-vue'
Vue.use(BootstrapVue);
2018-04-15 23:56:48 +00:00
try {
2018-05-20 03:12:56 +00:00
window.InfiniteScroll = require('infinite-scroll');
window.filesize = require('filesize');
window.typeahead = require('./lib/typeahead');
window.Bloodhound = require('./lib/bloodhound');
require('./components/localstorage');
2018-06-04 02:20:54 +00:00
require('./components/likebutton');
require('./components/commentform');
2018-05-20 03:12:56 +00:00
require('./components/searchform');
2018-06-01 03:21:02 +00:00
require('./components/bookmarkform');
2018-06-14 02:57:16 +00:00
require('./components/statusform');
2018-10-22 01:48:57 +00:00
// require('./components/embed');
// require('./components/shortcuts');
2018-04-15 23:56:48 +00:00
2018-08-10 03:50:09 +00:00
Vue.component(
'follow-suggestions',
require('./components/FollowSuggestions.vue')
);
2018-10-22 01:48:57 +00:00
// Vue.component(
// 'circle-panel',
// require('./components/CirclePanel.vue')
// );
2018-10-24 02:39:24 +00:00
// Vue.component(
// 'post-presenter',
// require('./components/PostPresenter.vue')
// );
// Vue.component(
// 'post-comments',
// require('./components/PostComments.vue')
// );
2018-10-22 01:48:57 +00:00
Vue.component(
'passport-clients',
require('./components/passport/Clients.vue')
);
Vue.component(
'passport-authorized-clients',
require('./components/passport/AuthorizedClients.vue')
);
Vue.component(
'passport-personal-access-tokens',
require('./components/passport/PersonalAccessTokens.vue')
);
2018-08-10 03:50:09 +00:00
} catch (e) {}
2018-04-15 23:56:48 +00:00
2018-10-22 01:48:57 +00:00
$(document).ready(function() {
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
});
2018-04-15 23:56:48 +00:00
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
let token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}
2018-10-22 01:48:57 +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,
// },
// },
// });
// }
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);
}
};