-
Notifications
You must be signed in to change notification settings - Fork 20
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
Reduce need for 3rd parties to modify as much #52
Comments
For an addon like BetterTTV, it will probably not be possible to reduce the need for modification. |
Updated diff of v0.6.3: --- our-script.user.js
+++ betterttv-script.user.js
@@ -1,4 +1,3 @@
-// ==UserScript==
// @name Twitch Chat Emotes
// @namespace #Cletus
// @version 0.6.3
@@ -15,7 +14,6 @@
// @exclude http://api.twitch.tv/*
// @exclude http://chatdepot.twitch.tv/*
// @exclude http://*.twitch.tv/*/profile*
-// ==/UserScript==
// This script was generated using an automated build script.
// See project build guide linked at http://cletusc.github.io/Userscript--Twitch-Chat-Emotes/ for more info.
@@ -234,26 +232,28 @@
).done(function (api) {
api.tickets.forEach(function (ticket) {
// Get subscriptions with emotes.
- if (ticket.product.emoticons && ticket.product.emoticons.length) {
- var badge = ticket.product.features.badge;
- var channel = ticket.product.owner_name;
- // Add channel badges.
- if (badge) {
- badge = 'http://static-cdn.jtvnw.net/jtv_user_pictures/' + [badge.prefix, badge.owner, badge.type, badge.uid, badge.sizes[0]].join('-') + '.' + badge.format;
+ window.Twitch.api.get("users/"+(ticket.product.owner_name || 'turbo')).done(function(owner) {
+ if (ticket.product.emoticons && ticket.product.emoticons.length) {
+ var badge = ticket.product.features.badge,
+ channel = owner.display_name;
+ // Add channel badges.
+ if (badge) {
+ badge = 'http://static-cdn.jtvnw.net/jtv_user_pictures/' + [badge.prefix, badge.owner, badge.type, badge.uid, badge.sizes[0]].join('-') + '.' + badge.format;
+ }
+ else {
+ badge = 'https://static-cdn.jtvnw.net/jtv_user_pictures/subscriber-star.png';
+ }
+ emotes.subscriptions.badges[channel] = badge;
+
+ // Add emotes channel.
+ ticket.product.emoticons.forEach(function (emote) {
+ emotes.subscriptions.emotes[getEmoteFromRegEx(new RegExp(emote.regex))] = {
+ channel: channel,
+ url: emote.url
+ };
+ });
}
- else {
- badge = 'https://static-cdn.jtvnw.net/jtv_user_pictures/subscriber-star.png';
- }
- emotes.subscriptions.badges[channel] = badge;
-
- // Add emotes channel.
- ticket.product.emoticons.forEach(function (emote) {
- emotes.subscriptions.emotes[getEmoteFromRegEx(new RegExp(emote.regex))] = {
- channel: channel,
- url: emote.url
- };
- });
- }
+ });
});
});
}
@@ -557,6 +557,10 @@
emote.image = image;
return true;
}
+ if (emote.channel === "Night" && window.Twitch.user.isLoggedIn() && window.BetterTTV.chat.helpers.getEmotes(window.Twitch.user.login()).indexOf('night') !== -1) {
+ emote.image = image;
+ return true;
+ }
});
emote.image = emote.image || defaultImage;
// Fix missing image.html on new layout.
@@ -684,13 +688,13 @@
if (emote.channel && emote.channel !== 'Twitch Turbo') {
var badge = emotes.subscriptions.badges[emote.channel] || emote.badge;
// Add notice about addon emotes.
- if (!emotes.subscriptions.badges[emote.channel] && !elements.menu.find('.group-header.addon-emotes-header').length) {
+ /*if (!emotes.subscriptions.badges[emote.channel] && !elements.menu.find('.group-header.addon-emotes-header').length) {
container.append(
$(templates.emoteGroupHeader({
isAddonHeader: true
}))
);
- }
+ }*/
if (!elements.menu.find('.group-header[data-emote-channel="' + emote.channel + '"]').length) {
container.append(
$(templates.emoteGroupHeader({
@@ -833,4 +837,4 @@
}
// End wrapper.
-})(this.unsafeWindow || window, window.chrome ? true : false);
+})(this.unsafeWindow || window, window.chrome ? true : false);
Edit: see bolded edit in the adds check for Night's channel section above. |
I am closing this, I think it is mostly taken care of on my end.
@night if there is anything else that you may normally modify, let me know and I'll reopen this issue. I want to reduce as much work as possible. This should basically be a drop-in addon. |
BetterTTV is modifying the script a bit for their uses and I'd like to reduce the need for it. Here is a diff of the changes they make to the script, as of v0.5.18:
Basically I am seeing the following:
32x32
max. This isn't needed at all, but would be further eliminated by Emotes are flickering on initial opening of menu #40Those watching the repo, please provide your input on the above points.
The text was updated successfully, but these errors were encountered: