mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
Merge branch 'develop' of github.com:ether/etherpad-lite into custom-obj-msg
This commit is contained in:
commit
23415eae49
9 changed files with 107 additions and 61 deletions
|
@ -143,6 +143,20 @@ Things in context:
|
||||||
|
|
||||||
This hook is called on the client side whenever a user joins or changes. This can be used to create notifications or an alternate user list.
|
This hook is called on the client side whenever a user joins or changes. This can be used to create notifications or an alternate user list.
|
||||||
|
|
||||||
|
## chatNewMessage
|
||||||
|
Called from: src/static/js/chat.js
|
||||||
|
|
||||||
|
Things in context:
|
||||||
|
|
||||||
|
1. authorName - The user that wrote this message
|
||||||
|
2. author - The authorID of the user that wrote the message
|
||||||
|
2. text - the message text
|
||||||
|
3. sticky (boolean) - if you want the gritter notification bubble to fade out on its own or just sit there
|
||||||
|
3. timestamp - the timestamp of the chat message
|
||||||
|
4. timeStr - the timestamp as a formatted string
|
||||||
|
|
||||||
|
This hook is called on the client side whenever a chat message is received from the server. It can be used to create different notifications for chat messages.
|
||||||
|
|
||||||
## collectContentPre
|
## collectContentPre
|
||||||
Called from: src/static/js/contentcollector.js
|
Called from: src/static/js/contentcollector.js
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ exports.doImport = function(req, res, padId)
|
||||||
form.parse(req, function(err, fields, files) {
|
form.parse(req, function(err, fields, files) {
|
||||||
//the upload failed, stop at this point
|
//the upload failed, stop at this point
|
||||||
if(err || files.file === undefined) {
|
if(err || files.file === undefined) {
|
||||||
console.warn("Uploading Error: " + err.stack);
|
if(err) console.warn("Uploading Error: " + err.stack);
|
||||||
callback("uploadFailed");
|
callback("uploadFailed");
|
||||||
}
|
}
|
||||||
//everything ok, continue
|
//everything ok, continue
|
||||||
|
|
|
@ -94,7 +94,7 @@ exports.expressConfigure = function (hook_name, args, cb) {
|
||||||
// If the log level specified in the config file is WARN or ERROR the application server never starts listening to requests as reported in issue #158.
|
// If the log level specified in the config file is WARN or ERROR the application server never starts listening to requests as reported in issue #158.
|
||||||
// Not installing the log4js connect logger when the log level has a higher severity than INFO since it would not log at that level anyway.
|
// Not installing the log4js connect logger when the log level has a higher severity than INFO since it would not log at that level anyway.
|
||||||
if (!(settings.loglevel === "WARN" || settings.loglevel == "ERROR"))
|
if (!(settings.loglevel === "WARN" || settings.loglevel == "ERROR"))
|
||||||
args.app.use(log4js.connectLogger(httpLogger, { level: log4js.levels.INFO, format: ':status, :method :url'}));
|
args.app.use(log4js.connectLogger(httpLogger, { level: log4js.levels.DEBUG, format: ':status, :method :url -- :response-timems'}));
|
||||||
|
|
||||||
/* Do not let express create the session, so that we can retain a
|
/* Do not let express create the session, so that we can retain a
|
||||||
* reference to it for socket.io to use. Also, set the key (cookie
|
* reference to it for socket.io to use. Also, set the key (cookie
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
"uglify-js" : "1.2.5",
|
"uglify-js" : "1.2.5",
|
||||||
"formidable" : "1.0.9",
|
"formidable" : "1.0.9",
|
||||||
"log4js" : "0.5.x",
|
"log4js" : "0.5.x",
|
||||||
|
"nodemailer" : "0.3.x",
|
||||||
"jsdom-nocontextifiy" : "0.2.10",
|
"jsdom-nocontextifiy" : "0.2.10",
|
||||||
"async-stacktrace" : "0.0.2",
|
"async-stacktrace" : "0.0.2",
|
||||||
"npm" : "1.1.x",
|
"npm" : "1.1.x",
|
||||||
|
|
|
@ -78,6 +78,7 @@ ul.list-indent8 { list-style-type: none; }
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
word-wrap: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#outerdocbody {
|
#outerdocbody {
|
||||||
|
@ -93,6 +94,7 @@ body.grayedout { background-color: #eee !important }
|
||||||
|
|
||||||
body.doesWrap {
|
body.doesWrap {
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
|
word-wrap: break-word; /* fix for issue #1648 - firefox not wrapping long lines (without spaces) correctly */
|
||||||
}
|
}
|
||||||
|
|
||||||
#innerdocbody {
|
#innerdocbody {
|
||||||
|
|
|
@ -828,7 +828,44 @@ input[type=checkbox] {
|
||||||
padding: 4px 1px
|
padding: 4px 1px
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@media screen and (max-width: 400px){
|
@media all and (max-width: 400px){
|
||||||
|
#gritter-notice-wrapper{
|
||||||
|
max-height:172px;
|
||||||
|
overflow:hidden;
|
||||||
|
width:100% !important;
|
||||||
|
background-color: #ccc;
|
||||||
|
bottom:20px;
|
||||||
|
left:0px;
|
||||||
|
right:0px;
|
||||||
|
color:#000;
|
||||||
|
}
|
||||||
|
.gritter-close {
|
||||||
|
display:block !important;
|
||||||
|
left: auto !important;
|
||||||
|
right:5px;
|
||||||
|
}
|
||||||
|
#gritter-notice-wrapper.bottom-right{
|
||||||
|
left:0px !important;
|
||||||
|
bottom:30px !important;
|
||||||
|
right:0px !important;
|
||||||
|
}
|
||||||
|
.gritter-item p{
|
||||||
|
color:black;
|
||||||
|
font-size:16px;
|
||||||
|
}
|
||||||
|
.gritter-title{
|
||||||
|
text-shadow: none !important;
|
||||||
|
color:black;
|
||||||
|
}
|
||||||
|
.gritter-item{
|
||||||
|
padding:2px 11px 8px 4px;
|
||||||
|
}
|
||||||
|
.gritter-item-wrapper{
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
.gritter-item-wrapper > div{
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
#editorcontainer {
|
#editorcontainer {
|
||||||
top: 68px;
|
top: 68px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
var padutils = require('./pad_utils').padutils;
|
var padutils = require('./pad_utils').padutils;
|
||||||
var padcookie = require('./pad_cookie').padcookie;
|
var padcookie = require('./pad_cookie').padcookie;
|
||||||
var Tinycon = require('tinycon/tinycon');
|
var Tinycon = require('tinycon/tinycon');
|
||||||
|
var hooks = require('./pluginfw/hooks');
|
||||||
|
|
||||||
var chat = (function()
|
var chat = (function()
|
||||||
{
|
{
|
||||||
|
@ -99,19 +100,39 @@ var chat = (function()
|
||||||
|
|
||||||
var text = padutils.escapeHtmlWithClickableLinks(msg.text, "_blank");
|
var text = padutils.escapeHtmlWithClickableLinks(msg.text, "_blank");
|
||||||
|
|
||||||
/* Performs an action if your name is mentioned */
|
|
||||||
var myName = $('#myusernameedit').val();
|
|
||||||
myName = myName.toLowerCase();
|
|
||||||
var chatText = text.toLowerCase();
|
|
||||||
var wasMentioned = false;
|
|
||||||
if (chatText.indexOf(myName) !== -1 && myName != "undefined"){
|
|
||||||
wasMentioned = true;
|
|
||||||
}
|
|
||||||
/* End of new action */
|
|
||||||
|
|
||||||
var authorName = msg.userName == null ? _('pad.userlist.unnamed') : padutils.escapeHtml(msg.userName);
|
var authorName = msg.userName == null ? _('pad.userlist.unnamed') : padutils.escapeHtml(msg.userName);
|
||||||
|
|
||||||
var html = "<p data-authorId='" + msg.userId + "' class='" + authorClass + "'><b>" + authorName + ":</b><span class='time " + authorClass + "'>" + timeStr + "</span> " + text + "</p>";
|
// the hook args
|
||||||
|
var ctx = {
|
||||||
|
"authorName" : authorName,
|
||||||
|
"author" : msg.userId,
|
||||||
|
"text" : text,
|
||||||
|
"sticky" : false,
|
||||||
|
"timestamp" : msg.time,
|
||||||
|
"timeStr" : timeStr
|
||||||
|
}
|
||||||
|
|
||||||
|
// is the users focus already in the chatbox?
|
||||||
|
var alreadyFocused = $("#chatinput").is(":focus");
|
||||||
|
|
||||||
|
// does the user already have the chatbox open?
|
||||||
|
var chatOpen = $("#chatbox").is(":visible");
|
||||||
|
|
||||||
|
// does this message contain this user's name? (is the curretn user mentioned?)
|
||||||
|
var myName = $('#myusernameedit').val();
|
||||||
|
var wasMentioned = (text.toLowerCase().indexOf(myName.toLowerCase()) !== -1 && myName != "undefined");
|
||||||
|
|
||||||
|
if(wasMentioned && !alreadyFocused && !isHistoryAdd && !chatOpen)
|
||||||
|
{ // If the user was mentioned show for twice as long and flash the browser window
|
||||||
|
chatMentions++;
|
||||||
|
Tinycon.setBubble(chatMentions);
|
||||||
|
ctx.sticky = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call chat message hook
|
||||||
|
hooks.aCallAll("chatNewMessage", ctx, function() {
|
||||||
|
|
||||||
|
var html = "<p data-authorId='" + msg.userId + "' class='" + authorClass + "'><b>" + authorName + ":</b><span class='time " + authorClass + "'>" + ctx.timeStr + "</span> " + ctx.text + "</p>";
|
||||||
if(isHistoryAdd)
|
if(isHistoryAdd)
|
||||||
$(html).insertAfter('#chatloadmessagesbutton');
|
$(html).insertAfter('#chatloadmessagesbutton');
|
||||||
else
|
else
|
||||||
|
@ -120,52 +141,26 @@ var chat = (function()
|
||||||
//should we increment the counter??
|
//should we increment the counter??
|
||||||
if(increment && !isHistoryAdd)
|
if(increment && !isHistoryAdd)
|
||||||
{
|
{
|
||||||
|
// Update the counter of unread messages
|
||||||
var count = Number($("#chatcounter").text());
|
var count = Number($("#chatcounter").text());
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
// is the users focus already in the chatbox?
|
|
||||||
var alreadyFocused = $("#chatinput").is(":focus");
|
|
||||||
|
|
||||||
// does the user already have the chatbox open?
|
|
||||||
var chatOpen = $("#chatbox").is(":visible");
|
|
||||||
|
|
||||||
$("#chatcounter").text(count);
|
$("#chatcounter").text(count);
|
||||||
// chat throb stuff -- Just make it throw for twice as long
|
|
||||||
if(wasMentioned && !alreadyFocused && !isHistoryAdd && !chatOpen)
|
if(!chatOpen) {
|
||||||
{ // If the user was mentioned show for twice as long and flash the browser window
|
|
||||||
$.gritter.add({
|
$.gritter.add({
|
||||||
// (string | mandatory) the heading of the notification
|
// (string | mandatory) the heading of the notification
|
||||||
title: authorName,
|
title: ctx.authorName,
|
||||||
// (string | mandatory) the text inside the notification
|
// (string | mandatory) the text inside the notification
|
||||||
text: text,
|
text: ctx.text,
|
||||||
// (bool | optional) if you want it to fade out on its own or just sit there
|
// (bool | optional) if you want it to fade out on its own or just sit there
|
||||||
sticky: true,
|
sticky: ctx.sticky,
|
||||||
// (int | optional) the time you want it to be alive for before fading out
|
|
||||||
time: '2000'
|
|
||||||
});
|
|
||||||
|
|
||||||
chatMentions++;
|
|
||||||
Tinycon.setBubble(chatMentions);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(!chatOpen){
|
|
||||||
$.gritter.add({
|
|
||||||
// (string | mandatory) the heading of the notification
|
|
||||||
title: authorName,
|
|
||||||
// (string | mandatory) the text inside the notification
|
|
||||||
text: text,
|
|
||||||
|
|
||||||
// (bool | optional) if you want it to fade out on its own or just sit there
|
|
||||||
sticky: false,
|
|
||||||
// (int | optional) the time you want it to be alive for before fading out
|
// (int | optional) the time you want it to be alive for before fading out
|
||||||
time: '4000'
|
time: '4000'
|
||||||
});
|
});
|
||||||
Tinycon.setBubble(count);
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Clear the chat mentions when the user clicks on the chat input box
|
// Clear the chat mentions when the user clicks on the chat input box
|
||||||
$('#chatinput').click(function(){
|
$('#chatinput').click(function(){
|
||||||
chatMentions = 0;
|
chatMentions = 0;
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
$.gritter.options = {
|
$.gritter.options = {
|
||||||
position: '',
|
position: '',
|
||||||
class_name: '', // could be set to 'gritter-light' to use white notifications
|
class_name: '', // could be set to 'gritter-light' to use white notifications
|
||||||
fade_in_speed: 'medium', // how fast notifications fade in
|
|
||||||
fade_out_speed: 1000, // how fast the notices fade out
|
|
||||||
time: 6000 // hang on the screen for...
|
time: 6000 // hang on the screen for...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -365,8 +365,7 @@ function handshake()
|
||||||
|
|
||||||
$.extend($.gritter.options, {
|
$.extend($.gritter.options, {
|
||||||
position: 'bottom-right', // defaults to 'top-right' but can be 'bottom-left', 'bottom-right', 'top-left', 'top-right' (added in 1.7.1)
|
position: 'bottom-right', // defaults to 'top-right' but can be 'bottom-left', 'bottom-right', 'top-left', 'top-right' (added in 1.7.1)
|
||||||
fade_in_speed: 'medium', // how fast notifications fade in (string or int)
|
fade: false, // dont fade, too jerky on mobile
|
||||||
fade_out_speed: 2000, // how fast the notices fade out
|
|
||||||
time: 6000 // hang on the screen for...
|
time: 6000 // hang on the screen for...
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue