Commit ab33596e by ramdayalmunda

half done

parent 886894b9
...@@ -122,7 +122,8 @@ var getUserDetails = null ...@@ -122,7 +122,8 @@ var getUserDetails = null
function sendMessageToActiveTab(messageObj){ function sendMessageToActiveTab(messageObj){
try{ try{
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
if (tabs && tabs.length && tabs[0].url.slice(0,6)!='chrome') { // if any tab is active let activeTab = tabs[0]
if (activeTab?.url?.slice(0,6)!='chrome') { // if any tab is active
let message = { let message = {
userDetails, userDetails,
tutorShotOid: tutorShotId, tutorShotOid: tutorShotId,
...@@ -131,7 +132,7 @@ var getUserDetails = null ...@@ -131,7 +132,7 @@ var getUserDetails = null
message: messageObj message: messageObj
} }
console.log('sending message:', message) console.log('sending message:', message)
chrome.tabs.sendMessage(tabs[0].id, message); chrome.tabs.sendMessage(activeTab.id, message);
} }
}) })
}catch(err){ }catch(err){
......
...@@ -104,6 +104,7 @@ var btn = {} ...@@ -104,6 +104,7 @@ var btn = {}
.tutor-shot .content .item .item-text { .tutor-shot .content .item .item-text {
all: unset; all: unset;
padding-top: 2px;
} }
` `
...@@ -180,14 +181,35 @@ async function getCaptureData() { ...@@ -180,14 +181,35 @@ async function getCaptureData() {
function reRenderFloatingBar(data) { function reRenderFloatingBar(data) {
console.log('reRenderFloatingBar', data) console.log('reRenderFloatingBar', data)
if (data){
if (data.status=='stopped'){
floatingBar.remove()
return
}else if (!document.body.contains(floatingBar)){
document.body.append(floatingBar)
}
}
if (!btn.play){ if (!btn.play){
btn.play = document.querySelector('[tutor-shot="play-btn"]') btn.play = document.querySelector('[tutor-shot="play-btn"]')
btn.play.addEventListener('click', startRecording) btn.play.addEventListener('click', startRecording)
} }
if (!btn.capture){
btn.capture = document.querySelector('[tutor-shot="capture-btn"]')
btn.capture.addEventListener('click', startRecording)
}
if (!btn.playText) btn.playText = document.querySelector('[tutor-shot="play-text"]') if (!btn.playText) btn.playText = document.querySelector('[tutor-shot="play-text"]')
if (!btn.pause) btn.pause = document.querySelector('[tutor-shot="pause-btn"]') if (!btn.pause){
if (!btn.stop) btn.stop = document.querySelector('[tutor-shot="stop-btn"]') btn.pause = document.querySelector('[tutor-shot="pause-btn"]')
if (!btn.restart) btn.restart = document.querySelector('[tutor-shot="restart-btn"]') btn.pause.addEventListener('click', pauseRecording)
}
if (!btn.stop){
btn.stop = document.querySelector('[tutor-shot="stop-btn"]')
btn.stop.addEventListener('clikc', stopRecording)
}
if (!btn.restart){
btn.restart = document.querySelector('[tutor-shot="restart-btn"]')
btn.restart.addEventListener('click', restartRecording)
}
if (!btn.counter) btn.counter = document.querySelector('[tutor-shot="counter"]') if (!btn.counter) btn.counter = document.querySelector('[tutor-shot="counter"]')
if (data?.hasOwnProperty('imageNumber')){ if (data?.hasOwnProperty('imageNumber')){
...@@ -200,17 +222,23 @@ function reRenderFloatingBar(data) { ...@@ -200,17 +222,23 @@ function reRenderFloatingBar(data) {
btn.play.style.display = 'flex' btn.play.style.display = 'flex'
btn.pause.style.display = 'none' btn.pause.style.display = 'none'
btn.stop.style.display = 'flex' btn.stop.style.display = 'flex'
btn.restart.style.display = 'flex'
btn.capture.style.display = 'flex'
btn.playText.innerHTML = 'CONTINUE' btn.playText.innerHTML = 'CONTINUE'
} }
else if (data?.status == 'recording') { else if (data?.status == 'recording') {
btn.play.style.display = 'none' btn.play.style.display = 'none'
btn.pause.style.display = 'flex' btn.pause.style.display = 'flex'
btn.restart.style.display = 'flex'
btn.capture.style.display = 'flex'
btn.stop.style.display = 'flex' btn.stop.style.display = 'flex'
} }
else { // stopped else { // stopped
btn.play.style.display = 'flex' btn.play.style.display = 'flex'
btn.pause.style.display = 'none' btn.pause.style.display = 'none'
btn.stop.style.display = 'none' btn.stop.style.display = 'none'
btn.capture.style.display = 'none'
btn.restart.style.display = 'none'
btn.playText.innerHTML = 'START' btn.playText.innerHTML = 'START'
} }
// floatingBar.innerHTML = innerHTML // floatingBar.innerHTML = innerHTML
...@@ -287,3 +315,15 @@ async function startRecording() { ...@@ -287,3 +315,15 @@ async function startRecording() {
inProgress = false inProgress = false
} }
} }
async function pauseRecording(){
console.log('to pause recording')
}
async function stopRecording(){
console.log('to stop recocrding')
}
async function restartRecording(){
console.log('remove all the screenshot in current recording')
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment