diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2017-10-23 11:09:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-23 11:09:17 +0200 |
commit | 1953a872932a63792293b4aec087880265ba89f7 (patch) | |
tree | fd16599e737fcdaf193c933ef3ec4a4ee248b117 /app/Resources/static/themes/material/js/init.js | |
parent | d83d25dadec2c38460a32d96f5d2903426fec9d3 (diff) | |
parent | 702f2d67d60ca963492b90dad74cb5f8dcc84e51 (diff) | |
download | wallabag-1953a872932a63792293b4aec087880265ba89f7.tar.gz wallabag-1953a872932a63792293b4aec087880265ba89f7.tar.zst wallabag-1953a872932a63792293b4aec087880265ba89f7.zip |
Merge pull request #3011 from wallabag/2.3
wallabag 2.3.0
Diffstat (limited to 'app/Resources/static/themes/material/js/init.js')
-rwxr-xr-x | app/Resources/static/themes/material/js/init.js | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/app/Resources/static/themes/material/js/init.js b/app/Resources/static/themes/material/js/init.js deleted file mode 100755 index 0b2832c0..00000000 --- a/app/Resources/static/themes/material/js/init.js +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | /* jQuery */ | ||
2 | import $ from 'jquery'; | ||
3 | |||
4 | /* Annotations */ | ||
5 | import annotator from 'annotator'; | ||
6 | |||
7 | /* Tools */ | ||
8 | import { savePercent, retrievePercent, initFilters, initExport } from '../../_global/js/tools'; | ||
9 | |||
10 | /* Import shortcuts */ | ||
11 | import './shortcuts/main'; | ||
12 | import './shortcuts/entry'; | ||
13 | import '../../_global/js/shortcuts/main'; | ||
14 | import '../../_global/js/shortcuts/entry'; | ||
15 | |||
16 | require('materialize'); // eslint-disable-line | ||
17 | |||
18 | global.jQuery = $; | ||
19 | |||
20 | $(document).ready(() => { | ||
21 | // sideNav | ||
22 | $('.button-collapse').sideNav(); | ||
23 | $('select').material_select(); | ||
24 | $('.collapsible').collapsible({ | ||
25 | accordion: false, | ||
26 | }); | ||
27 | $('.datepicker').pickadate({ | ||
28 | selectMonths: true, | ||
29 | selectYears: 15, | ||
30 | formatSubmit: 'dd/mm/yyyy', | ||
31 | hiddenName: true, | ||
32 | format: 'dd/mm/yyyy', | ||
33 | }); | ||
34 | initFilters(); | ||
35 | initExport(); | ||
36 | |||
37 | $('#nav-btn-add-tag').on('click', () => { | ||
38 | $('.nav-panel-add-tag').toggle(100); | ||
39 | $('.nav-panel-menu').addClass('hidden'); | ||
40 | $('#tag_label').focus(); | ||
41 | return false; | ||
42 | }); | ||
43 | $('#nav-btn-add').on('click', () => { | ||
44 | $('.nav-panel-buttom').hide(100); | ||
45 | $('.nav-panel-add').show(100); | ||
46 | $('.nav-panels .action').hide(100); | ||
47 | $('.nav-panel-menu').addClass('hidden'); | ||
48 | $('.nav-panels').css('background', 'white'); | ||
49 | $('#entry_url').focus(); | ||
50 | return false; | ||
51 | }); | ||
52 | $('#nav-btn-search').on('click', () => { | ||
53 | $('.nav-panel-buttom').hide(100); | ||
54 | $('.nav-panel-search').show(100); | ||
55 | $('.nav-panels .action').hide(100); | ||
56 | $('.nav-panel-menu').addClass('hidden'); | ||
57 | $('.nav-panels').css('background', 'white'); | ||
58 | $('#search_entry_term').focus(); | ||
59 | return false; | ||
60 | }); | ||
61 | $('.close').on('click', () => { | ||
62 | $('.nav-panel-add').hide(100); | ||
63 | $('.nav-panel-search').hide(100); | ||
64 | $('.nav-panel-buttom').show(100); | ||
65 | $('.nav-panels .action').show(100); | ||
66 | $('.nav-panel-menu').removeClass('hidden'); | ||
67 | $('.nav-panels').css('background', 'transparent'); | ||
68 | return false; | ||
69 | }); | ||
70 | $(window).scroll(() => { | ||
71 | const s = $(window).scrollTop(); | ||
72 | const d = $(document).height(); | ||
73 | const c = $(window).height(); | ||
74 | const scrollPercent = (s / (d - c)) * 100; | ||
75 | $('.progress .determinate').css('width', `${scrollPercent}%`); | ||
76 | }); | ||
77 | |||
78 | /* ========================================================================== | ||
79 | Annotations & Remember position | ||
80 | ========================================================================== */ | ||
81 | |||
82 | if ($('article').length) { | ||
83 | const app = new annotator.App(); | ||
84 | const x = JSON.parse($('#annotationroutes').html()); | ||
85 | |||
86 | app.include(annotator.ui.main, { | ||
87 | element: document.querySelector('article'), | ||
88 | }); | ||
89 | |||
90 | app.include(annotator.storage.http, x); | ||
91 | |||
92 | app.start().then(() => { | ||
93 | app.annotations.load({ entry: x.entryId }); | ||
94 | }); | ||
95 | |||
96 | $(window).scroll(() => { | ||
97 | const scrollTop = $(window).scrollTop(); | ||
98 | const docHeight = $(document).height(); | ||
99 | const scrollPercent = (scrollTop) / (docHeight); | ||
100 | const scrollPercentRounded = Math.round(scrollPercent * 100) / 100; | ||
101 | savePercent(x.entryId, scrollPercentRounded); | ||
102 | }); | ||
103 | |||
104 | retrievePercent(x.entryId); | ||
105 | |||
106 | $(window).resize(() => { | ||
107 | retrievePercent(x.entryId); | ||
108 | }); | ||
109 | } | ||
110 | }); | ||