mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Toggling rich embeds in chat
This commit is contained in:
parent
ec6af49f5b
commit
5447063f35
@ -43,6 +43,7 @@
|
|||||||
var global_guest_icon = null; // Guest icon
|
var global_guest_icon = null; // Guest icon
|
||||||
var notification_sound = null; // Sound Manager 2 demonstrative.mp3 object https://notificationsounds.com/message-tones/demonstrative-516
|
var notification_sound = null; // Sound Manager 2 demonstrative.mp3 object https://notificationsounds.com/message-tones/demonstrative-516
|
||||||
var notification_sound_setting; // nothing, mentions, newmsgs - to control what new sound it makes
|
var notification_sound_setting; // nothing, mentions, newmsgs - to control what new sound it makes
|
||||||
|
var display_richembeds; // true/false - if rich embeds should be displayed
|
||||||
|
|
||||||
function element_in_view(element, fullyInView) {
|
function element_in_view(element, fullyInView) {
|
||||||
var pageTop = $(window).scrollTop();
|
var pageTop = $(window).scrollTop();
|
||||||
@ -269,6 +270,19 @@
|
|||||||
volume: 8,
|
volume: 8,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("[name=richembed_toggle_radiobtn]").click(function (event) {
|
||||||
|
display_richembeds = event.target.value == "true";
|
||||||
|
localStorage.setItem("display_richembeds", display_richembeds);
|
||||||
|
$("[name=richembed_toggle_radiobtn][value=" + display_richembeds + "]").prop("checked", true);
|
||||||
|
});
|
||||||
|
var localstore_display_richembeds = localStorage.getItem("display_richembeds");
|
||||||
|
if (localstore_display_richembeds) {
|
||||||
|
display_richembeds = !(localstore_display_richembeds == "false");
|
||||||
|
} else {
|
||||||
|
display_richembeds = true;
|
||||||
|
}
|
||||||
|
$("[name=richembed_toggle_radiobtn][value=" + display_richembeds + "]").prop("checked", true);
|
||||||
|
|
||||||
var dembed = discord_embed();
|
var dembed = discord_embed();
|
||||||
dembed.done(function (data) {
|
dembed.done(function (data) {
|
||||||
$("#modal_invite_btn").attr("href", data.instant_invite);
|
$("#modal_invite_btn").attr("href", data.instant_invite);
|
||||||
@ -998,6 +1012,7 @@
|
|||||||
|
|
||||||
function parse_message_embeds(embeds) {
|
function parse_message_embeds(embeds) {
|
||||||
var emb = [];
|
var emb = [];
|
||||||
|
if (display_richembeds) {
|
||||||
for (var i = 0; i < embeds.length; i++) {
|
for (var i = 0; i < embeds.length; i++) {
|
||||||
var disembed = embeds[i];
|
var disembed = embeds[i];
|
||||||
// if ($.inArray(disembed.type, ["rich", "link", "video"]) == -1) {
|
// if ($.inArray(disembed.type, ["rich", "link", "video"]) == -1) {
|
||||||
@ -1021,6 +1036,7 @@
|
|||||||
var rendered = Mustache.render(template, disembed);
|
var rendered = Mustache.render(template, disembed);
|
||||||
emb.push(rendered);
|
emb.push(rendered);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return emb;
|
return emb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +171,19 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<h4>{{ _("Display Rich Embeds") }}</h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12">
|
||||||
|
<span>
|
||||||
|
<input name="richembed_toggle_radiobtn" type="radio" id="richembed_toggle_radiobtn_enable" value="true" />
|
||||||
|
<label for="richembed_toggle_radiobtn_enable">{{ _("Enable") }}</label>
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
<input name="richembed_toggle_radiobtn" type="radio" id="richembed_toggle_radiobtn_disable" value="false" />
|
||||||
|
<label for="richembed_toggle_radiobtn_disable">{{ _("Disable") }}</label>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<a id="logout_btn" class="waves-effect waves-light btn right" href="{{ url_for('user.logout', redirect=request.url) }}"><i class="material-icons">exit_to_app</i></a>
|
<a id="logout_btn" class="waves-effect waves-light btn right" href="{{ url_for('user.logout', redirect=request.url) }}"><i class="material-icons">exit_to_app</i></a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user