From 0da5633be66d1b3686bb5d02abf787b002cbe6ed Mon Sep 17 00:00:00 2001 From: SkyArrow Date: Sat, 28 Jan 2012 00:07:28 +0800 Subject: merge javascript --- source/_includes/after_footer.html | 4 +--- source/javascripts/slash.js | 45 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 source/javascripts/slash.js diff --git a/source/_includes/after_footer.html b/source/_includes/after_footer.html index f4edb38..35f440f 100644 --- a/source/_includes/after_footer.html +++ b/source/_includes/after_footer.html @@ -1,7 +1,5 @@ - - - + {% include disqus.html %} {% include custom/after_footer.html %} \ No newline at end of file diff --git a/source/javascripts/slash.js b/source/javascripts/slash.js new file mode 100644 index 0000000..c23a4a2 --- /dev/null +++ b/source/javascripts/slash.js @@ -0,0 +1,45 @@ +(function($){ + /* external.js */ + var host = location.host; + + $('a').on('click', function(e){ + var href = $(this).attr('href'), + link = href.replace(/(https?:\/\/)(.*)\/(.*)/, '$2'); + + if (href.match('https?') && link != host){ + window.open(href); + e.preventDefault(); + } + }); + + /* navigation.js */ + var appends = ''; + + $('.menu .main > li').each(function(){ + var link = $(this).children('a'); + appends += ''; + $(this).find('li').each(function(){ + var link = $(this).children('a'); + appends += ''; + }); + }); + + $('nav.menu').append('').on('change', 'select', function(){ + location.href = $(this).val(); + }); + + /* caption.js */ + $('.entry').each(function(i){ + var _i = i; + $(this).find('img').each(function(){ + var alt = $(this).attr('alt'); + + if (alt == '' || typeof alt == 'undefined'){ + $(this).wrap(''); + } else { + $(this).after(''+alt+'').wrap(''); + } + }); + }); + $('.fancybox').fancybox(); +})(jQuery); \ No newline at end of file -- cgit v1.1-2-g2b99