2 * StatusNet - a distributed open-source microblogging tool
3 * Copyright (C) 2008, StatusNet, Inc.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * @category UI interaction
20 * @author Sarven Capadisli <csarven@status.net>
21 * @author Evan Prodromou <evan@status.net>
22 * @copyright 2009 StatusNet, Inc.
23 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
24 * @link http://status.net/
27 var SN = { // StatusNet
30 CounterBlackout: false,
32 PatternUsername: /^[0-9a-zA-Z\-_.]*$/,
33 HTTP20x30x: [200, 201, 202, 203, 204, 205, 206, 300, 301, 302, 303, 304, 305, 306, 307]
41 Processing: 'processing',
42 CommandResult: 'command_result',
43 FormNotice: 'form_notice',
44 NoticeDataText: 'notice_data-text',
45 NoticeTextCount: 'notice_text-count',
46 NoticeInReplyTo: 'notice_in-reply-to',
47 NoticeDataAttach: 'notice_data-attach',
48 NoticeDataAttachSelected: 'notice_data-attach_selected',
49 NoticeActionSubmit: 'notice_action-submit',
50 NoticeLat: 'notice_data-lat',
51 NoticeLon: 'notice_data-lon',
52 NoticeLocationId: 'notice_data-location_id',
53 NoticeLocationNs: 'notice_data-location_ns',
54 NoticeGeoName: 'notice_data-geo_name',
55 NoticeDataGeo: 'notice_data-geo',
56 NoticeDataGeoCookie: 'NoticeDataGeo',
57 NoticeDataGeoSelected: 'notice_data-geo_selected',
58 StatusNetInstance:'StatusNetInstance'
63 FormNoticeEnhancements: function(form) {
64 if (jQuery.data(form[0], 'ElementData') === undefined) {
65 MaxLength = form.find('#'+SN.C.S.NoticeTextCount).text();
66 if (typeof(MaxLength) == 'undefined') {
67 MaxLength = SN.C.I.MaxLength;
69 jQuery.data(form[0], 'ElementData', {MaxLength:MaxLength});
73 NDT = form.find('#'+SN.C.S.NoticeDataText);
75 NDT.bind('keyup', function(e) {
79 NDT.bind('keydown', function(e) {
80 SN.U.SubmitOnReturn(e, form);
84 form.find('#'+SN.C.S.NoticeTextCount).text(jQuery.data(form[0], 'ElementData').MaxLength);
87 if ($('body')[0].id != 'conversation' && window.location.hash.length === 0 && $(window).scrollTop() == 0) {
88 form.find('textarea').focus();
92 SubmitOnReturn: function(event, el) {
93 if (event.keyCode == 13 || event.keyCode == 10) {
95 event.preventDefault();
96 event.stopPropagation();
97 $('#'+el[0].id+' #'+SN.C.S.NoticeDataText).blur();
104 Counter: function(form) {
105 SN.C.I.FormNoticeCurrent = form;
107 var MaxLength = jQuery.data(form[0], 'ElementData').MaxLength;
109 if (MaxLength <= 0) {
113 var remaining = MaxLength - form.find('#'+SN.C.S.NoticeDataText).val().length;
114 var counter = form.find('#'+SN.C.S.NoticeTextCount);
116 if (remaining.toString() != counter.text()) {
117 if (!SN.C.I.CounterBlackout || remaining === 0) {
118 if (counter.text() != String(remaining)) {
119 counter.text(remaining);
122 form.addClass(SN.C.S.Warning);
124 form.removeClass(SN.C.S.Warning);
126 // Skip updates for the next 500ms.
127 // On slower hardware, updating on every keypress is unpleasant.
128 if (!SN.C.I.CounterBlackout) {
129 SN.C.I.CounterBlackout = true;
130 SN.C.I.FormNoticeCurrent = form;
131 window.setTimeout("SN.U.ClearCounterBlackout(SN.C.I.FormNoticeCurrent);", 500);
137 ClearCounterBlackout: function(form) {
138 // Allow keyup events to poke the counter again
139 SN.C.I.CounterBlackout = false;
140 // Check if the string changed since we last looked
144 FormXHR: function(form) {
148 url: form.attr('action'),
149 data: form.serialize() + '&ajax=1',
150 beforeSend: function(xhr) {
152 .addClass(SN.C.S.Processing)
154 .addClass(SN.C.S.Disabled)
155 .attr(SN.C.S.Disabled, SN.C.S.Disabled);
157 error: function (xhr, textStatus, errorThrown) {
158 alert(errorThrown || textStatus);
160 success: function(data, textStatus) {
161 if (typeof($('form', data)[0]) != 'undefined') {
162 form_new = document._importNode($('form', data)[0], true);
163 form.replaceWith(form_new);
166 form.replaceWith(document._importNode($('p', data)[0], true));
172 FormNoticeXHR: function(form) {
173 SN.C.I.NoticeDataGeo = {};
174 form.append('<input type="hidden" name="ajax" value="1"/>');
178 beforeSend: function(formData) {
179 if (form.find('#'+SN.C.S.NoticeDataText)[0].value.length === 0) {
180 form.addClass(SN.C.S.Warning);
184 .addClass(SN.C.S.Processing)
185 .find('#'+SN.C.S.NoticeActionSubmit)
186 .addClass(SN.C.S.Disabled)
187 .attr(SN.C.S.Disabled, SN.C.S.Disabled);
189 SN.C.I.NoticeDataGeo.NLat = $('#'+SN.C.S.NoticeLat).val();
190 SN.C.I.NoticeDataGeo.NLon = $('#'+SN.C.S.NoticeLon).val();
191 SN.C.I.NoticeDataGeo.NLNS = $('#'+SN.C.S.NoticeLocationNs).val();
192 SN.C.I.NoticeDataGeo.NLID = $('#'+SN.C.S.NoticeLocationId).val();
193 SN.C.I.NoticeDataGeo.NDG = $('#'+SN.C.S.NoticeDataGeo).attr('checked');
195 cookieValue = $.cookie(SN.C.S.NoticeDataGeoCookie);
197 if (cookieValue !== null && cookieValue != 'disabled') {
198 cookieValue = JSON.parse(cookieValue);
199 SN.C.I.NoticeDataGeo.NLat = $('#'+SN.C.S.NoticeLat).val(cookieValue.NLat).val();
200 SN.C.I.NoticeDataGeo.NLon = $('#'+SN.C.S.NoticeLon).val(cookieValue.NLon).val();
201 if ($('#'+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS)) {
202 SN.C.I.NoticeDataGeo.NLNS = $('#'+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS).val();
203 SN.C.I.NoticeDataGeo.NLID = $('#'+SN.C.S.NoticeLocationId).val(cookieValue.NLID).val();
206 if (cookieValue == 'disabled') {
207 SN.C.I.NoticeDataGeo.NDG = $('#'+SN.C.S.NoticeDataGeo).attr('checked', false).attr('checked');
210 SN.C.I.NoticeDataGeo.NDG = $('#'+SN.C.S.NoticeDataGeo).attr('checked', true).attr('checked');
215 error: function (xhr, textStatus, errorThrown) {
217 .removeClass(SN.C.S.Processing)
218 .find('#'+SN.C.S.NoticeActionSubmit)
219 .removeClass(SN.C.S.Disabled)
220 .removeAttr(SN.C.S.Disabled, SN.C.S.Disabled);
221 form.find('.form_response').remove();
222 if (textStatus == 'timeout') {
223 form.append('<p class="form_response error">Sorry! We had trouble sending your notice. The servers are overloaded. Please try again, and contact the site administrator if this problem persists.</p>');
226 if ($('.'+SN.C.S.Error, xhr.responseXML).length > 0) {
227 form.append(document._importNode($('.'+SN.C.S.Error, xhr.responseXML)[0], true));
230 if (parseInt(xhr.status) === 0 || jQuery.inArray(parseInt(xhr.status), SN.C.I.HTTP20x30x) >= 0) {
233 .find('#'+SN.C.S.NoticeDataAttachSelected).remove();
234 SN.U.FormNoticeEnhancements(form);
237 form.append('<p class="form_response error">(Sorry! We had trouble sending your notice ('+xhr.status+' '+xhr.statusText+'). Please report the problem to the site administrator if this happens again.</p>');
242 success: function(data, textStatus) {
243 form.find('.form_response').remove();
245 if ($('#'+SN.C.S.Error, data).length > 0) {
246 result = document._importNode($('p', data)[0], true);
247 result = result.textContent || result.innerHTML;
248 form.append('<p class="form_response error">'+result+'</p>');
251 if($('body')[0].id == 'bookmarklet') {
255 if ($('#'+SN.C.S.CommandResult, data).length > 0) {
256 result = document._importNode($('p', data)[0], true);
257 result = result.textContent || result.innerHTML;
258 form.append('<p class="form_response success">'+result+'</p>');
261 // New notice post was successful. If on our timeline, show it!
262 var notice = document._importNode($('li', data)[0], true);
263 var notices = $('#notices_primary .notices');
264 if (notices.length > 0 && SN.U.belongsOnTimeline(notice)) {
265 if ($('#'+notice.id).length === 0) {
266 var notice_irt_value = $('#'+SN.C.S.NoticeInReplyTo).val();
267 var notice_irt = '#notices_primary #notice-'+notice_irt_value;
268 if($('body')[0].id == 'conversation') {
269 if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) {
270 $(notice_irt).append('<ul class="notices"></ul>');
272 $($(notice_irt+' .notices')[0]).append(notice);
275 notices.prepend(notice);
278 .css({display:'none'})
280 SN.U.NoticeWithAttachment($('#'+notice.id));
281 SN.U.NoticeReplyTo($('#'+notice.id));
285 // Not on a timeline that this belongs on?
286 // Just show a success message.
287 result = document._importNode($('title', data)[0], true);
288 result_title = result.textContent || result.innerHTML;
289 form.append('<p class="form_response success">'+result_title+'</p>');
293 form.find('#'+SN.C.S.NoticeInReplyTo).val('');
294 form.find('#'+SN.C.S.NoticeDataAttachSelected).remove();
295 SN.U.FormNoticeEnhancements(form);
298 complete: function(xhr, textStatus) {
300 .removeClass(SN.C.S.Processing)
301 .find('#'+SN.C.S.NoticeActionSubmit)
302 .removeAttr(SN.C.S.Disabled)
303 .removeClass(SN.C.S.Disabled);
305 $('#'+SN.C.S.NoticeLat).val(SN.C.I.NoticeDataGeo.NLat);
306 $('#'+SN.C.S.NoticeLon).val(SN.C.I.NoticeDataGeo.NLon);
307 if ($('#'+SN.C.S.NoticeLocationNs)) {
308 $('#'+SN.C.S.NoticeLocationNs).val(SN.C.I.NoticeDataGeo.NLNS);
309 $('#'+SN.C.S.NoticeLocationId).val(SN.C.I.NoticeDataGeo.NLID);
311 $('#'+SN.C.S.NoticeDataGeo).attr('checked', SN.C.I.NoticeDataGeo.NDG);
316 NoticeReply: function() {
317 if ($('#'+SN.C.S.NoticeDataText).length > 0 && $('#content .notice_reply').length > 0) {
318 $('#content .notice').each(function() { SN.U.NoticeReplyTo($(this)); });
322 NoticeReplyTo: function(notice) {
323 notice.find('.notice_reply').live('click', function() {
324 var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname.uid');
325 SN.U.NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
330 NoticeReplySet: function(nick,id) {
331 if (nick.match(SN.C.I.PatternUsername)) {
332 var text = $('#'+SN.C.S.NoticeDataText);
333 if (text.length > 0) {
334 replyto = '@' + nick + ' ';
335 text.val(replyto + text.val().replace(RegExp(replyto, 'i'), ''));
336 $('#'+SN.C.S.FormNotice+' #'+SN.C.S.NoticeInReplyTo).val(id);
339 if (text[0].setSelectionRange) {
340 var len = text.val().length;
341 text[0].setSelectionRange(len,len);
347 NoticeFavor: function() {
348 $('.form_favor').live('click', function() { SN.U.FormXHR($(this)); return false; });
349 $('.form_disfavor').live('click', function() { SN.U.FormXHR($(this)); return false; });
352 NoticeRepeat: function() {
353 $('.form_repeat').live('click', function(e) {
356 SN.U.NoticeRepeatConfirmation($(this));
361 NoticeRepeatConfirmation: function(form) {
362 var submit_i = form.find('.submit');
364 var submit = submit_i.clone();
366 .addClass('submit_dialogbox')
367 .removeClass('submit');
369 submit.bind('click', function() { SN.U.FormXHR(form); return false; });
374 .addClass('dialogbox')
375 .append('<button class="close">×</button>')
376 .closest('.notice-options')
379 form.find('button.close').click(function(){
383 .removeClass('dialogbox')
384 .closest('.notice-options')
385 .removeClass('opaque');
387 form.find('.submit_dialogbox').remove();
388 form.find('.submit').show();
394 NoticeAttachments: function() {
395 $('.notice a.attachment').each(function() {
396 SN.U.NoticeWithAttachment($(this).closest('.notice'));
400 NoticeWithAttachment: function(notice) {
401 if (notice.find('.attachment').length === 0) {
405 var attachment_more = notice.find('.attachment.more');
406 if (attachment_more.length > 0) {
407 $(attachment_more[0]).click(function() {
409 m.addClass(SN.C.S.Processing);
410 $.get(m.attr('href')+'/ajax', null, function(data) {
411 m.parent('.entry-content').html($(data).find('#attachment_view .entry-content').html());
418 $.fn.jOverlay.options = {
426 imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif',
427 bgClickToClose : true,
428 success : function() {
429 $('#jOverlayContent').append('<button class="close">×</button>');
430 $('#jOverlayContent button').click($.closeOverlay);
434 css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'}
437 notice.find('a.attachment').click(function() {
438 var attachId = ($(this).attr('id').substring('attachment'.length + 1));
440 $().jOverlay({url: $('address .url')[0].href+'attachment/' + attachId + '/ajax'});
445 if ($('#shownotice').length == 0) {
447 notice.find('a.thumbnail').hover(
449 var anchor = $(this);
450 $('a.thumbnail').children('img').hide();
451 anchor.closest(".entry-title").addClass('ov');
453 if (anchor.children('img').length === 0) {
454 t = setTimeout(function() {
455 $.get($('address .url')[0].href+'attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
461 anchor.children('img').show();
466 $('a.thumbnail').children('img').hide();
467 $(this).closest('.entry-title').removeClass('ov');
474 NoticeDataAttach: function() {
475 NDA = $('#'+SN.C.S.NoticeDataAttach);
476 NDA.change(function() {
477 S = '<div id="'+SN.C.S.NoticeDataAttachSelected+'" class="'+SN.C.S.Success+'"><code>'+$(this).val()+'</code> <button class="close">×</button></div>';
478 NDAS = $('#'+SN.C.S.NoticeDataAttachSelected);
479 if (NDAS.length > 0) {
483 $('#'+SN.C.S.FormNotice).append(S);
485 $('#'+SN.C.S.NoticeDataAttachSelected+' button').click(function(){
486 $('#'+SN.C.S.NoticeDataAttachSelected).remove();
494 NoticeLocationAttach: function() {
495 var NLat = $('#'+SN.C.S.NoticeLat).val();
496 var NLon = $('#'+SN.C.S.NoticeLon).val();
497 var NLNS = $('#'+SN.C.S.NoticeLocationNs).val();
498 var NLID = $('#'+SN.C.S.NoticeLocationId).val();
499 var NLN = $('#'+SN.C.S.NoticeGeoName).text();
500 var NDGe = $('#'+SN.C.S.NoticeDataGeo);
502 function removeNoticeDataGeo() {
503 $('label[for='+SN.C.S.NoticeDataGeo+']')
504 .attr('title', jQuery.trim($('label[for='+SN.C.S.NoticeDataGeo+']').text()))
505 .removeClass('checked');
507 $('#'+SN.C.S.NoticeLat).val('');
508 $('#'+SN.C.S.NoticeLon).val('');
509 $('#'+SN.C.S.NoticeLocationNs).val('');
510 $('#'+SN.C.S.NoticeLocationId).val('');
511 $('#'+SN.C.S.NoticeDataGeo).attr('checked', false);
513 $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled', { path: '/' });
516 function getJSONgeocodeURL(geocodeURL, data) {
517 $.getJSON(geocodeURL, data, function(location) {
520 if (typeof(location.location_ns) != 'undefined') {
521 $('#'+SN.C.S.NoticeLocationNs).val(location.location_ns);
522 lns = location.location_ns;
525 if (typeof(location.location_id) != 'undefined') {
526 $('#'+SN.C.S.NoticeLocationId).val(location.location_id);
527 lid = location.location_id;
530 if (typeof(location.name) == 'undefined') {
531 NLN_text = data.lat + ';' + data.lon;
534 NLN_text = location.name;
537 $('label[for='+SN.C.S.NoticeDataGeo+']')
538 .attr('title', NoticeDataGeo_text.ShareDisable + ' (' + NLN_text + ')');
540 $('#'+SN.C.S.NoticeLat).val(data.lat);
541 $('#'+SN.C.S.NoticeLon).val(data.lon);
542 $('#'+SN.C.S.NoticeLocationNs).val(lns);
543 $('#'+SN.C.S.NoticeLocationId).val(lid);
544 $('#'+SN.C.S.NoticeDataGeo).attr('checked', true);
556 $.cookie(SN.C.S.NoticeDataGeoCookie, JSON.stringify(cookieValue), { path: '/' });
560 if (NDGe.length > 0) {
561 if ($.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') {
562 NDGe.attr('checked', false);
565 NDGe.attr('checked', true);
568 var NGW = $('#notice_data-geo_wrap');
569 var geocodeURL = NGW.attr('title');
570 NGW.removeAttr('title');
572 $('label[for='+SN.C.S.NoticeDataGeo+']')
573 .attr('title', jQuery.trim($('label[for='+SN.C.S.NoticeDataGeo+']').text()));
575 NDGe.change(function() {
576 if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === null) {
577 $('label[for='+SN.C.S.NoticeDataGeo+']')
578 .attr('title', NoticeDataGeo_text.ShareDisable)
579 .addClass('checked');
581 if ($.cookie(SN.C.S.NoticeDataGeoCookie) === null || $.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') {
582 if (navigator.geolocation) {
583 navigator.geolocation.getCurrentPosition(
585 $('#'+SN.C.S.NoticeLat).val(position.coords.latitude);
586 $('#'+SN.C.S.NoticeLon).val(position.coords.longitude);
589 lat: position.coords.latitude,
590 lon: position.coords.longitude,
591 token: $('#token').val()
594 getJSONgeocodeURL(geocodeURL, data);
599 case error.PERMISSION_DENIED:
600 removeNoticeDataGeo();
603 $('#'+SN.C.S.NoticeDataGeo).attr('checked', false);
614 if (NLat.length > 0 && NLon.length > 0) {
618 token: $('#token').val()
621 getJSONgeocodeURL(geocodeURL, data);
624 removeNoticeDataGeo();
625 $('#'+SN.C.S.NoticeDataGeo).remove();
626 $('label[for='+SN.C.S.NoticeDataGeo+']').remove();
631 var cookieValue = JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));
633 $('#'+SN.C.S.NoticeLat).val(cookieValue.NLat);
634 $('#'+SN.C.S.NoticeLon).val(cookieValue.NLon);
635 $('#'+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS);
636 $('#'+SN.C.S.NoticeLocationId).val(cookieValue.NLID);
637 $('#'+SN.C.S.NoticeDataGeo).attr('checked', cookieValue.NDG);
639 $('label[for='+SN.C.S.NoticeDataGeo+']')
640 .attr('title', NoticeDataGeo_text.ShareDisable + ' (' + cookieValue.NLN + ')')
641 .addClass('checked');
645 removeNoticeDataGeo();
651 NewDirectMessage: function() {
652 NDM = $('.entity_send-a-message a');
653 NDM.attr({'href':NDM.attr('href')+'&ajax=1'});
654 NDM.bind('click', function() {
655 var NDMF = $('.entity_send-a-message form');
656 if (NDMF.length === 0) {
657 $(this).addClass(SN.C.S.Processing);
658 $.get(NDM.attr('href'), null, function(data) {
659 $('.entity_send-a-message').append(document._importNode($('form', data)[0], true));
660 NDMF = $('.entity_send-a-message .form_notice');
661 SN.U.FormNoticeXHR(NDMF);
662 SN.U.FormNoticeEnhancements(NDMF);
663 NDMF.append('<button class="close">×</button>');
664 $('.entity_send-a-message button').click(function(){
668 NDM.removeClass(SN.C.S.Processing);
673 $('.entity_send-a-message textarea').focus();
679 GetFullYear: function(year, month, day) {
680 var date = new Date();
681 date.setFullYear(year, month, day);
687 Set: function(value) {
688 var SNI = SN.U.StatusNetInstance.Get();
690 value = $.extend(SNI, value);
694 SN.C.S.StatusNetInstance,
695 JSON.stringify(value),
698 expires: SN.U.GetFullYear(2029, 0, 1)
703 var cookieValue = $.cookie(SN.C.S.StatusNetInstance);
704 if (cookieValue !== null) {
705 return JSON.parse(cookieValue);
711 $.cookie(SN.C.S.StatusNetInstance, null);
716 * Check if the current page is a timeline where the current user's
717 * posts should be displayed immediately on success.
719 * @fixme this should be done in a saner way, with machine-readable
720 * info about what page we're looking at.
722 belongsOnTimeline: function(notice) {
723 var action = $("body").attr('id');
724 if (action == 'public') {
728 var profileLink = $('#nav_profile a').attr('href');
730 var authorUrl = $(notice).find('.entry-title .author a.url').attr('href');
731 if (authorUrl == profileLink) {
732 if (action == 'all' || action == 'showstream') {
733 // Posts always show on your own friends and profile streams.
739 // @fixme tag, group, reply timelines should be feasible as well.
740 // Mismatch between id-based and name-based user/group links currently complicates
741 // the lookup, since all our inline mentions contain the absolute links but the
742 // UI links currently on the page use malleable names.
749 NoticeForm: function() {
750 if ($('body.user_in').length > 0) {
751 SN.U.NoticeLocationAttach();
753 $('.'+SN.C.S.FormNotice).each(function() {
754 SN.U.FormNoticeXHR($(this));
755 SN.U.FormNoticeEnhancements($(this));
758 SN.U.NoticeDataAttach();
762 Notices: function() {
763 if ($('body.user_in').length > 0) {
769 SN.U.NoticeAttachments();
772 EntityActions: function() {
773 if ($('body.user_in').length > 0) {
774 $('.form_user_subscribe').live('click', function() { SN.U.FormXHR($(this)); return false; });
775 $('.form_user_unsubscribe').live('click', function() { SN.U.FormXHR($(this)); return false; });
776 $('.form_group_join').live('click', function() { SN.U.FormXHR($(this)); return false; });
777 $('.form_group_leave').live('click', function() { SN.U.FormXHR($(this)); return false; });
778 $('.form_user_nudge').live('click', function() { SN.U.FormXHR($(this)); return false; });
780 SN.U.NewDirectMessage();
785 if (SN.U.StatusNetInstance.Get() !== null) {
786 var nickname = SN.U.StatusNetInstance.Get().Nickname;
787 if (nickname !== null) {
788 $('#form_login #nickname').val(nickname);
792 $('#form_login').bind('submit', function() {
793 SN.U.StatusNetInstance.Set({Nickname: $('#form_login #nickname').val()});
800 $(document).ready(function(){
801 if ($('.'+SN.C.S.FormNotice).length > 0) {
802 SN.Init.NoticeForm();
804 if ($('#content .notices').length > 0) {
807 if ($('#content .entity_actions').length > 0) {
808 SN.Init.EntityActions();
810 if ($('#form_login').length > 0) {