Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

loading: Use img tag for loading indicator instead of object tag.

sahil839fb53556cef27
diff --git a/static/images/loader-black.svg b/static/images/loader-black.svg
new file mode 100644
index 00000000000..d19b12d9501
--- /dev/null
+++ b/static/images/loader-black.svg
@@ -0,0 +1,49 @@
+<svg width="30px" height="30px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" style="background: none;"><g transform="rotate(0 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="-0.9166666666666666s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(30 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="-0.8333333333333334s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(60 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="-0.75s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(90 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="-0.6666666666666666s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(120 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="-0.5833333333333334s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(150 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="-0.5s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(180 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="-0.4166666666666667s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(210 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="-0.3333333333333333s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(240 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="-0.25s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(270 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="-0.16666666666666666s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(300 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="-0.08333333333333333s" repeatCount="indefinite"></animate>
+ </rect>
+</g><g transform="rotate(330 50 50)">
+ <rect x="47" y="15" rx="9.4" ry="3" width="6" height="20" fill="#000">
+ <animate attributeName="opacity" values="1;0" times="0;1" dur="1s" begin="0s" repeatCount="indefinite"></animate>
+ </rect>
+</g></svg>
diff --git a/static/js/dialog_widget.js b/static/js/dialog_widget.js
index 1051b602b7f..f35266030cc 100644
--- a/static/js/dialog_widget.js
+++ b/static/js/dialog_widget.js
@@ -5,6 +5,7 @@ import render_dialog_heading from "../templates/dialog_widget_heading.hbs";
import * as blueslip from "./blueslip";
import {$t_html} from "./i18n";
+import * as loading from "./loading";
import * as overlays from "./overlays";
import * as settings_data from "./settings_data";
@@ -48,17 +49,11 @@ export function hide_dialog_spinner() {
}
export function show_dialog_spinner() {
- $(".dialog_submit_button .loader").css("display", "inline-block");
+ const using_dark_theme = settings_data.using_dark_theme();
+ loading.show_button_spinner($(".dialog_submit_button .loader"), using_dark_theme);
$(".dialog_submit_button span").hide();
$(".dialog_submit_button").prop("disabled", true);
$("#dialog_widget_modal .close-modal-btn").prop("disabled", true);
- if (!settings_data.using_dark_theme()) {
- $(".dialog_submit_button object").on("load", function () {
- const doc = this.getSVGDocument();
- const $svg = $(doc).find("svg");
- $svg.find("rect").css("fill", "#000");
- });
- }
}
export function launch(conf) {
diff --git a/static/js/loading.ts b/static/js/loading.ts
index 246c39c65b6..e67472e486f 100644
--- a/static/js/loading.ts
+++ b/static/js/loading.ts
@@ -65,3 +65,12 @@ export function destroy_indicator(container: JQuery): void {
container.empty();
container.css({width: 0, height: 0});
}
+
+export function show_button_spinner(elt: JQuery, using_dark_theme: boolean): void {
+ if (!using_dark_theme) {
+ elt.attr("src", "/static/images/loader-black.svg");
+ } else {
+ elt.attr("src", "/static/images/loader.svg");
+ }
+ elt.css("display", "inline-block");
+}
diff --git a/static/js/message_edit.js b/static/js/message_edit.js
index fe9c31f626b..53810490d0d 100644
--- a/static/js/message_edit.js
+++ b/static/js/message_edit.js
@@ -202,17 +202,11 @@ export function hide_message_edit_spinner(row) {
}
export function show_message_edit_spinner(row) {
- row.find(".loader").css("display", "inline-block");
+ const using_dark_theme = settings_data.using_dark_theme();
+ loading.show_button_spinner(row.find(".loader"), using_dark_theme);
row.find(".message_edit_save span").hide();
row.find(".message_edit_save").addClass("disable-btn");
row.find(".message_edit_cancel").addClass("disable-btn");
- if (!settings_data.using_dark_theme()) {
- row.find("object").on("load", function () {
- const doc = this.getSVGDocument();
- const $svg = $(doc).find("svg");
- $svg.find("rect").css("fill", "#000");
- });
- }
}
export function show_topic_edit_spinner(row) {
diff --git a/static/templates/dialog_widget.hbs b/static/templates/dialog_widget.hbs
index 0b341cefb3d..5c198ee6736 100644
--- a/static/templates/dialog_widget.hbs
+++ b/static/templates/dialog_widget.hbs
@@ -10,7 +10,7 @@
<div class="modal-footer">
<button class="button rounded close-modal-btn" data-dismiss="modal">{{t "Cancel" }}</button>
<button class="button rounded {{#if danger_submit_button}}btn-danger{{else}}sea-green{{/if}} dialog_submit_button">
- <object class="loader" type="image/svg+xml" data="/static/images/loader.svg"></object>
+ <img class="loader" alt="" src="" />
<span>{{{ html_submit_button }}}</span>
</button>
</div>
diff --git a/static/templates/message_edit_form.hbs b/static/templates/message_edit_form.hbs
index 37e068aab62..3ef5cfe497c 100644
--- a/static/templates/message_edit_form.hbs
+++ b/static/templates/message_edit_form.hbs
@@ -55,7 +55,7 @@
{{#if is_editable}}
<div class="btn-wrapper inline-block">
<button type="button" class="button small rounded sea-green message_edit_save">
- <object class="loader" type="image/svg+xml" data="/static/images/loader.svg"></object>
+ <img class="loader" alt="" src="" />
<span>{{t "Save" }}</span>
</button>
</div>