mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-27 21:05:53 +00:00
Add a Prime Reminder on sub buttons. Super easy, the data was already there. Also add the Prime crown to the icon font.
This commit is contained in:
parent
e49dd9b216
commit
67053e3804
9 changed files with 93 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
<div class="list-header">4.0.0-beta1.6<span>@1d563b0f42b9912f8494</span> <time datetime="2018-02-28">(2018-02-28)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Added: Prime Reminder! Display a crown on subscription buttons when your free channel sub with Prime is available.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">4.0.0-beta1.5<span>@08fecb05d7e54dc038b0</span> <time datetime="2018-02-27">(2018-02-27)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Added: Setting to control how much the player volume changes when you scroll to adjust the volume.</li>
|
||||
|
|
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Copyright (C) 2017 by original authors @ fontello.com</metadata>
|
||||
<metadata>Copyright (C) 2018 by original authors @ fontello.com</metadata>
|
||||
<defs>
|
||||
<font id="ffz-fontello" horiz-adv-x="1000" >
|
||||
<font-face font-family="ffz-fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
||||
|
@ -38,6 +38,10 @@
|
|||
|
||||
<glyph glyph-name="floppy" unicode="" d="M214-7h429v214h-429v-214z m500 0h72v500q0 8-6 21t-11 20l-157 156q-5 6-19 12t-22 5v-232q0-22-15-38t-38-16h-322q-22 0-37 16t-16 38v232h-72v-714h72v232q0 22 16 38t37 16h465q22 0 38-16t15-38v-232z m-214 518v178q0 8-5 13t-13 5h-107q-7 0-13-5t-5-13v-178q0-7 5-13t13-5h107q7 0 13 5t5 13z m357-18v-518q0-22-15-38t-38-16h-750q-23 0-38 16t-16 38v750q0 22 16 38t38 16h517q23 0 50-12t42-26l156-157q16-15 27-42t11-49z" horiz-adv-x="857.1" />
|
||||
|
||||
<glyph glyph-name="crown" unicode="" d="M785 560l-285 285-285-285-215 215 0-570 1000 0 0 570z" horiz-adv-x="1000" />
|
||||
|
||||
<glyph glyph-name="verified" unicode="" d="M165 685l398 165 397-165 165-397-165-398-397-165-398 165-165 398 165 397z m296-654l381 401-90 86-296-311-100 95-86-91 191-180z" horiz-adv-x="1000" />
|
||||
|
||||
<glyph glyph-name="twitter" unicode="" d="M904 622q-37-54-90-93 0-8 0-23 0-73-21-145t-64-139-103-117-144-82-181-30q-151 0-276 81 19-2 43-2 126 0 224 77-59 1-105 36t-64 89q19-3 34-3 24 0 48 6-63 13-104 62t-41 115v2q38-21 82-23-37 25-59 64t-22 86q0 49 25 91 68-83 164-133t208-55q-5 21-5 41 0 75 53 127t127 53q79 0 132-57 61 12 115 44-21-64-80-100 52 6 104 28z" horiz-adv-x="928.6" />
|
||||
|
||||
<glyph glyph-name="gauge" unicode="" d="M214 207q0 30-21 51t-50 21-51-21-21-51 21-50 51-21 50 21 21 50z m107 250q0 30-20 51t-51 21-50-21-21-51 21-50 50-21 51 21 20 50z m239-268l57 213q3 14-5 27t-21 16-27-3-17-22l-56-213q-33-3-60-25t-35-55q-11-43 11-81t66-50 81 11 50 66q9 33-4 65t-40 51z m369 18q0 30-21 51t-51 21-50-21-21-51 21-50 50-21 51 21 21 50z m-358 357q0 30-20 51t-51 21-50-21-21-51 21-50 50-21 51 21 20 50z m250-107q0 30-20 51t-51 21-50-21-21-51 21-50 50-21 51 21 20 50z m179-250q0-145-79-269-10-17-30-17h-782q-20 0-30 17-79 123-79 269 0 102 40 194t106 160 160 107 194 39 194-39 160-107 106-160 40-194z" horiz-adv-x="1000" />
|
||||
|
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -95,7 +95,7 @@ class FrankerFaceZ extends Module {
|
|||
FrankerFaceZ.Logger = Logger;
|
||||
|
||||
const VER = FrankerFaceZ.version_info = {
|
||||
major: 4, minor: 0, revision: 0, extra: '-beta1.5',
|
||||
major: 4, minor: 0, revision: 0, extra: '-beta1.6',
|
||||
build: __webpack_hash__,
|
||||
toString: () =>
|
||||
`${VER.major}.${VER.minor}.${VER.revision}${VER.extra || ''}${DEBUG ? '-dev' : ''}`
|
||||
|
|
75
src/sites/twitch-twilight/modules/sub_button.js
Normal file
75
src/sites/twitch-twilight/modules/sub_button.js
Normal file
|
@ -0,0 +1,75 @@
|
|||
'use strict';
|
||||
|
||||
// ============================================================================
|
||||
// Sub Button
|
||||
// ============================================================================
|
||||
|
||||
import Module from 'utilities/module';
|
||||
import {createElement as e} from 'utilities/dom';
|
||||
|
||||
export default class SubButton extends Module {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
|
||||
this.should_enable = true;
|
||||
|
||||
this.inject('i18n');
|
||||
this.inject('settings');
|
||||
this.inject('site.fine');
|
||||
|
||||
this.settings.add('sub-button.prime-notice', {
|
||||
default: true,
|
||||
|
||||
ui: {
|
||||
path: 'Channel > Metadata >> Subscription',
|
||||
title: 'Show Prime Reminder',
|
||||
description: 'Display a crown on subscription buttons when your free channel sub with Prime is available.',
|
||||
component: 'setting-check-box'
|
||||
},
|
||||
|
||||
changed: () => this.SubButton.forceUpdate()
|
||||
});
|
||||
|
||||
this.SubButton = this.fine.define(
|
||||
'sub-button',
|
||||
n => n.reportSubMenuAction && n.isUserDataReady
|
||||
);
|
||||
}
|
||||
|
||||
onEnable() {
|
||||
this.SubButton.ready(() => this.SubButton.forceUpdate());
|
||||
|
||||
this.SubButton.on('mount', this.updateSubButton, this);
|
||||
this.SubButton.on('update', this.updateSubButton, this);
|
||||
}
|
||||
|
||||
|
||||
updateSubButton(inst) {
|
||||
const container = this.fine.getChildNode(inst),
|
||||
btn = container && container.querySelector('button[data-test-selector="subscribe-button__dropdown"]');
|
||||
if ( ! btn )
|
||||
return;
|
||||
|
||||
const props = inst.props,
|
||||
data = props.data && props.data.user,
|
||||
self = data && data.self,
|
||||
should_show = this.settings.get('sub-button.prime-notice') && self && self.canPrimeSubscribe && ! self.subscriptionBenefit,
|
||||
|
||||
icon = btn.querySelector('.ffz--can-prime');
|
||||
|
||||
if ( should_show && ! icon ) {
|
||||
btn.insertBefore(
|
||||
e('span', 'tw-button__icon tw-button__icon--left ffz--can-prime',
|
||||
e('figure', {
|
||||
className: 'ffz-i-crown ffz-tooltip',
|
||||
'data-tooltip-type': 'html',
|
||||
'data-title': this.i18n.t('sub-button.prime', 'Your free channel sub with Prime is available.')
|
||||
})
|
||||
),
|
||||
btn.firstElementChild
|
||||
);
|
||||
|
||||
} else if ( ! should_show && icon )
|
||||
icon.remove();
|
||||
}
|
||||
}
|
|
@ -75,6 +75,11 @@
|
|||
}
|
||||
}*/
|
||||
|
||||
.tw-button__icon .ffz-i-crown:before {
|
||||
margin: 0;
|
||||
font-size: 1.6rem;
|
||||
vertical-align: sub;
|
||||
}
|
||||
|
||||
.ffz-i-cancel:before { content: '\e800'; } /* '' */
|
||||
.ffz-i-search:before { content: '\e802'; } /* '' */
|
||||
|
@ -91,6 +96,8 @@
|
|||
.ffz-i-download:before { content: '\e80d'; } /* '' */
|
||||
.ffz-i-upload:before { content: '\e80e'; } /* '' */
|
||||
.ffz-i-floppy:before { content: '\e80f'; } /* '' */
|
||||
.ffz-i-crown:before { content: '\e810'; } /* '' */
|
||||
.ffz-i-verified:before { content: '\e811'; } /* '' */
|
||||
.ffz-i-twitter:before { content: '\f099'; } /* '' */
|
||||
.ffz-i-gauge:before { content: '\f0e4'; } /* '' */
|
||||
.ffz-i-download-cloud:before { content: '\f0ed'; } /* '' */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue