diff --git a/classes/comment.js b/classes/comment.js
index cb246ad..d794ba9 100644
--- a/classes/comment.js
+++ b/classes/comment.js
@@ -1,47 +1,46 @@
-
class Comment {
- constructor (data = {}) {
- this.applyData(data)
- }
+ constructor(data = {}) {
+ this.applyData(data)
+ }
- applyData (data) {
- this.mdBody = data.body
- this.htmlBody = window.markdown.toHTML(data.body)
- this.title = this.mdBody.match(/^[\*_][\*_]\[(.+)\].+[\*_][\*_][\n\r]/)
- this.title = this.title ? this.title[1] : ''
- this.link = this.mdBody.match(/^[\*_][\*_].+\((.+)\)[\*_][\*_][\n\r]/)
- this.link = this.link ? this.link[1] : ''
- this.outline = `${this.title}:
${this.link}
`
- this.created_at = data.created_at
- this.id = data.id
- this.url = data.url
- this.author = {
- id: data.user.id,
- login: data.user.login,
- avatar: data.user.avatar_url,
- url: data.user.html_url
- }
- this.applyCategory()
+ applyData(data) {
+ this.mdBody = data.body
+ this.htmlBody = window.markdown.toHTML(data.body)
+ this.title = this.mdBody.match(/^[\*_][\*_]\[(.+)\].+[\*_][\*_][\n\r]/)
+ this.title = this.title ? this.title[1] : ''
+ this.link = this.mdBody.match(/^[\*_][\*_].+\((.+)\)[\*_][\*_][\n\r]/)
+ this.link = this.link ? this.link[1] : ''
+ this.outline = `${this.title}:
${this.link}
`
+ this.created_at = data.created_at
+ this.id = data.id
+ this.url = data.url
+ this.author = {
+ id: data.user.id,
+ login: data.user.login,
+ avatar: data.user.avatar_url,
+ url: data.user.html_url
}
+ this.applyCategory()
+ }
- applyCategory () {
- let cat = this.mdBody.match(/[\n\r][\*_](.+)[\*_]$/m)
- let testCat = cat[1].toLowerCase()
+ applyCategory() {
+ let cat = this.mdBody.match(/[\n\r][\*_](.+)[\*_]$/m)
+ let testCat = cat[1].toLowerCase()
- if (testCat.match(/(new|not.cia|novidade|an.nci|announc)/)) {
- cat = "Notícias"
- } else if (testCat.match(/(event|confer.ncia|summit|workshop|congresso)/)) {
- cat = "Eventos"
- } else if (testCat.match(/(artigo|article|text|post)/)) {
- cat = "Artigos"
- } else if (testCat.match(/(talk|palestr|aula|curso|v.deo)/)) {
- cat = "Vídeos"
- } else if (testCat.match(/(tool|demo|experiment|ferrament)/)) {
- cat = "Demos e Ferramentas"
- } else {
- cat = 'Outros'
- }
-
- this.category = cat
+ if (testCat.match(/(new|not.cia|novidade|an.nci|announc)/)) {
+ cat = 'Notícias'
+ } else if (testCat.match(/(event|confer.ncia|summit|workshop|congresso)/)) {
+ cat = 'Eventos'
+ } else if (testCat.match(/(artigo|article|text|post)/)) {
+ cat = 'Artigos'
+ } else if (testCat.match(/(talk|palestr|aula|curso|v.deo)/)) {
+ cat = 'Vídeos'
+ } else if (testCat.match(/(tool|demo|experiment|ferrament)/)) {
+ cat = 'Demos e Ferramentas'
+ } else {
+ cat = 'Outros'
}
+
+ this.category = cat
+ }
}
diff --git a/classes/ui.js b/classes/ui.js
index c3e7f21..e775363 100644
--- a/classes/ui.js
+++ b/classes/ui.js
@@ -167,8 +167,7 @@ const UI = {
Indicado por
@${item.author.login}
-
+ style="${style}">@${item.author.login}
`
: ''
}
diff --git a/classes/weekly.js b/classes/weekly.js
index 8f1a2ab..3f3a11c 100644
--- a/classes/weekly.js
+++ b/classes/weekly.js
@@ -1,71 +1,63 @@
-
class Weekly {
- constructor (data) {
- this.applyData(data)
- this.state = "partial"
- this.loadComments().then(UI.update)
- this.contributors = {}
- this.categories = {}
- }
- static isValid (data) {
- if (
- data.title.startsWith('Edição ') &&
- data.repository_url === "https://api.github.com/repos/braziljs/weekly"
- ) {
- if (data.labels.find(item => item.name === "campaign")) {
- return true
- }
- }
- return false
- }
- applyData (data) {
- this.id = data.id
- this.title = data.title
- this.number = data.number
- this.edition = this.title.match(' ([0-9]+) ')[1] || 0,
- this.created_at = data.created_at
- this.closed_at = data.closed_at
- this.state = data.state
+ constructor(data) {
+ this.applyData(data)
+ this.state = 'partial'
+ this.loadComments().then(UI.update)
+ this.contributors = {}
+ this.categories = {}
+ }
+ static isValid(data) {
+ if (data.title.startsWith('Edição ') && data.repository_url === 'https://api.github.com/repos/braziljs/weekly') {
+ if (data.labels.find(item => item.name === 'campaign')) {
+ return true
+ }
}
- filterData (data) {
- const { id, number, created_at, closed_at, title, state } = data
- return {
- id,
- number,
- edition: this.title.match(' ([0-9]+) ')[1] || 0,
- created_at,
- closed_at,
- title,
- state
- }
+ return false
+ }
+ applyData(data) {
+ this.id = data.id
+ this.title = data.title
+ this.number = data.number
+ ;(this.edition = this.title.match(' ([0-9]+) ')[1] || 0), (this.created_at = data.created_at)
+ this.closed_at = data.closed_at
+ this.state = data.state
+ }
+ filterData(data) {
+ const { id, number, created_at, closed_at, title, state } = data
+ return {
+ id,
+ number,
+ edition: this.title.match(' ([0-9]+) ')[1] || 0,
+ created_at,
+ closed_at,
+ title,
+ state
}
- loadComments () {
- return new Promise((resolve, reject) => {
- if (this.comments) {
- return resolve(this.comments)
- }
- Github.get('comments', { issue: this.number })
- .then(comments => {
- comments.forEach(data => {
-
- if(data.body.charAt(0) !== '*')
- data.body = this.applyMarkdown(data.body)
+ }
+ loadComments() {
+ return new Promise((resolve, reject) => {
+ if (this.comments) {
+ return resolve(this.comments)
+ }
+ Github.get('comments', { issue: this.number }).then(comments => {
+ comments.forEach(data => {
+ if (data.body.charAt(0) !== '*') data.body = this.applyMarkdown(data.body)
- this.addComment(new Comment(data))
- })
- resolve(this)
- })
+ this.addComment(new Comment(data))
})
- }
- addComment (comment) {
- this.contributors[comment.author.id] = comment.author
- this.categories[comment.category] = this.categories[comment.category] || []
- this.categories[comment.category].push(comment)
- }
- applyMarkdown (item){
- item = item.replace(/^\[/, '**[')
- item = item.replace(/\)/, ')**')
- item = item.trim().replace(/(.+\w)$/, '*$1*')
- return item
- }
+ resolve(this)
+ })
+ })
+ }
+ addComment(comment) {
+ this.contributors[comment.author.id] = comment.author
+ this.categories[comment.category] = this.categories[comment.category] || []
+ this.categories[comment.category].push(comment)
+ }
+ applyMarkdown(item) {
+ item = item.replace(/^\[/, '**[')
+ item = item.replace(/\)/, ')**')
+ item = item.trim().replace(/(.+\w)$/, '*$1*')
+ return item
+ }
}