diff --git a/.gitignore b/.gitignore
index 86c05721..d5843b61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -117,6 +117,9 @@ ENV/
env.bak/
venv.bak/
+# VS Code config
+.vscode/
+
# Spyder project settings
.spyderproject
.spyproject
diff --git a/lute/bing/routes.py b/lute/bing/routes.py
index 92eac938..fa60d267 100644
--- a/lute/bing/routes.py
+++ b/lute/bing/routes.py
@@ -7,12 +7,43 @@
import hashlib
import re
import urllib.request
-from flask import Blueprint, request, Response, render_template, jsonify, current_app
+from flask import (
+ Blueprint,
+ request,
+ Response,
+ render_template,
+ jsonify,
+ current_app,
+ url_for,
+)
bp = Blueprint("bing", __name__, url_prefix="/bing")
+@bp.route(
+ "/search_page/
@@ -62,13 +96,13 @@ def build_struct(image):
# Also bing seems to throttle images if the count is higher (??).
images = images[:25]
- return render_template(
- "imagesearch/index.html",
- langid=langid,
- text=text,
- images=images,
- error_message=error_msg,
- )
+ ret = {
+ "langid": langid,
+ "text": text,
+ "images": images,
+ "error_message": error_msg,
+ }
+ return jsonify(ret)
def _get_dir_and_filename(langid, text):
diff --git a/lute/static/js/dict-tabs.js b/lute/static/js/dict-tabs.js
index 6c0624f0..80ceabbc 100644
--- a/lute/static/js/dict-tabs.js
+++ b/lute/static/js/dict-tabs.js
@@ -132,7 +132,7 @@ class ImageLookupButton extends GeneralLookupButton {
const raw_bing_url = 'https://www.bing.com/images/search?q=[LUTE]&form=HDRSC2&first=1&tsc=ImageHoverTitle';
const binghash = raw_bing_url.replace('https://www.bing.com/images/search?', '');
- const url = `/bing/search/${LookupButton.LANG_ID}/${encodeURIComponent(use_text)}/${encodeURIComponent(binghash)}`;
+ const url = `/bing/search_page/${LookupButton.LANG_ID}/${encodeURIComponent(use_text)}/${encodeURIComponent(binghash)}`;
iframe.setAttribute("src", url);
}; // end handler
diff --git a/lute/templates/imagesearch/index.html b/lute/templates/imagesearch/index.html
index ef5c21ff..82890ba8 100644
--- a/lute/templates/imagesearch/index.html
+++ b/lute/templates/imagesearch/index.html
@@ -26,25 +26,12 @@
then paste from your clipboard.
Error contacting image server: {{ error_message }}
- {% endif %} +Searching ...
+