$(function(){ setLink(); hang(); $('.tabs').tabs(); $('.parallax').parallax(); $('.content table').wrap('
'); $('a[data-rel^=lightcase]').lightcase({ slideshowAutoStart: false, maxHeight: '750px' }); $('.f2h').each(function(){ $(this).val(f2h($(this).val())); }); if ($(window).width() > 768) { $('.sort').each(function() { $(this).html( $(this).children().sort(function(a, b) { return parseInt($(a).attr('data-sort')) < parseInt($(b).attr('data-sort')) ? -1 : 1; }) ); }) } }); function getWidth(w){ if(w > lw){ return 'large'; }else if(w > mw) { return 'medium'; }else{ return 'small'; } } function showNav(){ $('#nav').fadeIn(200); $('body').addClass('is-open'); if(width == 'small'){$('html, body').css('overflow', 'hidden');} isopen = true; } function hideNav(){ $('#nav').hide(); $('body').removeClass('is-open'); if(width == 'small'){$('html, body').removeAttr('style');} isopen = false; } function setHeight(){ if($(window).width() > mw){ $('#topimage').css('height', ($('#nav').outerHeight() + margin.replace('px','') * 2) + 'px'); }else { $('#topimage').css('height', '100vh'); } } function hang(){ $("dl.tp").each(function(){ var max = 0; var margin = 0; $(this).find('dt').each(function(){ if ($(this).outerWidth() > max) max = $(this).outerWidth(); }); $(this).find('dt').width(max+1); margin = max + 25; $(this).find('dd').css("padding-left",margin); }); $("dl.hang").each(function(){ var max = 0; var margin = 0; $(this).find('dt').each(function(){ //console.log($(this).width()); if ($(this).width() > max) max = $(this).width() + 30; }); $(this).find('dt').width(max); margin = max + 30; $(this).find('dd').css("padding-left",margin); }); $(".hang-sync").each(function(){ var max = 0; var margin = 0; $(this).find('dt').each(function(){ //console.log($(this).width()); if ($(this).width() > max) max = $(this).width() + 30; }); $(this).find('dt').width(max); margin = max + 30; $(this).find('dd').css("padding-left",margin); }); } function setLink(){ var host = location.hostname; regex = '/'+host+'/'; $('a[href]').each(function(){ var t = $(this).attr('href'); if(t.match(/https?:/)){ if(!t.match(regex)){ $(this).addClass('ext'); if($(window).width() > 600){ $(this).attr('target','_blank'); } var c = $(this).attr('class'); if(c.match(/btn/)){ $(this).removeClass('ext'); } if($(this).children().prop('tagName')=='IMG'){ $(this).removeClass('ext'); } } } }); $('.external').attr('target','_blank'); } function f2h(str){ var han= '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@---.,:;'; var zen= '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@−-—.,:;'; var word = str; for(i=0;i