summaryrefslogtreecommitdiffstats
path: root/source/javascripts/slash.js
diff options
context:
space:
mode:
authorTommy Chen <tommy351@gmail.com>2012-06-03 04:35:21 +0200
committerTommy Chen <tommy351@gmail.com>2012-06-03 04:40:55 +0200
commit94270a6ab47692520b18fd136342f05c496deaeb (patch)
treec5703af62bfa7d9d9bcc20d2167d1541ded8b307 /source/javascripts/slash.js
parente3cc2b2ff5d96ed69c982c100692a1745bc261ef (diff)
downloadoctopress-theme-jeyzu-94270a6ab47692520b18fd136342f05c496deaeb.zip
octopress-theme-jeyzu-94270a6ab47692520b18fd136342f05c496deaeb.tar.gz
rewrite caption.js & isolate fancybox
Diffstat (limited to 'source/javascripts/slash.js')
-rw-r--r--source/javascripts/slash.js30
1 files changed, 17 insertions, 13 deletions
diff --git a/source/javascripts/slash.js b/source/javascripts/slash.js
index 0105d69..1e2649d 100644
--- a/source/javascripts/slash.js
+++ b/source/javascripts/slash.js
@@ -7,7 +7,7 @@
var href = this.href,
link = href.replace(/https?:\/\/([^\/]+)(.*)/, '$1');
- if (link != host){
+ if (link != '' && link != host && !$(this).hasClass('fancybox')){
window.open(href);
e.preventDefault();
}
@@ -49,19 +49,23 @@
});
};
- /* caption.js */
- $('.entry').each(function(i){
- var _i = i;
- $(this).find('img').each(function(){
- var alt = $(this).attr('alt');
+ // Append caption after pictures
+ var appendCaption = function(){
+ $('.entry').each(function(i){
+ var _i = i;
+ $(this).find('img').each(function(){
+ var alt = this.alt;
- if (alt == '' || typeof alt == 'undefined'){
- $(this).wrap('<a href="'+$(this).attr('src')+'" class="fancybox" rel="gallery'+_i+'" />');
- } else {
- $(this).after('<span class="caption">'+alt+'</span>').wrap('<a href="'+$(this).attr('src')+'" class="fancybox" title="'+alt+'" rel="gallery'+_i+'" />');
- }
+ if (alt != ''){
+ $(this).after('<span class="caption">'+alt+'</span>');
+ }
+
+ $(this).wrap('<a href="'+this.src+'" title="'+alt+'" class="fancybox" rel="gallery'+_i+'" />');
+ });
});
- });
- $('.fancybox').fancybox();
+ };
+
externalLinks(); // Delete or comment this line to disable opening external links in new window
+ navigationMenu(); // Delete or comment this line to disable menu for mobile device
+ appendCaption(); // Delete or comment this line to disable caption
})(jQuery); \ No newline at end of file