Merge branch 'dev'

This commit is contained in:
Yuya Ochiai
2016-02-16 21:17:44 +09:00
6 changed files with 34 additions and 12 deletions

View File

@@ -142,7 +142,7 @@ var MainPage = React.createClass({
var handleNotificationClick = function() {
thisObj.handleSelect(index);
}
return (<MattermostView id={ 'mattermostView' + index } style={ thisObj.visibleStyle(thisObj.state.key === index) } src={ team.url } onUnreadCountChange={ handleUnreadCountChange } onNotificationClick={ handleNotificationClick }
return (<MattermostView id={ 'mattermostView' + index } style={ thisObj.visibleStyle(thisObj.state.key === index) } src={ team.url } name={ team.name } onUnreadCountChange={ handleUnreadCountChange } onNotificationClick={ handleNotificationClick }
/>)
});
var views_row = (<Row>
@@ -268,12 +268,26 @@ var MattermostView = React.createClass({
case 'onNotificationClick':
thisObj.props.onNotificationClick();
break;
case 'console':
console.log(event.args[0]);
break;
}
});
webview.addEventListener('console-message', (e) => {
const message = `[${this.props.name}] ${e.message}`;
switch (e.level) {
case 0:
console.log(message);
break;
case 1:
console.warn(message);
break;
case 2:
console.error(message);
break;
default:
console.log(message);
break;
}
});
},
render: function() {
// 'disablewebsecurity' is necessary to display external images.

View File

@@ -42,13 +42,18 @@ var unreadCountTimer = setInterval(function() {
// find active post-list.
var postLists = document.querySelectorAll('div.post-list__content');
var post;
if (postLists.length === 0) {
return;
}
var post = null;
for (var i = 0; i < postLists.length; i++) {
if (isElementVisible(postLists[i])) {
post = postLists[i].children[0];
}
}
if (post === null) {
return;
}
// find latest post and save.
while (post = post.nextSibling) {
if (post.nextSibling === null) {

View File

@@ -111,10 +111,10 @@ app.on('ready', function() {
}
// Create the browser window.
var bounds_info_path = app.getPath("userData") + "/bounds-info.json";
var bounds_info_path = path.resolve(app.getPath("userData"), "bounds-info.json");
var window_options;
try {
window_options = require(bounds_info_path);
window_options = JSON.parse(fs.readFileSync(bounds_info_path, 'utf-8'));
}
catch (e) {
// follow Electron's defaults