1/*! 2 * ScriptName: shared.js 3 * 4 * FCV - http://foodconnection.jp/ 5 * 6 */ 7 8// DOM ready 9 10$(document).ready(function() { 11 if (navigator.vendor && navigator.vendor.toLowerCase().indexOf("apple") > -1 && navigator.platform && navigator.platform.toLowerCase().indexOf("mac") > -1 && navigator.userAgent && !navigator.userAgent.match('CriOS')) $("body").addClass("macos"); 12 13 $(".toggle").click(function() { 14 $(this).parents("aside").toggleClass("active"); 15 }); 16 17 $('#navbar .more').click(function() { 18 $(this).addClass("active"); 19 }); 20 21 $('#navbar').click(function(){ 22 //if ($("#navbar nav").css('right') == '0px') $('#navbar').removeClass('active'); 23 }); 24 25 // $("body").on("click", "a", function(e) { // dynamic links 26 $("a").click(function(e) { 27 var href = $(this).attr("href"), 28 slug = href ? href.getSlug() : "", 29 timer = 500; // duration in CSS 30 31 if (href != "" && $(this).attr("target") != "_blank" && href.substr(0, 1) !== "#" && (location.pathname.replace(/^\//, "") === this.pathname.replace(/^\//, "") || location.hostname === this.hostname) && !$(this).attr("data-lightbox") && !/^javascript/i.test($(this).attr("href"))) { // current 32 e.preventDefault(); 33 if ($("#loading").length > 0) { 34 $("#loading").stop().fadeIn(300, function() { 35 // delay on redirect 36 setTimeout(function() { 37 window.location.href = href; 38 }, timer); 39 window.location.href = href; 40 }); 41 } else window.location.href = href; 42 } 43 }); 44}); 45 46var resizeTimer; 47 48$(window) 49 .resize(function() { 50 $("body").addClass("resizing"); 51 52 clearTimeout(resizeTimer); 53 resizeTimer = setTimeout(function() { 54 $("body").removeClass("resizing"); 55 }, 250); 56 }) 57 .scroll(function() { 58 if ($(window).scrollTop() == 0) $('.hd_top').removeClass('fixed'); 59 }) 60 .trigger("resize") 61 .trigger("scroll"); 62 63String.prototype.getSlug = function() { 64 var str = this || "", 65 baseURL = (new RegExp(/^.*\//)).exec(str); 66 67 if (baseURL && baseURL.length > 0) { 68 baseURL = baseURL[0].replace(new RegExp("/*$"), ""); // right trim 69 70 var explodeURL = baseURL.split("/"); 71 72 if (explodeURL && explodeURL.length > 0) return explodeURL[explodeURL.length - 1]; 73 } 74 75 return false; 76};
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.