Skip to content

Commit

Permalink
second download button in player
Browse files Browse the repository at this point in the history
  • Loading branch information
RIVEK-Development committed Aug 18, 2023
1 parent b78942c commit 5409ab2
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 45 deletions.
Binary file added StudIP_Video_Download_V_1_7_0.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function parseJson(res, vidForm, sendResponse, download){
HQvideoTwo = HQvideo;
}

if(vidForm == "cam"){
if(vidForm == "webcam"){
HQvideo = HQvideoTwo;
}
}
Expand Down
113 changes: 70 additions & 43 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,49 +45,76 @@ if((url.includes("https://opencast-present") || url.includes("https://opencast03
}

function createButton(Link, parentObj, appereance){
var divID="LinkBtn";
if(!!document.getElementById(divID)){
document.getElementById(divID).remove();
}
var button = document.createElement("div"); //erstellt Container
var imgH = " 22px;";
var LinkImgSrc = "download.svg";
if(appereance == 0){
button.style="position: absolute;"+
"left: 0.7%;"+
"bottom: 1%;"+
"z-index: 50;"+
"height: 9%;";
imgH = " 100%; cursor: pointer;";
LinkImgSrc = "download_round.svg";
}
else if(appereance == 1){
button.className="buttonPlugin left showPlaybackRateButton";
}
else{
button.className="vjs-play-control vjs-control vjs-button vjs-paused";
button.style="padding-top: 5px;";
imgH = " 65%;";
}
button.title="Download";
button.id =divID;
if(appereance == 2){
parentObj.insertBefore(button, parentObj.children[9]);
}
else{
parentObj.appendChild(button); //Fügt den Container den vorhandenen Elementen hinzu
}
var link = document.createElement("img"); //erstellt Downlaod-Icon
link.src =chrome.runtime.getURL(LinkImgSrc);
link.id= "VideoLink";
link.style ="height:"+imgH;
button.appendChild(link); //fügt Icon dem Container hinzu
if(!document.getElementsByClassName("paella-profile-button")[0]){
button.onclick = click;
function click (){
download(id, null);
}
}

var vidAnz = 1;
if (!!document.getElementById("videoPlayerWrapper_1")){
vidAnz = 2;
}
for(i=0; i<vidAnz; i++){
var divID="LinkBtn_"+ i;
if(!!document.getElementById(divID)){
document.getElementById(divID).remove();
}
var button = document.createElement("div"); //erstellt Container
var imgH = " 22px;";
var LinkImgSrc = "download.svg";
if(appereance == 0){
button.style="position: absolute;"+
"left: 0.7%;"+
"bottom: 1%;"+
"z-index: 50;"+
"height: 9%;";
imgH = " 100%; cursor: pointer;";
LinkImgSrc = "download_round.svg";
}
else if(appereance == 1){
button.className="buttonPlugin left showPlaybackRateButton";
}
else{
button.className="vjs-play-control vjs-control vjs-button vjs-paused";
button.style="padding-top: 5px;";
imgH = " 65%;";
}
var buttonTitle = "Download";
let vidForm = null;
if(vidAnz>1 && i==0){
buttonTitle = "Download slides video"
vidForm = "slides";
}
if(vidAnz>1 && i==1){
buttonTitle = "Download webcam video"
vidForm = "webcam";
}
button.title= buttonTitle;
button.id =divID;
if(appereance == 2){
parentObj.insertBefore(button, parentObj.children[9]);
}
else{
parentObj.appendChild(button); //Fügt den Container den vorhandenen Elementen hinzu
}
var link = document.createElement("img"); //erstellt Downlaod-Icon
link.src =chrome.runtime.getURL(LinkImgSrc);
link.id= "VideoLink"+i;
link.style ="height:"+imgH;
button.appendChild(link); //fügt Icon dem Container hinzu
if(i == 0){
button.onclick = click0;
console.log("download 0: " + vidForm);
function click0 (){
console.log("download 0: " + vidForm);
download(id, vidForm);
}
}
else{
button.onclick = click1;
function click1 (){
console.log("download 1: " + vidForm);
download(id, vidForm);
}
}
}

}
}

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "StudIP Video Download",
"version": "1.6.0",
"version": "1.7.0",
"description": "Fügt im Opencast Videoplayer von StudIP eine Downloadmöglichkeit ein",
"manifest_version": 3,
"icons": {
Expand Down

0 comments on commit 5409ab2

Please sign in to comment.