better class generation and remove duplicate class

This commit is contained in:
Pierre Bondoerffer 2017-08-04 15:06:58 +02:00
parent 10e50fc5c7
commit c953e71a18
No known key found for this signature in database
GPG Key ID: C0C7C0C5063F2236
2 changed files with 11 additions and 10 deletions

View File

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

View File

@ -80,8 +80,9 @@ $(function () {
}
} else {
// add class on info-pages
var css = location.pathname.replace(/(\/$|^\/|.html$)/gm, "")
.replace(/[^a-zA-Z]/gi, "-");
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';