2016-03-18 21:26:17 -07:00
|
|
|
|
define([], function () {
|
2014-06-15 16:30:04 -07:00
|
|
|
|
|
2014-06-17 09:03:14 -07:00
|
|
|
|
function reloadItems(page) {
|
|
|
|
|
|
2015-07-19 20:43:13 -07:00
|
|
|
|
Dashboard.showLoadingMsg();
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
Sections.loadLatestChannelItems(page.querySelector('.latestItems'), Dashboard.getCurrentUserId()).then(function() {
|
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
}, function () {
|
2015-07-19 20:43:13 -07:00
|
|
|
|
Dashboard.hideLoadingMsg();
|
|
|
|
|
});
|
2014-06-15 16:30:04 -07:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 11:07:03 -07:00
|
|
|
|
function loadTab(page, index) {
|
2014-06-15 16:30:04 -07:00
|
|
|
|
|
2015-07-18 11:07:03 -07:00
|
|
|
|
switch (index) {
|
|
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
reloadItems(page);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-14 08:43:03 -07:00
|
|
|
|
pageIdOn('pageinit', "channelsPage", function () {
|
2015-07-18 11:07:03 -07:00
|
|
|
|
|
|
|
|
|
var page = this;
|
2016-05-09 12:27:38 -07:00
|
|
|
|
var mdlTabs = page.querySelector('.mdl-tabs');
|
2015-07-18 11:07:03 -07:00
|
|
|
|
|
2016-05-09 12:27:38 -07:00
|
|
|
|
mdlTabs.addEventListener('tabchange', function (e) {
|
2016-03-24 11:11:03 -07:00
|
|
|
|
loadTab(page, parseInt(e.detail.selectedTabIndex));
|
2015-07-18 11:07:03 -07:00
|
|
|
|
});
|
2014-06-15 16:30:04 -07:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2016-03-18 21:26:17 -07:00
|
|
|
|
});
|