!jQuery(this).css('border').match(/none/); var fid = jQuery(this).parent().find('[data-fb-id]').attr('data-fb-id').toString(); v++; if (wotm.friendsGet(fid).visible && selectedUsers.length1){ // dodajemy kolejnego jQuery('.sprocket-tags-Aktywny').find('div.sprocket-padding').each(function(){ var fid = jQuery(this).parent().find('[data-fb-id]').attr('data-fb-id').toString(); if (!wotm.friendsGet(fid).visible) { selectedUsers.push(fid); } }); } console.log('to ten przypadek!'); wotm.showBetween(selectedUsers[0],selectedUsers[1]); wotm.setVisible(selectedUsers[0],true); wotm.setVisible(selectedUsers[1],true); setTimeout(function(){ updateActivity(true); },500); } } else { } if (modeRide){// if (timeInSecounds(new Date(),lastUserUpdate) > 0){ if (selectedUsers.length>1){ if ((lastUpdateId.toString() == selectedUsers[0].toString()) || (lastUpdateId.toString() == selectedUsers[1].toString())){ console.log('update between'); wotm.updateBetween(selectedUsers[0],selectedUsers[1]); wotm.forceRedraw(); } } } // if (}var wotm,lastUserInfo,firstActive=true,firstFromLocal=true;var lastIndexBetween=-2;var modeRide = false;var modeTraining = false;var maxSelected = 100;var selectedUsers = [];var fbShareStatus = 0;var textsTrening = {'Bike':['cycling',''], 'Horse':['horseback',''], 'Jogging':['jogging','jogging'], 'Walking':['on foot','on foot'], 'Motorbike':['motorcycling','motorcycling'], 'Motorcycle':['motorcycling','motorcycling'], 'Rolki':['by rollers','by rollers'], 'Scooter':['by scooter','by scooter'], 'Car':['by car','car riding'], 'Aeroplane':['by plane','flying']};var trainingList;var triggerDay = true;var monthChanged = false;var lastUpdateId = -1;var lastUserUpdate = new Date();var showUserAdd = false;function initApp(){ jQuery(window).load(function(){ wotm = new WhereOnTheMap({ slider:'slider-range', friends: [ [-7.87267,-35.4422,'Fabiano da Silva','951417734960575','2017-06-06 11:39:57'],[-7.87261,-35.4422,'Roselita Regina','796451120533656','2017-06-06 11:29:37']], me:'951417734960575', isMyTraining: true, initWWW:true, mapNoZoomWhenTracking:true, saveOnStorage:true, stopMarkerSize:42, infoBetweenMarkerSize:42, rideMode:modeRide, noSlider:modeTraining, trainingMode:modeTraining, trainingId:0, onChangeVisible:function(f){ if (wotm){ if ((wotm.friendsGet(f.id).position.lat() << 0) == 0 && (wotm.friendsGet(f.id).position.lng() << 0) == 0) return false; } var par = jQuery("div.sprocket-mosaic-item a[data-fb-id='"+ f.id +"']").closest('div').parent(); // if (modeRide){// } else { if (f.visible){ jQuery(par).find('div.sprocket-padding').css({border:''}); jQuery(par).find('.sprocket-mosaic-hovercontent').text('Hide'); } else { f.hideStopsMarkers(); jQuery(par).find('div.sprocket-padding').css({border:'none'}); jQuery(par).find('.sprocket-mosaic-hovercontent').text('Show'); }// } }, onNewData:function(f,result){ lastUpdateId = f.id; updateActivity(); lastUserUpdate = new Date(); if (firstActive){ firstActive = false; jQuery('.sprocket-mosaic-order li:eq(0)').removeClass('active').before(jQuery('li[data-mosaic-orderby="date"]').addClass('active').trigger('click')); if (jQuery('.sprocket-tags-Aktywny').length){ var id = getIDUserNewest(); //wotm.params.friends[wotm.params.friends.length-1][3]; if (selectedUsers.length == 0) { jQuery('[data-fb-id="'+id+'"]').closest('li').find('div.sprocket-mosaic-image-container a').trigger('click'); } else if (selectedUsers.length == 1){ //setTimeout(function(){ google.maps.event.trigger(wotm.friendsGet(id).marker, 'click'); },200); } } } if (f.id == lastUserInfo){ updateUserInfo(f); } }, onNewDataToday:function(f,result){ blinkUser(f); }, onSlide:function(ui){ jQuery('#slider-hours').html(addZero(ui.values[0])+':00-'+addZero(ui.values[1]+1)+':00'); }, onMarkerClick:function(f){ if (!wotm.isToday()) return; clearUserInfo(); if (wotm){ if ((wotm.friendsGet(f.id).position.lat() << 0) == 0 && (wotm.friendsGet(f.id).position.lng() << 0) == 0) return false; } if (lastUserInfo == f.id && !(selectedUsers.length == 1 && selectedUsers[0] == f.id)){ clearUserInfo(); wotm.friendsGet(f.id).hideStopsMarkers(); return; } else { if (lastUserInfo) { wotm.friendsGet(lastUserInfo).hideStopsMarkers(); } } if (selectedUsers.length == 1 && selectedUsers[0] == f.id){ wotm.setTracking(f.id,true); wotm.friendsGet(f.id).showStopsMarkers(); if (showUserAdd) { showUserInfo(f); } showUserAdd=!showUserAdd; } else { lastUserInfo = f.id; wotm.setTracking(f.id,true); showUserInfo(f); wotm.friendsGet(f.id).showStopsMarkers(); } } }); // new WhereOnTheMap jQuery('.sprocket-mosaic ul:first').wrap("");// jQuery('div.scroll-content').wrap('');// jQuery('div.m-scroll-content').after(''); jQuery('.sprocket-mosaic ul:first').after(''); var scrollContent = jQuery('.sprocket-mosaic ul:first'),scrollPane = jQuery('.m-scroll-content'); scrollPane.css({'overflow':'hidden','float':'left','width':scrollContent.css('width')}); jQuery( "#scroll-bar" ).slider({ slide: function( event, ui ) { scrollPaneWidth = Math.max.apply(null,jQuery.map(jQuery('.sprocket-mosaic ul:first li[data-mosaic-item]'),function(n,i){ return (jQuery(n).position().left+jQuery(n).width()); })); if (scrollPaneWidth > scrollPane.width() ) { scrollContent.css( "margin-left", Math.round( -ui.value / 100 * ( scrollPaneWidth - scrollContent.width() ) ) + "px" ); } else { scrollContent.css( "margin-left", 0 ); } }, change:function( event, ui ) { scrollPaneWidth = Math.max.apply(null,jQuery.map(jQuery('.sprocket-mosaic ul:first li[data-mosaic-item]'),function(n,i){ return (jQuery(n).position().left+jQuery(n).width()); })); if (scrollPaneWidth > scrollPane.width() ) { scrollContent.css( "margin-left", Math.round( -ui.value / 100 * ( scrollPaneWidth - scrollContent.width() ) ) + "px" ); } else { scrollContent.css( "margin-left", 0 ); } } }); jQuery('div.scroll-bar-wrap').css({'position':'absolute','bottom':'-5px','width':(scrollContent.width() - 19) + 'px'});// console.log('scrollPaneWidth-scrollContent.width()');// console.log(jQuery('.sprocket-mosaic ul:first li:last').position().left+jQuery('.sprocket-mosaic ul:first li:last').width());// console.log(scrollPaneWidth + ' - ' + scrollContent.width()); initEvents(); jQuery('li.Aktywny').text('ACTIVE'); jQuery('div[data-last-order="1"]').parent().find('h2 a').text('Add'); jQuery('.sprocket-mosaic ul:first').data('drag-load',1); jQuery('.sprocket-mosaic-filter li,span.loadmore-more').on('click',function(){ var int = setInterval(function(){ if (jQuery('.sprocket-mosaic-container li').length > 20){ jQuery('div.sprocket-mosaic-image-container a').unbind('click'); clearInterval(int); setTimeout(initEvents,200); } },200); }); // on click filter,loadmore jQuery('li.Aktywny').click(function() { jQuery('[data-last-order="1"]').closest('li').remove(); }); jQuery('.sprocket-mosaic-filter li.all').click(function(){ var int = setInterval(function(){ if (jQuery('.sprocket-mosaic-container li').length > 20){ clearInterval(int); setTimeout(function() { jQuery('.sprocket-mosaic-order li.active').trigger('click'); // },1200); },1200); } },200); }); jQuery('div.sprocket-mosaic ul').show("fast", function() { //jQuery('.sprocket-mosaic-filter li.all').preBind('click',function(e){ setTimeout(function() {