Example #1
0
module.exports = function vehicle(selector) { // eslint-disable-line no-unused-vars
	if ($('body.vehicle').length === 0) {
		Logger.log('vehicleController : nothing to do');
		return;
	}
	Logger.log('vehicleController : initializing');
};
	start : function start() {
		Logger.log(["onBigSmall: start:enter", "isGoing",isGoing,bp_small,bp_big])
		if( isGoing )
			return;
		isGoing = true;
		bp_small = Breakpoints.on({
			name: "SCREEN-SMALL",
			matched: function(){
				if( state !== "SMALL"){
					Logger.log("onBigSmall:start:matched - triggering SMALL")
					$('body').trigger('screen:small')
					state = "SMALL"
				}
			},
			exit : function(){
			}
		})
	
		bp_big = Breakpoints.on({
			name: "SCREEN-MEDIUM",
			matched: function(){
				if( state !== "BIG"){
					Logger.log("onBigSmall:start:matched - triggering BIG")
					$('body').trigger('screen:big')
					state = "BIG"
				}
			},
			exit : function(){
			}
		})			
		Logger.log(["onBigSmall: start:return", "isGoing",isGoing,bp_small,bp_big])
		
	}	
					powerTipPreRender: function() {
						$(this).data('powertip-open','yes')
						var text64 = $(this).attr('data-tooltip')
						var html = base64.decode(text64)
			        	Logger.log('menu tooltip powerPreTipRender', html, text64, this);
			        	$(this).data('powertip' , html);
			    	},
			matched: function(){
				if( state !== "BIG"){
					Logger.log("onBigSmall:start:matched - triggering BIG")
					$('body').trigger('screen:big')
					state = "BIG"
				}
			},
			matched: function(){
				if( state !== "SMALL"){
					Logger.log("onBigSmall:start:matched - triggering SMALL")
					$('body').trigger('screen:small')
					state = "SMALL"
				}
			},
	register : function register(big_cb, small_cb){
		$('body').on('screen:big',function(){
			big_cb()
		})
		$('body').on('screen:small',function(){
			small_cb()
		})
		if(( bp_small !== undefined && bp_small.isMatched !== undefined) && bp_small.isMatched){
			Logger.log("onBigSmall:register:bp_small ")
			small_cb()
		}else if(( bp_big !== undefined && bp_big.isMatched !== undefined) && bp_big.isMatched){
			Logger.log("onBigSmall:register:bp_big ")
			big_cb()
		}else{
			Logger.log(["onBigSmall:register:nothing called ", bp_small,bp_big])
		}
	},
		// going big - turn on tooltip ( but only once - this even is bouncy)
		// use a flag in the #powerTip elements data entry to record starting
		function(){
			var isGoing = ($('#powerTip').data('powerTip-open') !== undefined && $('#powerTip').data('powerTip-open')=="yes" )
			Logger.log(["onBig main menu called", isGoing])
			if( ! isGoing ){
				$('#powerTip').data('powerTip-open','yes').css("width:300px")
				$(selector).powerTip({
					placement: placement,
					fadeInTime: 0,
					fadeOutTime: 0
				})
				$(selector).on({
					// about to render tooltip - give it the content
					powerTipPreRender: function() {
						$(this).data('powertip-open','yes')
						var text64 = $(this).attr('data-tooltip')
						var html = base64.decode(text64)
			        	Logger.log('menu tooltip powerPreTipRender', html, text64, this);
			        	$(this).data('powertip' , html);
			    	},
					powerTipRender : function(){
						var el = $("#powerTip").css("max-width","400px")
						$("#powerTip").css("white-space","normal")
						// $("#powerTip").css("display","table")
						// $("#powerTip").css("word-wrap","break-word")
						// $("#powerTip  p").css("display","block")
						// $("#powerTip p").css("float","left")
						// $("#powerTip p").css("width","300px")
						// $("#powerTip p").css("word-wrap","break-word")
						
						// var w = el.width()
						// var h = el.height()
						// Logger.log(["render", w, h])
						// if( w/h > 3){
						// 	w = w /2
						// 	h = h * 2
						// }
						// Logger.log(["render", w, h])
						// el.width(w)
						// el.height(h)
						Logger.log(["menu tooltip open", this, $("#powerTip")])
						
					},
					powerTipOpen : function(){
						Logger.log(["menu tooltip open", this, $("#powerTip")])
					}
				})
			}
		},
					powerTipRender : function(){
						var el = $("#powerTip").css("max-width","400px")
						$("#powerTip").css("white-space","normal")
						// $("#powerTip").css("display","table")
						// $("#powerTip").css("word-wrap","break-word")
						// $("#powerTip  p").css("display","block")
						// $("#powerTip p").css("float","left")
						// $("#powerTip p").css("width","300px")
						// $("#powerTip p").css("word-wrap","break-word")
						
						// var w = el.width()
						// var h = el.height()
						// Logger.log(["render", w, h])
						// if( w/h > 3){
						// 	w = w /2
						// 	h = h * 2
						// }
						// Logger.log(["render", w, h])
						// el.width(w)
						// el.height(h)
						Logger.log(["menu tooltip open", this, $("#powerTip")])
						
					},
		// going small - turn off tooltip
		function(){
			Logger.log(["onSmall main menu called"])
			$(selector).powerTip('destroy')
			$('#powerTip').data('powerTip-open','no')
		}
					powerTipOpen : function(){
						Logger.log(["menu tooltip open", this, $("#powerTip")])
					}
Example #11
0
			matched: () => {
				Logger.log('vehicleController::Media EXTRA SMALL screen entered');
			},
Example #12
0
			exit : function medExit() {
				Logger.log('vehicleController::Media MEDIUM screen EXIT');
			},
Example #13
0
			matched: function medMatch() {
				Logger.log('vehicleController::Media MEDIUM screen entered');
			},
Example #14
0
			exit : function smallExit() {
				Logger.log('vehicleController::Media SMALL screen EXIT');
			},
Example #15
0
			matched: function smallMatch() {
				Logger.log('vehicleController::Media SMALL screen entered');
			},
Example #16
0
			exit : () => {
				Logger.log('vehicleController::Media EXTRA SMALL screen EXIT');
			},