Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
5f440dc7
Commit
5f440dc7
authored
Jul 19, 2012
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove chatui.js, not being used anymore.
parent
944cca81
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
155 deletions
+1
-155
chat.js
chat.js
+1
-4
chatui.js
chatui.js
+0
-151
No files found.
chat.js
View file @
5f440dc7
...
@@ -215,10 +215,6 @@ xmppchat.ChatBoxView = Backbone.View.extend({
...
@@ -215,10 +215,6 @@ xmppchat.ChatBoxView = Backbone.View.extend({
'
username
'
:
user_id
,
'
username
'
:
user_id
,
'
extra_classes
'
:
(
$
(
message
).
find
(
'
delay
'
).
length
>
0
)
&&
'
delayed
'
||
''
'
extra_classes
'
:
(
$
(
message
).
find
(
'
delay
'
).
length
>
0
)
&&
'
delayed
'
||
''
}));
}));
// TODO:
// xmppchat.UI.msg_counter += 1;
// xmppchat.UI.updateMsgCounter();
$chat_content
.
scrollTop
(
$chat_content
[
0
].
scrollHeight
);
$chat_content
.
scrollTop
(
$chat_content
[
0
].
scrollHeight
);
}
}
},
},
...
@@ -1091,6 +1087,7 @@ $(document).ready(function () {
...
@@ -1091,6 +1087,7 @@ $(document).ready(function () {
$toggle
=
$
(
'
a#toggle-online-users
'
);
$toggle
=
$
(
'
a#toggle-online-users
'
);
$toggle
.
unbind
(
'
click
'
);
$toggle
.
unbind
(
'
click
'
);
$
(
'
ul.tabs
'
).
tabs
(
'
div.panes > div
'
);
xmppchat
.
username
=
chatdata
.
attr
(
'
username
'
);
xmppchat
.
username
=
chatdata
.
attr
(
'
username
'
);
xmppchat
.
base_url
=
chatdata
.
attr
(
'
base_url
'
);
xmppchat
.
base_url
=
chatdata
.
attr
(
'
base_url
'
);
...
...
chatui.js
deleted
100644 → 0
View file @
944cca81
xmppchat
.
UI
=
(
function
(
xmppUI
,
$
,
console
)
{
var
ob
=
xmppUI
;
ob
.
chats
=
[];
ob
.
chat_focus
=
[];
ob
.
addUserToRosterUI
=
function
(
user_id
,
bare_jid
,
fullname
,
userstatus
)
{};
ob
.
updateOnPresence
=
function
(
jid
,
status
,
presence
)
{
var
user_id
=
Strophe
.
getNodeFromJid
(
jid
),
bare_jid
=
Strophe
.
getBareJidFromJid
(
jid
),
resource
,
online_count
,
$chat
=
$
(
"
#
"
+
helpers
.
hash
(
bare_jid
)),
$chat_content
,
existing_user_element
=
$
(
'
#online-users-
'
+
user_id
);
if
(
xmppchat
.
isOwnUser
(
jid
))
{
return
;
}
if
(
$chat
.
length
>
0
)
{
$chat_content
=
$chat
.
find
(
"
.chat-content
"
);
$chat_content
.
find
(
'
div.chat-event
'
).
remove
();
if
(
status
===
'
offline
'
)
{
xmppchat
.
Presence
.
getUserInfo
(
user_id
,
function
(
data
)
{
$chat_content
.
append
(
$
(
'
<div></div>
'
).
addClass
(
'
chat-event
'
).
text
(
data
.
fullname
+
'
has gone offline.
'
));
$chat_content
.
scrollTop
(
$content
[
0
].
scrollHeight
);
});
}
else
if
(
status
===
'
unsubscribe
'
)
{
xmppchat
.
Presence
.
getUserInfo
(
user_id
,
function
(
data
)
{
$chat_content
.
append
(
$
(
'
<div></div>
'
).
addClass
(
'
chat-event
'
).
text
(
data
.
fullname
+
'
has removed you as a contact.
'
));
$chat_content
.
scrollTop
(
$content
[
0
].
scrollHeight
);
});
if
(
existing_user_element
.
length
>
0
)
{
existing_user_element
.
remove
();
}
$
(
'
#online-count
'
).
text
(
xmppchat
.
Presence
.
onlineCount
());
return
;
}
}
if
(
existing_user_element
.
length
>
0
)
{
existing_user_element
.
attr
(
'
class
'
,
status
);
}
else
if
((
status
!==
'
offline
'
)
&&
(
status
!==
'
unavailable
'
))
{
xmppchat
.
Presence
.
getUserInfo
(
user_id
,
function
(
data
)
{
xmppchat
.
UI
.
addUserToRosterUI
(
user_id
,
bare_jid
,
data
.
fullname
,
status
);
});
}
else
{
// status is offline and the user isn't shown as online
return
;
}
$
(
'
#online-count
'
).
text
(
xmppchat
.
Presence
.
onlineCount
());
};
ob
.
positionNewChat
=
function
(
$chat
)
{};
ob
.
handleChatEvents
=
function
(
chat_id
)
{
var
chat_area
=
$
(
"
#
"
+
chat_id
+
"
.chat-textarea
"
),
chat_type
=
chat_id
.
split
(
'
_
'
)[
0
],
that
=
this
;
that
.
chat_focus
[
chat_id
]
=
false
;
chat_area
.
blur
(
function
()
{
that
.
chat_focus
[
chat_id
]
=
false
;
chat_area
.
removeClass
(
'
chat-textarea-
'
+
chat_type
+
'
-selected
'
);
}).
focus
(
function
(){
that
.
chat_focus
[
chat_id
]
=
true
;
chat_area
.
addClass
(
'
chat-textarea-
'
+
chat_type
+
'
-selected
'
);
});
var
chatbox
=
$
(
"
#
"
+
chat_id
);
chatbox
.
click
(
function
()
{
if
(
chatbox
.
find
(
'
.chat-content
'
).
is
(
'
:visible
'
))
{
chatbox
.
find
(
'
.chat-textarea
'
).
focus
();
}
});
};
ob
.
insertCollectionMessages
=
function
(
$chat
,
bare_jid
,
recipient_name
)
{
xmppchat
.
Collections
.
getLastMessages
(
bare_jid
,
function
(
result
)
{
$
(
'
body
'
).
append
(
$chat
);
$
(
result
).
find
(
'
chat
'
).
children
().
each
(
function
(
idx
,
el
)
{
if
(
el
.
tagName
!==
'
set
'
)
{
// TODO: Calculate the time. We have the start time and the offset for each message...
var
text
=
$
(
el
).
find
(
'
body
'
).
text
(),
now
=
new
Date
(),
time
=
now
.
toLocaleTimeString
().
substring
(
0
,
5
),
$content
=
$chat
.
find
(
'
.chat-content
'
);
div
=
$
(
'
<div class="chat-message delayed"></div>
'
);
if
(
el
.
tagName
==
'
to
'
)
{
message_html
=
div
.
append
(
'
<span class="chat-message-me">
'
+
time
+
'
me: </span>
'
+
'
<span class="chat-message-content">
'
+
text
+
'
</span>
'
);
}
else
{
message_html
=
div
.
append
(
'
<span class="chat-message-them">
'
+
time
+
'
'
+
recipient_name
+
'
: </span>
'
+
'
<span class="chat-message-content">
'
+
text
+
'
</span>
'
);
}
$content
.
append
(
message_html
);
$content
.
scrollTop
(
$content
[
0
].
scrollHeight
);
}
});
callback
(
$chat
);
});
};
ob
.
insertClientStoredMessages
=
function
(
$chat
,
bare_jid
,
recipient_name
)
{};
ob
.
createChatbox
=
function
(
bare_jid
,
callback
)
{};
ob
.
prepNewChat
=
function
(
chat
,
jid
)
{
// Some operations that need to be applied on a chatbox
// after it has been created.
var
chat_content
,
value
;
if
(
jid
===
'
online-users-container
'
)
{
// Make sure the xmpp status is correctly set on the control box
value
=
xmppchat
.
Storage
.
get
(
xmppchat
.
username
+
'
-xmpp-status
'
)
||
'
online
'
;
$
(
chat
).
find
(
'
#select-xmpp-status
'
).
val
(
value
);
}
else
{
chat_content
=
$
(
chat
).
find
(
'
.chat-content
'
);
$
(
chat
).
find
(
"
.chat-textarea
"
).
focus
();
if
(
chat_content
.
length
>
0
)
{
chat_content
.
scrollTop
(
chat_content
[
0
].
scrollHeight
);
}
}
if
(
_
.
indexOf
(
this
.
chats
,
jid
)
==
-
1
)
{
this
.
chats
.
push
(
jid
);
}
this
.
addChatToCookie
(
jid
);
};
ob
.
getChatbox
=
function
(
jid
,
callback
)
{};
ob
.
reorderChats
=
function
()
{};
ob
.
addChatToCookie
=
function
(
jid
)
{};
return
ob
;
})(
xmppchat
.
UI
||
{},
jQuery
,
console
||
{
log
:
function
(){}}
);
// Event handlers
// --------------
$
(
document
).
ready
(
function
()
{
$
(
'
ul.tabs
'
).
tabs
(
'
div.panes > div
'
);
$
(
'
select#select-xmpp-status
'
).
bind
(
'
change
'
,
function
(
ev
)
{
var
jid
=
xmppchat
.
connection
.
jid
,
value
=
ev
.
target
.
value
;
xmppchat
.
Presence
.
sendPresence
(
value
);
xmppchat
.
Storage
.
set
(
xmppchat
.
username
+
'
-xmpp-status
'
,
value
);
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment