(function( $ ) { 'use strict'; $( document ).ready(function() { $( '#article' ).trigger( 'x-height-change' ); }); $( '#article' ).on('click', '.show-more', function() { $( '#article' ).trigger( 'x-height-change' ); }); $( '#article' ).on('click', '.show-less', function() { $( '#article' ).trigger( 'x-height-change' ); }); if ( $( 'body' ).hasClass( "theme-index-with-asides" ) ) { $("#asides").insertAfter ('#ia'); } $( 'body' ).addClass( window.location.hostname == "data.qld.gov.au" || window.location.hostname == "www.data.qld.gov.au" || window.location.hostname == "publications.qld.gov.au" || window.location.hostname == "www.publications.qld.gov.au" ? 'prod' : 'env-staging' ); function formApprovalCheck() { var $datesFields = $('.first-published-date, .effective-date'); var $fieldApproval = $('#field-approval'); if($fieldApproval.val() === 'yes'){ $datesFields.removeClass('visuallyhidden'); $datesFields.find('input').attr('required', 'required') } else if($fieldApproval.val() === 'no'){ $datesFields.addClass('visuallyhidden'); $datesFields.find('input').removeAttr('required') } } //on page load check formApprovalCheck(); // on change check $('#field-approval').change(formApprovalCheck); $( '.qg-datepicker' ).datepicker({ dateFormat: 'yy-mm-dd' }); // this fix is to solve the form disabled issue which is occurring because of conflict between CKAN 2.8 js plugins and SWE2 form js $("[data-module*='basic-form']").find("input").change(function() { var saveBtn = $("[name='save']"); if (saveBtn.attr('disabled')) { saveBtn.removeAttr('disabled'); } }); }( jQuery ));