refactor
This commit is contained in:
parent
13e3d5eb73
commit
796ce0c031
|
@ -1,8 +1,6 @@
|
||||||
import angular from "angular";
|
import angular from "angular";
|
||||||
import "bootstrap/scss/bootstrap.scss";
|
import "bootstrap/scss/bootstrap.scss";
|
||||||
import "babel-polyfill";
|
import "babel-polyfill";
|
||||||
import angularStickyfill from "angular-stickyfill";
|
|
||||||
import "angular-stickyfill/dist/angular-stickyfill.css";
|
|
||||||
import {cleanUsername, generateRandomUsername} from "./mailbox/util";
|
import {cleanUsername, generateRandomUsername} from "./mailbox/util";
|
||||||
import hasher from "hasher";
|
import hasher from "hasher";
|
||||||
import Header from "./mailbox/header/header";
|
import Header from "./mailbox/header/header";
|
||||||
|
@ -88,9 +86,7 @@ class AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
angular.module('app', [
|
angular.module('app', [List, Mail, Header])
|
||||||
List, Mail, angularStickyfill, Header
|
|
||||||
])
|
|
||||||
|
|
||||||
.component('app', {
|
.component('app', {
|
||||||
template: `
|
template: `
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import angular from "angular";
|
import angular from "angular";
|
||||||
import ngSanitize from "angular-sanitize";
|
import ngSanitize from "angular-sanitize";
|
||||||
import Autolinker from "autolinker";
|
import Autolinker from "autolinker";
|
||||||
|
import angularStickyfill from "angular-stickyfill";
|
||||||
|
import "angular-stickyfill/dist/angular-stickyfill.css";
|
||||||
import template from "./mail.html";
|
import template from "./mail.html";
|
||||||
import "./mail.scss";
|
import "./mail.scss";
|
||||||
|
|
||||||
|
@ -12,7 +14,7 @@ class MailController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default angular.module('mailbox.inbox.mail', [ngSanitize])
|
export default angular.module('mailbox.inbox.mail', [ngSanitize, angularStickyfill])
|
||||||
.component('mail', {
|
.component('mail', {
|
||||||
template,
|
template,
|
||||||
controller: MailController,
|
controller: MailController,
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
import phonetic from "phonetic";
|
import phonetic from "phonetic";
|
||||||
|
|
||||||
export function generateRandomUsername() {
|
|
||||||
let username = phonetic.generate({syllables: 3, phoneticSimplicity: 1});
|
|
||||||
if (Math.random() >= 0.5) {
|
|
||||||
username += this.getRandomInt(30, 99);
|
|
||||||
}
|
|
||||||
return username.toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRandomInt(min, max) {
|
function getRandomInt(min, max) {
|
||||||
return Math.floor(Math.random() * (max - min)) + min;
|
return Math.floor(Math.random() * (max - min)) + min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function generateRandomUsername() {
|
||||||
|
let username = phonetic.generate({syllables: 3, phoneticSimplicity: 1});
|
||||||
|
if (Math.random() >= 0.5) {
|
||||||
|
username += getRandomInt(30, 99);
|
||||||
|
}
|
||||||
|
return username.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
export function cleanUsername(username) {
|
export function cleanUsername(username) {
|
||||||
return username.replace(/[@].*$/, '');
|
return username.replace(/[@].*$/, '');
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user