114 lines
2.5 KiB
CoffeeScript
114 lines
2.5 KiB
CoffeeScript
|
|
#= require jquery
|
|
#= require jquery_ujs
|
|
|
|
#= require vendor/filterable.js
|
|
#= require vendor/jquery.mousewheel-3.0.4.pack.js
|
|
#= require vendor/jquery.fancybox.pack.js
|
|
|
|
|
|
jQuery.expr[":"].regex = (elem, index, match) ->
|
|
matchParams = match[3].split(",")
|
|
validLabels = /^(data|css):/
|
|
attr =
|
|
method: (if matchParams[0].match(validLabels) then matchParams[0].split(":")[0] else "attr")
|
|
property: matchParams.shift().replace(validLabels, "")
|
|
|
|
regexFlags = "ig"
|
|
regex = new RegExp(matchParams.join("").replace(/^\s+|\s+$/g, ""), regexFlags)
|
|
regex.test jQuery(elem)[attr.method](attr.property)
|
|
|
|
|
|
|
|
$.fn.animateBG = (x, y, speed) ->
|
|
pos = @css("background-position").split(" ")
|
|
@x = pos[0] or 0
|
|
@y = pos[1] or 0
|
|
|
|
$.Animation(this,
|
|
x: x
|
|
y: y
|
|
,
|
|
duration: speed,
|
|
easing:"linear"
|
|
).progress (e) ->
|
|
@css "background-position", e.tweens[0].now + "px " + e.tweens[1].now + "px"
|
|
|
|
this
|
|
|
|
|
|
|
|
@popstat = false;
|
|
|
|
$ ->
|
|
|
|
prev_link = ""
|
|
|
|
$(document).on "click", ".gallery .photo a", ->
|
|
|
|
prev_link = $(this)
|
|
|
|
|
|
$('#photo_large_place').fadeIn();
|
|
$('#photo_large_place .big_img').attr("src", $(this).attr("href"))
|
|
$('#photo_large_place .big_img').css("max-height", ($(window).height()-130)+"px")
|
|
|
|
|
|
$('#photo_large_place').find("h3").html($(this).closest(".photo").find("h3").html())
|
|
|
|
|
|
return false
|
|
|
|
|
|
$("#photo_large_place .next-photo").click ->
|
|
|
|
if prev_link.closest(".photo").next(".photo").length > 0
|
|
photo = prev_link.closest(".photo").next(".photo")
|
|
|
|
|
|
|
|
else
|
|
photo = prev_link.closest(".gallery").children(".photo:first")
|
|
|
|
link = photo.find("a:first")
|
|
titre = photo.find("h3")
|
|
$('#photo_large_place .big_img').attr("src", link.attr("href"))
|
|
$('#photo_large_place').find("h3").html(titre.html())
|
|
|
|
prev_link = link
|
|
|
|
|
|
|
|
|
|
|
|
$("#photo_large_place .prev-photo").click ->
|
|
|
|
if prev_link.closest(".photo").prev(".photo").length > 0
|
|
photo = prev_link.closest(".photo").prev(".photo")
|
|
|
|
|
|
|
|
else
|
|
photo = prev_link.closest(".gallery").children(".photo:last")
|
|
|
|
link = photo.find("a:first")
|
|
titre = photo.find("h3")
|
|
$('#photo_large_place .big_img').attr("src", link.attr("href"))
|
|
$('#photo_large_place').find("h3").html(titre.html())
|
|
|
|
prev_link = link
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(document).on "click", '#photo_large_place .close_large', ->
|
|
$('#photo_large_place').fadeOut()
|
|
|
|
|
|
|