Skip to content

Commit

Permalink
Added support for "Paying Forward Gift" message types.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMadog24 committed Mar 23, 2023
1 parent 6effcb5 commit 0c4306e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
13 changes: 13 additions & 0 deletions public/css/videoChatPlayer.css
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,19 @@ input[type=number] {
border-left-width: 6px;
background-color: #1f1f23;
}
.isPayingForward {
border-left-color: #26262c;
border-left-style: solid;
border-left-width: 4px;
color: #adadb8;
}
.isPayingForwardContainer {
padding: 5px 0;
margin-left: 16px;
}
.isPayingForward .chatmessage{
}

.issubmessage .commenter{
position: relative;
top: 8px;
Expand Down
34 changes: 34 additions & 0 deletions public/js/videoChatPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ var regExSubadvance = new RegExp(
"(?<=" + regExSubadvanceFragments + "))", "i");
// console.log("### regExSubResub (70): " + "((?=" + regExSubResubFragments + ")|" +
// "(?<=" + regExSubResubFragments + "))");

//Regex for "Paying Forward Gift" messages
var regExPayingForwardGiftFragments = "\\b\\w+ is paying forward the Gift they got from \\b\\w+ to ";
var regExPayingForwardGift = new RegExp(
"((?=" + regExPayingForwardGiftFragments + ")|" +
"(?<=" + regExPayingForwardGiftFragments + "))", "i");
// console.log("### regExSubResub (70): " + "((?=" + regExSubResubFragments + ")|" +
// "(?<=" + regExSubResubFragments + "))");

var regExSubResubTheyveFragments = "\\bThey've subscribed for \\d+ months(?:!|, currently on a \\d+ month streak!)";
var regExSubResubTheyve = new RegExp(
Expand Down Expand Up @@ -2304,6 +2312,10 @@ function renderChatBody(comment, index) {

return renderChatSub(comment, index);
}
else if ( regExPayingForwardGift.test( comment.message.body ) ) {

return renderPayingForwardGift(comment, index);
}
else if ( regExSubadvance.test( comment.message.body ) ) {

return renderChatAdvanceSub(comment, index);
Expand Down Expand Up @@ -2436,6 +2448,28 @@ function renderChatSub(comment, index) {
return chatBodies;
}

function renderPayingForwardGift(comment, index) {
var chatBodies = [];
comment.message["alt_fragments"] = [];

// comment.message.body;
let message = extractMessageFragments(comment);

let isPayingForwardContainer = $("<div>").addClass("isPayingForwardContainer");


let chatBody = $("<div>").addClass("chatbody no-time isPayingForward");

// chatBody.append( makeUserBadges( comment ) );

chatBody.append(isPayingForwardContainer);
isPayingForwardContainer.append(message);
chatBodies.push( chatBody );


return chatBodies;
}

function renderChatAdvanceSub(comment, index) {
var chatBodies = [];
comment.message["alt_fragments"] = [];
Expand Down

0 comments on commit 0c4306e

Please sign in to comment.