You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

66 lines
1.5 KiB
CoffeeScript

10 years ago
# Directives
angular
.module('myApp.directives', [])
.directive('appVersion', ['version', (version)->
(scope, elm, attrs)->
elm.text(version)
])
.directive('hoverShow', ()->
link: (scope, elm, attrs)->
elm.bind('mouseover', {attrs: attrs}, (ev)->
elm.closest('.projects').find('.' + ev.data.attrs.hoverShow).show()
)
elm.bind('mouseout', {attrs: attrs}, (ev)->
elm.closest('.projects').find('.' + ev.data.attrs.hoverShow).hide()
)
)
.directive('customScroll', ()->
link: (scoe, elm, attrs)->
10 years ago
$(elm).mCustomScrollbar
theme: 'dark-2'
)
.directive('copyToClipboard', ()->
link: (scope, elm, attrs) ->
elm.bind('click', ->
window.prompt('You can safely copy&past my bitcoin address :-)', elm.text())
)
)
10 years ago
.directive('carousel', ()->
scope:
carousel: '='
link: (scope, elm, attrs)->
carousel = scope.carousel
10 years ago
img = elm.find('img')[1]
10 years ago
cIndex = 0
img.src = carousel[cIndex]
setInterval(->
10 years ago
$(img).toggleClass('fadeIn fadeOut')
10 years ago
setTimeout(->
10 years ago
$(img).hide()
10 years ago
,
100
)
if cIndex < carousel.length - 1
cIndex += 1
else
cIndex = 0
setTimeout(->
10 years ago
img.src = carousel[cIndex]
$(img).toggleClass('fadeOut fadeIn')
$(img).show()
10 years ago
,
200
)
,
4500
)
)