xref: /webtrees/resources/js/vendor.js (revision 8a07c98e2c323f7fe8deb3ac46485d8082b4b795)
1/**
2 * webtrees: online genealogy
3 * Copyright (C) 2019 webtrees development team
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 */
15
16import $ from 'jquery';
17
18import 'popper.js';
19import 'bootstrap';
20import 'datatables.net';
21
22// Just import the subset of icons that we use in resources/views/icons/
23import { dom, library } from '@fortawesome/fontawesome-svg-core';
24import {
25  // For resources/views/icons/*
26  faBell, faCopy, faEnvelope, faFile, faFileAlt, faFileImage, faFolder, faKeyboard,
27  faMinusSquare, faPlusSquare, faStar, faStickyNote, faTrashAlt, faUser
28} from '@fortawesome/free-regular-svg-icons';
29import {
30  // For resources/views/icons/*
31  faArrowDown, faArrowLeft, faArrowRight, faArrowUp, faArrowsAltV, faBan, faBars,
32  faCalendar, faCaretDown, faCaretUp, faCheck, faCodeBranch, faDownload, faExclamationTriangle, faGenderless,
33  faGripHorizontal, faGripLines, faHistory, faInfoCircle, faLanguage, faLink, faList,
34  faLock, faMagic, faMap, faMapMarkerAlt, faMars, faMedkit, faPaintBrush, faPause, faPencilAlt,
35  faPlay, faPlus, faPuzzlePiece, faQuestionCircle, faRedo, faSearch, faSearchLocation, faSearchMinus, faSearchPlus, faShareAlt,
36  faSitemap, faSortAmountDown, faStepForward, faStop, faSyncAlt, faTags, faThList, faThumbtack,
37  faTimes, faTransgender, faTree, faUniversity, faUnlink, faUpload, faUsers, faVenus, faWrench,
38  // For the BeautifyMarker library
39  faBabyCarriage, faBullseye, faHome, faIndustry, faInfinity, faStarOfDavid, faWater
40} from '@fortawesome/free-solid-svg-icons';
41import 'corejs-typeahead';
42
43import 'datatables.net-bs4';
44
45import Sortable from 'sortablejs';
46
47import 'select2';
48// import "select2/dist/js/i18n/*.js";
49
50import 'select2/dist/js/i18n/af.js';
51import 'select2/dist/js/i18n/ar.js';
52import 'select2/dist/js/i18n/az.js';
53import 'select2/dist/js/i18n/bg.js';
54import 'select2/dist/js/i18n/bn.js';
55import 'select2/dist/js/i18n/bs.js';
56import 'select2/dist/js/i18n/ca.js';
57import 'select2/dist/js/i18n/cs.js';
58import 'select2/dist/js/i18n/da.js';
59import 'select2/dist/js/i18n/de.js';
60import 'select2/dist/js/i18n/dsb.js';
61import 'select2/dist/js/i18n/el.js';
62import 'select2/dist/js/i18n/en.js';
63import 'select2/dist/js/i18n/es.js';
64import 'select2/dist/js/i18n/et.js';
65import 'select2/dist/js/i18n/eu.js';
66import 'select2/dist/js/i18n/fa.js';
67import 'select2/dist/js/i18n/fi.js';
68import 'select2/dist/js/i18n/fr.js';
69import 'select2/dist/js/i18n/gl.js';
70import 'select2/dist/js/i18n/he.js';
71import 'select2/dist/js/i18n/hi.js';
72import 'select2/dist/js/i18n/hr.js';
73import 'select2/dist/js/i18n/hsb.js';
74import 'select2/dist/js/i18n/hu.js';
75import 'select2/dist/js/i18n/hy.js';
76import 'select2/dist/js/i18n/id.js';
77import 'select2/dist/js/i18n/is.js';
78import 'select2/dist/js/i18n/it.js';
79import 'select2/dist/js/i18n/ja.js';
80import 'select2/dist/js/i18n/ka.js';
81import 'select2/dist/js/i18n/km.js';
82import 'select2/dist/js/i18n/ko.js';
83import 'select2/dist/js/i18n/lt.js';
84import 'select2/dist/js/i18n/lv.js';
85import 'select2/dist/js/i18n/mk.js';
86import 'select2/dist/js/i18n/ms.js';
87import 'select2/dist/js/i18n/nb.js';
88import 'select2/dist/js/i18n/ne.js';
89import 'select2/dist/js/i18n/nl.js';
90import 'select2/dist/js/i18n/pl.js';
91import 'select2/dist/js/i18n/ps.js';
92import 'select2/dist/js/i18n/pt-BR.js';
93import 'select2/dist/js/i18n/pt.js';
94import 'select2/dist/js/i18n/ro.js';
95import 'select2/dist/js/i18n/ru.js';
96import 'select2/dist/js/i18n/sk.js';
97import 'select2/dist/js/i18n/sl.js';
98import 'select2/dist/js/i18n/sq.js';
99import 'select2/dist/js/i18n/sr-Cyrl.js';
100import 'select2/dist/js/i18n/sr.js';
101import 'select2/dist/js/i18n/sv.js';
102import 'select2/dist/js/i18n/th.js';
103import 'select2/dist/js/i18n/tk.js';
104import 'select2/dist/js/i18n/tr.js';
105import 'select2/dist/js/i18n/uk.js';
106import 'select2/dist/js/i18n/vi.js';
107import 'select2/dist/js/i18n/zh-CN.js';
108import 'select2/dist/js/i18n/zh-TW.js';
109
110import 'hideshowpassword';
111
112import 'moment';
113
114import 'jquery-colorbox';
115import 'pinch-zoom-element';
116
117import 'leaflet';
118import 'leaflet.markercluster';
119import 'beautifymarker';
120import 'leaflet-control-geocoder';
121import 'leaflet.control.layers.tree';
122import 'leaflet-bing-layer';
123
124window.$ = window.jQuery = $;
125
126library.add(
127  // For resources/views/icons/*
128  faBell, faCopy, faEnvelope, faFile, faFileAlt, faFileImage, faFolder, faKeyboard,
129  faMap, faMinusSquare, faPlusSquare, faStar, faStickyNote, faTags, faTrashAlt, faUser
130);
131library.add(
132  // For resources/views/icons/*
133  faArrowDown, faArrowLeft, faArrowRight, faArrowUp, faArrowsAltV, faBan, faBars,
134  faCalendar, faCaretDown, faCaretUp, faCheck, faCodeBranch, faDownload, faExclamationTriangle, faGenderless,
135  faGripHorizontal, faGripLines, faHistory, faInfoCircle, faLanguage, faLink, faList,
136  faLock, faMagic, faMap, faMapMarkerAlt, faMars, faMedkit, faPaintBrush, faPause, faPencilAlt,
137  faPlay, faPlus, faPuzzlePiece, faQuestionCircle, faRedo, faSearch, faSearchLocation, faSearchMinus, faSearchPlus, faShareAlt,
138  faSitemap, faSortAmountDown, faStepForward, faStop, faSyncAlt, faThList, faThumbtack,
139  faTimes, faTransgender, faTree, faUniversity, faUnlink, faUpload, faUsers, faVenus, faWrench,
140  // For the BeautifyMarker library
141  faBabyCarriage, faBullseye, faHome, faIndustry, faInfinity, faStarOfDavid, faWater
142);
143dom.watch();
144
145window.Bloodhound = require('corejs-typeahead/dist/bloodhound.min.js');
146
147// See https://github.com/RubaXa/Sortable/issues/1229
148// window.Sortable = require('sortablejs');
149window.Sortable = Sortable;
150
151// Add RTL support for dropdown menu - see https://github.com/fisharebest/webtrees/issues/3332
152$('html[dir=rtl] .dropdown').on('shown.bs.dropdown', function (event) {
153  const menu = event.target.querySelector('.dropdown-menu');
154  // Bootstrap sets these *after* the event has fired, so wait before updating them.
155  setTimeout(() => {
156    menu.style.right = '0';
157    menu.style.left = '';
158  }, 1);
159});
160