From 9d14b628e672059a1adc9fbb7b1079d6ba9d73a8 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 24 Sep 2021 00:37:34 +0200 Subject: [PATCH] fsd --- .../assets/js/{general35.js => general36.js} | 82 +++++++++---------- files/templates/default.html | 2 +- files/templates/formatting.html | 2 +- files/templates/login.html | 2 +- files/templates/settings.html | 2 +- files/templates/settings2.html | 2 +- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submit.html | 2 +- 9 files changed, 46 insertions(+), 52 deletions(-) rename files/assets/js/{general35.js => general36.js} (91%) diff --git a/files/assets/js/general35.js b/files/assets/js/general36.js similarity index 91% rename from files/assets/js/general35.js rename to files/assets/js/general36.js index af424bae0..cd03f5e23 100644 --- a/files/assets/js/general35.js +++ b/files/assets/js/general36.js @@ -160,55 +160,49 @@ function getGif(searchTerm) { cancelBtn.innerHTML = ''; - $.ajax({ - url: "/giphy?searchTerm=" + searchTerm + "&limit=48", - type: "GET", - success: function(response) { - var max = response.data.length - 1 //length of response, minus 1 (cuz array starts at index 0) - var randomNumber = Math.round(Math.random() * 6) //random number between 0 and max -1 - // GIF array - var gifURL = []; - // loop for fetching mutliple GIFs and creating the card divs - if (max < 48 && max > 0) { - for (var i = 0; i <= max; i++) { - gifURL[i] = "https://media.giphy.com/media/" + response.data[i].id + "/200w_d.webp"; - if (response.data[i].username==''){ - container.innerHTML += ('
'); + fetch("/giphy?searchTerm=" + searchTerm + "&limit=48") + .then(response => { + var max = response.data.length - 1 //length of response, minus 1 (cuz array starts at index 0) + var randomNumber = Math.round(Math.random() * 6) //random number between 0 and max -1 + // GIF array + var gifURL = []; + + // loop for fetching mutliple GIFs and creating the card divs + if (max < 48 && max > 0) { + for (var i = 0; i <= max; i++) { + gifURL[i] = "https://media.giphy.com/media/" + response.data[i].id + "/200w_d.webp"; + if (response.data[i].username==''){ + container.innerHTML += ('
'); + } + else { + container.innerHTML += ('
'); + } + noGIFs.innerHTML = null; + loadGIFs.innerHTML = '

Thou've reached the end of the list!

'; + } + } + else if (max <= 0) { + noGIFs.innerHTML = '

Aw shucks. No GIFs found...

'; + container.innerHTML = null; + loadGIFs.innerHTML = null; } else { - container.innerHTML += ('
'); + for (var i = 0; i <= 48; i++) { + gifURL[i] = "https://media.giphy.com/media/" + response.data[i].id + "/200w_d.webp"; + if (response.data[i].username==''){ + container.innerHTML += ('
'); + } + else { + container.innerHTML += ('
'); + } + noGIFs.innerHTML = null; + loadGIFs.innerHTML = '

Thou've reached the end of the list!

'; + } } - noGIFs.innerHTML = null; - loadGIFs.innerHTML = '

Thou've reached the end of the list!

'; - } - } - else if (max <= 0) { - noGIFs.innerHTML = '

Aw shucks. No GIFs found...

'; - container.innerHTML = null; - loadGIFs.innerHTML = null; - } - else { - for (var i = 0; i <= 48; i++) { - gifURL[i] = "https://media.giphy.com/media/" + response.data[i].id + "/200w_d.webp"; - if (response.data[i].username==''){ - container.innerHTML += ('
'); - } - else { - container.innerHTML += ('
'); - } - noGIFs.innerHTML = null; - loadGIFs.innerHTML = '

Thou've reached the end of the list!

'; - } - } - }, - error: function(e) { - alert(e); - } - }); - }; + }) } - +} function insertGIF(url,form) { diff --git a/files/templates/default.html b/files/templates/default.html index 2cdeba49d..ce8838f3d 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -1369,7 +1369,7 @@ {% include "expanded_image_modal.html" %} - + {% if request.path=='/' and g.system and g.timestamp>session.get('tooltip_last_dismissed',0)+60*60*24 and (not g.system.endswith('/chrome') and not g.system.endswith('/other')) and not g.system.endswith('/webview') %} diff --git a/files/templates/formatting.html b/files/templates/formatting.html index 7f87bbb2a..c03303859 100644 --- a/files/templates/formatting.html +++ b/files/templates/formatting.html @@ -192,6 +192,6 @@ Allowed styles: {% include "expanded_image_modal.html" %} - + {% endblock %} diff --git a/files/templates/login.html b/files/templates/login.html index 058b2b8b9..608134526 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -130,7 +130,7 @@ - +
 
diff --git a/files/templates/settings.html b/files/templates/settings.html
index 731a309e5..63aa7f5f2 100644
--- a/files/templates/settings.html
+++ b/files/templates/settings.html
@@ -258,7 +258,7 @@
 	
 
 
-
+
 
 {% block onload %}{% endblock %}
 
diff --git a/files/templates/settings2.html b/files/templates/settings2.html
index e27fa8bfa..9f4a2bf09 100644
--- a/files/templates/settings2.html
+++ b/files/templates/settings2.html
@@ -205,7 +205,7 @@
 
 
 
-
+
 
 	{% block scripts %}
 	{% endblock %}
diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html
index 792b3ade7..f6045cadc 100644
--- a/files/templates/sign_up.html
+++ b/files/templates/sign_up.html
@@ -235,7 +235,7 @@
 
 
 
-
+
 
 
 
diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html
index 3f3a20fb7..d397b244e 100644
--- a/files/templates/sign_up_failed_ref.html
+++ b/files/templates/sign_up_failed_ref.html
@@ -124,7 +124,7 @@
 
 
 
-
+
 
 
 
diff --git a/files/templates/submit.html b/files/templates/submit.html
index 648a311e1..d7ec1a0b1 100644
--- a/files/templates/submit.html
+++ b/files/templates/submit.html
@@ -5,7 +5,7 @@
 		
 		
 		
-		
+