2017-06-21 16:02:38 +00:00
|
|
|
|
define([
|
|
|
|
|
'jquery',
|
|
|
|
|
'/common/hyperscript.js',
|
|
|
|
|
'/customize/pages.js',
|
|
|
|
|
|
2018-03-21 17:31:53 +00:00
|
|
|
|
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
2017-11-21 14:52:21 +00:00
|
|
|
|
], function ($, h, Pages) {
|
2017-06-21 16:02:38 +00:00
|
|
|
|
$(function () {
|
|
|
|
|
var $body = $('body');
|
|
|
|
|
|
2017-06-22 09:06:11 +00:00
|
|
|
|
var infoPage = function () {
|
|
|
|
|
return h('div#mainBlock.hidden', typeof(Pages[location.pathname]) === 'function'?
|
|
|
|
|
Pages[location.pathname](): [h('div#container')]);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var $main = $(infoPage());
|
2017-06-21 16:02:38 +00:00
|
|
|
|
|
2017-06-22 09:06:11 +00:00
|
|
|
|
var pathname = location.pathname;
|
2017-06-22 14:01:33 +00:00
|
|
|
|
|
2018-03-20 09:44:26 +00:00
|
|
|
|
// add class on info-pages
|
|
|
|
|
var css = location.pathname.replace(/(index)?\.html$/gi, "") // .html
|
|
|
|
|
.replace(/[^a-zA-Z]+/gi, '-') // any non-alpha character
|
|
|
|
|
.replace(/^-|-$/g, ''); // starting/trailing dashes
|
|
|
|
|
if (css === '') { css = 'index'; }
|
|
|
|
|
$('body').addClass('cp-page-' + css);
|
2017-06-22 09:06:11 +00:00
|
|
|
|
|
2017-10-23 09:57:10 +00:00
|
|
|
|
window.Tether = function () {};
|
2017-06-22 14:01:33 +00:00
|
|
|
|
require([
|
2018-07-14 13:15:23 +00:00
|
|
|
|
'less!/customize/src/less2/pages/page-' + css + '.less',
|
2018-03-22 09:49:20 +00:00
|
|
|
|
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css'
|
2017-06-27 12:25:02 +00:00
|
|
|
|
], function () {
|
2017-08-01 09:53:06 +00:00
|
|
|
|
$body.append($main);
|
2017-06-22 14:01:33 +00:00
|
|
|
|
|
2017-07-12 16:34:16 +00:00
|
|
|
|
if (/^\/user\//.test(pathname)) {
|
2017-06-27 12:25:02 +00:00
|
|
|
|
require([ '/user/main.js'], function () {});
|
|
|
|
|
} else if (/^\/register\//.test(pathname)) {
|
|
|
|
|
require([ '/register/main.js' ], function () {});
|
|
|
|
|
} else if (/^\/login\//.test(pathname)) {
|
|
|
|
|
require([ '/login/main.js' ], function () {});
|
|
|
|
|
} else if (/^\/($|^\/index\.html$)/.test(pathname)) {
|
|
|
|
|
// TODO use different top bar
|
|
|
|
|
require([ '/customize/main.js', ], function () {});
|
2017-07-05 14:01:50 +00:00
|
|
|
|
} else if (/invite/.test(pathname)) {
|
|
|
|
|
require([ '/invite/main.js'], function () {});
|
2018-03-13 10:31:08 +00:00
|
|
|
|
} else if (/faq/.test(pathname)) {
|
|
|
|
|
window.location.hash = window.location.hash;
|
2017-06-27 12:25:02 +00:00
|
|
|
|
} else {
|
|
|
|
|
require([ '/customize/main.js', ], function () {});
|
|
|
|
|
}
|
|
|
|
|
});
|
2017-06-22 08:04:46 +00:00
|
|
|
|
});
|
|
|
|
|
});
|