Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix placeholder focus on ie7/8

  • Loading branch information...
commit 0736795efdabfbff3d0772fcb679166196937e2b 1 parent 185975c
@nihco2 nihco2 authored
View
3  dist/js/generic_autocomplete.js
@@ -149,8 +149,7 @@ tetra.controller.register("autocomplete", {
havingSuggestion = !0;
break;
}
- if (!havingSuggestion) return me._container.removeClass("active"), _(me._menu).empty(),
- void 0;
+ if (!havingSuggestion) return me._container.removeClass("active"), void _(me._menu).empty();
@slyg Owner
slyg added a note

Wha, wha, why this :alien: void ?

@redking
redking added a note

I've seen this before as an alternative to using 'undefined', because in JavaScript you can redefine the keyword 'undefined' if you want to

@slyg Owner
slyg added a note

This line is so so weird I've never seen that before, even the return <expression>, <expression> seems not to be a valid one.

@redking
redking added a note

It'll just return the last expression, I think. But it's a very bad idea to write a return like that.

@tregagnon Collaborator

If I am correct, you can separate expressions using a comma. Some people prefer this condensed syntax.

@slyg Owner
slyg added a note

Well, it's a built code, the source is different.

@tregagnon Collaborator

I guess it's OK for minified code. But I have seen some people arguing that the comma is perfectly fine for daily programming. It's a bit like "you don't need semicolons".

@slyg Owner
slyg added a note

Right ;) I've read the code without seeing the context, if it's a machine speaking to another machine I'm fine with it.

@redking
redking added a note

I guess void 0 is a semi-useful trick to know, in the rare case when you're afraid that undefined might be redefined by someone. It's not an issue in strict mode by the way, as far as I remember

@thaume
thaume added a note

team understanding the code > saving 1 line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
var suggestions = {};
suggestions.data = suggestionsPack.data.completion, suggestions.query = me._input.val(),
me._boldifyTerms && (suggestions = me.methods.suggestions.boldify(suggestions)),
View
4 dist/js/maps.js
@@ -46,13 +46,13 @@ tetra.controller.register("api", {
if ("undefined" != typeof params.address) geocoder.geocode({
address: params.address
}, function(results, status) {
- return status !== google.maps.GeocoderStatus.OK ? params.cbk(null) : params.cbk(results[0]);
+ return params.cbk(status !== google.maps.GeocoderStatus.OK ? null : results[0]);
}); else if ("undefined" != typeof params.latLng) {
var latlng = new google.maps.LatLng(params.latLng[0], params.latLng[1]);
geocoder.geocode({
location: latlng
}, function(results, status) {
- return status !== google.maps.GeocoderStatus.OK ? params.cbk(null) : params.cbk(results[1].formatted_address);
+ return params.cbk(status !== google.maps.GeocoderStatus.OK ? null : results[1].formatted_address);
});
}
}
View
2  dist/js/min/generic_autocomplete.min.js
@@ -1,3 +1,3 @@
/*! tetra-ui v1.4.8 - 2014 | (MIT Licence) (c) Viadeo/APVO Corp - inspired by Bootstrap (c) Twitter, Inc. (Apache 2 Licence) */
-tetra.controller.register("autocomplete",{scope:"generic_autocomplete",use:["autocomplete"],constr:function(a,b,c,d){"use strict";return{events:{model:{autocomplete:{append:function(a){b.notify("display suggestions",a[0].get("completion"))}}},view:{"do query":function(b){b.uriParams={url:b.url},a.methods.startCountDown(function(){d("autocomplete").fetch(b)},b)},"autocompleteGeneric : click on suggestion":function(a){c.notify("autocompleteGeneric : click on suggestion",a)}}},methods:{init:function(){a.defaultTypingDelay=150,a.countDown=null},startCountDown:function(b,c){a.countDown&&window.clearTimeout(a.countDown);var d="undefined"!=typeof c.typingDelay?c.typingDelay:a.defaultTypingDelay;a.countDown=window.setTimeout(b,d,c)}}}}}),tetra.model.register("autocomplete",{scope:"generic_autocomplete",req:{fetch:{url:"{0}",uriParams:["url"],parser:function(a,b,c){return a.id=c.id,b[c.uriParams.url]={id:c.id,completion:a},b}}},attr:{completion:{}},methods:function(){return{validate:function(a,b){return b}}}}),tetra.view.register("autocomplete",{scope:"generic_autocomplete",use:["autocomplete"],constr:function(a,b,c){"use strict";return{events:{user:{keydown:{".autocomplete input":function(b,c){switch(a.methods.reinit(c),b.which){case 13:c=a._container.find(".autocomplete-menu li.active");var d=a._containerId;c.length&&(b.preventDefault(),a.methods.suggestions.clickOnSuggestion(c)),a.methods.suggestions.hide(d);break;case 38:case 40:b.preventDefault()}}},keyup:{".autocomplete input":function(b,c){switch(a.methods.reinit(c),b.which){case 37:case 39:a._container.hasClass("active")||a.methods.suggestions.doQuery(c,!1);break;case 13:break;case 27:a.methods.suggestions.hide(a._containerId);break;case 38:a.methods.suggestions.select("previous");break;case 40:a.methods.suggestions.select("next");break;default:c.val().length>=parseInt(a._container.attr("data-min-length"),10)&&(a._sts=a._sts>0?a._sts:(new Date).getTime(),a.methods.suggestions.doQuery(c,!0)),0===c.val().length&&(a._sts=0,a.methods.suggestions.hide(a._containerId))}}},focus:{".autocomplete input":function(b,c){a._containerId=null,a.methods.reinit(c),c.val().length>=parseInt(a._container.attr("data-min-length"),10)&&a.methods.suggestions.doQuery(c,!0)}},blur:{".autocomplete input":function(b,c){var d=a._containerId;a.methods.reinit(c),window.setTimeout(function(){a.methods.suggestions.hide(d)},200)}},mouseover:{".autocomplete .autocomplete-menu li":function(a,b){b.addClass("active").siblings().removeClass("active")}},click:{".autocomplete .autocomplete-menu li":function(b,c){var d=a._containerId;a.methods.suggestions.clickOnSuggestion(c),a.methods.suggestions.hide(d)}}},controller:{"display suggestions":function(d){var e=!1;for(var f in d.data.completion){e=!0;break}if(!e)return a._container.removeClass("active"),c(a._menu).empty(),void 0;var g={};g.data=d.data.completion,g.query=a._input.val(),a._boldifyTerms&&(g=a.methods.suggestions.boldify(g)),b.exec(a._templateRef,g,function(b){c(a._menu).html(b)}),a._container.attr("data-no-default")||a._menu.find("li:first-child").addClass("active"),a._container.addClass("active")},"display value":function(b){a._input.val(b.value),a.methods.suggestions.hide(a._containerId)}}},methods:{init:function(){a._param="%param%",a._containerId=null,a._sts=0},reinit:function(b){a._containerId||(a._containerId=c(b.parents(".autocomplete"))[0].id,a._container=c("#"+a._containerId),a._paramName=a._container.attr("data-param")||"param",a._input=a._container.find("input"),a._menu=a._container.find("#"+a._container.attr("data-suggest-container-id")),a._templateRef=a._container.attr("data-suggest-template-ref"),a._boldifyTerms=a._container.attr("data-boldify")?a._container.attr("data-boldify").split(","):0,0===c("#tmpl_"+a._templateRef).length&&(a._templateRef=a._templateRef.substring(0,a._templateRef.indexOf("_"))+"_1"))},suggestions:{select:function(b){var c,d=a._container.find(".autocomplete-menu li"),e=d.filter(".active").removeClass("active").index();e+="next"===b?1:-1,e>=d.length&&(e=0),c=d.eq(e),c.addClass("active"),c.hasClass("no-highlight")&&a.methods.suggestions.select(b)},boldify:function(b){var c,d,e,f,g=a._boldifyTerms.length,h=new RegExp("("+b.query+")","gi");for(e in b.data)for(c=b.data[e],f=0;g>f;f++)d=a._boldifyTerms[f],b.data[e][d]=c[d].replace(h,"<b>$1</b>");return b},hide:function(a){c("#"+a).removeClass("active")},replaceParam:function(b,c){return b.replace(a._param,c)},clickOnSuggestion:function(d){var e=c.trim(c(d.find(".value")).text());"undefined"!=typeof e&&e.length>0&&a._input.val(e),b.notify("autocompleteGeneric : click on suggestion",d[0]),a._containerId=null},doQuery:function(d,e){var f=d.val(),g=a.methods.suggestions.replaceParam(a._container.attr("data-url"),f),h={url:g,id:a._containerId};e&&(h.typingDelay=a._container.attr("data-typing-delay")||void 0),h[a._paramName]=f,"quicksearch-input"===d.prop("id")&&(d.attr("data-sts",a._sts),h.sts=a._sts);var i;if(d.hasClass("schoolDepartment")){if(i=c(d.parents(".core-form"))[0],c(i).find("#schoolId").val(""),h.itemName=c(i).find(".autocompleteSchool").val(),h.itemName.blank())return;h.town=c(i).find("input.town").val()}else d.hasClass("autocompleteSchool")&&(i=c(d.parents(".core-form"))[0],c(i).find("#schoolId").val(""),c(i).find("input.town").val(""));b.notify("do query",h)}}}}}});
+tetra.controller.register("autocomplete",{scope:"generic_autocomplete",use:["autocomplete"],constr:function(a,b,c,d){"use strict";return{events:{model:{autocomplete:{append:function(a){b.notify("display suggestions",a[0].get("completion"))}}},view:{"do query":function(b){b.uriParams={url:b.url},a.methods.startCountDown(function(){d("autocomplete").fetch(b)},b)},"autocompleteGeneric : click on suggestion":function(a){c.notify("autocompleteGeneric : click on suggestion",a)}}},methods:{init:function(){a.defaultTypingDelay=150,a.countDown=null},startCountDown:function(b,c){a.countDown&&window.clearTimeout(a.countDown);var d="undefined"!=typeof c.typingDelay?c.typingDelay:a.defaultTypingDelay;a.countDown=window.setTimeout(b,d,c)}}}}}),tetra.model.register("autocomplete",{scope:"generic_autocomplete",req:{fetch:{url:"{0}",uriParams:["url"],parser:function(a,b,c){return a.id=c.id,b[c.uriParams.url]={id:c.id,completion:a},b}}},attr:{completion:{}},methods:function(){return{validate:function(a,b){return b}}}}),tetra.view.register("autocomplete",{scope:"generic_autocomplete",use:["autocomplete"],constr:function(a,b,c){"use strict";return{events:{user:{keydown:{".autocomplete input":function(b,c){switch(a.methods.reinit(c),b.which){case 13:c=a._container.find(".autocomplete-menu li.active");var d=a._containerId;c.length&&(b.preventDefault(),a.methods.suggestions.clickOnSuggestion(c)),a.methods.suggestions.hide(d);break;case 38:case 40:b.preventDefault()}}},keyup:{".autocomplete input":function(b,c){switch(a.methods.reinit(c),b.which){case 37:case 39:a._container.hasClass("active")||a.methods.suggestions.doQuery(c,!1);break;case 13:break;case 27:a.methods.suggestions.hide(a._containerId);break;case 38:a.methods.suggestions.select("previous");break;case 40:a.methods.suggestions.select("next");break;default:c.val().length>=parseInt(a._container.attr("data-min-length"),10)&&(a._sts=a._sts>0?a._sts:(new Date).getTime(),a.methods.suggestions.doQuery(c,!0)),0===c.val().length&&(a._sts=0,a.methods.suggestions.hide(a._containerId))}}},focus:{".autocomplete input":function(b,c){a._containerId=null,a.methods.reinit(c),c.val().length>=parseInt(a._container.attr("data-min-length"),10)&&a.methods.suggestions.doQuery(c,!0)}},blur:{".autocomplete input":function(b,c){var d=a._containerId;a.methods.reinit(c),window.setTimeout(function(){a.methods.suggestions.hide(d)},200)}},mouseover:{".autocomplete .autocomplete-menu li":function(a,b){b.addClass("active").siblings().removeClass("active")}},click:{".autocomplete .autocomplete-menu li":function(b,c){var d=a._containerId;a.methods.suggestions.clickOnSuggestion(c),a.methods.suggestions.hide(d)}}},controller:{"display suggestions":function(d){var e=!1;for(var f in d.data.completion){e=!0;break}if(!e)return a._container.removeClass("active"),void c(a._menu).empty();var g={};g.data=d.data.completion,g.query=a._input.val(),a._boldifyTerms&&(g=a.methods.suggestions.boldify(g)),b.exec(a._templateRef,g,function(b){c(a._menu).html(b)}),a._container.attr("data-no-default")||a._menu.find("li:first-child").addClass("active"),a._container.addClass("active")},"display value":function(b){a._input.val(b.value),a.methods.suggestions.hide(a._containerId)}}},methods:{init:function(){a._param="%param%",a._containerId=null,a._sts=0},reinit:function(b){a._containerId||(a._containerId=c(b.parents(".autocomplete"))[0].id,a._container=c("#"+a._containerId),a._paramName=a._container.attr("data-param")||"param",a._input=a._container.find("input"),a._menu=a._container.find("#"+a._container.attr("data-suggest-container-id")),a._templateRef=a._container.attr("data-suggest-template-ref"),a._boldifyTerms=a._container.attr("data-boldify")?a._container.attr("data-boldify").split(","):0,0===c("#tmpl_"+a._templateRef).length&&(a._templateRef=a._templateRef.substring(0,a._templateRef.indexOf("_"))+"_1"))},suggestions:{select:function(b){var c,d=a._container.find(".autocomplete-menu li"),e=d.filter(".active").removeClass("active").index();e+="next"===b?1:-1,e>=d.length&&(e=0),c=d.eq(e),c.addClass("active"),c.hasClass("no-highlight")&&a.methods.suggestions.select(b)},boldify:function(b){var c,d,e,f,g=a._boldifyTerms.length,h=new RegExp("("+b.query+")","gi");for(e in b.data)for(c=b.data[e],f=0;g>f;f++)d=a._boldifyTerms[f],b.data[e][d]=c[d].replace(h,"<b>$1</b>");return b},hide:function(a){c("#"+a).removeClass("active")},replaceParam:function(b,c){return b.replace(a._param,c)},clickOnSuggestion:function(d){var e=c.trim(c(d.find(".value")).text());"undefined"!=typeof e&&e.length>0&&a._input.val(e),b.notify("autocompleteGeneric : click on suggestion",d[0]),a._containerId=null},doQuery:function(d,e){var f=d.val(),g=a.methods.suggestions.replaceParam(a._container.attr("data-url"),f),h={url:g,id:a._containerId};e&&(h.typingDelay=a._container.attr("data-typing-delay")||void 0),h[a._paramName]=f,"quicksearch-input"===d.prop("id")&&(d.attr("data-sts",a._sts),h.sts=a._sts);var i;if(d.hasClass("schoolDepartment")){if(i=c(d.parents(".core-form"))[0],c(i).find("#schoolId").val(""),h.itemName=c(i).find(".autocompleteSchool").val(),h.itemName.blank())return;h.town=c(i).find("input.town").val()}else d.hasClass("autocompleteSchool")&&(i=c(d.parents(".core-form"))[0],c(i).find("#schoolId").val(""),c(i).find("input.town").val(""));b.notify("do query",h)}}}}}});
View
2  dist/js/min/maps.min.js
@@ -1,3 +1,3 @@
/*! tetra-ui v1.4.8 - 2014 | (MIT Licence) (c) Viadeo/APVO Corp - inspired by Bootstrap (c) Twitter, Inc. (Apache 2 Licence) */
-tetra.controller.register("api",{scope:"maps",constr:function(a,b,c){return{events:{view:{"maps: load api":function(b){a.methods.loadscript(b)},"maps: api loaded":function(a){c.notify("maps: api loaded",a)}},controller:{"maps: load api":function(b){a.methods.loadscript(b)}}},methods:{init:function(){},loadscript:function(a){var b=a.key?a.key:"",c=a.version?a.version:"3",d=a.language?a.language:"",e=a.libraries?a.libraries:"",f="http://maps.googleapis.com/maps/api/js?",g=document.createElement("script");g.type="text/javascript",g.src=f+"key="+b+"&v="+c+"&language="+d+"&libraries="+e+"&sensor=false&callback=mapsApiLoaded",document.body.appendChild(g),window.mapsApiLoaded=function(){tetra.controller.notify("maps: api loaded",a,"maps");try{delete window.mapsApiLoaded}catch(b){}}}}}}}),tetra.controller.register("geocode",{scope:"maps",constr:function(){return{events:{controller:{"maps: geocode":function(a){if("undefined"!=typeof google){var b=new google.maps.Geocoder;if("undefined"!=typeof a.address)b.geocode({address:a.address},function(b,c){return c!==google.maps.GeocoderStatus.OK?a.cbk(null):a.cbk(b[0])});else if("undefined"!=typeof a.latLng){var c=new google.maps.LatLng(a.latLng[0],a.latLng[1]);b.geocode({location:c},function(b,c){return c!==google.maps.GeocoderStatus.OK?a.cbk(null):a.cbk(b[1].formatted_address)})}}}}}}}}),tetra.controller.register("itinerary",{scope:"maps",constr:function(a,b,c){return{events:{controller:{"maps: api loaded":function(){a.directionsDisplay={},a.directionsService={}},"maps: set itinerary":function(b){if("undefined"!=typeof google){var c=b.origin,d=b.destination,e=b.mode,f=b.mapId,g=b.cbk;a.methods.start_service(b);var h={origin:c,destination:d,travelMode:google.maps.TravelMode[e],durationInTraffic:!0};a.directionsDisplay[f].setDirections({routes:[]}),a.directionsService.route(h,function(b,c){c===google.maps.DirectionsStatus.OK&&a.directionsDisplay[f].setDirections(b),g(b,c)})}},"maps: unset itinerary":function(b){a.directionsDisplay[b].setDirections({routes:[]})}}},methods:{start_service:function(b){a.directionsDisplay[b.mapId]||(a.directionsService=new google.maps.DirectionsService,c.notify("maps: get map",{mapId:b.mapId,cbk:function(c){a.directionsDisplay[b.mapId]=new google.maps.DirectionsRenderer,a.directionsDisplay[b.mapId].setMap(c),b.panelId&&a.directionsDisplay[b.mapId].setPanel(document.getElementById(b.panelId))}}))}}}}}),tetra.controller.register("map",{scope:"maps",constr:function(a){return{events:{controller:{"maps: api loaded":function(b){a.maps={},a.markers={},a.infoWindow={},a.center={},a.bounds={},a.markerPath=b.marker||"/v_img/global/marker.png"},"maps: set map":function(b){if("undefined"!=typeof google){var c={zoom:12,zoomControl:!0,streetViewControl:!0,streetViewControlOptions:{position:google.maps.ControlPosition.RIGHT_TOP},zoomControlOptions:{style:google.maps.ZoomControlStyle.SMALL},mapTypeControl:!1,mapTypeId:google.maps.MapTypeId.ROADMAP},d=new google.maps.Map(document.getElementById(b.mapId),c);a.markers[b.mapId]=[],a.center[b.mapId]=d.getCenter(),a.bounds[b.mapId]=new google.maps.LatLngBounds,a.maps[b.mapId]=d,a.infoWindow[b.mapId]=new google.maps.InfoWindow({maxWidth:300,pixelOffset:new google.maps.Size(-10,0)}),google.maps.visualRefresh=!0,a.methods.setStyle_314(d),document.getElementById(b.mapId).style.lineHeight="normal"}},"maps: set options":function(b){a.maps[b.mapId].setOptions(b.options)},"maps: get map":function(b){b.cbk(a.maps[b.mapId])},"maps: set marker":function(b){var c=new google.maps.Marker({map:a.maps[b.mapId],position:new google.maps.LatLng(b.latLng[0],b.latLng[1]),title:b.title});c.setIcon(a.methods.getIcons().icon()),c.setShape(a.methods.getIcons().shape()),b.infoWindow&&a.methods.setInfoWindow({mapId:b.mapId,marker:c,content:b.infoWindow.content,event:b.infoWindow.event}),a.bounds[b.mapId].extend(new google.maps.LatLng(b.latLng[0],b.latLng[1])),a.markers[b.mapId].push(c),b.cbk&&b.cbk(c)},"maps: unset marker":function(a){a.setMap(null)},"maps: unset markers":function(b){for(var c=a.markers[b],d=0,e=c.length;e>d;d++)c[d].setMap(null)},"maps: get markers":function(b){b.cbk(a.markers[b.mapId])},"maps: set center":function(b){a.maps[b.mapId].setCenter(new google.maps.LatLng(b.latLng[0],b.latLng[1])),a.center[b.mapId]=a.maps[b.mapId].getCenter()},"maps: fit bounds":function(b){a.markers[b].length>0&&(a.maps[b].fitBounds(a.bounds[b]),google.maps.event.addListenerOnce(a.maps[b],"bounds_changed",function(){a.maps[b].setZoom(Math.min(12,Math.max(2,a.maps[b].getZoom())))}),a.center[b]=a.bounds[b].getCenter())},"maps: set bounds":function(b){a.bounds[b.mapId]=new google.maps.LatLngBounds(b.latLng[0],b.latLng[1])},"maps: set zoom":function(b){a.maps[b.mapId].setZoom(b.zoom)},"maps: set infoWindow":function(b){a.methods.setInfoWindow(b)}}},methods:{setInfoWindow:function(b){google.maps.event.addListenerOnce(a.maps[b.mapId],"idle",function(){"string"==typeof b.content&&""!==b.content&&(google.maps.event.addListener(b.marker,"click",function(){a.infoWindow[b.mapId].setContent(b.content),a.infoWindow[b.mapId].open(a.maps[b.mapId],b.marker)}),google.maps.event.addListener(a.infoWindow[b.mapId],"closeclick",function(){a.maps[b.mapId].panTo(a.center[b.mapId])}),"string"==typeof b.event&&"onload"===b.event&&setTimeout(function(){google.maps.event.trigger(b.marker,"click")},100))})},getIcons:function(){return{icon:function(){return new google.maps.MarkerImage(a.markerPath,new google.maps.Size(50,45),new google.maps.Point(0,0),new google.maps.Point(25,45))},shape:function(){return{coord:[22,0,25,1,28,2,29,3,30,4,32,5,32,6,33,7,34,8,35,9,35,10,35,11,36,12,36,13,36,14,37,15,37,16,37,17,37,18,37,19,37,20,37,21,37,22,36,23,36,24,36,25,35,26,35,27,35,28,34,29,33,30,33,31,32,32,32,33,31,34,30,35,30,36,29,37,29,38,28,39,27,40,27,41,26,42,26,43,25,44,24,45,24,46,23,47,23,48,22,49,19,50,18,50,15,49,14,48,14,47,13,46,13,45,12,44,11,43,11,42,10,41,10,40,9,39,8,38,8,37,7,36,7,35,6,34,5,33,5,32,4,31,4,30,3,29,2,28,2,27,2,26,1,25,1,24,1,23,0,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,1,14,1,13,1,12,2,11,2,10,2,9,3,8,4,7,5,6,5,5,7,4,8,3,9,2,12,1,15,0,22,0],type:"poly"}}}},setStyle_314:function(a){var b=[{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{hue:"#ff8800"},{gamma:1},{saturation:-87},{lightness:29}]},{featureType:"road",elementType:"geometry.fill",stylers:[{lightness:100}]},{featureType:"road.highway",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"road.local",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative.locality",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{hue:"#d9ccbe"}]},{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{visibility:"on"},{lightness:0},{color:"#c8df9f"}]}];a.setOptions({styles:b})},setStyle:function(a){var b=[{featureType:"landscape",stylers:[{visibility:"off"}]},{featureType:"landscape.natural",elementType:"geometry",stylers:[{visibility:"on"},{color:"#e8e0d8"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#73b6e6"}]},{featureType:"water",elementType:"labels",stylers:[{color:"#2a75aa"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{lightness:100},{weight:2}]},{featureType:"road",elementType:"geometry.fill",stylers:[{lightness:100}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{hue:"#ff8800"},{gamma:1},{saturation:-87},{lightness:29}]},{featureType:"road.highway",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{lightness:100}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{hue:"#ff8800"},{gamma:1},{saturation:-87},{lightness:29}]},{featureType:"road.arterial",elementType:"labels.text.fill",stylers:[{color:"#000000"}]},{featureType:"road.arterial",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{hue:"0xffffff"},{lightness:100},{weight:2.5}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"road.local",elementType:"labels.text.fill",stylers:[{color:"#7a7a7a"}]},{featureType:"road.local",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative.country",elementType:"geometry",stylers:[{visibility:"on"},{color:"#5b5b5b"},{weight:.5}]},{featureType:"administrative.country",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{lightness:100},{weight:3}]},{featureType:"administrative.locality",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative.locality",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{lightness:100},{weight:4.9}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#d9ccbe"}]},{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{visibility:"on"},{lightness:0},{color:"#c8df9f"}]}];a.setOptions({styles:b})}}}}}),tetra.controller.register("places",{scope:"maps",constr:function(){return{events:{controller:{"maps: places":function(){}}},methods:{init:function(){}}}}});
+tetra.controller.register("api",{scope:"maps",constr:function(a,b,c){return{events:{view:{"maps: load api":function(b){a.methods.loadscript(b)},"maps: api loaded":function(a){c.notify("maps: api loaded",a)}},controller:{"maps: load api":function(b){a.methods.loadscript(b)}}},methods:{init:function(){},loadscript:function(a){var b=a.key?a.key:"",c=a.version?a.version:"3",d=a.language?a.language:"",e=a.libraries?a.libraries:"",f="http://maps.googleapis.com/maps/api/js?",g=document.createElement("script");g.type="text/javascript",g.src=f+"key="+b+"&v="+c+"&language="+d+"&libraries="+e+"&sensor=false&callback=mapsApiLoaded",document.body.appendChild(g),window.mapsApiLoaded=function(){tetra.controller.notify("maps: api loaded",a,"maps");try{delete window.mapsApiLoaded}catch(b){}}}}}}}),tetra.controller.register("geocode",{scope:"maps",constr:function(){return{events:{controller:{"maps: geocode":function(a){if("undefined"!=typeof google){var b=new google.maps.Geocoder;if("undefined"!=typeof a.address)b.geocode({address:a.address},function(b,c){return a.cbk(c!==google.maps.GeocoderStatus.OK?null:b[0])});else if("undefined"!=typeof a.latLng){var c=new google.maps.LatLng(a.latLng[0],a.latLng[1]);b.geocode({location:c},function(b,c){return a.cbk(c!==google.maps.GeocoderStatus.OK?null:b[1].formatted_address)})}}}}}}}}),tetra.controller.register("itinerary",{scope:"maps",constr:function(a,b,c){return{events:{controller:{"maps: api loaded":function(){a.directionsDisplay={},a.directionsService={}},"maps: set itinerary":function(b){if("undefined"!=typeof google){var c=b.origin,d=b.destination,e=b.mode,f=b.mapId,g=b.cbk;a.methods.start_service(b);var h={origin:c,destination:d,travelMode:google.maps.TravelMode[e],durationInTraffic:!0};a.directionsDisplay[f].setDirections({routes:[]}),a.directionsService.route(h,function(b,c){c===google.maps.DirectionsStatus.OK&&a.directionsDisplay[f].setDirections(b),g(b,c)})}},"maps: unset itinerary":function(b){a.directionsDisplay[b].setDirections({routes:[]})}}},methods:{start_service:function(b){a.directionsDisplay[b.mapId]||(a.directionsService=new google.maps.DirectionsService,c.notify("maps: get map",{mapId:b.mapId,cbk:function(c){a.directionsDisplay[b.mapId]=new google.maps.DirectionsRenderer,a.directionsDisplay[b.mapId].setMap(c),b.panelId&&a.directionsDisplay[b.mapId].setPanel(document.getElementById(b.panelId))}}))}}}}}),tetra.controller.register("map",{scope:"maps",constr:function(a){return{events:{controller:{"maps: api loaded":function(b){a.maps={},a.markers={},a.infoWindow={},a.center={},a.bounds={},a.markerPath=b.marker||"/v_img/global/marker.png"},"maps: set map":function(b){if("undefined"!=typeof google){var c={zoom:12,zoomControl:!0,streetViewControl:!0,streetViewControlOptions:{position:google.maps.ControlPosition.RIGHT_TOP},zoomControlOptions:{style:google.maps.ZoomControlStyle.SMALL},mapTypeControl:!1,mapTypeId:google.maps.MapTypeId.ROADMAP},d=new google.maps.Map(document.getElementById(b.mapId),c);a.markers[b.mapId]=[],a.center[b.mapId]=d.getCenter(),a.bounds[b.mapId]=new google.maps.LatLngBounds,a.maps[b.mapId]=d,a.infoWindow[b.mapId]=new google.maps.InfoWindow({maxWidth:300,pixelOffset:new google.maps.Size(-10,0)}),google.maps.visualRefresh=!0,a.methods.setStyle_314(d),document.getElementById(b.mapId).style.lineHeight="normal"}},"maps: set options":function(b){a.maps[b.mapId].setOptions(b.options)},"maps: get map":function(b){b.cbk(a.maps[b.mapId])},"maps: set marker":function(b){var c=new google.maps.Marker({map:a.maps[b.mapId],position:new google.maps.LatLng(b.latLng[0],b.latLng[1]),title:b.title});c.setIcon(a.methods.getIcons().icon()),c.setShape(a.methods.getIcons().shape()),b.infoWindow&&a.methods.setInfoWindow({mapId:b.mapId,marker:c,content:b.infoWindow.content,event:b.infoWindow.event}),a.bounds[b.mapId].extend(new google.maps.LatLng(b.latLng[0],b.latLng[1])),a.markers[b.mapId].push(c),b.cbk&&b.cbk(c)},"maps: unset marker":function(a){a.setMap(null)},"maps: unset markers":function(b){for(var c=a.markers[b],d=0,e=c.length;e>d;d++)c[d].setMap(null)},"maps: get markers":function(b){b.cbk(a.markers[b.mapId])},"maps: set center":function(b){a.maps[b.mapId].setCenter(new google.maps.LatLng(b.latLng[0],b.latLng[1])),a.center[b.mapId]=a.maps[b.mapId].getCenter()},"maps: fit bounds":function(b){a.markers[b].length>0&&(a.maps[b].fitBounds(a.bounds[b]),google.maps.event.addListenerOnce(a.maps[b],"bounds_changed",function(){a.maps[b].setZoom(Math.min(12,Math.max(2,a.maps[b].getZoom())))}),a.center[b]=a.bounds[b].getCenter())},"maps: set bounds":function(b){a.bounds[b.mapId]=new google.maps.LatLngBounds(b.latLng[0],b.latLng[1])},"maps: set zoom":function(b){a.maps[b.mapId].setZoom(b.zoom)},"maps: set infoWindow":function(b){a.methods.setInfoWindow(b)}}},methods:{setInfoWindow:function(b){google.maps.event.addListenerOnce(a.maps[b.mapId],"idle",function(){"string"==typeof b.content&&""!==b.content&&(google.maps.event.addListener(b.marker,"click",function(){a.infoWindow[b.mapId].setContent(b.content),a.infoWindow[b.mapId].open(a.maps[b.mapId],b.marker)}),google.maps.event.addListener(a.infoWindow[b.mapId],"closeclick",function(){a.maps[b.mapId].panTo(a.center[b.mapId])}),"string"==typeof b.event&&"onload"===b.event&&setTimeout(function(){google.maps.event.trigger(b.marker,"click")},100))})},getIcons:function(){return{icon:function(){return new google.maps.MarkerImage(a.markerPath,new google.maps.Size(50,45),new google.maps.Point(0,0),new google.maps.Point(25,45))},shape:function(){return{coord:[22,0,25,1,28,2,29,3,30,4,32,5,32,6,33,7,34,8,35,9,35,10,35,11,36,12,36,13,36,14,37,15,37,16,37,17,37,18,37,19,37,20,37,21,37,22,36,23,36,24,36,25,35,26,35,27,35,28,34,29,33,30,33,31,32,32,32,33,31,34,30,35,30,36,29,37,29,38,28,39,27,40,27,41,26,42,26,43,25,44,24,45,24,46,23,47,23,48,22,49,19,50,18,50,15,49,14,48,14,47,13,46,13,45,12,44,11,43,11,42,10,41,10,40,9,39,8,38,8,37,7,36,7,35,6,34,5,33,5,32,4,31,4,30,3,29,2,28,2,27,2,26,1,25,1,24,1,23,0,22,0,21,0,20,0,19,0,18,0,17,0,16,0,15,1,14,1,13,1,12,2,11,2,10,2,9,3,8,4,7,5,6,5,5,7,4,8,3,9,2,12,1,15,0,22,0],type:"poly"}}}},setStyle_314:function(a){var b=[{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{hue:"#ff8800"},{gamma:1},{saturation:-87},{lightness:29}]},{featureType:"road",elementType:"geometry.fill",stylers:[{lightness:100}]},{featureType:"road.highway",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"road.local",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative.locality",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{hue:"#d9ccbe"}]},{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{visibility:"on"},{lightness:0},{color:"#c8df9f"}]}];a.setOptions({styles:b})},setStyle:function(a){var b=[{featureType:"landscape",stylers:[{visibility:"off"}]},{featureType:"landscape.natural",elementType:"geometry",stylers:[{visibility:"on"},{color:"#e8e0d8"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#73b6e6"}]},{featureType:"water",elementType:"labels",stylers:[{color:"#2a75aa"}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{lightness:100},{weight:2}]},{featureType:"road",elementType:"geometry.fill",stylers:[{lightness:100}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{hue:"#ff8800"},{gamma:1},{saturation:-87},{lightness:29}]},{featureType:"road.highway",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{lightness:100}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{hue:"#ff8800"},{gamma:1},{saturation:-87},{lightness:29}]},{featureType:"road.arterial",elementType:"labels.text.fill",stylers:[{color:"#000000"}]},{featureType:"road.arterial",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{hue:"0xffffff"},{lightness:100},{weight:2.5}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"road.local",elementType:"labels.text.fill",stylers:[{color:"#7a7a7a"}]},{featureType:"road.local",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative.country",elementType:"geometry",stylers:[{visibility:"on"},{color:"#5b5b5b"},{weight:.5}]},{featureType:"administrative.country",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{lightness:100},{weight:3}]},{featureType:"administrative.locality",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"administrative.locality",elementType:"labels.text.stroke",stylers:[{visibility:"on"},{lightness:100},{weight:4.9}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#d9ccbe"}]},{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{visibility:"on"},{lightness:0},{color:"#c8df9f"}]}];a.setOptions({styles:b})}}}}}),tetra.controller.register("places",{scope:"maps",constr:function(){return{events:{controller:{"maps: places":function(){}}},methods:{init:function(){}}}}});
View
2  dist/js/min/placeholder.min.js
@@ -1,3 +1,3 @@
/*! tetra-ui v1.4.8 - 2014 | (MIT Licence) (c) Viadeo/APVO Corp - inspired by Bootstrap (c) Twitter, Inc. (Apache 2 Licence) */
-tetra.view.register("placeholder",{scope:"placeholder",constr:function(a,b,c){"use strict";return{events:{user:{click:{".placeholding":function(a,b){c(b).addClass("active")}},clickout:{".placeholding":function(a,b){c(b).removeClass("active")}},focus:{".placeholding input, .placeholding textarea":function(a,b){c(b).parent().addClass("active")}},blur:{".placeholding input, .placeholding textarea":function(a,b){c(b).parent().removeClass("active")}},input:{".placeholding input":function(b,c){a.methods.isTyping(c)}},keyup:{".placeholding input, .placeholding textarea":function(b,c){a.methods.isTyping(c)}}},controller:{}},methods:{init:function(){c(document).ready(function(){for(var a=c(".placeholding input, .placeholding textarea"),b=0;b<a.length;b++){var d=a[b];c(d).val().length>0&&c(d).parent().addClass("typing")}})},isTyping:function(a){var b=c(a).parent(),d=c(a).val().length;d>0?b.hasClass("typing")||b.addClass("typing"):b.removeClass("typing")}}}}});
+tetra.view.register("placeholder",{scope:"placeholder",constr:function(a,b,c){"use strict";return{events:{user:{click:{".placeholding":function(a,b){c(b).addClass("active"),(c(".msie7").length||c(".msie8").length)&&c(b).find("input").focus()}},clickout:{".placeholding":function(a,b){c(b).removeClass("active")}},focus:{".placeholding input, .placeholding textarea":function(a,b){c(b).parent().addClass("active")}},blur:{".placeholding input, .placeholding textarea":function(a,b){c(b).parent().removeClass("active")}},input:{".placeholding input":function(b,c){a.methods.isTyping(c)}},keyup:{".placeholding input, .placeholding textarea":function(b,c){a.methods.isTyping(c)}}},controller:{}},methods:{init:function(){c(document).ready(function(){for(var a=c(".placeholding input, .placeholding textarea"),b=0;b<a.length;b++){var d=a[b];c(d).val().length>0&&c(d).parent().addClass("typing")}})},isTyping:function(a){var b=c(a).parent(),d=c(a).val().length;d>0?b.hasClass("typing")||b.addClass("typing"):b.removeClass("typing")}}}}});
View
2  dist/js/placeholder.js
@@ -9,7 +9,7 @@ tetra.view.register("placeholder", {
user: {
click: {
".placeholding": function(e, elm) {
- _(elm).addClass("active");
+ _(elm).addClass("active"), (_(".msie7").length || _(".msie8").length) && _(elm).find("input").focus();
}
},
clickout: {
View
3  src/js/coremvc/comps/placeholder/view/placeholder.ui.js
@@ -11,6 +11,9 @@ tetra.view.register('placeholder', {
'click': {
'.placeholding': function(e, elm) {
_(elm).addClass('active');
+ if(_('.msie7').length || _('.msie8').length){
+ _(elm).find('input').focus();
+ }
}
},
Please sign in to comment.
Something went wrong with that request. Please try again.