aboutsummaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/JsApi.hx2
-rw-r--r--src/client/Main.hx23
-rw-r--r--src/client/Player.hx8
-rw-r--r--src/client/players/Youtube.hx2
4 files changed, 15 insertions, 20 deletions
diff --git a/src/client/JsApi.hx b/src/client/JsApi.hx
index 63b98c5..637878d 100644
--- a/src/client/JsApi.hx
+++ b/src/client/JsApi.hx
@@ -28,7 +28,7 @@ class JsApi {
static function initPluginsSpace():Void {
final w:Dynamic = window;
- if (w.synctube == null) w.synctube = {};
+ w.synctube ??= {};
}
@:expose
diff --git a/src/client/Main.hx b/src/client/Main.hx
index c8688b4..7b8228e 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -289,8 +289,8 @@ class Main {
serverMessage(Lang.get("addVideoError"));
return;
}
- if (data.title == null) data.title = Lang.get("rawVideo");
- if (data.url == null) data.url = url;
+ data.title ??= Lang.get("rawVideo");
+ data.url ??= url;
send({
type: AddVideo,
addVideo: {
@@ -330,8 +330,8 @@ class Main {
return;
}
if (title.length > 0) data.title = title;
- if (data.title == null) data.title = "Custom Media";
- if (data.url == null) data.url = iframe;
+ data.title ??= "Custom Media";
+ data.url ??= iframe;
send({
type: AddVideo,
addVideo: {
@@ -480,8 +480,8 @@ class Main {
player.play();
case GetTime:
- if (data.getTime.paused == null) data.getTime.paused = false;
- if (data.getTime.rate == null) data.getTime.rate = 1;
+ data.getTime.paused ??= false;
+ data.getTime.rate ??= 1;
if (player.getPlaybackRate() != data.getTime.rate) {
player.setPlaybackRate(data.getTime.rate);
@@ -746,8 +746,7 @@ class Main {
function onLogin(data:Array<ClientData>, clientName:String):Void {
updateClients(data);
- final newPersonal = clients.getByName(clientName);
- if (newPersonal == null) return;
+ final newPersonal = clients.getByName(clientName) ?? return;
personal = newPersonal;
onUserGroupChanged();
hideGuestLoginPanel();
@@ -880,7 +879,7 @@ class Main {
if (date == null) date = Date.now().toString();
else date = getLocalDateFromUtc(date);
final time = date.split(" ")[1];
- tstamp.textContent = time == null ? date : time;
+ tstamp.textContent = time ?? date;
tstamp.title = date;
final nameDiv = document.createElement("strong");
@@ -932,10 +931,8 @@ class Main {
function onChatVideoLoaded(e:Event):Void {
final el:VideoElement = cast e.target;
- if (emoteMaxSize == null) {
- emoteMaxSize = Std.parseInt(window.getComputedStyle(el)
- .getPropertyValue("max-width"));
- }
+ emoteMaxSize ??= Std.parseInt(window.getComputedStyle(el)
+ .getPropertyValue("max-width"));
// fixes default video tag size in chat when tab unloads videos in background
// (some browsers optimization i guess)
final max = emoteMaxSize;
diff --git a/src/client/Player.hx b/src/client/Player.hx
index 207f93a..0407ab2 100644
--- a/src/client/Player.hx
+++ b/src/client/Player.hx
@@ -102,7 +102,7 @@ class Player {
public function getVideoData(data:VideoDataRequest, callback:(data:VideoData) -> Void):Void {
var player = players.find(player -> player.isSupportedLink(data.url));
- if (player == null) player = rawPlayer;
+ player ??= rawPlayer;
player.getVideoData(data, callback);
}
@@ -134,8 +134,7 @@ class Player {
public function changeVideoSrc(src:String):Void {
if (player == null) return;
- final item = videoList.getCurrentItem();
- if (item == null) return;
+ final item = videoList.getCurrentItem() ?? return;
player.loadVideo({
url: src,
title: item.title,
@@ -447,8 +446,7 @@ class Player {
}
public function skipAd():Void {
- final item = videoList.getCurrentItem();
- if (item == null) return;
+ final item = videoList.getCurrentItem() ?? return;
if (!youtube.isSupportedLink(item.url)) return;
final id = youtube.extractVideoId(item.url);
final url = 'https://sponsor.ajay.app/api/skipSegments?videoID=$id';
diff --git a/src/client/players/Youtube.hx b/src/client/players/Youtube.hx
index b370f24..a728012 100644
--- a/src/client/players/Youtube.hx
+++ b/src/client/players/Youtube.hx
@@ -79,7 +79,7 @@ class Youtube implements IPlayer {
public function getVideoData(data:VideoDataRequest, callback:(data:VideoData) -> Void):Void {
final url = data.url;
- if (apiKey == null) apiKey = main.getYoutubeApiKey();
+ apiKey ??= main.getYoutubeApiKey();
final id = extractVideoId(url);
if (id == "") {
getPlaylistVideoData(data, callback);
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage