2014-06-04 19:24:16 +00:00
|
|
|
/* authCanEditMapPage means:
|
|
|
|
1. being logged in and,
|
|
|
|
2. being on a Map page and having edit permissions (your map, or commons map)
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
2014-06-11 20:47:46 +00:00
|
|
|
function bindRealtimeHover() {
|
|
|
|
|
|
|
|
var realtimeIsOpen = false
|
|
|
|
|
|
|
|
// controls the sliding hover of the bottom left menu
|
|
|
|
var sliding1 = false;
|
|
|
|
var lT;
|
|
|
|
|
|
|
|
var closeRealtime = function () {
|
|
|
|
lT = setTimeout(function () {
|
|
|
|
if (!sliding1) {
|
|
|
|
sliding1 = true;
|
|
|
|
$('.sidebarCollaborateIcon').css('background-color', '#0F1519');
|
|
|
|
$('.sidebarCollaborateBox').fadeOut(200, function () {
|
|
|
|
sliding1 = false;
|
|
|
|
realtimeIsOpen = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, 300);
|
|
|
|
}
|
|
|
|
|
|
|
|
var openRealtime = function () {
|
|
|
|
clearTimeout(lT);
|
|
|
|
if (!sliding1) {
|
|
|
|
sliding1 = true;
|
|
|
|
|
|
|
|
// hide the other two
|
|
|
|
$('.sidebarFilterBox').hide();
|
|
|
|
$('.sidebarAccountBox').hide();
|
|
|
|
$('.sidebarFilterIcon').css('background-color', '#0F1519');
|
2014-07-27 19:57:35 +00:00
|
|
|
//$('.sidebarAccountIcon').css('background-color', '#0F1519');
|
2014-06-11 20:47:46 +00:00
|
|
|
|
|
|
|
$('.sidebarCollaborateIcon').css('background-color', '#000');
|
|
|
|
$('.sidebarCollaborateBox').fadeIn(200, function () {
|
|
|
|
sliding1 = false;
|
|
|
|
realtimeIsOpen = true;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// bind the hover events
|
|
|
|
$(".sidebarCollaborate").hover(openRealtime, closeRealtime);
|
|
|
|
} // end bindRealtimeHover
|
|
|
|
|
|
|
|
function bindSaveHover() {
|
|
|
|
var closeSave = function () {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var openSave = function () {
|
|
|
|
// hide the other three
|
|
|
|
$('.sidebarFilterBox, .sidebarAccountBox, .sidebarCollaborateBox').hide();
|
2014-07-27 19:57:35 +00:00
|
|
|
$('.sidebarFilterIcon, .sidebarCollaborateIcon').css('background-color', '#0F1519');
|
2014-06-11 20:47:46 +00:00
|
|
|
}
|
|
|
|
// bind the hover events
|
|
|
|
$(".sidebarSave").hover(openSave, closeSave);
|
|
|
|
} // end bindSaveHover
|
|
|
|
|
|
|
|
// bind hover events
|
|
|
|
bindRealtimeHover();
|
|
|
|
bindSaveHover();
|
|
|
|
|
2014-06-04 19:24:16 +00:00
|
|
|
// because anyone who can edit the map can collaborate on it in realtime
|
2014-06-11 20:47:46 +00:00
|
|
|
$(".realtimeOnOff").click(function (event) {
|
2014-06-04 19:24:16 +00:00
|
|
|
if (!goRealtime) {
|
2014-06-09 20:37:09 +00:00
|
|
|
window.realtime.sendRealtimeOn();
|
2014-06-11 20:47:46 +00:00
|
|
|
$(this).html('ON').removeClass('rtOff').addClass('rtOn');
|
|
|
|
$(".rtMapperSelf").removeClass('littleRtOff').addClass('littleRtOn');
|
2014-06-04 19:24:16 +00:00
|
|
|
} else {
|
2014-06-09 20:37:09 +00:00
|
|
|
window.realtime.sendRealtimeOff();
|
2014-06-11 20:47:46 +00:00
|
|
|
$(this).html('OFF').removeClass('rtOn').addClass('rtOff');
|
|
|
|
$(".rtMapperSelf").removeClass('littleRtOn').addClass('littleRtOff');
|
2014-06-04 19:24:16 +00:00
|
|
|
}
|
|
|
|
goRealtime = !goRealtime;
|
|
|
|
$(".sidebarCollaborateIcon").toggleClass("blue");
|
|
|
|
});
|
2014-06-11 20:47:46 +00:00
|
|
|
|
2014-06-04 19:24:16 +00:00
|
|
|
// because anyone who can edit the map can save a new map layout
|
|
|
|
$('.sidebarSave').click(function () {
|
|
|
|
saveLayoutAll();
|
|
|
|
});
|
2014-06-11 20:47:46 +00:00
|
|
|
|
2014-06-04 19:24:16 +00:00
|
|
|
// because anyone who can edit the map can change the map title
|
|
|
|
$('.mapInfoName .best_in_place_name').bind("ajax:success", function () {
|
|
|
|
var name = $(this).html();
|
|
|
|
$('.mapName').html(name);
|
|
|
|
});
|
2014-06-11 20:47:46 +00:00
|
|
|
|
2014-06-04 19:24:16 +00:00
|
|
|
}); // end document.ready
|