-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 71bcaf4
Showing
7 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
body{ | ||
min-width : 400px; | ||
min-height : 300px; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "Deep Player", | ||
"description": "Deep Player Chrome Extension", | ||
"version": "1.0.0", | ||
"browser_action": { | ||
"default_popup": "popup.html" | ||
}, | ||
|
||
"permissions": [ | ||
"activeTab", | ||
"cookies", | ||
"tabs", | ||
"http://localhost:8000/", | ||
"webNavigation" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Recothem</title> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> | ||
<link rel="stylesheet" type="text/css" href="css/style.css"> | ||
</head> | ||
<body> | ||
<div id="not-logged-in" class="d-none container"> | ||
<br><br><br><br><br><br> | ||
<div class="row align-items-center text-center"> | ||
<div class="col"> | ||
You are not logged in, please login to <br> | ||
<a target="_blank" href="http://localhost:8000/accounts/login/">Deep Player</a> | ||
</div> | ||
</div> | ||
<br><br><br> | ||
</div> | ||
<div id="youtube" class="d-none container"> | ||
<br><br><br><br><br> | ||
<div id="upload-form" class="row align-items-center text-center"> | ||
<div class="col-2"></div> | ||
<div class="col-8"> | ||
<input class="form-control" placeholder="Enter a name for this video" id="video-name"> | ||
<br> | ||
<button class="btn btn-default" id="upload-button">Upload this video</button> | ||
</div> | ||
<div class="col-2"></div> | ||
</div> | ||
<div id="upload-success" class="row align-items-center text-center d-none"> | ||
<div class="col"> | ||
Video upload request successfully sent to <br> <a target="_blank" href="http://localhost:8000/">Deep Player</a> | ||
</div> | ||
</div> | ||
<br><br><br> | ||
|
||
</div> | ||
<div id="not-youtube" class="d-none container"> | ||
<br><br><br><br><br><br> | ||
<div class="row align-items-center text-center"> | ||
<div class="col"> | ||
Open a YouTube video to upload it. | ||
</div> | ||
</div> | ||
<br><br><br> | ||
</div> | ||
<script src="jquery-3.2.1.slim.min.js"></script> | ||
<script src="bootstrap.min.js"></script> | ||
<script src="popup.js" type="text/javascript"></script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
$(document).ready(function(){ | ||
$("#not-logged-in").addClass("d-none"); | ||
$("#youtube").addClass("d-none"); | ||
$("#not-youtube").addClass("d-none"); | ||
|
||
var csrftoken = ""; | ||
var sessionid = ""; | ||
|
||
chrome.cookies.get({url: 'http://localhost:8000/', name: 'csrftoken'}, | ||
function (cookie) { | ||
console.log(cookie); | ||
csrftoken = cookie.value; | ||
} | ||
); | ||
|
||
chrome.cookies.get({url: 'http://localhost:8000/', name: 'sessionid'}, | ||
function (cookie) { | ||
console.log(cookie); | ||
if (cookie){ | ||
sessionid = cookie; | ||
var userid = sessionid.user_id; | ||
var username = sessionid.username; | ||
$("#notlogin").removeClass("d-none"); | ||
chrome.tabs.query({active: true, currentWindow: true}, | ||
function(tabs){ | ||
var tabURL = new URL(tabs[0].url); | ||
if (tabURL.host == "www.youtube.com"){ | ||
console.log(tabURL); | ||
$('#youtube').removeClass('d-none'); | ||
var videoid = tabURL.searchParams.get("v"); | ||
console.log(videoid); | ||
$('#upload-button').onclick(function(){ | ||
var videoname = $('#video-name').value(); | ||
$.ajax({ | ||
url: "http://localhost:8000/uploadvideo", | ||
type: "POST", | ||
data: { | ||
videoname: videoname, | ||
source: "youtube", | ||
videoid: videoid, | ||
csrfmiddlewaretoken: csrftoken | ||
}, | ||
success: function () { | ||
$('#upload-success').removeClass("d-none"); | ||
$('#upload-form').addClass("d-none"); | ||
console.log("Upload request successfull"); | ||
}, | ||
error:function(){ | ||
console.log("Upload error"); | ||
} | ||
}); | ||
}); | ||
} | ||
else{ | ||
console.log(tabURL); | ||
$('#not-youtube').removeClass('d-none'); | ||
$("#youtube").addClass("d-none"); | ||
} | ||
} | ||
) | ||
} | ||
else{ | ||
$('#not-logged-in').removeClass('d-none'); | ||
$("#youtube").addClass("d-none"); | ||
$("#not-youtube").addClass("d-none"); | ||
} | ||
} | ||
); | ||
|
||
}); |