@ -400,7 +400,7 @@ function initManage(){
}
else if ( param === 'ownerPassSwitch' ) {
if ( state ) {
$ ( '#persistent Modal' ) . modal ( 'show' ) ;
$ ( '#ownerPass Modal' ) . modal ( 'show' ) ;
sw . bootstrapSwitch ( 'toggleState' , true ) ;
}
else {
@ -409,6 +409,11 @@ function initManage(){
sendAction ( data , sw ) ;
}
}
else if ( param === 'persistentSwitch' ) {
data . action = 'setPersistent' ;
data . type = ( state ) ? 'set' : 'unset' ;
sendAction ( data , sw ) ;
}
// Something isn't implemented yet ?
else {
$ . notify ( locale . ERROR _OCCURRED , 'error' ) ;
@ -438,7 +443,7 @@ function initManage(){
}
} ) ;
$ ( '#persistent Form' ) . submit ( function ( event ) {
$ ( '#ownerPass Form' ) . submit ( function ( event ) {
event . preventDefault ( ) ;
var pass = $ ( '#ownerPass' ) . val ( ) ;
var pass2 = $ ( '#ownerPassConfirm' ) . val ( ) ;
@ -451,7 +456,7 @@ function initManage(){
data . password = pass
sendAction ( data , $ ( '#ownerPassSwitch' ) ) ;
$ ( '#ownerPassSwitch' ) . bootstrapSwitch ( 'toggleState' , true ) ;
$ ( '#persistent Modal' ) . modal ( 'hide' ) ;
$ ( '#ownerPass Modal' ) . modal ( 'hide' ) ;
}
else {
$ ( '#ownerPassConfirm' ) . notify ( locale . PASSWORDS _DO _NOT _MATCH , 'error' ) ;
@ -599,8 +604,8 @@ function initVroom(room) {
$ ( '#joinPassButton' ) . prop ( 'checked' , true ) ;
}
if ( data . owner _auth == 'yes' ) {
$ ( '#persistent Label' ) . addClass ( 'btn-danger active' ) ;
$ ( '#persistent Button' ) . prop ( 'checked' , true ) ;
$ ( '#ownerPass Label' ) . addClass ( 'btn-danger active' ) ;
$ ( '#ownerPass Button' ) . prop ( 'checked' , true ) ;
}
}
} ) ;
@ -1430,13 +1435,13 @@ function initVroom(room) {
var who = ( peers [ data . id ] . hasName ) ? peers [ data . id ] . displayName : locale . A _ROOM _ADMIN ;
if ( data . payload . action == 'set' ) {
$ . notify ( sprintf ( locale . OWNER _PASSWORD _CHANGED _BY _s , stringEscape ( who ) ) , 'info' ) ;
$ ( '#persistent Label' ) . addClass ( 'btn-danger active' ) ;
$ ( '#persistent Button' ) . prop ( 'checked' , true ) ;
$ ( '#ownerPass Label' ) . addClass ( 'btn-danger active' ) ;
$ ( '#ownerPass Button' ) . prop ( 'checked' , true ) ;
}
else {
$ . notify ( sprintf ( locale . OWNER _PASSWORD _REMOVED _BY _s , stringEscape ( who ) ) , 'info' ) ;
$ ( '#persistent Label' ) . removeClass ( 'btn-danger active' ) ;
$ ( '#persistent Button' ) . prop ( 'checked' , false ) ;
$ ( '#ownerPass Label' ) . removeClass ( 'btn-danger active' ) ;
$ ( '#ownerPass Button' ) . prop ( 'checked' , false ) ;
}
}
else {
@ -1983,15 +1988,15 @@ function initVroom(room) {
}
} ) ;
$ ( '#persistent Button' ) . change ( function ( ) {
$ ( '#ownerPass Button' ) . change ( function ( ) {
var action = ( $ ( this ) . is ( ':checked' ) ) ? 'set' : 'unset' ;
if ( action == 'set' ) {
$ ( '#persistent Modal' ) . modal ( 'show' ) ;
$ ( '#ownerPass Modal' ) . modal ( 'show' ) ;
// Uncheck the button now
// so it's not inconsistent if we just close the modal dialog
// submitting the form will recheck it
$ ( '#persistent Button' ) . prop ( 'checked' , false ) ;
$ ( '#persistent Label' ) . removeClass ( 'active' ) ;
$ ( '#ownerPass Button' ) . prop ( 'checked' , false ) ;
$ ( '#ownerPass Label' ) . removeClass ( 'active' ) ;
}
else {
$ . ajax ( {
@ -2008,7 +2013,7 @@ function initVroom(room) {
if ( data . status == 'success' ) {
$ . notify ( data . msg , 'info' ) ;
webrtc . sendToAll ( 'owner_password' , { action : 'remove' } ) ;
$ ( '#persistent Label' ) . removeClass ( 'btn-danger active' ) ;
$ ( '#ownerPass Label' ) . removeClass ( 'btn-danger active' ) ;
}
else {
$ . notify ( data . msg , 'error' ) ;
@ -2019,7 +2024,7 @@ function initVroom(room) {
}
} ) ;
$ ( '#persistent Form' ) . submit ( function ( event ) {
$ ( '#ownerPass Form' ) . submit ( function ( event ) {
event . preventDefault ( ) ;
var pass = $ ( '#ownerPass' ) . val ( ) ;
var pass2 = $ ( '#ownerPassConfirm' ) . val ( ) ;
@ -2034,15 +2039,15 @@ function initVroom(room) {
} ,
error : function ( ) {
$ . notify ( locale . ERROR _OCCURRED , 'error' ) ;
$ ( '#persistent Label' ) . removeClass ( 'btn-danger active' ) ;
$ ( '#ownerPass Label' ) . removeClass ( 'btn-danger active' ) ;
} ,
success : function ( data ) {
$ ( '#ownerPass' ) . val ( '' ) ;
$ ( '#ownerPassConfirm' ) . val ( '' ) ;
if ( data . status == 'success' ) {
$ ( '#persistent Modal' ) . modal ( 'hide' ) ;
$ ( '#persistent Label' ) . addClass ( 'btn-danger active' ) ;
$ ( '#persistent Button' ) . prop ( 'checked' , true ) ;
$ ( '#ownerPass Modal' ) . modal ( 'hide' ) ;
$ ( '#ownerPass Label' ) . addClass ( 'btn-danger active' ) ;
$ ( '#ownerPass Button' ) . prop ( 'checked' , true ) ;
$ . notify ( data . msg , 'info' ) ;
webrtc . sendToAll ( 'owner_password' , { action : 'set' } ) ;
}
@ -2224,7 +2229,7 @@ function initVroom(room) {
} ) ;
// Empty password fields on modal dismiss
$ ( '#joinPassModal,#persistent Modal' ) . on ( 'hide.bs.modal' , function ( ) {
$ ( '#joinPassModal,#ownerPass Modal' ) . on ( 'hide.bs.modal' , function ( ) {
$ ( this ) . find ( ':input' ) . val ( '' ) ;
} ) ;