Changeset 36960


Ignore:
Timestamp:
2022-11-29T23:24:08+13:00 (17 months ago)
Author:
davidb
Message:

Clicking on the AV chart now initiates a new AV Recommendation

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

    r36959 r36960  
    689689            <div id="recommendationArea">
    690690               
    691               <form action="{$library_name}" method="get" name="QueryForm">
     691              <form id="av-query-form" action="{$library_name}" method="get" name="QueryForm">
    692692                <input name="a" type="hidden" value="q"/>
    693693                <input name="sa" type="hidden">
     
    759759              <div>
    760760                <div id="av-chart-div" style="height: 265px; width: 250px; float: right; display: none;">
    761                   <img id="av-chart-img" width="250" src="{$library_name}/sites/{$site_name}/collect/{$collName}/images/av-diagram-bw.svg" />
     761                  <img id="av-chart-img" width="250"
     762                   style="cursor: crosshair; background-colorXX: #fefefe;"
     763                   src="{$library_name}/sites/{$site_name}/collect/{$collName}/images/av-diagram-bw.svg" />
    762764                  <div>
    763765                <i>Or click inside the Arousal-Valence visualisation above to initiate a new AV-based recommendation.</i>
  • gs3-installations/mars/trunk/sites/mars/collect/amc-essentia/js/av_document.js

    r36959 r36960  
    8484    var arousal_val = parseFloat($('#arousal-val').text());
    8585    var valence_val = parseFloat($('#valence-val').text());
    86    
     86
     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);
     90}
     91
     92function submitAVRecommendation(form, arousal_val,valence_val, current_time)
     93{
    8794    form.elements["s1.arousal"].value = arousal_val;
    8895    form.elements["s1.valence"].value = valence_val;
    89 
    90     $('#makeRecommendationFrom-AV').html(`(@${current_time_1dp} secs: arousal=${arousal_val}, valence=${valence_val})`);
    91    
     96       
    9297    var args = {
    9398    "a":  "q",
     
    129134        $('#resultsAreaDiv').html("<div>Recommendations:</div>"+html_result);
    130135        $('#av-chart-div').show();
    131        
    132         const updated_url = new URL(window.location);
    133         updated_url.searchParams.set('p.frameOffset', current_time);
    134         //window.history.pushState({}, '', url + "?p.frameOffset=" + current_time);
    135         //window.history.pushState({}, '', updated_url);
    136         window.history.replaceState({}, '', updated_url);
    137 
    138        
     136
     137        if (current_time) {
     138        const updated_url = new URL(window.location);
     139        updated_url.searchParams.set('p.frameOffset', current_time);
     140        //window.history.pushState({}, '', url + "?p.frameOffset=" + current_time);
     141        //window.history.pushState({}, '', updated_url);
     142        window.history.replaceState({}, '', updated_url);
     143        }
    139144    });
    140145   
     
    273278
    274279    console.log(`av x,y: (${capped_av_x},${capped_av_y})`);
     280
     281    var form = $('#av-query-form')[0];
     282   
     283    submitAVRecommendation(form, capped_av_x, capped_av_y, null);
    275284   
    276285}
Note: See TracChangeset for help on using the changeset viewer.