Add a prompt explaining the situation as well as documentation
This commit is contained in:
parent
578d3fbb23
commit
5a81ab7ce7
10 changed files with 184 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ window.GoogleDriveYouTubePlayer = class GoogleDriveYouTubePlayer extends Player
|
|||
@init(data)
|
||||
|
||||
init: (data) ->
|
||||
window.promptToInstallDriveUserscript()
|
||||
embed = $('<embed />').attr(
|
||||
type: 'application/x-shockwave-flash'
|
||||
src: "https://www.youtube.com/get_player?docid=#{data.id}&ps=docs\
|
||||
|
|
@ -102,3 +103,30 @@ window.GoogleDriveYouTubePlayer = class GoogleDriveYouTubePlayer extends Player
|
|||
cb(@yt.getVolume() / 100)
|
||||
else
|
||||
cb(VOLUME)
|
||||
|
||||
window.promptToInstallDriveUserscript = ->
|
||||
if document.getElementById('prompt-install-drive-userscript')
|
||||
return
|
||||
alertBox = document.createElement('div')
|
||||
alertBox.id = 'prompt-install-drive-userscript'
|
||||
alertBox.className = 'alert alert-info'
|
||||
alertBox.innerHTML = """
|
||||
Due to continual breaking changes making it increasingly difficult to
|
||||
maintain Google Drive support, you can now install a userscript that
|
||||
simplifies the code and has better compatibility. In the future, the
|
||||
old player will be removed."""
|
||||
alertBox.appendChild(document.createElement('br'))
|
||||
infoLink = document.createElement('a')
|
||||
infoLink.className = 'btn btn-info'
|
||||
infoLink.href = '/google_drive_userscript'
|
||||
infoLink.textContent = 'Click here for details'
|
||||
infoLink.target = '_blank'
|
||||
alertBox.appendChild(infoLink)
|
||||
|
||||
closeButton = document.createElement('button')
|
||||
closeButton.className = 'close pull-right'
|
||||
closeButton.innerHTML = '×'
|
||||
closeButton.onclick = ->
|
||||
alertBox.parentNode.removeChild(alertBox)
|
||||
alertBox.insertBefore(closeButton, alertBox.firstChild)
|
||||
document.getElementById('videowrap').appendChild(alertBox)
|
||||
|
|
|
|||
|
|
@ -93,6 +93,8 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
|
|||
@player.src(@sources[@sourceIdx])
|
||||
else
|
||||
console.error('Out of sources, video will not play')
|
||||
if @mediaType is 'gd' and not window.hasDriveUserscript
|
||||
window.promptToInstallDriveUserscript()
|
||||
)
|
||||
@setVolume(VOLUME)
|
||||
@player.on('ended', ->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue