2018-10-20 17:54:15 +03:00
|
|
|
/**
|
|
|
|
* @class Page
|
|
|
|
* @classdesc Class for page module
|
|
|
|
*/
|
2022-07-26 18:49:30 +03:00
|
|
|
export default class Page {
|
2018-10-20 17:54:15 +03:00
|
|
|
/**
|
|
|
|
* Creates base properties
|
|
|
|
*/
|
|
|
|
constructor() {
|
|
|
|
this.codeStyler = null;
|
2022-07-26 18:49:30 +03:00
|
|
|
this.tableOfContent = null;
|
2018-10-20 17:54:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called by ModuleDispatcher to initialize module from DOM
|
|
|
|
*/
|
2022-07-26 18:49:30 +03:00
|
|
|
init() {
|
2018-10-20 17:54:15 +03:00
|
|
|
this.codeStyler = this.createCodeStyling();
|
2022-07-26 18:49:30 +03:00
|
|
|
this.tableOfContent = this.createTableOfContent();
|
|
|
|
}
|
2018-10-20 17:54:15 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Init code highlighting
|
|
|
|
*/
|
|
|
|
async createCodeStyling() {
|
Authentication (#22)
* Authorization added
* added secret to password, md5 hashing, removed promise from verifyToken, deleted links when not authorized
* added dbinsert script
* turned verifyToken to middleware, added description for dbinsert, added hidden csrf field in auth form
* added middlewares, user model and controller
* JSDoc fix
* wrong password processing fix
* added comments to dbinsert script, moved salt and passHash to singe db doc
* Moved salt to .env, upgradedscript for generating password was, fixed comments and JSDoc
* Deleted using salt (now user is only one), changed verifying password to bcrypt.compare, added httpyOnly property to jwt cookie
2019-03-06 13:22:57 +03:00
|
|
|
const { default: CodeStyler } = await import(/* webpackChunkName: "code-styling" */ './../classes/codeStyler');
|
2018-10-20 17:54:15 +03:00
|
|
|
|
2022-07-26 18:49:30 +03:00
|
|
|
try {
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new CodeStyler({
|
|
|
|
selector: '.block-code__content',
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error); // @todo send to Hawk
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Init table of content
|
|
|
|
*
|
|
|
|
* @returns {Promise<TableOfContent>}
|
|
|
|
*/
|
|
|
|
async createTableOfContent() {
|
|
|
|
const { default: TableOfContent } = await import(/* webpackChunkName: "table-of-content" */ '../classes/table-of-content');
|
|
|
|
|
|
|
|
try {
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new TableOfContent({
|
|
|
|
tagSelector:
|
|
|
|
'h2.block-header--anchor,' +
|
|
|
|
'h3.block-header--anchor,' +
|
|
|
|
'h4.block-header--anchor',
|
|
|
|
appendTo: document.getElementById('layout-sidebar-right'),
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error); // @todo send to Hawk
|
|
|
|
}
|
|
|
|
}
|
2018-10-20 17:54:15 +03:00
|
|
|
}
|