xref: /webtrees/resources/js/vendor.js (revision f1d11eefe3d88b0296ccacf33ecbbebbaf2a5143)
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, 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, faSearchMinus, faSearchPlus,
36  faSitemap, faSortAmountDown, faStepForward, faStop, faSyncAlt, 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';
115
116import 'wheelzoom';
117
118import 'leaflet';
119import 'leaflet.markercluster';
120import 'beautifymarker';
121import 'leaflet-control-geocoder';
122
123window.$ = window.jQuery = $;
124
125library.add(
126  // For resources/views/icons/*
127  faBell, faCopy, faEnvelope, faFile, faFileAlt, faFileImage, faFolder, faKeyboard,
128  faMap, faMinusSquare, faPlusSquare, faStar, faStickyNote, faTrashAlt, faUser
129);
130library.add(
131  // For resources/views/icons/*
132  faArrowDown, faArrowLeft, faArrowRight, faArrowUp, faArrowsAltV, faBan, faBars,
133  faCalendar, faCheck, faCodeBranch, faDownload, faExclamationTriangle, faGenderless,
134  faGripHorizontal, faGripLines, faHistory, faInfoCircle, faLanguage, faLink, faList,
135  faLock, faMagic, faMap, faMapMarkerAlt, faMars, faMedkit, faPaintBrush, faPause, faPencilAlt,
136  faPlay, faPlus, faPuzzlePiece, faQuestionCircle, faRedo, faSearch, faSearchMinus, faSearchPlus,
137  faSitemap, faSortAmountDown, faStepForward, faStop, faSyncAlt, faThList, faThumbtack,
138  faTimes, faTransgender, faTree, faUniversity, faUnlink, faUpload, faUsers, faVenus, faWrench,
139  // For the BeautifyMarker library
140  faBabyCarriage, faBullseye, faHome, faIndustry, faInfinity, faStarOfDavid, faWater
141);
142dom.watch();
143
144window.Bloodhound = require('corejs-typeahead/dist/bloodhound.min.js');
145
146// See https://github.com/RubaXa/Sortable/issues/1229
147// window.Sortable = require('sortablejs');
148window.Sortable = Sortable;
149
150// Add RTL support for dropdown menu - see https://github.com/fisharebest/webtrees/issues/3332
151$('html[dir=rtl] .dropdown').on('shown.bs.dropdown', function (event) {
152  let menu = event.target.querySelector('.dropdown-menu');
153  // Bootstrap sets these *after* the event has fired, so wait before updating them.
154  setTimeout(function () {
155    menu.style.right='0';
156    menu.style.left='';
157  }, 1);
158});