Repository navigation
Expand file tree
/
Copy pathstatus.js
More file actions
96 lines (87 loc) · 3.57 KB
/
Copy pathstatus.js
File metadata and controls
96 lines (87 loc) · 3.57 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
define(['data', 'design', 'transition'], function (dataManager, designManager, transitionManager) {
var activeItem;
// var ignoreTypeChange;
return {
init: function (vm) {
designManager.loadCssLink(vm.currentDesign());
vm.clickLayout = function (layoutData, e) {
vm.currentLayout(layoutData.key);
};
// vm.clickTpl = function (templateData, e) {
// vm.currentTpl(templateData.key);
// };
vm.clickPage = function (pageData, e) {
var $index = vm.pageList().indexOf(pageData);
vm.currentPage($index);
};
vm.clickDesign = function (designData, e) {
var key = designData.key;
var cssLink;
designManager.loadCssLink(key);
vm.currentDesign(key);
};
vm.clickTransition = function (transitionData, e) {
var key = transitionData.key;
vm.currentTransition(key);
};
vm.resetData = function (newData) {
if (newData === vm) {
newData = null;
}
dataManager.reset(newData);
dataManager.stopStorage();
var currentPage = 0;
var currentSlide = dataManager.getSlideList()[currentPage];
vm.title(dataManager.getTitle()),
vm.currentDesign(dataManager.getDesign());
vm.currentPage(currentPage);
vm.currentLayout(currentSlide.layout);
// vm.currentTpl(currentSlide.template);
vm.pageList(dataManager.getPageList());
dataManager.startStorage();
dataManager.save();
};
vm.currentLayout.subscribe(function (newValue) {
var page = vm.currentPage();
dataManager.changeLayout(page, newValue);
setTimeout(vm.resizeAll, 13);
dataManager.save();
});
// vm.currentTpl.subscribe(function (newValue) {
// var page = vm.currentPage();
// var changedKeys = dataManager.changeTemplate(page, newValue, ignoreTypeChange);
// changedKeys.forEach(function (key) {
// vm.previewItem(key);
// });
// vm.resizeAll();
// dataManager.save();
// });
vm.currentPage.subscribe(function (newValue) {
var slideData = dataManager.getSlide(newValue);
dataManager.stopStorage();
vm.currentLayout(slideData.layout);
// ignoreTypeChange = true;
// vm.currentTpl(slideData.template);
// ignoreTypeChange = false;
dataManager.startStorage();
});
vm.currentDesign.subscribe(function (newValue) {
dataManager.setDesign(newValue);
dataManager.save();
});
vm.currentTransition.subscribe(function (newValue) {
transitionManager.change(newValue);
dataManager.setTransition(newValue);
dataManager.save();
});
vm.currentItem.subscribe(function (newValue) {
if (activeItem) {
activeItem.removeClass('active');
}
if (newValue) {
activeItem = $('#slide-' + newValue).addClass('active');
}
});
}
};
});