@@ -8,7 +8,7 @@ import ClipboardJS from 'clipboard';
88import { version } from '../version' ;
99window . assetsVersion = version ;
1010
11- $ ( document ) . ready ( function ( ) {
11+ $ ( document ) . ready ( function ( ) {
1212 // add a js class to indicate we have JS enabled. Might need a change to either modernizr or somethng comparable
1313 $ ( 'html' ) . addClass ( 'js' ) ;
1414
@@ -20,7 +20,7 @@ $(document).ready(function() {
2020 */
2121 $ ( '.admin__sidebar' ) . addClass ( 'admin__sidebar--is-collapsed' ) ;
2222
23- $ ( '.admin-sidebar-toggler' ) . on ( 'click' , function ( ) {
23+ $ ( '.admin-sidebar-toggler' ) . on ( 'click' , function ( ) {
2424 if ( $ ( '.admin__sidebar' ) . hasClass ( 'admin__sidebar--is-collapsed' ) ) {
2525 $ ( '.admin__sidebar' )
2626 . addClass ( 'admin__sidebar--is-expanded' )
@@ -52,7 +52,7 @@ $(document).ready(function() {
5252 } , 50 ) ;
5353 }
5454
55- $ ( 'a[data-bs-toggle="tab"]' ) . on ( 'click' , function ( ) {
55+ $ ( 'a[data-bs-toggle="tab"]' ) . on ( 'click' , function ( ) {
5656 let newUrl ;
5757 const hash = $ ( this ) . attr ( 'href' ) ;
5858 newUrl = url . split ( '#' ) [ 0 ] + hash ;
@@ -62,23 +62,23 @@ $(document).ready(function() {
6262 /*
6363 ** Convert all ISO dates with class .datetime-relative to relative time
6464 */
65- $ ( '.datetime-relative' ) . each ( function ( ) {
65+ $ ( '.datetime-relative' ) . each ( function ( ) {
6666 $ ( this ) . text ( DateTime . fromISO ( $ ( this ) . text ( ) ) . toRelative ( ) ) ;
6767 } ) ;
6868
6969 /*
7070 ** Initialise all popover elements
7171 */
7272 let popoverTriggerList = [ ] . slice . call ( document . querySelectorAll ( '[data-bs-toggle="popover"]' ) ) ;
73- popoverTriggerList . map ( function ( popoverTriggerEl ) {
73+ popoverTriggerList . map ( function ( popoverTriggerEl ) {
7474 return new Popover ( popoverTriggerEl ) ;
7575 } ) ;
7676
7777 /*
7878 ** When a field from another group is invalid, show it.
7979 */
80- $ ( '#editor button[type="submit"]' ) . click ( function ( ) {
81- $ ( '#editor input:invalid' ) . each ( function ( ) {
80+ $ ( '#editor button[type="submit"]' ) . click ( function ( ) {
81+ $ ( '#editor input:invalid' ) . each ( function ( ) {
8282 // Find the tab-pane that this element is inside, and get the id
8383 let $closest = $ ( this ) . closest ( '.tab-pane' ) ;
8484 let id = $closest . attr ( 'id' ) ;
@@ -97,20 +97,15 @@ $(document).ready(function() {
9797 ** Simulates disabled behavior for elements with data-readonly attribute.
9898 * This is needed, because a disabled input cannot be required.
9999 */
100- $ ( '[data-readonly]' ) . on ( 'keydown paste' , function ( e ) {
100+ $ ( '[data-readonly]' ) . on ( 'keydown paste' , function ( e ) {
101101 e . preventDefault ( ) ;
102102 } ) ;
103103 /* Part of the code above, however make sure flatpickr is not readonly
104104 * and that its validation works.
105105 */
106- $ ( '.editor--date' )
107- . siblings ( )
108- . prop ( 'readonly' , false )
109- . attr ( 'data-readonly' , 'readonly' ) ;
110- $ ( '.editor--date' ) . on ( 'change' , e => {
111- const target = $ ( e . target )
112- . parent ( )
113- . find ( 'input[data-readonly="readonly"]' ) ;
106+ $ ( '.editor--date' ) . siblings ( ) . prop ( 'readonly' , false ) . attr ( 'data-readonly' , 'readonly' ) ;
107+ $ ( '.editor--date' ) . on ( 'change' , ( e ) => {
108+ const target = $ ( e . target ) . parent ( ) . find ( 'input[data-readonly="readonly"]' ) ;
114109 if ( target . val ( ) ) {
115110 target [ 0 ] . setCustomValidity ( '' ) ;
116111 } else {
@@ -136,15 +131,12 @@ $(document).ready(function() {
136131 $ ( '[data-errormessage]' ) . on ( 'input' , handleInput ) ;
137132
138133 /* Set the errormessage on the correct editor--date field */
139- $ ( '.editor--date' ) . each ( function ( ) {
134+ $ ( '.editor--date' ) . each ( function ( ) {
140135 let siblings = $ ( this ) . siblings ( ) ;
141136 const errormessage = $ ( this ) . attr ( 'data-errormessage' ) ;
142137
143- siblings . each ( function ( ) {
144- $ ( this )
145- . attr ( 'data-errormessage' , errormessage )
146- . on ( 'invalid' , handleInvalid )
147- . on ( 'input' , handleInput ) ;
138+ siblings . each ( function ( ) {
139+ $ ( this ) . attr ( 'data-errormessage' , errormessage ) . on ( 'invalid' , handleInvalid ) . on ( 'input' , handleInput ) ;
148140 } ) ;
149141 } ) ;
150142 /* End of custom error message */
@@ -161,7 +153,7 @@ $(document).ready(function() {
161153
162154 // Reset the content of a modal to it's default
163155
164- window . $ ( document ) . on ( 'click' , '[data-bs-toggle="modal"]' , function ( event ) {
156+ window . $ ( document ) . on ( 'click' , '[data-bs-toggle="modal"]' , function ( event ) {
165157 let resourcesModal = document . getElementById ( 'resourcesModal' ) ;
166158
167159 let saveButton = document . getElementById ( 'modalButtonAccept' ) ;
0 commit comments