1/**! 2 * Child Root MAIN script 3 * 4 */ 5if( window.console ) console.log("LOADED -> /main.js"); 6 7 8//*** STICKY NAVBAR 9var navbar = jQuery('.is-sticky'); // qui selettore per il nav 10 11if( navbar ) { 12 var active_ticky = true; 13 //var orig_offset_y = navbar.offset().top; 14 var orig_offset_y = 50; 15 16 //if( window.console ) console.log("sticky -> orig_offset_y: " + orig_offset_y ); 17} 18else { 19 var active_sticky = false; 20} 21 22function stickyNavbar() { 23 24 //if( window.console ) console.log("qui!"); 25 26 if ( jQuery(window).scrollTop() >= orig_offset_y ) { 27 navbar.addClass('nav-sticky'); 28 // if( window.console ) console.log("sticky -> ON -> " + jQuery(window).scrollTop() ); 29 } 30 else { 31 navbar.removeClass('nav-sticky'); 32 //if( window.console ) console.log("sticky -> OFF -> " + jQuery(window).scrollTop() ); 33 } 34} 35 36 37 38 39 40 41 42 43// ** SCROLL PAGE TO SPECIFIED SELECTOR 44function scrollToSelector(selector){ 45 var where = jQuery(selector).offset().top; 46 var offset = 0; 47 jQuery("html,body").animate({scrollTop: where + offset}, 800, function() { 48 // completed animation opts code 49 }); 50 return false; 51} 52 53 54// ** SCROLL PAGE TO SPECIFIED POSITION (PX) 55function scrollToPosition(position){ 56 jQuery("html,body").animate({scrollTop: position}, 800, function() { 57 // completed animation opts code 58 }); 59} 60 61 62 63// ** CUSTOM TRACKING SCRIPT 64function trackGaEvent(category, action, message){ 65 //alert('cat: ' + category + ' - action: ' + action + ' - message: ' + message ); 66 try{ 67 if(typeof _gaq != 'undefined'){ 68 _gaq.push(['_trackEvent', category, action, message]); 69 } 70 } 71 catch(e){ 72 //alert(e.message); 73 } 74} 75 76 77// ** READ VIEWPORT HEIGHT 78function pageHeight(){ 79 var viewportheight; 80 81 // ** The more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerHeight 82 if (typeof window.innerHeight != 'undefined') { 83 viewportheight = window.innerHeight; 84 } 85 // ** IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) 86 else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientHeight != 'undefined' && document.documentElement.clientHeight != 0) { 87 viewportheight = document.documentElement.clientHeight; 88 } 89 // ** Older versions of IE 90 else { 91 viewportheight = document.getElementsByTagName('body')[0].clientHeight; 92 } 93 return viewportheight; 94} 95 96 97 98// ** READ VIEWPORT WIDTH 99function pageWidth() { 100 var viewportwidth; 101 102 // ** The more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth 103 if (typeof window.innerWidth != 'undefined') { 104 viewportwidth = window.innerWidth; 105 } 106 // ** IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) 107 else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { 108 viewportwidth = document.documentElement.clientWidth; 109 } 110 // ** Older versions of IE 111 else { 112 viewportwidth = document.getElementsByTagName('body')[0].clientWidth; 113 } 114 return viewportwidth; 115} 116 117 118 119// * LANCIA ADAPTIVE IMAGE PER OGNI TARGET 120function initAdaptImage( item_target_class ) { 121 // var container_w = false; 122 // if( window.console ) console.log( 'cont w: ' + container_w ); 123 124 jQuery( item_target_class ).each( function() { 125 126 item_this = jQuery(this); 127 changeImageSrc( item_this ); 128 129 }); 130}// --end function 131 132 133// ** ESEGUE ADAPTIVE IMAGE: trova l'immagine della dimensione 134// più adatta e sostituisce il valore del parametro "src" nel target 135function changeImageSrc( target ) { 136 137 var target_item = jQuery( target ); 138 var target_data_src_adaptive = target_item.attr('data-src-adaptive'); 139 var target_tag = jQuery(target).prop("tagName").toLowerCase(); 140 141 //if( window.console ) console.log('tag: ' + target_tag); 142 //if( window.console ) console.log('data: ' + target_data_src_adaptive); 143 144 if( target_tag == 'img' ){ 145 var container = target_item; 146 } 147 else { 148 var container = target_item.parent(); 149 } 150 151 //var container = target_item.parent(); 152 var cont_w = container.width(); 153 154 var img_obj = new Array(); 155 var arrTarget = target_data_src_adaptive.split(","); 156 157 for( i = 0; i < arrTarget.length; i++) { 158 var arrObj = arrTarget[i].split(' '); 159 img_obj[i] = {"path" : arrObj[0],"width": arrObj[1]}; 160 } 161 162 img_obj.sort(function(a, b) { 163 return a.width - b.width; 164 }); 165 166 var cnt = 0; 167 for( key in img_obj ) { 168 cnt++; 169 var path = img_obj[key].path; 170 var width = img_obj[key].width; 171 // if( window.console ) console.log( width + ' ' + cont_w); 172 if ( width >= cont_w || img_obj.length == cnt) { 173 174 //if( window.console ) console.log( '[Cont W: ' + cont_w + '] -> Img w:' + width ); 175 //if( window.console ) console.log( 'Img url:' + path ); 176 //if( window.console ) console.log('Classes: ' + target_item.attr('class')); 177 178 target_item.attr('src', path); 179 180 if( target_tag != 'img' ){ 181 target_item.attr('data-src', path); 182 target_item.css('background-image','url(' + path + ')'); 183 //if( window.console ) console.log('-> container TAG: ' + target_tag ); 184 } 185 break; 186 } 187 } 188}// --end function 189 190 191// ** RESPONSIVE AUTO HEIGHT 192// ** Usare nelle liste con foto + testo affiancati: fa in modo che la foto adatti la sua altezza a quella dei contenuti
193function responsive_auto_height(article_container, ah_breakpoint, bkgr_mode, item_thumb, item_text ) { 194 195 if( typeof ah_breakpoint === 'undefined' ) { 196 ah_breakpoint = 768; 197 } 198 199 if( typeof bkgr_mode === 'undefined' ){ 200 bkgr_mode = true; 201 } 202 203 if( typeof item_thumb === 'undefined' ){ 204 item_thumb = '.entry-thumb'; 205 } 206 207 if( typeof item_text === 'undefined' ){ 208 item_text = '.entry-content'; 209 } 210 211 //if( window.console ) console.log('-> pageWidth(): ' + pageWidth() ); 212 213 //jQuery(article_container).each(function(){ 214 jQuery( article_container + ' article' ).each(function(){ 215 216 var item = jQuery(this); 217 var item_c_thumb = item.find(item_thumb); 218 var item_c_text = item.find(item_text); 219 var item_thumb_h = item_c_text.height(); 220 221 if( pageWidth() > ah_breakpoint ) { 222 223 item_c_thumb.css('height', item_thumb_h); 224 225 if( bkgr_mode == true ) { 226 var item_img_src = item_c_thumb.find('img').attr('src'); 227 //if( window.console ) console.log('img_src: ' + item_img_src); 228 229 item_c_thumb.find('img').css('display','none'); 230 // item_c_thumb.css('background-repeat', 'no-repeat'); 231 // item_c_thumb.css('background-position', '50% 50%'); 232 // item_c_thumb.css('background-size', '100%'); 233 // item_c_thumb.css('background-size', 'cover'); 234 item_c_thumb.css('background-image', 'url("' + item_img_src + '")'); 235 } 236 237 } 238 else { 239 240 item_c_thumb.css('height', 'auto'); 241 item_c_thumb.css('min-height', '0'); 242 item_c_thumb.find('img').css('display','block'); 243 item_c_thumb.css('background-image', 'none'); 244 245 } 246 }); 247 248} 249 250 251 252//*** ON LOAD EVENTS 253jQuery(window).load(function() { 254 255 //... 256 257}); 258 259 260//*** ON READY EVENTS 261jQuery(document).ready(function() { 262 263 264 //*** ON SCROLL EVENTS 265 jQuery(window).scroll(function() { 266 267 // only if window width is greater than Navbar breakpoint 268 if( active_ticky && ( pageWidth() >= pageWidthStickyNavBreakpoint ) ) { 269 stickyNavbar(); 270 } 271 272 }); 273 274 275 //*** ON RESIZE EVENTS 276 jQuery(window).resize(function() { 277 278 //... 279 280 initAdaptImage( '.adaptative-image' ); 281 responsive_auto_height('.autoheight', 767); 282 283 }); 284 285 286 //*** ON RESIZE + TIME EVENTS 287 jQuery(window).bind('resize', function(e) { 288 window.resizeEvt; 289 jQuery(window).resize(function() { 290 clearTimeout(window.resizeEvt); 291 window.resizeEvt = setTimeout(function() { 292 293 //... 294 295 }, 250); 296 }); 297 }); 298 299 300 301 //... 302 303 initAdaptImage( '.adaptative-image' ); 304 responsive_auto_height('.autoheight', 767); 305 306 307 // ** Scroll on click a.scrolltoid 308 jQuery('.scrolltoid').click(function() { 309 310 var target = jQuery(this).find('a').attr('href'); 311 scrollToSelector(target); 312 return false; 313 314 }); 315 316 // ** TIME EXPIRED 317 //jQuery("#cool-carouseluzy2ggd").setTimeout( close_ban(), 15000 ); 318 319 setTimeout( function(){jQuery('#cool-carouseluzy2ggd').addClass('over-close'); } ,10000); 320 321 jQuery('.box-right').click(function() { 322 jQuery('#cool-carouseluzy2ggd').toggleClass('over-close'); 323 }); 324 325 326 327 // ** MODE: TOGGLE 328 jQuery('.itemblock .itemtoggle').click(function() { 329 relativeItemTitle = jQuery(this); 330 relativeItemContent = relativeItemTitle.parents().find(".itemcontent"); 331 332 if ( relativeItemContent.is(':visible') ) { 333 // ** Close Block 334 relativeItemContent.hide('slow'); 335 relativeItemTitle.removeClass('open'); 336 relativeItemTitle.parent().find('.itemactiontxt').text( lbl_apri ); 337 338 } else { 339 // ** Open Block 340 relativeItemContent.show('slow'); 341 relativeItemTitle.addClass('open'); 342 relativeItemTitle.parent().find('.itemactiontxt').text( lbl_chiudi ); 343 } 344 return false; 345 }); 346 347 348 // ** MODE: EXPANDER 349 jQuery('.expander').each(function() { 350 351 var sPoint = 100; 352 if(jQuery(this).attr('data-expander')){ 353 sPoint = jQuery(this).attr('data-expander'); 354 } 355 jQuery(this).expander({ 356 slicePoint: sPoint, 357 expandEffect: 'fadeIn', 358 expandSpeed: 400, 359 collapseEffect: 'fadeOut', 360 collapseSpeed: 400, 361 362 //expandPrefix: '... ', 363 expandPrefix: '', 364 expandText: '' + lbl_apri + '', 365 userCollapseText: '' + lbl_chiudi + '' 366 }); 367 }); 368 369 370 // only if window width is greater than Navbar breakpoint 371 if( active_ticky && ( pageWidth() >
371= pageWidthStickyNavBreakpoint ) ) { 372 stickyNavbar(); 373 } 374 375 376 // jQuery('#blueimp-gallery').data('useBootstrapModal', false); 377 // jQuery('#blueimp-gallery').toggleClass('blueimp-gallery-controls', true); 378 379 380 381 // ** SCROLL DOWN 382 jQuery('.scrolldown').click(function () { 383 384 var titleTop = jQuery('#content').find('h1.entry-title').offset().top; 385 386 jQuery('body,html').animate({ 387 scrollTop: titleTop - 48 388 }, 800); 389 return false; 390 }); 391 392 393 // ** SCROLL TO TOP POSITION 394 jQuery(".scrolltop").click(function() { 395 scrollToPosition(500); 396 return false; 397 }); 398 399});// --end JQUERY(DOCUMENT).READY ------------------------------------------------------------------------------ // 400 401/*! 402 * jQuery Expander Plugin v1.4.4 403 * 404 * Date: Sun Sep 16 21:07:05 2012 EDT 405 * Requires: jQuery v1.3+ 406 * 407 * Copyright 2011, Karl Swedberg 408 * Dual licensed under the MIT and GPL licenses (just like jQuery): 409 * http://www.opensource.org/licenses/mit-license.php 410 * 411*/ 412(function(c){c.expander={version:"1.4.4",defaults:{slicePoint:100,preserveWords:true,widow:4,expandText:"read more",expandPrefix:"… ",expandAfterSummary:false,summaryClass:"summary",detailClass:"details",moreClass:"read-more",lessClass:"read-less",collapseTimer:0,expandEffect:"slideDown",expandSpeed:250,collapseEffect:"slideUp",collapseSpeed:200,userCollapse:true,userCollapseText:"read less",userCollapsePrefix:" ",onSlice:null,beforeExpand:null,afterExpand:null,onCollapse:null}};c.fn.expander= 413function(l){function I(a,d){var e="span",h=a.summary;if(d){e="div";if(x.test(h)&&!a.expandAfterSummary)h=h.replace(x,a.moreLabel+"$1");else h+=a.moreLabel;h='<div class="'+a.summaryClass+'">'+h+"</div>"}else h+=a.moreLabel;return[h,"<",e+' class="'+a.detailClass+'"',">",a.details,"</"+e+">"].join("")}function J(a){var d='<span class="'+a.moreClass+'">'+a.expandPrefix;d+='<a href="#">'+a.expandText+"</a></span>";return d}function y(a,d){if(a.lastIndexOf("<")>a.lastIndexOf(">"))a=a.slice(0,a.lastIndexOf("<")); 414if(d)a=a.replace(K,"");return c.trim(a)}function z(a,d){d.stop(true,true)[a.collapseEffect](a.collapseSpeed,function(){d.prev("span."+a.moreClass).show().length||d.parent().children("div."+a.summaryClass).show().find("span."+a.moreClass).show()})}function L(a,d,e){if(a.collapseTimer)A=setTimeout(function(){z(a,d);c.isFunction(a.onCollapse)&&a.onCollapse.call(e,false)},a.collapseTimer)}var u="init";if(typeof l=="string"){u=l;l={}}var v=c.extend({},c.expander.defaults,l),M=/^<(?:area|br|col|embed|hr|img|input|link|meta|param).*>$/i, 415K=v.wordEnd||/(&(?:[^;]+;)?|[a-zA-Z\u00C0-\u0100]+)$/,B=/<\/?(\w+)[^>]*>/g,C=/<(\w+)[^>]*>/g,D=/<\/(\w+)>/g,x=/(<\/[^>]+>)\s*$/,N=/^<[^>]+>.?/,A;l={init:function(){this.each(function(){var a,d,e,h,m,i,o,w,E=[],s=[],p={},q=this,f=c(this),F=c([]),b=c.extend({},v,f.data("expander")||c.meta&&f.data()||{});i=!!f.find("."+b.detailClass).length;var r=!!f.find("*").filter(function(){return/^block|table|list/.test(c(this).css("display"))}).length,t=(r?"div":"span")+"."+b.detailClass;a=b.moreClass+"";d=b.lessClass+ 416"";var O=b.expandSpeed||0,n=c.trim(f.html());c.trim(f.text());var g=n.slice(0,b.slicePoint);b.moreSelector="span."+a.split(" ").join(".");b.lessSelector="span."+d.split(" ").join(".");if(!c.data(this,"expanderInit")){c.data(this,"expanderInit",true);c.data(this,"expander",b);c.each(["onSlice","beforeExpand","afterExpand","onCollapse"],function(j,k){p[k]=c.isFunction(b[k])});g=y(g);for(d=g.replace(B,"").length;d<b.slicePoint;){a=n.charAt(g.length);if(a=="<")a=n.slice(g.length).match(N)[0];g+=a;d++}g= 417y(g,b.preserveWords);h=g.match(C)||[];m=g.match(D)||[];e=[];c.each(h,function(j,k){M.test(k)||e.push(k)});h=e;d=m.length;for(a=0;a<d;a++)m[a]=m[a].replace(D,"$1");c.each(h,function(j,k){var G=k.replace(C,"$1"),H=c.inArray(G,m);if(H===-1){E.push(k);s.push("</"+G+">")}else m.splice(H,1)});s.reverse();if(i){i=f.find(t).remove().html();g=f.html();n=g+i;a=""}else{i=n.slice(g.length);a=c.trim(i.replace(B,""));if(a===""||a.split(/\s+/).length<b.widow)return;a=s.pop()||"";g+=s.join("");i=E.join("")+i}b.moreLabel= 418f.find(b.moreSelector).length?"":J(b);if(r)i=n;g+=a;b.summary=g;b.details=i;
418b.lastCloseTag=a;if(p.onSlice)b=(e=b.onSlice.call(q,b))&&e.details?e:b;r=I(b,r);f.html(r);o=f.find(t);w=f.find(b.moreSelector);o[b.collapseEffect](0);w.find("a").unbind("click.expander").bind("click.expander",function(j){j.preventDefault();w.hide();F.hide();p.beforeExpand&&b.beforeExpand.call(q);o.stop(false,true)[b.expandEffect](O,function(){o.css({zoom:""});p.afterExpand&&b.afterExpand.call(q);L(b,o,q)})});F=f.find("div."+ 419b.summaryClass);b.userCollapse&&!f.find(b.lessSelector).length&&f.find(t).append('<span class="'+b.lessClass+'">'+b.userCollapsePrefix+'<a href="#">'+b.userCollapseText+"</a></span>");f.find(b.lessSelector+" a").unbind("click.expander").bind("click.expander",function(j){j.preventDefault();clearTimeout(A);j=c(this).closest(t);z(b,j);p.onCollapse&&b.onCollapse.call(q,true)})}})},destroy:function(){this.each(function(){var a,d,e=c(this);if(e.data("expanderInit")){a=c.extend({},e.data("expander")||{}, 420v);d=e.find("."+a.detailClass).contents();e.removeData("expanderInit");e.removeData("expander");e.find(a.moreSelector).remove();e.find("."+a.summaryClass).remove();e.find("."+a.detailClass).after(d).remove();e.find(a.lessSelector).remove()}})}};l[u]&&l[u].call(this);return this};c.fn.expander.defaults=c.expander.defaults})(jQuery);; 421 422 423 424 425 426
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.