From 0da5633be66d1b3686bb5d02abf787b002cbe6ed Mon Sep 17 00:00:00 2001 From: SkyArrow Date: Sat, 28 Jan 2012 00:07:28 +0800 Subject: merge javascript --- source/javascripts/slash.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 source/javascripts/slash.js (limited to 'source/javascripts') 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.2.3