@@ -908,176 +908,9 @@ function getAnnotationDataFrom(data) {
908908 } ;
909909 return annotation ;
910910}
911- // the ROI Form Event
912- function changeROITypeValue ( radio ) {
913- // group 1: Evaluable for sTILs
914- if ( radio . value == 'Evaluable for sTILs' ) {
915- enableITS ( ) ;
916- disableSaveBtn ( ) ;
917- }
918- // group 2: Not Evaluable for sTILs
919- if ( radio . value == 'Not Evaluable for sTILs' ) {
920- disableITS ( ) ;
921- disableTIL ( ) ;
922- enableSaveBtn ( ) ;
923- }
924- }
925- function disableSaveBtn ( ) {
926- const btn = document . getElementById ( 'save' ) ;
927- btn . classList . add ( 'disabled' ) ;
928- btn . disabled = true ;
929- }
930- function enableSaveBtn ( ) {
931- const btn = document . getElementById ( 'save' ) ;
932- btn . classList . remove ( 'disabled' ) ;
933- btn . disabled = false ;
934- }
935- function itsChangeText ( e ) {
936- if ( itsRange . value > 0 ) {
937- enableTIL ( ) ;
938- } else {
939- disableTIL ( ) ;
940- }
941- itsTxtContent . textContent = `${ itsRange . value } %` ;
942- itsTxtIp . value = itsRange . value ;
943- }
944- function enableTIL ( ) {
945- vta . style . display = 'flex' ;
946- tilMessage . style . display = 'block' ;
947- }
948- function enableITS ( ) {
949- its . style . display = 'flex' ;
950- itsMessage . style . display = 'block' ;
951- }
952- function disableITS ( ) {
953- its . style . display = 'none' ;
954- itsMessage . style . display = 'none' ;
955- itsTxtContent . textContent = '-1%' ;
956- itsTxtIp . value = - 1 ;
957- itsRange . value = - 1 ;
958- itsChangeText ( ) ;
959- }
960- function disableTIL ( ) {
961- vta . style . display = 'none' ;
962- tilMessage . style . display = 'none' ;
963- vtaTxtContent . textContent = '-1%' ;
964- vtaTxtIp . value = - 1 ;
965- vtaRange . value = - 1 ;
966- vtaChangeText ( ) ;
967- }
968- function vtaChangeText ( e ) {
969- vtaTxtContent . textContent = `${ vtaRange . value } %` ;
970- vtaTxtIp . value = vtaRange . value ;
971- if ( vtaRange . value > - 1 ) {
972- enableSaveBtn ( ) ;
973- } else {
974- disableSaveBtn ( ) ;
975- }
976- }
977911
978- // % intra-tumoral stroma variables
979- const its = document . getElementById ( 'its' ) ;
980- const itsRange = document . getElementById ( 'its_range' ) ;
981- const itsTxt = document . getElementById ( 'its_txt' ) ;
982- const itsTxtContent = itsTxt . querySelector ( '.txt' ) ;
983- const itsTxtIp = itsTxt . querySelector ( '.ip' ) ;
984- const itsMessage = document . getElementById ( 'its_message' ) ;
985-
986- // % tumor-associated stroma variables
987- const vta = document . getElementById ( 'vta' ) ;
988- const vtaRange = document . getElementById ( 'vta_range' ) ;
989- const vtaTxt = document . getElementById ( 'vta_txt' ) ;
990- const vtaTxtContent = vtaTxt . querySelector ( '.txt' ) ;
991- const vtaTxtIp = vtaTxt . querySelector ( '.ip' ) ;
992- const tilMessage = document . getElementById ( 'til_message' ) ;
993912
994913function addROIFormEvent ( ) {
995- itsTxt . addEventListener ( 'click' , function ( e ) {
996- if ( itsRange . disabled ) return ;
997- // set image zoom value to input
998- let value = itsTxtContent . textContent ;
999- value = value . slice ( 0 , value . length - 1 ) ;
1000- itsTxtIp . value = + value ;
1001-
1002-
1003- // hide txt
1004- itsTxtContent . classList . add ( 'hide' ) ;
1005- itsTxtIp . focus ( ) ;
1006- itsTxtIp . select ( ) ;
1007- } ) ;
1008-
1009- itsTxt . addEventListener ( 'keydown' , function ( e ) {
1010- if ( e . key === 'Enter' ) {
1011- itsTxtIp . blur ( ) ;
1012- }
1013- } ) ;
1014-
1015- itsTxtIp . addEventListener ( 'blur' , function ( e ) {
1016- const regex = new RegExp ( / ^ ( [ 1 - 9 ] ? \d | 1 0 0 | - 1 ) $ / ) ;
1017- const rs = regex . test ( itsTxtIp . value ) ;
1018- if ( rs ) {
1019- itsRange . value = itsTxtIp . value ;
1020- itsTxtContent . textContent = `${ itsRange . value } %` ;
1021- delete itsTxt . dataset . error ;
1022- itsTxtContent . classList . remove ( 'hide' ) ;
1023- itsChangeText ( ) ;
1024- } else {
1025- // give error tip
1026- itsTxt . dataset . error = `% Stroma Range (Integer): -1 ~ 100` ;
1027- itsTxtIp . focus ( ) ;
1028- }
1029- } ) ;
1030-
1031-
1032- itsRange . addEventListener ( 'change' , itsChangeText ) ;
1033- itsRange . addEventListener ( 'mousemove' , function ( e ) {
1034- if ( e . buttons > 0 ) {
1035- itsChangeText ( e ) ;
1036- }
1037- } ) ;
1038-
1039-
1040- vtaTxt . addEventListener ( 'click' , function ( e ) {
1041- if ( vtaRange . disabled ) return ;
1042- // set image zoom value to input
1043- let value = vtaTxtContent . textContent ;
1044- value = value . slice ( 0 , value . length - 1 ) ;
1045- vtaTxtIp . value = + value ;
1046- // hide txt
1047- vtaTxtContent . classList . add ( 'hide' ) ;
1048- vtaTxtIp . focus ( ) ;
1049- vtaTxtIp . select ( ) ;
1050- } ) ;
1051-
1052- vtaTxt . addEventListener ( 'keydown' , function ( e ) {
1053- if ( e . key === 'Enter' ) {
1054- vtaTxtIp . blur ( ) ;
1055- }
1056- } ) ;
1057-
1058- vtaTxtIp . addEventListener ( 'blur' , function ( e ) {
1059- const regex = new RegExp ( / ^ ( [ 1 - 9 ] ? \d | 1 0 0 | - 1 ) $ / ) ;
1060- const rs = regex . test ( vtaTxtIp . value ) ;
1061- if ( rs ) {
1062- vtaRange . value = vtaTxtIp . value ;
1063- vtaTxtContent . textContent = `${ vtaRange . value } %` ;
1064- delete vtaTxt . dataset . error ;
1065- vtaTxtContent . classList . remove ( 'hide' ) ;
1066- vtaChangeText ( ) ;
1067- } else {
1068- // give error tip
1069- vtaTxt . dataset . error = `sTILs Range (Integer): -1 ~ 100` ;
1070- vtaTxtIp . focus ( ) ;
1071- }
1072- } ) ;
1073-
1074-
1075- vtaRange . addEventListener ( 'change' , vtaChangeText ) ;
1076- vtaRange . addEventListener ( 'mousemove' , function ( e ) {
1077- if ( e . buttons > 0 ) {
1078- vtaChangeText ( e ) ;
1079- }
1080- } ) ;
1081914
1082915 const actionBtn = document . querySelector ( '#left_menu .foot .action' ) ;
1083916
@@ -1121,84 +954,6 @@ function addROIFormEvent() {
1121954 } ) ;
1122955}
1123956
1124- function downloadSlide ( e ) {
1125- const location = $D . params . data . location ;
1126- var fileName = `` ;
1127- var len = 0 ;
1128- var cur = 0 ;
1129- $CAMIC . store . downloadSlide ( location ) . then ( ( response ) => {
1130- if ( response . status == 200 ) {
1131- const headers = response . headers ;
1132- const disposition = headers . get ( 'content-disposition' ) ;
1133- len = headers . get ( 'content-length' ) ;
1134- if ( disposition && disposition . indexOf ( 'attachment' ) !== - 1 ) {
1135- var filenameRegex = / f i l e n a m e [ ^ ; = \n ] * = ( ( [ ' " ] ) .* ?\2| [ ^ ; \n ] * ) / ;
1136- var matches = filenameRegex . exec ( disposition ) ;
1137- if ( matches != null && matches [ 1 ] ) {
1138- fileName = matches [ 1 ] . replace ( / [ ' " ] / g, '' ) ;
1139- }
1140- }
1141- setDownloadModalTitle ( fileName ) ;
1142- setDownloadModalProgress ( 0 ) ;
1143- showDownloadModal ( ) ;
1144- return response . body ;
1145- } else {
1146- throw response ;
1147- }
1148- } )
1149- . then ( ( body ) => {
1150- const reader = body . getReader ( ) ;
1151-
1152- return new ReadableStream ( {
1153- start ( controller ) {
1154- return pump ( ) ;
1155-
1156- function pump ( ) {
1157- return reader . read ( ) . then ( ( { done, value} ) => {
1158- // When no more data needs to be consumed, close the stream
1159- if ( done ) {
1160- controller . close ( ) ;
1161- return ;
1162- }
1163- // Enqueue the next data chunk into our target stream
1164- cur += value . length ;
1165- setDownloadModalProgress ( Math . round ( cur / len * 100 ) ) ;
1166- controller . enqueue ( value ) ;
1167- return pump ( ) ;
1168- } ) ;
1169- }
1170- } ,
1171- } ) ;
1172- } )
1173- . then ( ( stream ) => new Response ( stream ) )
1174- . then ( ( response ) => response . blob ( ) )
1175- . then ( ( blob ) => {
1176- var url = window . URL . createObjectURL ( blob ) ;
1177- var a = document . createElement ( 'a' ) ;
1178- a . href = url ;
1179- a . download = fileName ;
1180- document . body . appendChild ( a ) ;
1181- a . click ( ) ;
1182- a . remove ( ) ; // afterwards we remove the element again
1183-
1184- hideDownloadModal ( ) ;
1185- window . URL . revokeObjectURL ( blob ) ;
1186- } )
1187- . catch ( ( err ) => console . error ( err ) ) ;
1188- }
1189-
1190- function showDownloadModal ( ) {
1191- $ ( '#downloadModal' ) . modal ( 'show' ) ;
1192- }
1193- function hideDownloadModal ( ) {
1194- $ ( '#downloadModal' ) . modal ( 'hide' ) ;
1195- }
1196- function setDownloadModalTitle ( title ) {
1197- $ ( '#downloadModal' ) . find ( '.modal-title' ) . text ( title ) ;
1198- }
1199- function setDownloadModalProgress ( num ) {
1200- $ ( '#downloadModal' ) . find ( '.progress-bar' ) . css ( 'width' , `${ num } %` ) . attr ( 'aria-valuenow' , num ) . text ( `${ num } %` ) ;
1201- }
1202957
1203958
1204959// override labeling code
0 commit comments