v1.6.0/cleanup, create expander, peacock msg

This commit is contained in:
2020-08-07 23:09:59 -04:00
parent fcd223bf2e
commit 89b956967c
4 changed files with 35 additions and 105 deletions
-88
View File
@@ -1,88 +0,0 @@
/************************************************************************
Copyright (C) Ayushya Amitabh - All Rights Reserved
Unauthorized copying of this file, via any medium is strictly prohibited
Proprietary and confidential
Written by Ayushya Amitabh <admin@chromewatchparty.com>, 2020
https://www.chromewatchparty.com/copyright
=========================================================================
ALL CONTENT ON WATCH PARTY'S WEBSITE OR IN WATCH PARTY'S CHROME EXTENSION APP, UNLESS OTHERWISE
CITED ARE THE SOLE INTELECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
************************************************************************/
/************************************************************************
THE CODE BELOW WAS WRITTEN BY USER
https://stackoverflow.com/users/68808/tweezz
ON STACKOVERFLOW, WHICH CAN BE FOUND AT
https://stackoverflow.com/questions/6157929/how-to-simulate-a-mouse-click-using-javascript
************************************************************************/
export default function simulate(element, eventName) {
var options = extend(defaultOptions, arguments[2] || {});
var oEvent,
eventType = null;
for (var name in eventMatchers) {
if (eventMatchers[name].test(eventName)) {
eventType = name;
break;
}
}
if (!eventType) throw new SyntaxError('Only HTMLEvents and MouseEvents interfaces are supported');
if (document.createEvent) {
oEvent = document.createEvent(eventType);
if (eventType == 'HTMLEvents') {
oEvent.initEvent(eventName, options.bubbles, options.cancelable);
} else {
oEvent.initMouseEvent(
eventName,
options.bubbles,
options.cancelable,
document.defaultView,
options.button,
options.pointerX,
options.pointerY,
options.pointerX,
options.pointerY,
options.ctrlKey,
options.altKey,
options.shiftKey,
options.metaKey,
options.button,
element
);
}
element.dispatchEvent(oEvent);
} else {
options.clientX = options.pointerX;
options.clientY = options.pointerY;
var evt = document.createEventObject();
oEvent = extend(evt, options);
element.fireEvent('on' + eventName, oEvent);
}
return element;
}
function extend(destination, source) {
for (var property in source) destination[property] = source[property];
return destination;
}
const eventMatchers = {
HTMLEvents: /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
MouseEvents: /^(?:click|dblclick|mouse(?:down|up|over|move|out))$/,
};
const defaultOptions = {
pointerX: 0,
pointerY: 0,
button: 0,
ctrlKey: false,
altKey: false,
shiftKey: false,
metaKey: false,
bubbles: true,
cancelable: true,
};
+19 -8
View File
@@ -77,6 +77,7 @@ export default class Create extends Component {
LocalData().allowAutoRejoin !== undefined ? LocalData().allowAutoRejoin : true,
allowChatNotification:
LocalData().allowChatNotification !== undefined ? LocalData().allowChatNotification : true,
expanded: 'alerts',
};
this.createCall = this.createCall.bind(this);
this.joinCall = this.joinCall.bind(this);
@@ -242,6 +243,11 @@ export default class Create extends Component {
if (alertStep + direction >= this.props.status.alerts.length) return;
this.setState({ alertStep: alertStep + direction });
}
handleExpanders(e) {
const { expanded } = this.state;
if (e === expanded) this.setState({ expanded: '' });
else this.setState({ expanded: e });
}
render() {
const {
mode,
@@ -253,6 +259,7 @@ export default class Create extends Component {
allowAutoRejoin,
allowChatNotification,
alertStep,
expanded,
} = this.state;
const { status } = this.props;
return (
@@ -365,8 +372,11 @@ export default class Create extends Component {
<span>{mode === 'create' ? 'Start Party' : 'Join Party'}</span> <ChevronRight />
</Button>
</Paper>
<ExpansionPanel defaultExpanded className="create-settings-card">
<ExpansionPanelSummary expandIcon={<ExpandLess />}>
<ExpansionPanel expanded={expanded === 'alerts'} className="create-settings-card">
<ExpansionPanelSummary
onClick={() => this.handleExpanders('alerts')}
expandIcon={<ExpandLess />}
>
<Notifications />
<Typography className="create-settings-title" variant="button">
Alerts
@@ -399,8 +409,7 @@ export default class Create extends Component {
activeStep={alertStep}
backButton={
<IconButton disabled={alertStep === 0} onClick={() => this.handleSteps(-1)}>
{' '}
<KeyboardArrowLeft />{' '}
<KeyboardArrowLeft />
</IconButton>
}
nextButton={
@@ -408,8 +417,7 @@ export default class Create extends Component {
disabled={alertStep === status.alerts.length - 1}
onClick={() => this.handleSteps(1)}
>
{' '}
<KeyboardArrowRight />{' '}
<KeyboardArrowRight />
</IconButton>
}
steps={status.alerts ? status.alerts.length : 0}
@@ -422,8 +430,11 @@ export default class Create extends Component {
)}
</ExpansionPanelDetails>
</ExpansionPanel>
<ExpansionPanel className="create-settings-card">
<ExpansionPanelSummary expandIcon={<ExpandLess />}>
<ExpansionPanel expanded={expanded === 'settings'} className="create-settings-card">
<ExpansionPanelSummary
onClick={() => this.handleExpanders('settings')}
expandIcon={<ExpandLess />}
>
<Settings />
<Typography className="create-settings-title" variant="button">
Settings
+6 -3
View File
@@ -10,7 +10,6 @@ CITED ARE THE SOLE INTELECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
************************************************************************/
import { PLAYER_STATUS, getPlayerSource, PLAYER_SOURCE, LocalData } from './Api';
import simulate from './ClickSimulator';
const templateListener = (video) => console.log('MISSING VIDEO LISTENER');
@@ -515,7 +514,9 @@ export default class VideoListener {
const peacockInjectScript = document.createElement('script');
peacockInjectScript.text = peacockInject;
document.head.appendChild(peacockInjectScript);
const peacockVideoElement = document.querySelector(".video-player-component.playback-component video")
const peacockVideoElement = document.querySelector(
'.video-player-component.playback-component video'
);
if (peacockVideoElement) {
this.firstTimeSync(peacockVideoElement);
} else {
@@ -523,7 +524,9 @@ export default class VideoListener {
this.video.element
? null
: () => {
var pve = document.querySelector(".video-player-component.playback-component video");
var pve = document.querySelector(
'.video-player-component.playback-component video'
);
if (
pve !== null &&
pve !== undefined &&