PageSourceSearch

https://www.golfdater.com/themes/js/app/common/directives/video_player-directive.js?t=1791275615

js golfdater.com collected 2026-10-07 13:33:16 UTC 6,082 bytes, 187 lines download raw bytes

1angular
2	.module('dating.directives.videoPlayer', [
3		'ngSanitize',
4		'com.2fdevs.videogular',
5		'com.2fdevs.videogular.plugins.controls',
6		'com.2fdevs.videogular.plugins.overlayplay',
7		'com.2fdevs.videogular.plugins.buffering'
8	])
9	.controller('VideoPlayerCtrl', function ($sce, $scope, $rootScope, authService, ProfilesModel, globalParamsService) {
10		var GLOBALS = globalParamsService.GLOBALS;
11		var videoPlayerCtrl = this;
12		videoPlayerCtrl.currentUser = authService.currentUser;
13		videoPlayerCtrl.isPremium = videoPlayerCtrl.isAuthenticated && videoPlayerCtrl.currentUser.canSendMessages;
14		videoPlayerCtrl.isCreditsSite = GLOBALS.isCreditsSite;
15		videoPlayerCtrl.insufficientCredits = false;
16		videoPlayerCtrl.creditsPerVideoReveal = GLOBALS.creditsPerVideoReveal;
17		videoPlayerCtrl.hideCreditCost = GLOBALS.hideCreditsCostForMobile;
18		videoPlayerCtrl.API = null;
19
20		videoPlayerCtrl.theme = '/themes/scss/vendor/videogular/videogular.min.css';
21		videoPlayerCtrl.isPlaying = false;
22
23		var externalUpgradeUrl = authService.isAuthenticated ? GLOBALS.userInfo.partnerBillingRedirectUrl : '';
24		var upgradeUrl = parseInt(GLOBALS.isExternalUpgradeSite) ? externalUpgradeUrl : '/billing/upgrade';
25		videoPlayerCtrl.config = {
26			sources: [
27				{
28					src: $sce.trustAsResourceUrl(videoPlayerCtrl.videoSource),
29					type: 'video/mp4'
30				}
31			]
32		};
33
34		videoPlayerCtrl.onPlayerReady = function (API) {
35			videoPlayerCtrl.API = API;
36			videoPlayerCtrl.API.playsInline = true;
37			videoPlayerCtrl.progress = 0;
38			videoPlayerCtrl.videoBlurred = false;
39			API.setState('stop');
40
41			document.querySelectorAll('video').forEach(function (video) {
42				video.setAttribute('playsinline', 'true');
43				video.setAttribute('webkit-playsinline', 'true');
44			});
45			videoPlayerCtrl.API.mediaElement[0].addEventListener('play', function () {
46				$scope.$apply(function () {
47					videoPlayerCtrl.isPlaying = true;
48				});
49			});
50			videoPlayerCtrl.API.mediaElement[0].addEventListener('pause', function () {
51				$scope.$apply(function () {
52					videoPlayerCtrl.isPlaying = false;
53				});
54			});
55			videoPlayerCtrl.API.mediaElement[0].addEventListener('ended', function () {
56				$scope.$apply(function () {
57					videoPlayerCtrl.isPlaying = false;
58				});
59			});
60		};
61
62		$scope.onCompletePlayer = function () {
63			$rootScope.$broadcast('videoEnded', { stopped: true });
64		};
65
66		videoPlayerCtrl.onCanPlay = function () {
67			$rootScope.$broadcast('canPlay', { canPlay: true });
68			if (videoPlayerCtrl.autoplay) {
69				videoPlayerCtrl.API.setVolume(0);
70				videoPlayerCtrl.API.setState('play');
71				videoPlayerCtrl.API.play();
72			}
73		};
74
75		videoPlayerCtrl.onUpdateTime = function (currentTime) {
76			if (videoPlayerCtrl.showNudityCover) {
77				if (currentTime > videoPlayerCtrl.secondsForLoop) {
78					videoPlayerCtrl.API.seekTime(0);
79				}
80			} else {
81				if (Math.abs(currentTime - videoPlayerCtrl.progress) < 1) {
82					videoPlayerCtrl.progress = currentTime;
83				}
84				if (
85					videoPlayerCtrl.shouldBlur &&
86					videoPlayerCtrl.secondsBeforeBlur &&
87					currentTime >= videoPlayerCtrl.secondsBeforeBlur
88				) {
89					videoPlayerCtrl.videoBlurred = true;
90				}
91			}
92			if (videoPlayerCtrl.stopAt && currentTime >= videoPlayerCtrl.stopAt) {
93				videoPlayerCtrl.API.pause();
94				videoPlayerCtrl.videoBlurred = true;
95				$rootScope.$broadcast('videoEnded', { stopped: true });
96			}
97		};
98
99		videoPlayerCtrl.onBarClick = function () {
100			if (!videoPlayerCtrl.isPremium) {
101				videoPlayerCtrl.API.seekTime(videoPlayerCtrl.progress);
102			}
103		};
104
105		videoPlayerCtrl.revealVideo = function (videoId) {
106			ProfilesModel.revealVideo(videoId).then(function (result) {
107				if (result.data.res) {
108					$rootScope.$broadcast('videoRevealed', { shouldBlur: false });
109					videoPlayerCtrl.videoBlurred = false;
110					videoPlayerCtrl.insufficientCredits = false;
111				} else {
112					videoPlayerCtrl.insufficientCredits = true;
113					$.fancybox.close();
114					$rootScope.$broadcast('showPurchaseModal');
115				}
116			});
117		};
118
119		videoPlayerCtrl.redirectToUpgrade = function () {
120			if (
121				(videoPlayerCtrl.isCreditsSite && videoPlayerCtrl.insufficientCredits) ||
122				(!videoPlayerCtrl.isCreditsSite && videoPlayerCtrl.videoBlurred)
123			) {
124				var shouldShowUpgradePopup = +GLOBALS.showUpgradePopup && !parseInt(GLOBALS.isExternalUpgradeSite);
125				if (shouldShowUpgradePopup) {
126					$('.fancybox-container').css('z-index', 1000);
127					$rootScope.$broadcast('showPurchaseModal');
128				} else {
129					window.location.href = upgradeUrl;
130				}
131			}
132		};
133
134		videoPlayerCtrl.setSafeMode = function () {
135			ProfilesModel.setSafeMode().then(function () {
136				$scope.$parent.videoPlayerCtrl.API.stop();
137				$scope.$parent.videoPlayerCtrl.API.seekTime(0);
138				var currentSafeModeValue = !videoPlayerCtrl.currentUser.safeMode;
139				videoPlayerCtrl.currentUser.safeMode = currentSafeModeValue;
140				$rootScope.$broadcast('setSafeMode', {
141					safeMode: currentSafeModeValue
142				});
143				$rootScope.$broadcast('safeModeChanged');
144			});
145		};
146
147		$scope.$on('sign-out:success', function () {
148			videoPlayerCtrl.currentUser = null;
149		});
150	})
151	.directive('videoPlayer', function () {
152		return {
153			restrict: 'E',
154			controller: 'VideoPlayerCtrl',
155			controllerAs: 'videoPlayerCtrl',
156			bindToController: true,
157			scope: {
158				videoSource: '=videoSource',
159				autoplay: '=autoplay',
160				videoType: '@videoType',
161				secondsBeforeBlur: '=secondsBeforeBlur',
162				secondsForLoop: '=secondsForLoop',
163				showNudityCover: '=showNudityCover',
164				shouldBlur: '=shouldBlur',
165				videoId: '=videoId',
166				stopAt: '=stopAt'
167			},
168			templateUrl: globalParams.templateUrls.directives.video_player
169		};
170	})
171	.directive('videoBlur', function () {
172		return {
173			restrict: 'E',
174			controller: 'VideoPlayerCtrl',
175			controllerAs: 'videoPlayerCtrl',
176			bindToController: true,
177			require: '^videogular',
178			scope: {
179				videoType: '=videoType',
180				showNudityCover: '=showNudityCover',
181				videoBlurred: '=videoBlurred',
182				videoId: '=videoId',
183				insufficientCredits: '=insufficientCredits'
184			},
185			templateUrl: globalParams.templateUrls.directives.video_blur
186		};
187	});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.