Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #58 from Phalanxia/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Phalanxia committed Feb 24, 2016
2 parents 8a30b97 + 0418824 commit 441c1ec
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ script:
- node maid.js
before_deploy:
- grunt package
- export RELEASE_PKG_FILE=$(ls dist/maid-irc_v*.zip)
- export RELEASE_PKG_FILE=$(ls dist/maid-irc_v*_prebuilt.zip)
deploy:
- provider: npm
email: [email protected]
Expand Down
53 changes: 53 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Hello, it looks like you're considering contributing to Maid-IRC. Please read the following carefully, it's important. Thank you for considering contributing to Maid-IRC.

**[Issues](#issues) | [Pull Request](#pull-request) | [Guidelines](#guidelines)**

---

## Issues

Please include as much information as possible regarding the bug. The following information will make our job easier when we attempt to address your issue:

- **Maid-IRC version** Is it a current or past release? Please include the version number.
- **Steps for reproducing the problem** Assuming the issue is reproducible, please include steps explaining how to do so.
- **Operating system and/or web browser** If its an issue on the server you probably wont need to include the web browser.
- **Related issues** If a similar or related issue has been reported before, please include that in your issue.

### Questions

If your issue is a question, please ask us via IRC or twitter. Our IRC and Twitter contact information is available [here](README.md#community).

### Feature request

If you have a suggestion or a feature request we prefer you do so by opening up a new issue. Before you do so, please check if somebody has already requested the same feature.

## Pull Request

- Fork Maid-IRC
- All checks must pass

## Guidelines

There are several guidelines that will need to be followed when contributing to Maid-IRC.

When communicating through one of Maid-IRC's channels, be it IRC or Github, please adhere to our [Code of Conduct](https://github.com/Phalanxia/Maid-IRC/wiki/Code-of-Conduct).

### Code

Please keep code short and sweet unless otherwise impossible.

#### Less and HTML

- [Code Guide by @mdo](https://github.com/mdo/code-guide)
- [Less Coding Guidelines](https://gist.github.com/fat/a47b882eb5f84293c4ed)

There are several things we do differently than otherwise specified in these guidelines:

- If they're conflictions in the guides, use code we already wrote as examples of what to do, if there isn't any, do what you think is best.
- Keep HTML tags and attributes **lowercase** unless otherwise required by the spec.
- **@import is okay** and actually required in the Less files due to the modularized way they're coded.
- Prefixed Less properties use Less [Parametric Mixins](http://lesscss.org/features/#mixins-parametric-feature) from the [polyfills.less](https://github.com/Phalanxia/Maid-IRC/blob/master/src/client/less/polyfills.less) file.
- Use hard tabs instead of soft tabs, unless the language doesn't support it.

#### JavaScript
JavaScript code must comply with [github.com/airbnb/javascript](https://github.com/airbnb/javascript)
8 changes: 4 additions & 4 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
host: '0.0.0.0'
http:
enabled: true
port: 4848
port: 6615
https:
enabled: false
port: 4949
port: 6616

# Location of private key file
private_key: 'key.pem'
private_key: ''

# Location of certificate file
certificate: 'cert.pem'
certificate: ''
public: false

# Check GitHub for avaliable updates on startup
Expand Down
38 changes: 10 additions & 28 deletions src/client/js/modules/Incoming.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ class Incoming {
type: 'privmsg',
channel: _data.args[0],
head: _data.nick,
nick: _data.nick,
message: _data.args[1],
highlightable: true,
isHighlightable: true,
});
},

Expand All @@ -64,9 +63,8 @@ class Incoming {
type: 'notice',
channel: _data.args[0],
head: '-notice-',
nick: _data.nick,
message: _data.args[1],
highlightable: true,
isHighlightable: true,
});
},

Expand Down Expand Up @@ -96,8 +94,7 @@ class Incoming {
this.addMessage({
type: 'join',
channel: _data.args[0],
head: ['icon', 'fa-sign-in'],
nick: _data.nick,
icon: 'fa-sign-in',
message: _data.nick + ' (' + _data.prefix + ') has Joined (' + _data.args[0] + ')',
});
},
Expand All @@ -108,16 +105,14 @@ class Incoming {
this.addMessage({
channel,
type: 'quit',
head: ['icon', 'fa-angle-double-left'],
nick: network.nick,
icon: 'fa-angle-double-left',
message: _data.nick + ' (' + _data.prefix + ') has Quit (' + _data.args[0] + ')',
});
} else if (_data.nick in channel.users) {
this.addMessage({
channel,
type: 'quit',
head: ['icon', 'fa-angle-double-left'],
nick: _data.nick,
icon: 'fa-angle-double-left',
message: _data.nick + ' (' + _data.prefix + ') has Quit (' + _data.args[0] + ')',
});
}
Expand All @@ -130,8 +125,7 @@ class Incoming {
this.addMessage({
channel,
type: 'error',
head: ['icon', 'fa-exclamation-circle'],
nick: 'server',
icon: 'fa-exclamation-circle',
message: 'Error: ' + _data.args[0],
});
}
Expand All @@ -141,8 +135,7 @@ class Incoming {
this.addMessage({
type: 'error',
channel: 'server',
head: ['icon', 'fa-exclamation-circle'],
nick: 'SERVER',
icon: 'fa-exclamation-circle',
message: 'Error: ' + _data.args[0],
});
},
Expand All @@ -157,7 +150,6 @@ class Incoming {
type: 'RPL_WELCOME',
channel: 'server',
head: '>',
nick: 'SERVER',
message: _data.args[1],
});
},
Expand All @@ -167,7 +159,6 @@ class Incoming {
type: 'RPL_YOURHOST',
channel: 'server',
head: '>',
nick: 'SERVER',
message: _data.args[1],
});
},
Expand All @@ -177,7 +168,6 @@ class Incoming {
type: 'RPL_CREATED',
channel: 'server',
head: '>',
nick: 'SERVER',
message: _data.args[1],
});
},
Expand All @@ -196,7 +186,6 @@ class Incoming {
type: 'RPL_MYINFO',
channel: 'server',
head: '>',
nick: 'SERVER',
});
},

Expand All @@ -205,7 +194,6 @@ class Incoming {
type: 'RPL_LUSERCLIENT',
channel: 'server',
head: '>',
nick: 'SERVER',
message: _data.args[1],
});
},
Expand Down Expand Up @@ -237,7 +225,6 @@ class Incoming {
type: 'RPL_TOPICWHOTIME',
channel: _data.args[1],
head: '>',
nick: 'SERVER',
message: 'Topic for ' + _data.args[1] + ' set by ' + _data.args[2] + ' at ' + topicDate,
});
},
Expand Down Expand Up @@ -272,7 +259,6 @@ class Incoming {
type: 'RPL_MOTD',
channel: 'server',
head: '>',
nick: 'SERVER',
message: _data.args[1],
});
},
Expand All @@ -282,7 +268,6 @@ class Incoming {
type: 'RPL_ENDOFMOTD',
channel: 'server',
head: '>',
nick: 'SERVER',
message: _data.args[1],
});
},
Expand All @@ -295,8 +280,7 @@ class Incoming {
this.addMessage({
type: 'warning',
channel: 'server',
head: ['icon', 'fa-exclamation-triangle'],
nick: 'SERVER',
icon: 'fa-exclamation-triangle',
message: _data.args[1] + ': ' + _data.args[2],
});
},
Expand All @@ -305,8 +289,7 @@ class Incoming {
this.addMessage({
type: 'warning',
channel: 'server',
head: ['icon', 'fa-exclamation-triangle'],
nick: 'SERVER',
icon: 'fa-exclamation-triangle',
message: _data.args[1] + ': ' + _data.args[2],
});
},
Expand All @@ -315,8 +298,7 @@ class Incoming {
this.addMessage({
type: 'warning',
channel: 'server',
head: ['icon', 'fa-exclamation-triangle'],
nick: 'SERVER',
icon: 'fa-exclamation-triangle',
message: _data.args[1] + ': ' + _data.args[2],
});
},
Expand Down
44 changes: 6 additions & 38 deletions src/client/js/modules/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,6 @@ const autolinker = new Autolinker({
phone: false,
});

function headGenerator(head) {
let _head = '';
let _icon = '';

// if (new format) else (old format)
if (typeof head === 'object') {
if (head[0] === 'text') {
_head = head[1];
} else if (head[0] === 'icon') {
_head = '';
_icon = `fa ${head[1]}`;
}
} else {
_head = head;

if (typeof _head !== 'undefined' && _head.length > 15) {
_head = _head.substring(0, 13) + '...';
}
}

return { _head, _icon };
}

class Message {
constructor(raw, connectionId) {
this.raw = raw;
Expand All @@ -44,15 +21,6 @@ class Message {
this.timestamp = `${('0' + this.rawTime.getHours()).slice(-2)}:` +
`${('0' + this.rawTime.getMinutes()).slice(-2)}:` +
`${('0' + this.rawTime.getSeconds()).slice(-2)}`;

// Message nick / icon
const headObj = headGenerator(this.raw.head);

this.head = headObj._head;

if (!headObj._icon) {
this.icon = headObj._icon;
}
}

display() {
Expand All @@ -69,9 +37,9 @@ class Message {
source: this.channel.toLowerCase(),
type: this.raw.type,
timestamp: this.timestamp,
head: this.head,
message: this.message,
icon: this.icon,
head: this.raw.head,
message: this.message || '',
icon: this.raw.icon,
}));

// Hide all messages
Expand Down Expand Up @@ -102,13 +70,13 @@ class Message {
.replace(/>/g, '>');

function highlight(name, input) {
const exp = new RegExp('\\b(' + name + ')', 'ig');
const exp = new RegExp(`\\b(${name})`, 'ig');
return input.replace(exp, '<span class="highlighted">$1</span>');
}

// Highlight nick if it's a message not from the server
if (this.channel !== 'server' && this.raw.highlightable) {
for (let i = 0; i < Maid.settings.highlights.length; i++) {
if (this.channel !== 'server' && this.raw.isHighlightable) {
for (const i of Maid.settings.highlights) {
this.message = highlight(Maid.settings.highlights[i], this.message);
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/client/views/message.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<article data-messageType="{{type}}" data-connection-id="{{connectionId}}" data-source="{{source}}">
<aside>
<time>{{timestamp}}</time>
<span class="{{icon}}">{{head}}</span>
{{#if head}}
<span>{{head}}</span>
{{/if}}
{{#if icon}}
<span class="fa {{icon}}"></span>
{{/if}}
</aside>
<p>{{{message}}}</p>
</article>
24 changes: 12 additions & 12 deletions src/server/views/client.jade
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ html(lang="en")
link(rel="dns-prefetch", href="twemoji.maxcdn.com")

body
#pageCover.displayed
.displayed#pageCover

// Client
#client
Expand All @@ -45,14 +45,14 @@ html(lang="en")
h1
span Maid
| IRC
button.btn.btn--clear.fa.fa-cog
button.btn.btn--clear.fa.fa-cog(title="Settings")
nav#message-source-list
footer
button.btn.fa.fa-plus
button.btn.fa.fa-plus(title="New connection")

.panel#channel-console
header
button.btn.btn--clear.fa.fa-bars(type="button")
button.btn.btn--clear.fa.fa-bars(type="button", title="Hide menu")
input(type="text")
output
article.filler
Expand All @@ -73,18 +73,18 @@ html(lang="en")
button(type="button") &times;
form(method="post")
#connect-basic
input#name(type="text", placeholder="Nickname", name="nick", spellcheck="false", autofocus, required)
input#name(name="nick", type="text", placeholder="Nickname", spellcheck="false", autofocus, required)
section
input#server(type="text", placeholder="Server", name="server", spellcheck="false", required)
input#port(type="number", placeholder="Port", name="port", maxlength="5", max="65535", required)
input#channel(type="text", placeholder="Channel", name="channel", spellcheck="false")
input#server(name="server", type="text", placeholder="Server", spellcheck="false", required)
input#port(name="port", type="number", placeholder="Port", maxlength="5", min="0" max="65535", required)
input#channel(name="channel", type="text", placeholder="Channel", spellcheck="false")
footer
button.btn#submit(type="submit", name="connect") Connect
button.btn#submit(name="connect", type="submit") Connect
button.btn.fa.fa-gear(type="button")
#connect-advanced
input#nicknamePassword(type="password", name="nickPassword", placeholder="Password", tabIndex="-1")
input#realName(type="text", name="realName", placeholder="Real name", tabIndex="-1")
input#ssl(type="checkbox", name="ssl", tabIndex="-1")
input#nicknamePassword(name="nickPassword", type="password", placeholder="Password", tabIndex="-1")
input#realName(name="realName", type="text", placeholder="Real name", tabIndex="-1")
input#ssl(name="ssl", type="checkbox", tabIndex="-1")
span.checkboxLabel SSL
footer
button.btn.fa.fa-gear(type="button")
Expand Down

0 comments on commit 441c1ec

Please sign in to comment.