From 99170862c60b062ca30e2de2fc8acc0d8781499d Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Fri, 19 Jan 2024 08:17:44 +0700 Subject: [PATCH] fix(web): pred-text test page path to model --- web/src/test/manual/web/prediction-mtnt/index.html | 9 ++++++--- web/src/test/manual/web/prediction-ui/index.html | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/web/src/test/manual/web/prediction-mtnt/index.html b/web/src/test/manual/web/prediction-mtnt/index.html index 10e277cfd6c..34f43f3c5b7 100644 --- a/web/src/test/manual/web/prediction-mtnt/index.html +++ b/web/src/test/manual/web/prediction-mtnt/index.html @@ -48,9 +48,12 @@ kmw.addKeyboards({id:'gesture_prototyping',name:'Gesture prototyping',languages:{id:'en',name:'English'}, filename:('../keyboards/gesture_prototyping/build/gesture_prototyping.js')}); - var pageRef = (window.location.protocol == 'file:') - ? window.location.href.substr(0, window.location.href.lastIndexOf('/')+1) - : window.location.href; + // Ensure the URL we prefix to the page's path is the page's directory, not including + // the actual HTML page itself. + var urlIncludesIndex = window.location.href.lastIndexOf('.html') > 1; + var pageRef = (urlIncludesIndex + ? window.location.href.substr(0, window.location.href.lastIndexOf('/')) + : window.location.href) + '/'; var modelStub = {'id': 'nrc.en.mtnt', languages: ['en'], diff --git a/web/src/test/manual/web/prediction-ui/index.html b/web/src/test/manual/web/prediction-ui/index.html index e7cfc761014..84d08cbb87b 100644 --- a/web/src/test/manual/web/prediction-ui/index.html +++ b/web/src/test/manual/web/prediction-ui/index.html @@ -46,9 +46,12 @@ kmw.addKeyboards({id:'obolo_chwerty_6351',name:'obolo_chwerty_6351',languages:{id:'en',name:'English'}, filename:('../obolo_chwerty_6351.js')}); - var pageRef = (window.location.protocol == 'file:') - ? window.location.href.substr(0, window.location.href.lastIndexOf('/')+1) - : window.location.href; + // Ensure the URL we prefix to the page's path is the page's directory, not including + // the actual HTML page itself. + var urlIncludesIndex = window.location.href.lastIndexOf('.html') > 1; + var pageRef = (urlIncludesIndex + ? window.location.href.substr(0, window.location.href.lastIndexOf('/')) + : window.location.href) + '/'; var modelStub = {'id': 'example.en.trie', languages: ['en'],