Changeset 2673436
- Timestamp:
- 02/05/2022 04:43:41 PM (4 years ago)
- File:
-
- 1 edited
-
morphii/trunk/assets/js/morphii-custom.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
morphii/trunk/assets/js/morphii-custom.js
r2673321 r2673436 3 3 jQuery.noConflict(); 4 4 var collection = null; 5 5 var intensitySet=false; 6 6 window.onload = function() { 7 7 createWidget(); … … 56 56 }, 57 57 slider: { 58 initial_intensity: 0. 2,58 initial_intensity: 0.0, 59 59 show_animation: true, 60 60 anchor_labels: { … … 161 161 function selectionChangeCallback(event) { 162 162 //console.log('Selection Change callback: ' + JSON.stringify(event, null, 2)); 163 var submitButton = document.getElementById('morphii-submit-button'); 164 if (submitButton) { 165 166 if (event.selection_required_valid === true) { 167 168 submitButton.removeAttribute('disabled'); 169 } 170 else { 171 172 173 submitButton.setAttribute('disabled', 'disabled'); 174 } 175 } 163 176 var noUiOrigin=document.getElementsByClassName('noUi-origin')[0]; 164 177 var observer = new MutationObserver(function(mutations) { 165 178 var style=jQuery(".noUi-origin").attr("style"); 179 intensitySet=true; 166 180 // console.log(style); 167 var submitButton = document.getElementById('morphii-submit-button'); 168 if (submitButton) { 169 170 if (event.selection_required_valid === true) { 171 jQuery(".morphii-questions").find(".intensity-error").remove(); 172 submitButton.removeAttribute('disabled'); 173 } 174 else { 175 if(jQuery(".morphii-questions").find(".intensity-error").length==0) 176 jQuery(".morphii-questions").append("<span class='intensity-error'><br/><hr/><p style='color:red'>Oops! You forgot to tell us how intense your feelings are. Use the slider to adjust the facial expression to show us</p></span>"); 177 178 submitButton.setAttribute('disabled', 'disabled'); 179 } 180 } 181 181 182 }); 182 183 … … 191 192 192 193 function submit(event) { 194 if(intensitySet && jQuery(".noUi-origin").attr("style")!="left: 0%;"){ 195 console.log("Intensity Set"); 196 jQuery(".morphii-questions").find(".intensity-error").remove(); 197 198 } 199 else{ 200 if(jQuery(".morphii-questions").find(".intensity-error").length==0) 201 { 202 jQuery(".morphii-questions").append("<span class='intensity-error'><br/><hr/><p style='color:red'>Oops! You forgot to tell us how intense your feelings are. Use the slider to adjust the facial expression to show us</p></span>"); 203 return false; 204 } 205 } 206 193 207 if (collection) { 194 208 var submitButton = document.getElementById('morphii-submit-button');
Note: See TracChangeset
for help on using the changeset viewer.