-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
72 lines (62 loc) · 1.94 KB
/
app.js
File metadata and controls
72 lines (62 loc) · 1.94 KB
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
console.log('hello from app.js');
var app = angular.module('MapApp', []);
app.controller('AppCtrl', ['$scope', function($scope) {
console.log("hello from the controller");
$scope.maps = MAPS;
//$scope.selectedMap = $scope.maps[0];
$scope.preview = function(map){
//$scope.selectedMap = map;
//console.log(imgID);
//console.log($("imgID"));
//console.log(img.height, img.width);
//console.log(img.naturalHeight, img.naturalWidth);
$("#previewModalContent").css("background-image", "url('" + $scope.getImageSrc(map) +"')");
$("#previewModalContent").css("width", map.dimensions.width);
$("#previewModalContent").css("height", map.dimensions.height);
$('#previewModal').modal('show');
};
$scope.setAlt = function(map, alt){
map.activeAlt = alt;
};
$scope.getImageSrc = function(map){
if(map.alternates){
var src = "maps/" + map.image_base;
src += "-" + map.activeAlt + "_500.jpg";
return src;
} else {
return "maps/" + map.image_base + "_500.jpg"
}
$scope.$apply();
};
}]);
var MAPS = [
{"name":"Australia",
"dimensions":{"width":"500", "height":"500"},
"image_base":"Australia"},
{"name":"Belgium",
"dimensions":{"width":"500", "height":"417"},
"alternates":["original", "orange", "rose"],
"activeAlt":"original",
"image_base":"Belgique"},
{"name":"Colombia",
"dimensions":{"width":"500", "height":"500"},
"image_base":"Colombia"},
{"name":"Cuba",
"dimensions":{"width":"500", "height":"500"},
"image_base":"Cuba"},
{"name":"Dominican Republic",
"dimensions":{"width":"500", "height":"500"},
"image_base":"Dominican_Republic"},
{"name":"Earth",
"dimensions":{"width":"500", "height":"500"},
"image_base":"Earth"},
{"name":"Ecuador",
"dimensions":{"width":"500", "height":"500"},
"image_base":"Ecuador"},
{"name":"Senegal",
"dimensions":{"width":"500", "height":"500"},
"image_base":"Senegal"},
{"name":"Spain",
"dimensions":{"width":"500", "height":"500"},
"image_base":"Spain"},
];