bigbluebutton-Github/bigbluebutton-html5/app/client/main.coffee

275 lines
14 KiB
CoffeeScript
Executable File

# RaphaelJS "settings" icon
settingsIconPath = 'M17.41,20.395l-0.778-2.723c0.228-0.2,0.442-0.414,0.644-0.643l2.721,0.778c0.287-0.418,0.534-0.862,0.755-1.323l-2.025-1.96c0.097-0.288,0.181-0.581,0.241-0.883l2.729-0.684c0.02-0.252,0.039-0.505,0.039-0.763s-0.02-0.51-0.039-0.762l-2.729-0.684c-0.061-0.302-0.145-0.595-0.241-0.883l2.026-1.96c-0.222-0.46-0.469-0.905-0.756-1.323l-2.721,0.777c-0.201-0.228-0.416-0.442-0.644-0.643l0.778-2.722c-0.418-0.286-0.863-0.534-1.324-0.755l-1.96,2.026c-0.287-0.097-0.581-0.18-0.883-0.241l-0.683-2.73c-0.253-0.019-0.505-0.039-0.763-0.039s-0.51,0.02-0.762,0.039l-0.684,2.73c-0.302,0.061-0.595,0.144-0.883,0.241l-1.96-2.026C7.048,3.463,6.604,3.71,6.186,3.997l0.778,2.722C6.736,6.919,6.521,7.134,6.321,7.361L3.599,6.583C3.312,7.001,3.065,7.446,2.844,7.907l2.026,1.96c-0.096,0.288-0.18,0.581-0.241,0.883l-2.73,0.684c-0.019,0.252-0.039,0.505-0.039,0.762s0.02,0.51,0.039,0.763l2.73,0.684c0.061,0.302,0.145,0.595,0.241,0.883l-2.026,1.96c0.221,0.46,0.468,0.905,0.755,1.323l2.722-0.778c0.2,0.229,0.415,0.442,0.643,0.643l-0.778,2.723c0.418,0.286,0.863,0.533,1.323,0.755l1.96-2.026c0.288,0.097,0.581,0.181,0.883,0.241l0.684,2.729c0.252,0.02,0.505,0.039,0.763,0.039s0.51-0.02,0.763-0.039l0.683-2.729c0.302-0.061,0.596-0.145,0.883-0.241l1.96,2.026C16.547,20.928,16.992,20.681,17.41,20.395zM11.798,15.594c-1.877,0-3.399-1.522-3.399-3.399s1.522-3.398,3.399-3.398s3.398,1.521,3.398,3.398S13.675,15.594,11.798,15.594zM27.29,22.699c0.019-0.547-0.06-1.104-0.23-1.654l1.244-1.773c-0.188-0.35-0.4-0.682-0.641-0.984l-2.122,0.445c-0.428-0.364-0.915-0.648-1.436-0.851l-0.611-2.079c-0.386-0.068-0.777-0.105-1.173-0.106l-0.974,1.936c-0.279,0.054-0.558,0.128-0.832,0.233c-0.257,0.098-0.497,0.22-0.727,0.353L17.782,17.4c-0.297,0.262-0.568,0.545-0.813,0.852l0.907,1.968c-0.259,0.495-0.437,1.028-0.519,1.585l-1.891,1.06c0.019,0.388,0.076,0.776,0.164,1.165l2.104,0.519c0.231,0.524,0.541,0.993,0.916,1.393l-0.352,2.138c0.32,0.23,0.66,0.428,1.013,0.6l1.715-1.32c0.536,0.141,1.097,0.195,1.662,0.15l1.452,1.607c0.2-0.057,0.399-0.118,0.596-0.193c0.175-0.066,0.34-0.144,0.505-0.223l0.037-2.165c0.455-0.339,0.843-0.747,1.152-1.206l2.161-0.134c0.152-0.359,0.279-0.732,0.368-1.115L27.29,22.699zM23.127,24.706c-1.201,0.458-2.545-0.144-3.004-1.345s0.143-2.546,1.344-3.005c1.201-0.458,2.547,0.144,3.006,1.345C24.931,22.902,24.328,24.247,23.127,24.706z'
# RaphaelJS "Safari" icon
safariIconPath = 'M16.154,5.135c-0.504,0-1,0.031-1.488,0.089l-0.036-0.18c-0.021-0.104-0.06-0.198-0.112-0.283c0.381-0.308,0.625-0.778,0.625-1.306c0-0.927-0.751-1.678-1.678-1.678s-1.678,0.751-1.678,1.678c0,0.745,0.485,1.376,1.157,1.595c-0.021,0.105-0.021,0.216,0,0.328l0.033,0.167C7.645,6.95,3.712,11.804,3.712,17.578c0,6.871,5.571,12.441,12.442,12.441c6.871,0,12.441-5.57,12.441-12.441C28.596,10.706,23.025,5.135,16.154,5.135zM16.369,8.1c4.455,0,8.183,3.116,9.123,7.287l-0.576,0.234c-0.148-0.681-0.755-1.191-1.48-1.191c-0.837,0-1.516,0.679-1.516,1.516c0,0.075,0.008,0.148,0.018,0.221l-2.771-0.028c-0.054-0.115-0.114-0.226-0.182-0.333l3.399-5.11l0.055-0.083l-4.766,4.059c-0.352-0.157-0.74-0.248-1.148-0.256l0.086-0.018l-1.177-2.585c0.64-0.177,1.111-0.763,1.111-1.459c0-0.837-0.678-1.515-1.516-1.515c-0.075,0-0.147,0.007-0.219,0.018l0.058-0.634C15.357,8.141,15.858,8.1,16.369,8.1zM12.146,3.455c0-0.727,0.591-1.318,1.318-1.318c0.727,0,1.318,0.591,1.318,1.318c0,0.425-0.203,0.802-0.516,1.043c-0.183-0.123-0.413-0.176-0.647-0.13c-0.226,0.045-0.413,0.174-0.535,0.349C12.542,4.553,12.146,4.049,12.146,3.455zM7.017,17.452c0-4.443,3.098-8.163,7.252-9.116l0.297,0.573c-0.61,0.196-1.051,0.768-1.051,1.442c0,0.837,0.678,1.516,1.515,1.516c0.068,0,0.135-0.006,0.2-0.015l-0.058,2.845l0.052-0.011c-0.442,0.204-0.824,0.513-1.116,0.895l0.093-0.147l-1.574-0.603l1.172,1.239l0.026-0.042c-0.19,0.371-0.306,0.788-0.324,1.229l-0.003-0.016l-2.623,1.209c-0.199-0.604-0.767-1.041-1.438-1.041c-0.837,0-1.516,0.678-1.516,1.516c0,0.064,0.005,0.128,0.013,0.191l-0.783-0.076C7.063,18.524,7.017,17.994,7.017,17.452zM16.369,26.805c-4.429,0-8.138-3.078-9.106-7.211l0.691-0.353c0.146,0.686,0.753,1.2,1.482,1.2c0.837,0,1.515-0.679,1.515-1.516c0-0.105-0.011-0.207-0.031-0.307l2.858,0.03c0.045,0.095,0.096,0.187,0.15,0.276l-3.45,5.277l0.227-0.195l4.529-3.92c0.336,0.153,0.705,0.248,1.094,0.266l-0.019,0.004l1.226,2.627c-0.655,0.166-1.142,0.76-1.142,1.468c0,0.837,0.678,1.515,1.516,1.515c0.076,0,0.151-0.007,0.225-0.018l0.004,0.688C17.566,26.746,16.975,26.805,16.369,26.805zM18.662,26.521l-0.389-0.6c0.661-0.164,1.152-0.759,1.152-1.47c0-0.837-0.68-1.516-1.516-1.516c-0.066,0-0.13,0.005-0.193,0.014v-2.86l-0.025,0.004c0.409-0.185,0.77-0.459,1.055-0.798l1.516,0.659l-1.104-1.304c0.158-0.335,0.256-0.704,0.278-1.095l2.552-1.164c0.19,0.618,0.766,1.068,1.447,1.068c0.838,0,1.516-0.679,1.516-1.516c0-0.069-0.006-0.137-0.016-0.204l0.65,0.12c0.089,0.517,0.136,1.049,0.136,1.591C25.722,21.826,22.719,25.499,18.662,26.521z'
# RaphaelJS "Internet Explorer" icon
ieIconPath = 'M27.998,2.266c-2.12-1.91-6.925,0.382-9.575,1.93c-0.76-0.12-1.557-0.185-2.388-0.185c-3.349,0-6.052,0.985-8.106,2.843c-2.336,2.139-3.631,4.94-3.631,8.177c0,0.028,0.001,0.056,0.001,0.084c3.287-5.15,8.342-7.79,9.682-8.487c0.212-0.099,0.338,0.155,0.141,0.253c-0.015,0.042-0.015,0,0,0c-2.254,1.35-6.434,5.259-9.146,10.886l-0.003-0.007c-1.717,3.547-3.167,8.529-0.267,10.358c2.197,1.382,6.13-0.248,9.295-2.318c0.764,0.108,1.567,0.165,2.415,0.165c5.84,0,9.937-3.223,11.399-7.924l-8.022-0.014c-0.337,1.661-1.464,2.548-3.223,2.548c-2.21,0-3.729-1.211-3.828-4.012l15.228-0.014c0.028-0.578-0.042-0.985-0.042-1.436c0-5.251-3.143-9.355-8.255-10.663c2.081-1.294,5.974-3.209,7.848-1.681c1.407,1.14,0.633,3.533,0.295,4.518c-0.056,0.254,0.24,0.296,0.296,0.057C28.814,5.573,29.026,3.194,27.998,2.266zM13.272,25.676c-2.469,1.475-5.873,2.539-7.539,1.289c-1.243-0.935-0.696-3.468,0.398-5.938c0.664,0.992,1.495,1.886,2.473,2.63C9.926,24.651,11.479,25.324,13.272,25.676zM12.714,13.046c0.042-2.435,1.787-3.49,3.617-3.49c1.928,0,3.49,1.112,3.49,3.49H12.714z'
# Helper to load javascript libraries from the BBB server
loadLib = (libname) ->
successCallback = ->
retryMessageCallback = (param) ->
#Meteor.log.info "Failed to load library", param
console.log "Failed to load library", param
Meteor.Loader.loadJs("http://#{window.location.hostname}/client/lib/#{libname}", successCallback, 10000).fail(retryMessageCallback)
# These settings can just be stored locally in session, created at start up
Meteor.startup ->
# Load SIP libraries before the application starts
loadLib('sip.js')
loadLib('bbb_webrtc_bridge_sip.js')
loadLib('bbblogger.js')
@SessionAmplify = _.extend({}, Session,
keys: _.object(_.map(amplify.store(), (value, key) ->
[
key
JSON.stringify(value)
]
))
set: (key, value) ->
Session.set.apply this, arguments
amplify.store key, value
return
)
#
Template.footer.helpers
getFooterString: ->
info = getBuildInformation()
foot = "(c) #{info.copyrightYear} BigBlueButton Inc. [build #{info.bbbServerVersion} - #{info.dateOfBuild}] - For more information visit #{info.link}"
Template.header.events
"click .audioFeedIcon": (event) ->
if getInSession('webrtc_notification_is_displayed') is false # prevents the notification from displaying until the previous one is hidden
if !isWebRTCAvailable() # verifies if the browser supports WebRTC
$('.notification').addClass('webrtc-support-notification')
setInSession 'webrtc_notification_is_displayed', true
pp = new Raphael('browser-icon-container', 35, 35)
if getBrowserName() is 'Safari'
pp.path(safariIconPath).attr({fill: "#000", stroke: "none"})
$('#notification-text').html("Sorry,<br/>Safari doesn't support WebRTC")
else if getBrowserName() is 'IE'
pp.path(ieIconPath).attr({fill: "#000", stroke: "none"})
$('#notification-text').html("Sorry,<br/>IE doesn't support WebRTC")
else
pp.path(settingsIconPath).attr({fill: "#000", stroke: "none"})
$('.notification.ui-widget-content p').css('font-size', '11px') # to make sure the text fits the dialog box
$('#notification-text').html("Sorry,<br/>your browser doesn't support WebRTC")
$('#notification').dialog('open')
setTimeout () -> # waits 2 sec, then hides the notification
$('#notification').dialog('close')
$('.audioFeedIcon').blur()
setTimeout () -> # waits 0.5 sec (time to hide the notification), then removes the icons
pp.remove()
$('.notification').removeClass('webrtc-support-notification')
setInSession 'webrtc_notification_is_displayed', false
, 500
, 2000
else
if !BBB.amISharingAudio()
Tracker.autorun (comp) ->
if BBB.amISharingAudio()
$('.notification').addClass('joined-audio-notification')
setInSession 'webrtc_notification_is_displayed', true
$('#notification-text').html("You've joined the audio")
$('#notification').dialog('open')
setTimeout () ->
$('#notification').dialog('close')
$('.audioFeedIcon').blur()
setTimeout () ->
$('.notification').removeClass('joined-audio-notification')
setInSession 'webrtc_notification_is_displayed', false
, 500
, 2000
comp.stop()
$('.audioFeedIcon').blur()
toggleVoiceCall @
if BBB.amISharingAudio()
$('.navbarTitle').css('width', $('#navbar').width() - 358.4)
else
$('.navbarTitle').css('width', $('#navbar').width() - 409.6)
"click .chatBarIcon": (event) ->
$(".tooltip").hide()
toggleChatbar()
"click .collapseSlidingMenuButton": (event) ->
toggleSlidingMenu()
$(".tooltip").hide()
$('.collapseSlidingMenuButton').blur()
$('.myNavbar').css('z-index', 1032)
'click .collapseNavbarButton': (event) ->
$(".tooltip").hide()
$('.collapseNavbarButton').blur()
toggleNavbarCollapse()
"click .hideNavbarIcon": (event) ->
$(".tooltip").hide()
toggleNavbar()
"click .lowerHand": (event) ->
$(".tooltip").hide()
Meteor.call('userLowerHand', getInSession("meetingId"), getInSession("userId"), getInSession("userId"), getInSession("authToken"))
"click .muteIcon": (event) ->
$(".tooltip").hide()
toggleMic @
"click .raiseHand": (event) ->
#Meteor.log.info "navbar raise own hand from client"
console.log "navbar raise own hand from client"
$(".tooltip").hide()
Meteor.call('userRaiseHand', getInSession("meetingId"), getInSession("userId"), getInSession("userId"), getInSession("authToken"))
# "click .settingsIcon": (event) ->
# alert "settings"
"click .signOutIcon": (event) ->
$('.signOutIcon').blur()
if isLandscapeMobile()
$('.logout-dialog').addClass('landscape-mobile-logout-dialog')
else
$('.logout-dialog').addClass('desktop-logout-dialog')
$("#dialog").dialog("open")
"click .hideNavbarIcon": (event) ->
$(".tooltip").hide()
toggleNavbar()
# "click .settingsIcon": (event) ->
# alert "settings"
"click .usersListIcon": (event) ->
$(".tooltip").hide()
toggleUsersList()
"click .videoFeedIcon": (event) ->
$(".tooltip").hide()
toggleCam @
"click .whiteboardIcon": (event) ->
$(".tooltip").hide()
toggleWhiteBoard()
"mouseout #navbarMinimizedButton": (event) ->
$("#navbarMinimizedButton").removeClass("navbarMinimizedButtonLarge")
$("#navbarMinimizedButton").addClass("navbarMinimizedButtonSmall")
"mouseover #navbarMinimizedButton": (event) ->
$("#navbarMinimizedButton").removeClass("navbarMinimizedButtonSmall")
$("#navbarMinimizedButton").addClass("navbarMinimizedButtonLarge")
Template.slidingMenu.events
'click .audioFeedIcon': (event) ->
$('.audioFeedIcon').blur()
toggleSlidingMenu()
toggleVoiceCall @
if BBB.amISharingAudio()
$('.navbarTitle').css('width', '70%')
else
$('.navbarTitle').css('width', '55%')
'click .chatBarIcon': (event) ->
$('.tooltip').hide()
toggleSlidingMenu()
toggleChatbar()
'click .lowerHand': (event) ->
$('.tooltip').hide()
toggleSlidingMenu()
Meteor.call('userLowerHand', getInSession('meetingId'), getInSession('userId'), getInSession('userId'), getInSession('authToken'))
'click .raiseHand': (event) ->
console.log 'navbar raise own hand from client'
$('.tooltip').hide()
toggleSlidingMenu()
Meteor.call('userRaiseHand', getInSession("meetingId"), getInSession("userId"), getInSession("userId"), getInSession("authToken"))
'click .usersListIcon': (event) ->
$('.tooltip').hide()
toggleSlidingMenu()
toggleUsersList()
'click .whiteboardIcon': (event) ->
$('.tooltip').hide()
toggleSlidingMenu()
toggleWhiteBoard()
'click .collapseButton': (event) ->
$('.tooltip').hide()
toggleSlidingMenu()
$('.collapseButton').blur()
Template.main.helpers
setTitle: ->
document.title = "BigBlueButton #{window.getMeetingName() ? 'HTML5'}"
Template.main.rendered = ->
$("#dialog").dialog(
modal: true
draggable: false
resizable: false
autoOpen: false
dialogClass: 'no-close logout-dialog'
buttons: [
{
text: 'Yes'
click: () ->
userLogout getInSession("meetingId"), getInSession("userId"), true
$(this).dialog("close")
class: 'btn btn-xs btn-primary active'
}
{
text: 'No'
click: () ->
$(this).dialog("close")
$(".tooltip").hide()
class: 'btn btn-xs btn-default'
}
]
open: (event, ui) ->
$('.ui-widget-overlay').bind 'click', () ->
if isMobile()
$("#dialog").dialog('close')
position:
my: 'right top'
at: 'right bottom'
of: '.signOutIcon'
)
$("#notification").dialog(
modal: false
draggable: false
resizable: false
autoOpen: false
dialogClass: 'no-close no-titlebar notification'
show:
effect: "blind"
duration: 500
,
hide:
effect: "blind"
duration: 500
position:
my: 'left top'
at: 'left bottom'
of: '.audioFeedIcon'
)
$(window).resize( ->
$('#dialog').dialog('close')
)
$('#shield').click () ->
toggleSlidingMenu()
Template.makeButton.rendered = ->
$('button[rel=tooltip]').tooltip()
Template.recordingStatus.rendered = ->
$('button[rel=tooltip]').tooltip()