-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrollers.txt
132 lines (112 loc) · 3.2 KB
/
controllers.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//include ui, ui.filters? for unique
var photoApp = angular.module('photoApp', []);
//Ben Lesh http://stackoverflow.com/questions/20222555/angularjs-remove-duplicate-elements-in-ng-repeat
photoApp.filter('unique', function() {
return function(collection, keyname) {
var output = [],
keys = [];
angular.forEach(collection, function(item) {
var key = item[keyname];
if(keys.indexOf(key) === -1) {
keys.push(key);
output.push(item);
}
});
return output;
};
});
photoApp.filter('bySet', function () {
return function (collection, setname) {
if (setname === "" || !setname)
return collection;
var filtered = [];
angular.forEach(collection, function(item) {
var curr = item.set;
if(curr === setname)
filtered.push(item);
});
return filtered;
};
});
photoApp.directive("scroll", function () {
return function(scope, element, attrs) {
element.bind("mousewheel", function(e, delta) {
element.context.scrollLeft -= delta*60;
e.preventDefault();
scope.$apply();
if (element.context.scrollLeft + element.context.offsetWidth > (element.context.scrollWidth - 60))
scope.$apply(attrs.endReached);
});
//console.log("Last left offset: " + scope.photos[scope.photos.length-1].context.offsetLeft);
};
});
photoApp.directive('hoverphoto', function () {
return {
link : function(scope, element, attrs) {
element.bind('mouseenter', function() {
element.addClass('focus');
var image = this.getElementsByTagName('img')[0];
//console.log(EXIF.pretty(image));
});
element.bind('mouseleave', function() {
element.removeClass('focus');
});
}
};
});
photoApp.controller('PhotoController', function ($scope) {
$scope.currentSet = "";
$scope.currentCaption = "";
$scope.nextPointer = 0;
$scope.photos = [];
$scope.allPhotos = [
{'src': 'IMG_1344.jpg',
'caption': 'Bubble tea at Teado.',
'set': 'Test'
},
{'src': 'camp.jpg',
'caption': 'Test caption here for camp.',
'set': 'Test'
},
{'src': 'temple.jpg',
'caption': 'Test caption here for temple.',
'set': 'Test'
},
{'src': 'kili.jpg',
'caption': 'Test caption here for kili.',
'set': 'Test'
},
{'src': 'house.jpg',
'caption': 'Test caption here for house.',
'set': 'Test2'
},
{'src': 'galaxy.jpg',
'caption': 'Test caption here for galaxy.',
'set': 'Test2'
},
{'src': 'sky.jpg',
'caption': 'Test caption here for sky.',
'set': 'Test2'
}
];
$scope.loadMore = function(num) {
for (var i = 0; i < num; i++) {
if ($scope.nextPointer == $scope.allPhotos.length)
return;
else {
var temp = $scope.allPhotos[$scope.nextPointer]
$scope.photos.push(temp);
$scope.nextPointer++;
}
}
};
$scope.selectSet = function(setname) {
$scope.currentSet = setname;
}
$scope.showData = function(img) {
console.log(Colors.rotateHex("aabbcc"));
console.log(EXIF.getTag(image,"ShutterSpeedValue"));
console.log(img);
}
$scope.loadMore(3);
});