diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-06-09 19:02:38 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2016-06-09 19:02:38 +0200 |
commit | 0743287f955fd19fd1a04c91f3b40a4ac2236423 (patch) | |
tree | 42d9f4efef7c8099416e24ce751de78524b9a58a /app/Resources/static/themes/material | |
parent | 5ecdfcd041767c9e3244a92bb0a6cc3c3f80fea3 (diff) | |
download | wallabag-0743287f955fd19fd1a04c91f3b40a4ac2236423.tar.gz wallabag-0743287f955fd19fd1a04c91f3b40a4ac2236423.tar.zst wallabag-0743287f955fd19fd1a04c91f3b40a4ac2236423.zip |
clean & lint stuff
Diffstat (limited to 'app/Resources/static/themes/material')
-rwxr-xr-x | app/Resources/static/themes/material/js/init.js | 201 |
1 files changed, 101 insertions, 100 deletions
diff --git a/app/Resources/static/themes/material/js/init.js b/app/Resources/static/themes/material/js/init.js index 33019d3d..d6a87941 100755 --- a/app/Resources/static/themes/material/js/init.js +++ b/app/Resources/static/themes/material/js/init.js | |||
@@ -1,116 +1,117 @@ | |||
1 | var $ = require("jquery"), | 1 | var $ = require('jquery'); |
2 | materialize = require("materialize"); | 2 | require('materialize'); |
3 | var annotator = require('annotator'); | 3 | var annotator = require('annotator'); |
4 | 4 | ||
5 | function init_filters() { | 5 | function initFilters() { |
6 | // no display if filters not aviable | 6 | // no display if filters not aviable |
7 | if ($("div").is("#filters")) { | 7 | if ($('div').is('#filters')) { |
8 | $('#button_filters').show(); | 8 | $('#button_filters').show(); |
9 | $('.button-collapse-right').sideNav({ edge: 'right' }); | 9 | $('.button-collapse-right').sideNav({ edge: 'right' }); |
10 | $('#clear_form_filters').on('click', function(){ | 10 | $('#clear_form_filters').on('click', function () { |
11 | $('#filters input').val(''); | 11 | $('#filters input').val(''); |
12 | $('#filters :checked').removeAttr('checked'); | 12 | $('#filters :checked').removeAttr('checked'); |
13 | return false; | 13 | return false; |
14 | }); | 14 | }); |
15 | } | 15 | } |
16 | } | 16 | } |
17 | 17 | ||
18 | function init_export() { | 18 | function initExport() { |
19 | // no display if export not aviable | 19 | // no display if export not aviable |
20 | if ($("div").is("#export")) { | 20 | if ($('div').is('#export')) { |
21 | $('#button_export').show(); | 21 | $('#button_export').show(); |
22 | $('.button-collapse-right').sideNav({ edge: 'right' }); | 22 | $('.button-collapse-right').sideNav({ edge: 'right' }); |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | $(document).ready(function(){ | 26 | $(document).ready(function () { |
27 | // sideNav | 27 | // sideNav |
28 | $('.button-collapse').sideNav(); | 28 | $('.button-collapse').sideNav(); |
29 | $('select').material_select(); | 29 | $('select').material_select(); |
30 | $('.collapsible').collapsible({ | 30 | $('.collapsible').collapsible({ |
31 | accordion : false | 31 | accordion: false, |
32 | }); | 32 | }); |
33 | $('.datepicker').pickadate({ | 33 | $('.datepicker').pickadate({ |
34 | selectMonths: true, | 34 | selectMonths: true, |
35 | selectYears: 15, | 35 | selectYears: 15, |
36 | formatSubmit: 'dd/mm/yyyy', | 36 | formatSubmit: 'dd/mm/yyyy', |
37 | hiddenName: true, | 37 | hiddenName: true, |
38 | format: 'dd/mm/yyyy', | 38 | format: 'dd/mm/yyyy', |
39 | }); | 39 | }); |
40 | init_filters(); | 40 | initFilters(); |
41 | init_export(); | 41 | initExport(); |
42 | 42 | ||
43 | $('#nav-btn-add-tag').on('click', function(){ | 43 | $('#nav-btn-add-tag').on('click', function () { |
44 | $(".nav-panel-add-tag").toggle(100); | 44 | $('.nav-panel-add-tag').toggle(100); |
45 | $(".nav-panel-menu").addClass('hidden'); | 45 | $('.nav-panel-menu').addClass('hidden'); |
46 | $("#tag_label").focus(); | 46 | $('#tag_label').focus(); |
47 | return false; | 47 | return false; |
48 | }); | 48 | }); |
49 | $('#nav-btn-add').on('click', function(){ | 49 | $('#nav-btn-add').on('click', function () { |
50 | $(".nav-panel-buttom").hide(100); | 50 | $('.nav-panel-buttom').hide(100); |
51 | $(".nav-panel-add").show(100); | 51 | $('.nav-panel-add').show(100); |
52 | $(".nav-panels .action").hide(100); | 52 | $('.nav-panels .action').hide(100); |
53 | $(".nav-panel-menu").addClass('hidden'); | 53 | $('.nav-panel-menu').addClass('hidden'); |
54 | $(".nav-panels").css('background', 'white'); | 54 | $('.nav-panels').css('background', 'white'); |
55 | $("#entry_url").focus(); | 55 | $('#entry_url').focus(); |
56 | return false; | 56 | return false; |
57 | }); | 57 | }); |
58 | $('#nav-btn-search').on('click', function(){ | 58 | $('#nav-btn-search').on('click', function () { |
59 | $(".nav-panel-buttom").hide(100); | 59 | $('.nav-panel-buttom').hide(100); |
60 | $(".nav-panel-search").show(100); | 60 | $('.nav-panel-search').show(100); |
61 | $(".nav-panels .action").hide(100); | 61 | $('.nav-panels .action').hide(100); |
62 | $(".nav-panel-menu").addClass('hidden'); | 62 | $('.nav-panel-menu').addClass('hidden'); |
63 | $(".nav-panels").css('background', 'white'); | 63 | $('.nav-panels').css('background', 'white'); |
64 | $("#searchfield").focus(); | 64 | $('#searchfield').focus(); |
65 | return false; | 65 | return false; |
66 | }); | 66 | }); |
67 | $('.close').on('click', function(){ | 67 | $('.close').on('click', function () { |
68 | $(".nav-panel-add").hide(100); | 68 | $('.nav-panel-add').hide(100); |
69 | $(".nav-panel-search").hide(100); | 69 | $('.nav-panel-search').hide(100); |
70 | $(".nav-panel-buttom").show(100); | 70 | $('.nav-panel-buttom').show(100); |
71 | $(".nav-panels .action").show(100); | 71 | $('.nav-panels .action').show(100); |
72 | $(".nav-panel-menu").removeClass('hidden'); | 72 | $('.nav-panel-menu').removeClass('hidden'); |
73 | $(".nav-panels").css('background', 'transparent'); | 73 | $('.nav-panels').css('background', 'transparent'); |
74 | return false; | 74 | return false; |
75 | }); | 75 | }); |
76 | $(window).scroll(function () { | 76 | $(window).scroll(function () { |
77 | var s = $(window).scrollTop(), | 77 | var s = $(window).scrollTop(); |
78 | d = $(document).height(), | 78 | var d = $(document).height(); |
79 | c = $(window).height(); | 79 | var c = $(window).height(); |
80 | var scrollPercent = (s / (d-c)) * 100; | 80 | var scrollPercent = (s / (d - c)) * 100; |
81 | $(".progress .determinate").css('width', scrollPercent+'%'); | 81 | $('.progress .determinate').css('width', scrollPercent + '%'); |
82 | }); | 82 | }); |
83 | |||
84 | /* ========================================================================== | ||
85 | Annotations & Remember position | ||
86 | ========================================================================== */ | ||
83 | 87 | ||
84 | /* ========================================================================== | 88 | if ($('article').length) { |
85 | Annotations & Remember position | 89 | var app = new annotator.App(); |
86 | ========================================================================== */ | 90 | var x = JSON.parse($('#annotationroutes').html()); |
87 | 91 | ||
88 | if ($("article").length) { | ||
89 | var app = new annotator.App(); | ||
90 | 92 | ||
91 | app.include(annotator.ui.main, { | 93 | app.include(annotator.ui.main, { |
92 | element: document.querySelector('article') | 94 | element: document.querySelector('article'), |
93 | }); | 95 | }); |
94 | 96 | ||
95 | var x = JSON.parse($('#annotationroutes').html()); | 97 | app.include(annotator.storage.http, x); |
96 | app.include(annotator.storage.http, x); | ||
97 | 98 | ||
98 | app.start().then(function () { | 99 | app.start().then(function () { |
99 | app.annotations.load({entry: x.entryId}); | 100 | app.annotations.load({ entry: x.entryId }); |
100 | }); | 101 | }); |
101 | 102 | ||
102 | $(window).scroll(function(e){ | 103 | $(window).scroll(function (e) { |
103 | var scrollTop = $(window).scrollTop(); | 104 | var scrollTop = $(window).scrollTop(); |
104 | var docHeight = $(document).height(); | 105 | var docHeight = $(document).height(); |
105 | var scrollPercent = (scrollTop) / (docHeight); | 106 | var scrollPercent = (scrollTop) / (docHeight); |
106 | var scrollPercentRounded = Math.round(scrollPercent*100)/100; | 107 | var scrollPercentRounded = Math.round(scrollPercent * 100) / 100; |
107 | savePercent(x.entryId, scrollPercentRounded); | 108 | savePercent(x.entryId, scrollPercentRounded); |
108 | }); | 109 | }); |
109 | 110 | ||
110 | retrievePercent(x.entryId); | 111 | retrievePercent(x.entryId); |
111 | 112 | ||
112 | $(window).resize(function(){ | 113 | $(window).resize(function () { |
113 | retrievePercent(x.entryId); | 114 | retrievePercent(x.entryId); |
114 | }); | 115 | }); |
115 | } | 116 | } |
116 | }); | 117 | }); |