From 138157a4444c37722584729767253aa8e875651f Mon Sep 17 00:00:00 2001 From: cbrender-deploy1 <128198801+cbrender-deploy1@users.noreply.github.com> Date: Sat, 18 Mar 2023 11:02:13 +0800 Subject: [PATCH 1/7] Update handwriting.js Add serviceEndpointURLs --- handwriting.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/handwriting.js b/handwriting.js index 9e63752..66bc5fd 100644 --- a/handwriting.js +++ b/handwriting.js @@ -20,6 +20,13 @@ options = this.options; callback = this.callback; } else if (!options) options = {}; + var serviceEndpointURLs = { + "default": "https://www.google.com.tw/inputtools/request?ime=handwriting&app=mobilesearch&cs=1&oe=UTF-8", + "google_tw": "https://www.google.com.tw/inputtools/request?ime=handwriting", + "google_jp": "https://www.google.co.jp/inputtools/request?ime=handwriting", + "google": "https://www.google.com/inputtools/request?ime=handwriting", + "inputtools": "https://inputtools.google.com/request?ime=handwriting" + } var data = JSON.stringify({ "options": "enable_pre_space", "requests": [{ @@ -61,7 +68,7 @@ } }); - xhr.open("POST", "https://www.google.com.tw/inputtools/request?ime=handwriting&app=mobilesearch&cs=1&oe=UTF-8"); + xhr.open("POST", serviceEndpointURLs[options.serviceEndpoint] || serviceEndpointURLs["default"]); xhr.setRequestHeader("content-type", "application/json"); xhr.send(data); }; From c83ce952b353e279bc48528aa7a01ab6925da8db Mon Sep 17 00:00:00 2001 From: cbrender-deploy1 <128198801+cbrender-deploy1@users.noreply.github.com> Date: Sat, 18 Mar 2023 11:05:18 +0800 Subject: [PATCH 2/7] Update handwriting.canvas.js Add serviceEndpointURLs --- handwriting.canvas.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/handwriting.canvas.js b/handwriting.canvas.js index 4890d3d..992a515 100644 --- a/handwriting.canvas.js +++ b/handwriting.canvas.js @@ -199,6 +199,13 @@ options = this.options; callback = this.callback; } else if (!options) options = {}; + var serviceEndpointURLs = { + "default": "https://www.google.com.tw/inputtools/request?ime=handwriting&app=mobilesearch&cs=1&oe=UTF-8", + "google_tw": "https://www.google.com.tw/inputtools/request?ime=handwriting", + "google_jp": "https://www.google.co.jp/inputtools/request?ime=handwriting", + "google": "https://www.google.com/inputtools/request?ime=handwriting", + "inputtools": "https://inputtools.google.com/request?ime=handwriting" + } var data = JSON.stringify({ "options": "enable_pre_space", "requests": [{ @@ -240,7 +247,7 @@ } }); - xhr.open("POST", "https://www.google.com.tw/inputtools/request?ime=handwriting&app=mobilesearch&cs=1&oe=UTF-8"); + xhr.open("POST", serviceEndpointURLs[options.serviceEndpoint] || serviceEndpointURLs["default"]); xhr.setRequestHeader("content-type", "application/json"); xhr.send(data); }; From 090d8d92f35485970d85e21a259015424c7f1dd8 Mon Sep 17 00:00:00 2001 From: cbrender-deploy1 <128198801+cbrender-deploy1@users.noreply.github.com> Date: Sat, 18 Mar 2023 11:18:38 +0800 Subject: [PATCH 3/7] Update README.md Add serviceEndpointURL documentation --- README.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a09afa5..c03b436 100644 --- a/README.md +++ b/README.md @@ -52,11 +52,12 @@ options argument is an optional object of following fields: ```javascript var options = { - width : 800, //int, width of the writing area, default: undefined - height : 800, //int, height of the writing area, default: undefined - language : "zh_TW", //string, language of input trace, default: "zh_TW" - numOfWords : 1, //int, number of words of input trace, default: undefined - numOfReturn : 5, //int, number of maximum returned results, default: undefined + width : 800, //int, width of the writing area, default: undefined + height : 800, //int, height of the writing area, default: undefined + language : "zh_TW", //string, language of input trace, default: "zh_TW" + serviceEndpoint: "google_tw", //string, service endpoint URL used, default: "default" + numOfWords : 1, //int, number of words of input trace, default: undefined + numOfReturn : 5, //int, number of maximum returned results, default: undefined }; ``` @@ -177,6 +178,17 @@ Note that, even included handwriting.canvas.js now, the previous way of calling so that you can take advantage of the **handwriting.canvas** object, while not changing previous code. +--- +

Supported Service Endpoint URLs

+ +| code | URL | +|------------|---------------------------------------------------------------------------------------------| +| default | https://www.google.com.tw/inputtools/request?ime=handwriting&app=mobilesearch&cs=1&oe=UTF-8 | +| google_tw | https://www.google.com.tw/inputtools/request?ime=handwriting | +| google_jp | https://www.google.co.jp/inputtools/request?ime=handwriting | +| google | https://www.google.com/inputtools/request?ime=handwriting | +| inputtools | https://inputtools.google.com/request?ime=handwriting | + ---

Supported Language

From e92c0ffea3bbc853d5d6d5261b3e2781d6cc89c9 Mon Sep 17 00:00:00 2001 From: cbrender-deploy1 <128198801+cbrender-deploy1@users.noreply.github.com> Date: Mon, 20 Mar 2023 12:30:36 +0800 Subject: [PATCH 4/7] Update handwriting.canvas.js --- handwriting.canvas.js | 1 + 1 file changed, 1 insertion(+) diff --git a/handwriting.canvas.js b/handwriting.canvas.js index 992a515..69f13ce 100644 --- a/handwriting.canvas.js +++ b/handwriting.canvas.js @@ -203,6 +203,7 @@ "default": "https://www.google.com.tw/inputtools/request?ime=handwriting&app=mobilesearch&cs=1&oe=UTF-8", "google_tw": "https://www.google.com.tw/inputtools/request?ime=handwriting", "google_jp": "https://www.google.co.jp/inputtools/request?ime=handwriting", + "google_kr": "https://www.google.co.kr/inputtools/request?ime=handwriting", "google": "https://www.google.com/inputtools/request?ime=handwriting", "inputtools": "https://inputtools.google.com/request?ime=handwriting" } From d8d2c642ab3d19c64491c13862a06f9f1ad8860a Mon Sep 17 00:00:00 2001 From: cbrender-deploy1 <128198801+cbrender-deploy1@users.noreply.github.com> Date: Mon, 20 Mar 2023 12:31:25 +0800 Subject: [PATCH 5/7] Update handwriting.js --- handwriting.js | 1 + 1 file changed, 1 insertion(+) diff --git a/handwriting.js b/handwriting.js index 66bc5fd..bb86383 100644 --- a/handwriting.js +++ b/handwriting.js @@ -24,6 +24,7 @@ "default": "https://www.google.com.tw/inputtools/request?ime=handwriting&app=mobilesearch&cs=1&oe=UTF-8", "google_tw": "https://www.google.com.tw/inputtools/request?ime=handwriting", "google_jp": "https://www.google.co.jp/inputtools/request?ime=handwriting", + "google_kr": "https://www.google.co.jp/inputtools/request?ime=handwriting", "google": "https://www.google.com/inputtools/request?ime=handwriting", "inputtools": "https://inputtools.google.com/request?ime=handwriting" } From 6d2183b9869774e5d306bd9a88ed8dd6d0a5dc6a Mon Sep 17 00:00:00 2001 From: cbrender-deploy1 <128198801+cbrender-deploy1@users.noreply.github.com> Date: Mon, 20 Mar 2023 12:32:32 +0800 Subject: [PATCH 6/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c03b436..fdad9c1 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,7 @@ so that you can take advantage of the **handwriting.canvas** object, while not c | default | https://www.google.com.tw/inputtools/request?ime=handwriting&app=mobilesearch&cs=1&oe=UTF-8 | | google_tw | https://www.google.com.tw/inputtools/request?ime=handwriting | | google_jp | https://www.google.co.jp/inputtools/request?ime=handwriting | +| google_kr | https://www.google.co.kr/inputtools/request?ime=handwriting | | google | https://www.google.com/inputtools/request?ime=handwriting | | inputtools | https://inputtools.google.com/request?ime=handwriting | From 9e4283156f9d2bfe4686c4b3cc9322c7e484356b Mon Sep 17 00:00:00 2001 From: cbrender-deploy1 <128198801+cbrender-deploy1@users.noreply.github.com> Date: Mon, 20 Mar 2023 12:36:28 +0800 Subject: [PATCH 7/7] Update handwriting.js --- handwriting.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handwriting.js b/handwriting.js index bb86383..750fac0 100644 --- a/handwriting.js +++ b/handwriting.js @@ -24,7 +24,7 @@ "default": "https://www.google.com.tw/inputtools/request?ime=handwriting&app=mobilesearch&cs=1&oe=UTF-8", "google_tw": "https://www.google.com.tw/inputtools/request?ime=handwriting", "google_jp": "https://www.google.co.jp/inputtools/request?ime=handwriting", - "google_kr": "https://www.google.co.jp/inputtools/request?ime=handwriting", + "google_kr": "https://www.google.co.kr/inputtools/request?ime=handwriting", "google": "https://www.google.com/inputtools/request?ime=handwriting", "inputtools": "https://inputtools.google.com/request?ime=handwriting" }