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

211 lines
6.3 KiB
CoffeeScript
Raw Normal View History

# Helper to load javascript libraries from the BBB server
loadLib = (libname) ->
successCallback = ->
retryMessageCallback = (param) ->
2014-11-13 05:04:03 +08:00
#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)
2014-06-14 02:20:36 +08:00
# These settings can just be stored locally in session, created at start up
Meteor.startup ->
2015-03-03 00:30:46 +08:00
# Load SIP libraries before the application starts
2014-11-18 06:02:17 +08:00
loadLib('sip.js')
loadLib('bbb_webrtc_bridge_sip.js')
2015-03-03 00:30:46 +08:00
loadLib('bbblogger.js')
2014-09-24 02:27:59 +08:00
@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
)
2014-12-16 23:55:38 +08:00
#
2014-08-09 03:30:28 +08:00
Template.footer.helpers
2014-09-24 02:27:59 +08:00
getFooterString: ->
2014-12-16 23:55:38 +08:00
info = getBuildInformation()
2014-12-17 00:53:30 +08:00
foot = "(c) #{info.copyrightYear} BigBlueButton Inc. [build #{info.bbbServerVersion} - #{info.dateOfBuild}] - For more information visit #{info.link}"
2014-06-14 02:20:36 +08:00
Template.header.events
"click .audioFeedIcon": (event) ->
$('.audioFeedIcon').blur()
#toggleSlidingMenu()
toggleVoiceCall @
if BBB.amISharingAudio()
$('.navbarTitle').css('width', $('#navbar').width() - 358.4)
else
$('.navbarTitle').css('width', $('#navbar').width() - 409.6)
2014-09-24 02:27:59 +08:00
"click .chatBarIcon": (event) ->
$(".tooltip").hide()
toggleSlidingMenu()
2014-09-24 02:27:59 +08:00
toggleChatbar()
"click .collapseSlidingMenuButton": (event) ->
toggleSlidingMenu()
2014-12-18 01:14:39 +08:00
$(".tooltip").hide()
$('.collapseSlidingMenuButton').blur()
$('.myNavbar').css('z-index', 1032)
2014-12-18 01:14:39 +08:00
'click .collapseNavbarButton': (event) ->
$(".tooltip").hide()
$('.collapseNavbarButton').blur()
toggleNavbarCollapse()
"click .hideNavbarIcon": (event) ->
$(".tooltip").hide()
toggleNavbar()
"click .lowerHand": (event) ->
$(".tooltip").hide()
toggleSlidingMenu()
2014-11-22 01:36:21 +08:00
Meteor.call('userLowerHand', getInSession("meetingId"), getInSession("userId"), getInSession("userId"), getInSession("authToken"))
2014-09-24 02:27:59 +08:00
"click .muteIcon": (event) ->
$(".tooltip").hide()
2014-09-24 02:27:59 +08:00
toggleMic @
"click .raiseHand": (event) ->
2014-11-13 05:04:03 +08:00
#Meteor.log.info "navbar raise own hand from client"
console.log "navbar raise own hand from client"
$(".tooltip").hide()
toggleSlidingMenu()
2014-11-22 01:36:21 +08:00
Meteor.call('userRaiseHand', getInSession("meetingId"), getInSession("userId"), getInSession("userId"), getInSession("authToken"))
# "click .settingsIcon": (event) ->
# alert "settings"
2014-09-24 02:27:59 +08:00
"click .signOutIcon": (event) ->
$('.signOutIcon').blur()
if window.matchMedia('(orientation: portrait)').matches and window.matchMedia('(max-device-width: 1279px)').matches
if $('#dialog').dialog('option', 'height') isnt 450
$('#dialog').dialog('option', 'width', '100%')
$('#dialog').dialog('option', 'height', 450)
else
if $('#dialog').dialog('option', 'height') isnt 115
$('#dialog').dialog('option', 'width', 270)
$('#dialog').dialog('option', 'height', 115)
2014-11-21 11:15:29 +08:00
$("#dialog").dialog("open")
2014-09-24 02:27:59 +08:00
"click .hideNavbarIcon": (event) ->
$(".tooltip").hide()
2014-09-24 02:27:59 +08:00
toggleNavbar()
# "click .settingsIcon": (event) ->
# alert "settings"
"click .usersListIcon": (event) ->
$(".tooltip").hide()
toggleSlidingMenu
toggleUsersList()
"click .videoFeedIcon": (event) ->
$(".tooltip").hide()
toggleCam @
2014-09-24 02:27:59 +08:00
"click .whiteboardIcon": (event) ->
$(".tooltip").hide()
toggleSlidingMenu
2014-09-24 02:27:59 +08:00
toggleWhiteBoard()
2014-09-24 02:27:59 +08:00
"mouseout #navbarMinimizedButton": (event) ->
$("#navbarMinimizedButton").removeClass("navbarMinimizedButtonLarge")
$("#navbarMinimizedButton").addClass("navbarMinimizedButtonSmall")
2014-07-31 04:22:23 +08:00
"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()
2014-09-05 01:06:36 +08:00
Template.main.helpers
setTitle: ->
2014-09-12 01:37:09 +08:00
document.title = "BigBlueButton #{window.getMeetingName() ? 'HTML5'}"
2014-09-05 01:06:36 +08:00
2014-11-21 11:15:29 +08:00
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'
}
]
position:
my: 'right top'
at: 'right bottom'
of: '.signOutIcon'
)
$(window).resize( ->
$('#dialog').dialog('close')
)
$('#darkened-screen').click () ->
toggleSlidingMenu()
2014-07-31 04:22:23 +08:00
Template.makeButton.rendered = ->
2014-09-24 02:27:59 +08:00
$('button[rel=tooltip]').tooltip()
Template.recordingStatus.rendered = ->
$('button[rel=tooltip]').tooltip()