cahnge link format for accessibility.

This commit is contained in:
BoHung Chiu 2020-03-27 16:50:29 +08:00
parent 71d9785a5f
commit 76bf583da5
3 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
var GalleryTheater = function(){ window.GalleryTheater = function(){
var parent_divs = $('.gallery').parents('div'), var parent_divs = $('.gallery').parents('div'),
parent_div_z_index = parent_divs.eq(parent_divs.length-1).css('z-index') parent_div_z_index = parent_divs.eq(parent_divs.length-1).css('z-index')
parent_divs.eq(parent_divs.length-1).css('z-index','2000') parent_divs.eq(parent_divs.length-1).css('z-index','2000')
@ -188,6 +188,7 @@ var GalleryTheater = function(){
gt.stage.show(); gt.stage.show();
$("body").addClass("gallery-mode-on"); $("body").addClass("gallery-mode-on");
bindKeyHandlers(); bindKeyHandlers();
gt.isTheaterInitialized = false;
if(!gt.isTheaterInitialized){ if(!gt.isTheaterInitialized){
$.ajax({ $.ajax({
url : link, url : link,
@ -206,6 +207,7 @@ var GalleryTheater = function(){
currentPic = {"image" : cp, "index" : gt.albumData.images.indexOf(cp)}; currentPic = {"image" : cp, "index" : gt.albumData.images.indexOf(cp)};
createThumbStrip(); createThumbStrip();
} }
window.currentPic = currentPic;
} }
gt.hasNextImage = function(){ gt.hasNextImage = function(){
@ -398,7 +400,7 @@ var GalleryTheater = function(){
mainPicLoading = 1; mainPicLoading = 1;
img.fadeIn(100); img.fadeIn(100);
} }
var setMainPic = function(direction,selectedFromStrip){ window.setMainPic = function(direction,selectedFromStrip){
var img = null; var img = null;
$('div.gallery-show-original a').eq(0).attr('href',currentPic.image.url) $('div.gallery-show-original a').eq(0).attr('href',currentPic.image.url)
if(direction == null){ if(direction == null){

View File

@ -65,7 +65,7 @@ class GalleriesController < ApplicationController
{ {
"image-description" => (flag ? a.description : ''), "image-description" => (flag ? a.description : ''),
"alt_title" => alt_text, "alt_title" => alt_text,
"link_to_show" => "/xhr/galleries/theater/" + a.id.to_s, "link_to_show" => "#" + a.id.to_s,
"thumb-src" => a.file.thumb.url "thumb-src" => a.file.thumb.url
} }
end end

View File

@ -7,7 +7,7 @@
<div class="show-content col-xs-6 col-sm-2"> <div class="show-content col-xs-6 col-sm-2">
<div class="show-content-inner"> <div class="show-content-inner">
<div class="show-pic"> <div class="show-pic">
<a href="{{link_to_show}}"> <a href="{{link_to_show}}" onclick="window.location.hash = '{{link_to_show}}';GalleryTheater();">
<img class="img" src="{{thumb-src}}" alt="{{alt_title}}"> <img class="img" src="{{thumb-src}}" alt="{{alt_title}}">
</a> </a>
<p class="show-description">{{image-description}}</p> <p class="show-description">{{image-description}}</p>