better class generation and remove duplicate class

pull/1/head
Pierre Bondoerffer 7 years ago
parent 10e50fc5c7
commit c953e71a18
No known key found for this signature in database
GPG Key ID: C0C7C0C5063F2236

@ -94,7 +94,7 @@ define([
}; };
Pages['/about.html'] = function () { Pages['/about.html'] = function () {
return h('div#cp-main.cp-page-about', [ return h('div#cp-main', [
infopageTopbar(), infopageTopbar(),
h('div.container.cp-container', [ h('div.container.cp-container', [
h('center', [ h('center', [
@ -143,7 +143,7 @@ define([
}; };
Pages['/privacy.html'] = function () { Pages['/privacy.html'] = function () {
return h('div#cp-main.cp-page-privacy', [ return h('div#cp-main', [
infopageTopbar(), infopageTopbar(),
h('div.container.cp-container', [ h('div.container.cp-container', [
h('center', h('h1', Msg.policy_title)), h('center', h('h1', Msg.policy_title)),
@ -172,7 +172,7 @@ define([
}; };
Pages['/terms.html'] = function () { Pages['/terms.html'] = function () {
return h('div#cp-main.cp-page-terms', [ return h('div#cp-main', [
infopageTopbar(), infopageTopbar(),
h('div.container.cp-container', [ h('div.container.cp-container', [
h('center', h('h1', Msg.tos_title)), h('center', h('h1', Msg.tos_title)),
@ -187,7 +187,7 @@ define([
}; };
Pages['/contact.html'] = function () { Pages['/contact.html'] = function () {
return h('div#cp-main.cp-page-contact', [ return h('div#cp-main', [
infopageTopbar(), infopageTopbar(),
h('div.container.cp-container', [ h('div.container.cp-container', [
h('center', h('h1', Msg.contact)), h('center', h('h1', Msg.contact)),
@ -198,7 +198,7 @@ define([
}; };
Pages['/what-is-cryptpad.html'] = function () { Pages['/what-is-cryptpad.html'] = function () {
return h('div#cp-main.cp-page-what-is-cryptpad', [ return h('div#cp-main', [
infopageTopbar(), infopageTopbar(),
h('div.container.cp-container', [ h('div.container.cp-container', [
h('center', h('h1', Msg.whatis_title)), h('center', h('h1', Msg.whatis_title)),
@ -234,7 +234,7 @@ define([
Pages['/'] = Pages['/index.html'] = function () { Pages['/'] = Pages['/index.html'] = function () {
var showingMore = false; var showingMore = false;
return [ return [
h('div#cp-main.cp-page-index', [ h('div#cp-main', [
infopageTopbar(), infopageTopbar(),
h('div.container.cp-container', [ h('div.container.cp-container', [
h('div.row', [ h('div.row', [
@ -310,7 +310,7 @@ define([
}; };
Pages['/register/'] = Pages['/register/index.html'] = function () { Pages['/register/'] = Pages['/register/index.html'] = function () {
return [h('div#cp-main.cp-page-register', [ return [h('div#cp-main', [
infopageTopbar(), infopageTopbar(),
h('div.container.cp-container', [ h('div.container.cp-container', [
h('div.row.align-items-center', [ h('div.row.align-items-center', [
@ -362,7 +362,7 @@ define([
}; };
Pages['/login/'] = Pages['/login/index.html'] = function () { Pages['/login/'] = Pages['/login/index.html'] = function () {
return [h('div#cp-main.cp-page-login', [ return [h('div#cp-main', [
infopageTopbar(), infopageTopbar(),
h('div.container.cp-container', [ h('div.container.cp-container', [
h('div.row.align-items-center', [ h('div.row.align-items-center', [

@ -80,8 +80,9 @@ $(function () {
} }
} else { } else {
// add class on info-pages // add class on info-pages
var css = location.pathname.replace(/(\/$|^\/|.html$)/gm, "") var css = location.pathname.replace(/(index)?\.html$/gi, "") // .html
.replace(/[^a-zA-Z]/gi, "-"); .replace(/[^a-zA-Z]+/gi, '-') // any non-alpha character
.replace(/^-|-$/g, ''); // starting/trailing dashes
if (css === '') if (css === '')
{ {
css = 'index'; css = 'index';

Loading…
Cancel
Save