|
|
@ -7,9 +7,6 @@ define([
|
|
|
|
], function ($, h, Pages) {
|
|
|
|
], function ($, h, Pages) {
|
|
|
|
$(function () {
|
|
|
|
$(function () {
|
|
|
|
var $body = $('body');
|
|
|
|
var $body = $('body');
|
|
|
|
var isMainApp = function () {
|
|
|
|
|
|
|
|
return /^\/(pad|code|slide|poll|whiteboard|file|media|contacts|drive|settings|profile|todo)\/$/.test(location.pathname);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var infoPage = function () {
|
|
|
|
var infoPage = function () {
|
|
|
|
return h('div#mainBlock.hidden', typeof(Pages[location.pathname]) === 'function'?
|
|
|
|
return h('div#mainBlock.hidden', typeof(Pages[location.pathname]) === 'function'?
|
|
|
@ -20,80 +17,18 @@ $(function () {
|
|
|
|
|
|
|
|
|
|
|
|
var pathname = location.pathname;
|
|
|
|
var pathname = location.pathname;
|
|
|
|
|
|
|
|
|
|
|
|
if (isMainApp()) {
|
|
|
|
// add class on info-pages
|
|
|
|
if (typeof(Pages[pathname]) === 'function') {
|
|
|
|
var css = location.pathname.replace(/(index)?\.html$/gi, "") // .html
|
|
|
|
var $flash = $('body, #iframe-container, #pad-iframe, textarea');
|
|
|
|
.replace(/[^a-zA-Z]+/gi, '-') // any non-alpha character
|
|
|
|
$flash.css({
|
|
|
|
.replace(/^-|-$/g, ''); // starting/trailing dashes
|
|
|
|
display: 'none',
|
|
|
|
if (css === '') { css = 'index'; }
|
|
|
|
opacity: 0,
|
|
|
|
$('body').addClass('cp-page-' + css);
|
|
|
|
overflow: 'hidden',
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
var ready = function () {
|
|
|
|
|
|
|
|
$flash.css({
|
|
|
|
|
|
|
|
display: '',
|
|
|
|
|
|
|
|
opacity: '',
|
|
|
|
|
|
|
|
overflow: '',
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
require([
|
|
|
|
|
|
|
|
'less!/customize/src/less2/loading.less'
|
|
|
|
|
|
|
|
], function () {
|
|
|
|
|
|
|
|
if (/whiteboard/.test(pathname)) {
|
|
|
|
|
|
|
|
$('body').html(h('body', Pages[pathname]()).innerHTML);
|
|
|
|
|
|
|
|
require(['/whiteboard/main.js'], ready);
|
|
|
|
|
|
|
|
} else if (/poll/.test(pathname)) {
|
|
|
|
|
|
|
|
$('body').html(h('body', Pages[pathname]()).innerHTML);
|
|
|
|
|
|
|
|
require(['/poll/main.js'], ready);
|
|
|
|
|
|
|
|
} else if (/drive/.test(pathname)) {
|
|
|
|
|
|
|
|
$('body').append(h('body', Pages[pathname]()).innerHTML);
|
|
|
|
|
|
|
|
require(['/drive/main.js'], ready);
|
|
|
|
|
|
|
|
} else if (/\/file\//.test(pathname)) {
|
|
|
|
|
|
|
|
$('body').append(h('body', Pages[pathname]()).innerHTML);
|
|
|
|
|
|
|
|
require([ '/file/main.js' ], ready);
|
|
|
|
|
|
|
|
} else if (/^\/contacts\/$/.test(pathname)) {
|
|
|
|
|
|
|
|
$('body').append(h('body', Pages[pathname]()).innerHTML);
|
|
|
|
|
|
|
|
require([ '/contacts/main.js' ], ready);
|
|
|
|
|
|
|
|
} else if (/pad/.test(pathname)) {
|
|
|
|
|
|
|
|
$('body').append(h('body', Pages[pathname]()).innerHTML);
|
|
|
|
|
|
|
|
require([ '/pad/main.js' ], ready);
|
|
|
|
|
|
|
|
} else if (/code/.test(pathname)) {
|
|
|
|
|
|
|
|
$('body').append(h('body', Pages[pathname]()).innerHTML);
|
|
|
|
|
|
|
|
require([ '/code/main.js' ], ready);
|
|
|
|
|
|
|
|
} else if (/slide/.test(pathname)) {
|
|
|
|
|
|
|
|
$('body').append(h('body', Pages[pathname]()).innerHTML);
|
|
|
|
|
|
|
|
require([ '/slide/main.js' ], ready);
|
|
|
|
|
|
|
|
} else if (/^\/settings\//.test(pathname)) {
|
|
|
|
|
|
|
|
$('body').append(h('body', Pages[pathname]()).innerHTML);
|
|
|
|
|
|
|
|
require([ '/settings/main.js', ], ready);
|
|
|
|
|
|
|
|
} else if (/^\/profile\//.test(pathname)) {
|
|
|
|
|
|
|
|
$('body').append(h('body', Pages[pathname]()).innerHTML);
|
|
|
|
|
|
|
|
require([ '/profile/main.js', ], ready);
|
|
|
|
|
|
|
|
} else if (/^\/todo\//.test(pathname)) {
|
|
|
|
|
|
|
|
$('body').append(h('body', Pages[pathname]()).innerHTML);
|
|
|
|
|
|
|
|
require([ '/todo/main.js', ], ready);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.Tether = function () {};
|
|
|
|
window.Tether = function () {};
|
|
|
|
require([
|
|
|
|
require([
|
|
|
|
'less!/customize/src/less2/main.less',
|
|
|
|
'less!/customize/src/less2/main.less',
|
|
|
|
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
|
|
|
|
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
|
|
|
|
'/bower_components/bootstrap/dist/js/bootstrap.min.js'
|
|
|
|
'/bower_components/bootstrap/dist/js/bootstrap.bundle.min.js'
|
|
|
|
], function () {
|
|
|
|
], function () {
|
|
|
|
$body.append($main);
|
|
|
|
$body.append($main);
|
|
|
|
|
|
|
|
|
|
|
|