1- const feedbackProps = {
1+ var feedbackProps = {
22 feedbackFixedClassName : 'feedback-fixed' ,
33 feedbackDisabledClassName : 'vote-disabled' ,
44 feedbackFormSelector : '.feedback-row' ,
@@ -9,19 +9,19 @@ const feedbackProps = {
99
1010$ ( document ) . ready ( function ( ) {
1111
12- const localStorageFeedbackKey = function ( ) {
12+ var localStorageFeedbackKey = function ( ) {
1313 return 'T_DOCUMENTATION_FEEDBACK_SUBMIT' + window . location . href ;
1414 } ;
1515
16- const getFeedbackInfo = function ( ) {
16+ var getFeedbackInfo = function ( ) {
1717 return localStorage . getItem ( localStorageFeedbackKey ( ) ) ;
1818 } ;
1919
20- const setFeedbackInfo = function ( vote , closed ) {
21- let feedbackInfo = getFeedbackInfo ( ) ;
20+ var setFeedbackInfo = function ( vote , closed ) {
21+ var feedbackInfo = getFeedbackInfo ( ) ;
2222
2323 if ( feedbackInfo ) {
24- const currentFeedbackInfo = JSON . parse ( feedbackInfo ) ;
24+ var currentFeedbackInfo = JSON . parse ( feedbackInfo ) ;
2525 if ( ! vote ) {
2626 vote = currentFeedbackInfo . vote ;
2727 }
@@ -41,10 +41,10 @@ $(document).ready(function () {
4141 localStorage . setItem ( localStorageFeedbackKey ( ) , JSON . stringify ( feedbackInfo ) ) ;
4242 } ;
4343
44- const canVote = ( ) => {
45- const previousVote = getFeedbackInfo ( ) ;
44+ var canVote = function ( ) {
45+ var previousVote = getFeedbackInfo ( ) ;
4646 if ( previousVote ) {
47- const previousVoteData = JSON . parse ( previousVote ) ;
47+ var previousVoteData = JSON . parse ( previousVote ) ;
4848 if ( previousVoteData . url === window . location . href ) {
4949 // You can vote once per week for an article.
5050 return Math . abs ( new Date ( ) - new Date ( previousVoteData . date ) ) / 1000 / 60 / 60 >= 168 ;
@@ -54,24 +54,24 @@ $(document).ready(function () {
5454 return true ;
5555 } ;
5656
57- const getCookieByName = function ( name ) {
57+ var getCookieByName = function ( name ) {
5858 var match = document . cookie . match ( new RegExp ( name + '=([^;]+)' ) ) ;
5959 if ( match ) return match [ 1 ] ;
6060 } ;
6161
62- const onAfterVote = function ( ) {
63- setTimeout ( ( ) => {
62+ var onAfterVote = function ( ) {
63+ setTimeout ( function ( ) {
6464 $ ( '.feedback' ) . html ( "<div class='side-title uppercase-clear'>Thank you for your feedback!</div>" ) ;
6565 } , 200 ) ;
66-
67- setTimeout ( ( ) => {
66+
67+ setTimeout ( function ( ) {
6868 $ ( feedbackProps . feedbackFormSelector ) . removeClass ( feedbackProps . feedbackFixedClassName ) ;
6969 $ ( feedbackProps . feedbackFormSelector ) . addClass ( 'vote-hide' ) ;
7070 } , 2000 )
7171 } ;
7272
73- const getFeedbackData = function ( ) {
74- const otherFeedbackText = $ ( '#feedback-other-text-input' ) . val ( ) . trim ( ) ;
73+ var getFeedbackData = function ( ) {
74+ var otherFeedbackText = $ ( '#feedback-other-text-input' ) . val ( ) . trim ( ) ;
7575 return {
7676 email : "" ,
7777 inaccurateContent : false ,
@@ -94,8 +94,8 @@ $(document).ready(function () {
9494 } ;
9595
9696 $ ( '.feedback .feedback-vote-button' ) . on ( 'click' , function ( e ) {
97- const moreContent = $ ( feedbackProps . feedbackMoreInfoSelector ) ;
98- let vote = '' ;
97+ var moreContent = $ ( feedbackProps . feedbackMoreInfoSelector ) ;
98+ var vote = '' ;
9999 if ( $ ( this ) . hasClass ( 'feedback-no-button' ) ) {
100100 moreContent . show ( ) ;
101101 moreContent . addClass ( 'show' ) ;
@@ -112,7 +112,7 @@ $(document).ready(function () {
112112
113113 $ ( '.feedback .feedback-send-data-button' ) . on ( 'click' , function ( ) {
114114 $ ( feedbackProps . feedbackMoreInfoSelector ) . addClass ( 'hide' ) ;
115-
115+
116116 $ . ajax ( {
117117 url : "https://baas.kinvey.com/rpc/kid_Hk57KwIFf/custom/saveFeedback" ,
118118 method : "POST" ,
@@ -134,42 +134,42 @@ $(document).ready(function () {
134134 setFeedbackInfo ( null , feedbackProps . isClosed )
135135 } ) ;
136136
137- const hasVoted = ( ) => {
138- let feedbackInfo = getFeedbackInfo ( ) ;
137+ var hasVoted = function ( ) {
138+ var feedbackInfo = getFeedbackInfo ( ) ;
139139 if ( feedbackInfo ) {
140- const vote = JSON . parse ( feedbackInfo ) . vote ;
140+ var vote = JSON . parse ( feedbackInfo ) . vote ;
141141 return vote && ( vote . toLowerCase ( ) === 'yes' || vote . toLowerCase ( ) === 'no' ) ;
142142 }
143143
144144 return false ;
145145 }
146146
147- const hasClosed = ( ) => {
148- let feedbackInfo = getFeedbackInfo ( ) ;
147+ var hasClosed = function ( ) {
148+ var feedbackInfo = getFeedbackInfo ( ) ;
149149 if ( feedbackInfo ) {
150150 return JSON . parse ( feedbackInfo ) . closed ;
151151 }
152152
153153 return false ;
154154 }
155155
156- const shouldRunFeedbackTimer = ( ) => {
156+ var shouldRunFeedbackTimer = function ( ) {
157157 return ! ( hasVoted ( ) || hasClosed ( ) ) ;
158158 }
159159
160- const getElementTopOffset = ( selector ) => {
160+ var getElementTopOffset = function ( selector ) {
161161 return $ ( selector ) [ 0 ] . getBoundingClientRect ( ) . top ;
162162 }
163163
164- const isFeedbackBarInViewPort = ( ) => {
164+ var isFeedbackBarInViewPort = function ( ) {
165165 return getElementTopOffset ( feedbackProps . feedbackFormSelector ) < window . innerHeight ;
166166 }
167167
168- const shouldShowFeedbackPopup = ( ) => {
168+ var shouldShowFeedbackPopup = function ( ) {
169169 return ! feedbackProps . isVoting && ! isFeedbackBarInViewPort ( ) ;
170170 }
171171
172- const toggleFeedbackSticky = ( isSticky ) => {
172+ var toggleFeedbackSticky = function ( isSticky ) {
173173 if ( isSticky ) {
174174 $ ( feedbackProps . feedbackFormSelector ) . addClass ( feedbackProps . feedbackFixedClassName ) ;
175175 } else {
@@ -179,12 +179,12 @@ $(document).ready(function () {
179179 feedbackProps . isSticky = isSticky ;
180180 }
181181
182- const onWindowScrollOrResize = ( ) => {
182+ var onWindowScrollOrResize = function ( ) {
183183 if ( ! feedbackProps . isClosed ) {
184- const $window = $ ( window ) ;
185- const scrollOffset = $window . height ( ) + $window . scrollTop ( ) ;
186- const footerHeight = $ ( feedbackProps . feedbackFormSelector ) . outerHeight ( ) + $ ( '#footer' ) . outerHeight ( ) ;
187- const feedbackOffsetTop = document . body . scrollHeight - footerHeight ;
184+ var $window = $ ( window ) ;
185+ var scrollOffset = $window . height ( ) + $window . scrollTop ( ) ;
186+ var footerHeight = $ ( feedbackProps . feedbackFormSelector ) . outerHeight ( ) + $ ( '#footer' ) . outerHeight ( ) ;
187+ var feedbackOffsetTop = document . body . scrollHeight - footerHeight ;
188188
189189 // Double the feedback form height in order to have sticky scroll when it is scrolled down to footer
190190 toggleFeedbackSticky ( scrollOffset - $ ( feedbackProps . feedbackFormSelector ) . outerHeight ( ) * 2 < feedbackOffsetTop ) ;
@@ -195,13 +195,13 @@ $(document).ready(function () {
195195 }
196196 }
197197
198- const init = ( ) => {
198+ var init = function ( ) {
199199 if ( ! canVote ( ) ) {
200200 $ ( feedbackProps . feedbackFormSelector ) . addClass ( feedbackProps . feedbackDisabledClassName ) ;
201201 }
202202 else {
203203 if ( shouldRunFeedbackTimer ( ) ) {
204- setTimeout ( ( ) => {
204+ setTimeout ( function ( ) {
205205 if ( shouldShowFeedbackPopup ( ) ) {
206206 $ ( feedbackProps . feedbackFormSelector ) . addClass ( feedbackProps . feedbackFixedClassName ) ;
207207
0 commit comments