Hello folks I'm trying to develop an extension for my chrome browser to add emoticons to the chat of a website that i usually visit, so on that page yo need to pay 25 box if you want to purchase an emoticon for me its very expensive so I decided to create a extension to inject some emotes, the problem is I can't override his functions to insert my own emotes I have tried several times and didn't work I share you the original script and my injected script if someone can orient me I 'll be very helpfully, I have ruduced original script bucause it have hundreds of emotes so I just leave a few as reference.
Original Script:
function clsEmoticons() {
this.Insert = Insert;
this.Handle = Handle;
function Insert(obj, txt) {
var cursorPos = $('#' + obj).prop('selectionStart');
var v = $('#' + obj).val();
var textBefore = v.substring(0, cursorPos);
var textAfter = v.substring(cursorPos, v.length);
$('#' + obj).val(textBefore + txt + textAfter);
}
function Handle(v1, response, the_channel, isGuest) {
if (the_channel != "e") {
try {
the_channel = ChatV2.appChannel;
the_channel = the_channel.toLowerCase();
} catch (e) {}
}
response = response.replaceAll3(":)", "<img class=\"chat_img smile\" src=\"https://cdn.website.com/img/clear.png\" border=\"0\" /> ");
if (!isGuest) {
response = response.replaceAll3("(WCV)", "<img class=\"chat_img vsemoji_WCV_000\" src=\"https://cdn.website.com/img/clear.png\" border=\"0\" />");
}
if (the_channel == "test") {
response = response.replaceAll3("bounce", "<img class=\"chat_img bounce\" src=\"https://cdn.website.com/img/clear.png\" border=\"0\" />");
}
return response;
}
}
var ChatEmoticons = new clsEmoticons();
Injected script: