Changeset 37029
- Timestamp:
- 2022-12-15T11:22:13+13:00 (12 months ago)
- Location:
- gs3-installations/mars/trunk/sites/mars/collect/amc-essentia
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-installations/mars/trunk/sites/mars/collect/amc-essentia/etc/collectionConfig.xml
r36966 r37029 157 157 <xsl:otherwise> 158 158 <td valign="top"> 159 <gsf:link type="document" >159 <gsf:link type="document" extraLinkArgs="renderWave=0"> 160 160 <gsf:icon type="document"/> 161 161 </gsf:link> … … 163 163 <td> 164 164 165 <gsf:link type="document" >165 <gsf:link type="document" extraLinkArgs="renderWave=0"> 166 166 <gsf:metadata name="amc.title"/> 167 167 by <gsf:metadata name="amc.artist"/> … … 326 326 <gsf:template match="documentNode"> 327 327 <td valign="top"> 328 <gsf:link type="document" >328 <gsf:link type="document" extraLinkArgs="renderWave=0"> 329 329 <gsf:icon type="document"/> 330 330 </gsf:link> … … 339 339 </td> 340 340 <td valign="top"> 341 <gsf:link type="document" >341 <gsf:link type="document" extraLinkArgs="renderWave=0"> 342 342 <gsf:choose-metadata> 343 343 <gsf:metadata name="dc.Title"/> … … 550 550 <gsf:script src="{$httpCollection}/js/av_document.js"/> 551 551 552 <div id="metadata-documenttext" class="documenttext" style="padding-bottom: 20px; width:100%;">552 <div id="metadata-documenttext" class="documenttext" style="padding-bottom: 35px; width:100%;"> 553 553 <style> 554 554 .doc-metadata td { padding: 7px; } … … 588 588 <div id="ajax-loaded-assocfilepath" style="display: none;"><gsf:metadata name="assocfilepath" pos="first"/></div> 589 589 590 <style> 591 #hide-av-chart { 592 display: none; 593 } 594 595 span.display-view-modes, a.display-view-modes { 596 padding: 5px; 597 } 598 599 .display-view-modes:hover { 600 background-color: #b0b0b0; 601 } 602 </style> 590 603 591 <div style="position: absolute; right: 24px; top: -18px; z-index: 1000; font-size: 90%; font-style:italic"> 592 <a id="switch-to-waveform" stylexx="display: none;" href="">Switch to Waveform</a> 593 <a id="switch-to-spectrogram" stylexx="display: none;" href="">Switch to Spectrogram</a> 604 <div style="position: absolute; right: 24px; top: -23px; z-index: 1000; font-size: 90%; font-styleXX:italic"> 605 <span style="display: inline-block"> 606 <a id="switch-to-waveform" class="display-view-modes" stylexx="display: none;" href="">Switch to Waveform</a> 607 <a id="switch-to-spectrogram" class="display-view-modes" stylexx="display: none;" href="">Switch to Spectrogram</a> 608 </span> 609 <span style="display: inline-block; width: 140px;"> 610 | <span id="show-av-chart" class="display-view-modes" onclick="return showAVChart();">Display AV Chart</span> 611 <span id="hide-av-chart" class="display-view-modes" onclick="return hideAVChart();">Hide AV Chart</span> 612 </span> 613 <span style="display: inline-block"> 614 | <span class="display-view-modes" onclick="alert('To be implemented')">⏺ Record <i>your</i> AV experience</span> 615 </span> 594 616 </div> 595 617 … … 669 691 670 692 </div> 693 694 695 <div id="av-chart-outerdiv" style="display: none;"> 696 <hr/> 697 <div style="width: 500px; margin: auto;"> 698 <div id="av-chart-div" style="position: relative; height: 325px; width: 300px; margin: auto"> 699 <div style="position: absolute; top: 0; left: 0; width: 300px; height: 300px; pointer-events: none;"> 700 <canvas id="av-chart-canvas" style="XXwidth: 100%; height: 300px;"> 701 Your browser does not support the canvas element 702 </canvas> 703 </div> 704 <img id="av-chart-img" width="300" 705 style="cursor: crosshair; background-colorXX: #fefefe;" 706 src="{$library_name}/sites/{$site_name}/collect/{$collName}/images/av-diagram-bw.svg" /> 707 <div> 708 <i>Click inside the Arousal-Valence visualisation above to initiate an AV-based recommendation.</i> 709 </div> 710 711 </div> 712 </div> 713 </div> 671 714 672 715 <gsf:variable name="mp3url"><xsl:value-of select="$httpCollection"/>/index/assoc/<xsl:value-of select="$assocFilePath"/>/audio.mp3</gsf:variable> … … 762 805 </form> 763 806 <div> 807 <!-- 764 808 <div id="av-chart-div" style="position: relative; height: 325px; width: 300px; float: right; display: none;"> 765 809 <div style="position: absolute; top: 0; left: 0; width: 300px; height: 300px; pointer-events: none;"> … … 776 820 777 821 </div> 822 --> 778 823 <div id="resultsAreaDiv" style="padding-top: 1rem; min-height: 325px; display: none;"> 779 824 <xsl:text> </xsl:text> -
gs3-installations/mars/trunk/sites/mars/collect/amc-essentia/js/av_document.js
r36966 r37029 67 67 */ 68 68 69 function preSubmit(form) 69 70 function displayClampedCurrentTimeAndAV() 70 71 { 71 72 // Note, the Arousal and Valence feature window values used is: … … 75 76 76 77 // clamp to ensure >= 6.0 secs 78 77 79 var current_time = Math.max(6.0,wavesurfer.getCurrentTime()); 78 80 var current_time_1dp = current_time.toFixed(1); 79 AVEnsurePaused();80 81 weka_segment = Math.round(current_time/3) * 3;82 form.elements["s1.offset"].value = weka_segment;83 81 84 82 var arousal_val = parseFloat($('#arousal-val').text()); 85 83 var valence_val = parseFloat($('#valence-val').text()); 86 84 87 $('#makeRecommendationFrom-AV').html(`(@${current_time_1dp} secs: arousal=${arousal_val}, valence=${valence_val})`); 88 89 return submitAVRecommendation(form, arousal_val,valence_val, current_time); 85 var arousal_val_str = (arousal_val>0) ? "+"+arousal_val : ""+arousal_val; 86 var valence_val_str = (valence_val>0) ? "+"+valence_val : ""+valence_val; 87 88 $('#makeRecommendationFrom-AV').html(`(@${current_time_1dp} secs: arousal = ${arousal_val_str}, valence = ${valence_val_str})`); 89 90 return current_time; 91 } 92 93 function preSubmit(form) 94 { 95 // Note, the Arousal and Valence feature window values used is: 96 // 6 secs + 50% overlap 97 // So the Weka computed AV values are spaced out: 98 // 6s, 9s, 12s, ... 99 100 // clamp to ensure >= 6.0 secs 101 //var current_time = Math.max(6.0,wavesurfer.getCurrentTime()); 102 //var current_time_1dp = current_time.toFixed(1); 103 104 var clamped_current_time = displayClampedCurrentTimeAndAV(); 105 106 AVEnsurePaused(); 107 108 weka_segment = Math.round(clamped_current_time/3) * 3; 109 form.elements["s1.offset"].value = weka_segment; 110 111 var arousal_val = parseFloat($('#arousal-val').text()); 112 var valence_val = parseFloat($('#valence-val').text()); 113 114 //$('#makeRecommendationFrom-AV').html(`(@${current_time_1dp} secs: arousal=${arousal_val}, valence=${valence_val})`); 115 116 return submitAVRecommendation(form, arousal_val,valence_val, clamped_current_time); 90 117 } 91 118 … … 176 203 var new_doc_playervisual_url = new_doc_url_parts[0] + "&excerptid=playervisual-documenttext#" + new_doc_url_parts[1]; 177 204 178 console.log("new doc metadata url = " + new_doc_metadata_url); 179 console.log("new doc playervisual url = " + new_doc_playervisual_url); 205 //console.log("new doc metadata url = " + new_doc_metadata_url); 206 //console.log("new doc playervisual url = " + new_doc_playervisual_url); 207 208 209 // current URL ends with collect/amc-essentia/document/ds_51017_15513?p.frameOffset=... 210 // Need to remove old '/document/ds_...' and replace with new doc 211 212 const current_doc_url_str = window.location.href; 213 214 console.log(current_doc_url_str); 215 var push_doc_url_str = current_doc_url_str.replace(/document\/\w+\?/,"document/"+doc_id+"?"); 216 console.log("new doc url str = " + push_doc_url_str); 217 const push_doc_url = new URL(push_doc_url_str); 218 219 var frameOffset = $av_recommendation.data("frameoffset"); 220 push_doc_url.searchParams.set('p.frameOffset', frameOffset); 221 push_doc_url.searchParams.set('d', doc_id); 222 window.history.pushState({}, '', push_doc_url); 223 //window.history.replaceState({}, '', push_doc_url); 224 225 226 227 $('#metadata-documenttext').css("cursor","wait"); 228 $('#playervisual-documenttext').css("cursor","wait"); 180 229 181 230 $.ajax({ … … 183 232 url: new_doc_metadata_url, 184 233 }) 234 .always(function() { 235 $('#metadata-documenttext').css("cursor","revert"); 236 }) 237 185 238 .fail(function(jqXHR,textStatus) { 186 239 console.error( "metadata-documenttext ajax request failed: " + textStatus); … … 195 248 url: new_doc_playervisual_url, 196 249 }) 250 .always(function() { 251 $('#playervisual-documenttext').css("cursor","revert"); 252 }) 197 253 .fail(function(jqXHR,textStatus) { 198 254 console.error( "playervisual-documenttext equest failed: " + textStatus); 199 255 }) 200 256 .done(function(html_result) { 201 // current URL ends with collect/amc-essentia/document/ds_51017_15513?p.frameOffset=...202 // Need to remove old '/document/ds_...' and replace with new doc203 204 const current_doc_url_str = window.location.href;205 206 console.log(current_doc_url_str);207 var new_doc_url_str = current_doc_url_str.replace(/document\/\w+\?/,"document/"+doc_id+"?");208 console.log("new doc url str = " + new_doc_url_str);209 const new_doc_url = new URL(new_doc_url_str);210 211 var frameOffset = $av_recommendation.data("frameoffset");212 new_doc_url.searchParams.set('p.frameOffset', frameOffset);213 new_doc_url.searchParams.set('d', doc_id);214 window.history.pushState({}, '', new_doc_url);215 //window.history.replaceState({}, '', new_doc_url);216 257 217 258 $('#playervisual-documenttext').replaceWith(html_result); … … 223 264 initWavesurferPlayer(); 224 265 266 wavesurfer.seekTo(frameOffset/AMC_SONG_DURATION); 267 225 268 postInitWavesurfer(wavesurfer); 226 269 … … 229 272 230 273 231 274 $resultsTable_tr1.slideUp(); 232 275 233 276 //var arousal_val = $av_recommendation.data("arousalval"); … … 341 384 recommendFromPos(); 342 385 } 386 displayClampedCurrentTimeAndAV(); 343 387 }); 344 388 … … 353 397 //console.log("**** setting play seek @ " + frameOffset); 354 398 wavesurfer.seekTo(frameOffset/AMC_SONG_DURATION); 355 356 console.log("av_document.js keeping 'currentPosRunup' at 0"); 399 recommendFromPos(); 400 displayClampedCurrentTimeAndAV(); 401 402 console.log("av_document.js: **** Keeping 'currentPosRunup' at 0 for now!"); 357 403 /*if (frameOffset>1.0) { 358 404 currentPosRunup = 1.0; // 1 second 359 }*/ 405 }*/ 406 } 407 else { 408 recommendFromStart(); 409 displayClampedCurrentTimeAndAV(); 360 410 } 361 411 }); … … 502 552 } 503 553 554 function showAVChart() 555 { 556 $('#av-chart-outerdiv').slideDown(); 557 $('#show-av-chart').hide(); 558 $('#hide-av-chart').show(); 559 560 return false; 561 } 562 563 function hideAVChart() 564 { 565 $('#av-chart-outerdiv').slideUp(); 566 $('#hide-av-chart').hide(); 567 $('#show-av-chart').show(); 568 569 return false; 570 } 571 504 572 $(document).ready(function() { 505 573
Note:
See TracChangeset
for help on using the changeset viewer.