refactor
This commit is contained in:
parent
13e3d5eb73
commit
796ce0c031
|
@ -1,8 +1,6 @@
|
|||
import angular from "angular";
|
||||
import "bootstrap/scss/bootstrap.scss";
|
||||
import "babel-polyfill";
|
||||
import angularStickyfill from "angular-stickyfill";
|
||||
import "angular-stickyfill/dist/angular-stickyfill.css";
|
||||
import {cleanUsername, generateRandomUsername} from "./mailbox/util";
|
||||
import hasher from "hasher";
|
||||
import Header from "./mailbox/header/header";
|
||||
|
@ -88,9 +86,7 @@ class AppController {
|
|||
}
|
||||
|
||||
|
||||
angular.module('app', [
|
||||
List, Mail, angularStickyfill, Header
|
||||
])
|
||||
angular.module('app', [List, Mail, Header])
|
||||
|
||||
.component('app', {
|
||||
template: `
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import angular from "angular";
|
||||
import ngSanitize from "angular-sanitize";
|
||||
import Autolinker from "autolinker";
|
||||
import angularStickyfill from "angular-stickyfill";
|
||||
import "angular-stickyfill/dist/angular-stickyfill.css";
|
||||
import template from "./mail.html";
|
||||
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', {
|
||||
template,
|
||||
controller: MailController,
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
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) {
|
||||
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) {
|
||||
return username.replace(/[@].*$/, '');
|
||||
}
|
Loading…
Reference in New Issue
Block a user