Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

now formatting modals and overlays with emotes #269

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/TagzApp.Web/Pages/Overlay.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</div>

<script src="~/lib/microsoft-signalr/signalr.min.js"></script>
<script src="~/js/site.js"></script>

@if (!string.IsNullOrEmpty(Model.Tag))
{
Expand Down Expand Up @@ -63,7 +64,7 @@
</div>
<i class="provider bi bi-${content.provider.toLowerCase()}"></i>
<span class="time">${new Date(content.timestamp).toLocaleString(undefined, { day: 'numeric', month: 'long', year: 'numeric', hour: '2-digit', minute: '2-digit' })}</span>
<span class="content">${content.text}</span>
<span class="content">${window.TagzApp.FormatContentWithEmotes(content)}</span>
`;

if (content.previewCard) {
Expand Down
2 changes: 1 addition & 1 deletion src/TagzApp.Web/Pages/PortraitOverlay.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</div>
<i class="provider bi ${window.TagzApp.MapProviderToIconClass(content.provider)}"></i>
<span class="time">${new Date(content.timestamp).toLocaleString(undefined, { day: 'numeric', month: 'long', year: 'numeric', hour: '2-digit', minute: '2-digit' })}</span>
<span class="content">${content.text}</span>
<span class="content">${window.TagzApp.FormatContentWithEmotes(content)}</span>
`;

if (content.previewCard) {
Expand Down
47 changes: 30 additions & 17 deletions src/TagzApp.Web/wwwroot/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Unmoderated: '0',
};

var tagCsv = "";
var tagCsv = '';
var paused = false;
var rolloverPause = false;
var pauseQueue = [];
Expand Down Expand Up @@ -191,7 +191,7 @@
})}`;

let modalBody = (document.querySelector('.modal-body').innerHTML =
content.text);
FormatContextWithEmotes(content));

if (
content.previewCard &&
Expand Down Expand Up @@ -349,22 +349,34 @@
return text;
}

function LoadAdditionalContentForFilters()
{

function LoadAdditionalContentForFilters() {
// only proceed if less than 20 article elements are visible
if (document.querySelectorAll('article:not([style*="display: none"])').length < 20) return;
if (
document.querySelectorAll('article:not([style*="display: none"])')
.length < 20
)
return;

// use the SignalR connection to call the server and get the additional content
connection.invoke('GetFilteredContentByTag', tagCsv, providerFilter, approvedFilterStatus).then(function (result) {
console.log(`Received ${result.length} additional messages from server`);
result.forEach(function (content) {
console.log(`Formatting ${content.providerId} with state ${content.state}`);
FormatMessageForModeration(content);
connection
.invoke(
'GetFilteredContentByTag',
tagCsv,
providerFilter,
approvedFilterStatus,
)
.then(function (result) {
console.log(
`Received ${result.length} additional messages from server`,
);
result.forEach(function (content) {
console.log(
`Formatting ${content.providerId} with state ${content.state}`,
);
FormatMessageForModeration(content);
});
window.Masonry.resizeAllGridItems();
});
window.Masonry.resizeAllGridItems();
});

}

function ApproveMessage(content) {
Expand Down Expand Up @@ -595,6 +607,10 @@
return MapProviderToIcon(provider);
},

FormatContentWithEmotes: function (content) {
return FormatContextWithEmotes(content);
},

FilterByApprovalStatus: function (status) {
let taggedContent = document.getElementById('taggedContent');
approvedFilterStatus = status;
Expand All @@ -619,11 +635,9 @@
taggedContent.classList.remove('filter-rejectedOnly');
taggedContent.classList.add('filter-needsModeration');
break;

}

LoadAdditionalContentForFilters();

},

ListenForWaterfallContent: async function (tags) {
Expand Down Expand Up @@ -774,7 +788,6 @@
}

if (providerFilter.length > 0) LoadAdditionalContentForFilters();

},
};

Expand Down