Skip to content

Commit 5fff731

Browse files
unknownunknown
authored andcommitted
#5-08-2024
1 parent 4bff629 commit 5fff731

File tree

3 files changed

+79
-55
lines changed

3 files changed

+79
-55
lines changed

appsTeacher/lectures/site_files/html/view-video.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
background-color: transparent;
2828
border: none;
2929
display: block;
30-
z-index: 999999;
30+
z-index: 999999;
3131
}
3232
</style>
3333
</head>
@@ -36,5 +36,10 @@
3636
<iframe src="##data.videoURL##" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
3737
<div x-import="teacher-theme/scripts.html"></div>
3838
<script x-import="lectures/view-video.js"></script>
39+
<script>
40+
if (!window.SOCIALBROWSER) {
41+
document.querySelector("iframe").removeAttribute("allowfullscreen");
42+
}
43+
</script>
3944
</body>
4045
</html>

appsTeacher/lectures/site_files/js/lectureView.js

Lines changed: 72 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
app.controller("lectureView", function ($scope, $http, $timeout) {
22
$scope.item = {};
33
$scope.quiz = {};
4+
$scope.setting = site.showObject(`##data.#setting##`);
5+
46
$scope.baseURL = "";
57
$scope.view = function () {
68
$scope.busy = true;
@@ -99,69 +101,85 @@ app.controller("lectureView", function ($scope, $http, $timeout) {
99101
};
100102

101103
$scope.openVideo = function (link) {
102-
if (!window.SOCIALBROWSER) {
104+
if (!window.SOCIALBROWSER && !$scope.setting.allowVideoMobile) {
103105
site.showModal("#socialBrowserModal");
104106
return;
105107
}
106108

107109
$scope.error = "";
108-
$scope.busy = true;
109-
$http({
110-
method: "POST",
111-
url: `${$scope.baseURL}/api/lectures/changeView`,
112-
data: {
113-
socialBrowserID: SOCIALBROWSER.var.core.id,
114-
code: link.code,
115-
_id: "##query.id##",
116-
},
117-
}).then(
118-
function (response) {
119-
$scope.busy = false;
120-
if (response.data.done) {
121-
let code_injected = `/*##lectures/custom-youtube-video.js*/`;
122-
code_injected += "youtubeRun();";
123-
SOCIALBROWSER.ipc("[open new popup]", {
124-
url: document.location.origin + "/view-video?code=" + link.code + "&id=" + $scope.item._id,
125-
eval: code_injected,
126-
show: true,
127-
iframe: true,
128-
center: true,
129-
maximize: true,
130-
trusted: true,
131-
showDevTools: false,
132-
allowMenu: true,
133-
allowDevTools: false,
134-
allowDownload: false,
135-
allowAds: false,
136-
allowNewWindows: false,
137-
allowSaveUserData: false,
138-
allowSaveUrls: false,
139-
allowSocialBrowser: true,
140-
// allowRedirect: false,
141-
allowSelfRedirect: false,
142-
allowSelfWindow: false,
143-
allowJavascript: true,
144-
allowAudio: true,
145-
allowPopup: false,
146-
width: 800,
147-
height: 800,
148-
security: false,
149-
$timeout: 5000,
150-
});
151-
if ($scope.item.typeExpiryView && $scope.item.typeExpiryView.name == "number") {
152-
let index = $scope.item.linksList.findIndex((itm) => itm.code === link.code);
153-
if (index !== -1) {
154-
$scope.item.linksList[index].remainNumber -= 1;
110+
if (window.SOCIALBROWSER) {
111+
$scope.busy = true;
112+
$http({
113+
method: "POST",
114+
url: `${$scope.baseURL}/api/lectures/changeView`,
115+
data: {
116+
socialBrowserID: SOCIALBROWSER.var.core.id,
117+
code: link.code,
118+
_id: "##query.id##",
119+
},
120+
}).then(
121+
function (response) {
122+
$scope.busy = false;
123+
if (response.data.done) {
124+
let code_injected = `/*##lectures/custom-youtube-video.js*/`;
125+
code_injected += "youtubeRun();";
126+
SOCIALBROWSER.ipc("[open new popup]", {
127+
url: document.location.origin + "/view-video?code=" + link.code + "&id=" + $scope.item._id,
128+
eval: code_injected,
129+
show: true,
130+
iframe: true,
131+
center: true,
132+
maximize: true,
133+
trusted: true,
134+
showDevTools: false,
135+
allowMenu: true,
136+
allowDevTools: false,
137+
allowDownload: false,
138+
allowAds: false,
139+
allowNewWindows: false,
140+
allowSaveUserData: false,
141+
allowSaveUrls: false,
142+
allowSocialBrowser: true,
143+
// allowRedirect: false,
144+
allowSelfRedirect: false,
145+
allowSelfWindow: false,
146+
allowJavascript: true,
147+
allowAudio: true,
148+
allowPopup: false,
149+
width: 800,
150+
height: 800,
151+
security: false,
152+
$timeout: 5000,
153+
});
154+
if ($scope.item.typeExpiryView && $scope.item.typeExpiryView.name == "number") {
155+
let index = $scope.item.linksList.findIndex((itm) => itm.code === link.code);
156+
if (index !== -1) {
157+
$scope.item.linksList[index].remainNumber -= 1;
158+
}
155159
}
160+
} else {
161+
$scope.error = response.data.error;
156162
}
157-
} else {
158-
$scope.error = response.data.error;
163+
},
164+
function (err) {
165+
$scope.busy = false;
159166
}
160-
},
161-
function (err) {
167+
);
168+
} else if (site.isMobile()) {
169+
$http({
170+
method: "POST",
171+
url: `${$scope.baseURL}/api/lectures/changeViewMobile`,
172+
data: {
173+
code: link.code,
174+
_id: "##query.id##",
175+
},
176+
}).then(function (response) {
162177
$scope.busy = false;
163-
}
164-
);
178+
if (response.data.done) {
179+
window.open(`/view-video?code=${link.code}&id=${$scope.item._id}`);
180+
}
181+
});
182+
}
165183
};
166184

167185
$scope.finishQuiz = function (quiz) {

appsTeacher/site-setting/site_files/html/content.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
<i-checkbox label="##word.Books Show##" ng-show="siteSetting.isEducationalPlatform" ng-model="siteSetting.showBooks"> </i-checkbox>
108108
<i-checkbox label="##word.Banner Show##" ng-model="siteSetting.showBanner"> </i-checkbox>
109109
<i-checkbox label="##word.Auto Student Barcode##" ng-show="siteSetting.isCenter" ng-model="siteSetting.autoStudentBarcode"> </i-checkbox>
110+
<i-checkbox label="##word.Allow View Video From Mobile##" ng-show="siteSetting.isEducationalPlatform" ng-model="siteSetting.allowVideoMobile"> </i-checkbox>
110111
</div>
111112

112113
<div class="row">

0 commit comments

Comments
 (0)