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],
42 Processing: 'processing',
43 CommandResult: 'command_result',
44 FormNotice: 'form_notice',
45 NoticeDataText: 'notice_data-text',
46 NoticeTextCount: 'notice_text-count',
47 NoticeInReplyTo: 'notice_in-reply-to',
48 NoticeDataAttach: 'notice_data-attach',
49 NoticeDataAttachSelected: 'notice_data-attach_selected',
50 NoticeActionSubmit: 'notice_action-submit',
51 NoticeLat: 'notice_data-lat',
52 NoticeLon: 'notice_data-lon',
53 NoticeLocationId: 'notice_data-location_id',
54 NoticeLocationNs: 'notice_data-location_ns',
55 NoticeGeoName: 'notice_data-geo_name',
56 NoticeDataGeo: 'notice_data-geo',
57 NoticeDataGeoCookie: 'NoticeDataGeo',
58 NoticeDataGeoSelected: 'notice_data-geo_selected',
59 StatusNetInstance:'StatusNetInstance'
64 FormNoticeEnhancements: function(form) {
65 if (jQuery.data(form[0], 'ElementData') === undefined) {
66 MaxLength = form.find('#'+SN.C.S.NoticeTextCount).text();
67 if (typeof(MaxLength) == 'undefined') {
68 MaxLength = SN.C.I.MaxLength;
70 jQuery.data(form[0], 'ElementData', {MaxLength:MaxLength});
74 NDT = form.find('#'+SN.C.S.NoticeDataText);
76 NDT.bind('keyup', function(e) {
80 NDT.bind('keydown', function(e) {
81 SN.U.SubmitOnReturn(e, form);
85 form.find('#'+SN.C.S.NoticeTextCount).text(jQuery.data(form[0], 'ElementData').MaxLength);
88 if ($('body')[0].id != 'conversation' && window.location.hash.length === 0) {
89 form.find('textarea').focus();
93 SubmitOnReturn: function(event, el) {
94 if (event.keyCode == 13 || event.keyCode == 10) {
96 event.preventDefault();
97 event.stopPropagation();
98 $('#'+el[0].id+' #'+SN.C.S.NoticeDataText).blur();
105 Counter: function(form) {
106 SN.C.I.FormNoticeCurrent = form;
108 var MaxLength = jQuery.data(form[0], 'ElementData').MaxLength;
110 if (MaxLength <= 0) {
114 var remaining = MaxLength - form.find('#'+SN.C.S.NoticeDataText).val().length;
115 var counter = form.find('#'+SN.C.S.NoticeTextCount);
117 if (remaining.toString() != counter.text()) {
118 if (!SN.C.I.CounterBlackout || remaining === 0) {
119 if (counter.text() != String(remaining)) {
120 counter.text(remaining);
123 form.addClass(SN.C.S.Warning);
125 form.removeClass(SN.C.S.Warning);
127 // Skip updates for the next 500ms.
128 // On slower hardware, updating on every keypress is unpleasant.
129 if (!SN.C.I.CounterBlackout) {
130 SN.C.I.CounterBlackout = true;
131 SN.C.I.FormNoticeCurrent = form;
132 window.setTimeout("SN.U.ClearCounterBlackout(SN.C.I.FormNoticeCurrent);", 500);
138 ClearCounterBlackout: function(form) {
139 // Allow keyup events to poke the counter again
140 SN.C.I.CounterBlackout = false;
141 // Check if the string changed since we last looked
145 FormXHR: function(form) {
149 url: form.attr('action'),
150 data: form.serialize() + '&ajax=1',
151 beforeSend: function(xhr) {
153 .addClass(SN.C.S.Processing)
155 .addClass(SN.C.S.Disabled)
156 .attr(SN.C.S.Disabled, SN.C.S.Disabled);
158 error: function (xhr, textStatus, errorThrown) {
159 alert(errorThrown || textStatus);
161 success: function(data, textStatus) {
162 if (typeof($('form', data)[0]) != 'undefined') {
163 form_new = document._importNode($('form', data)[0], true);
164 form.replaceWith(form_new);
167 form.replaceWith(document._importNode($('p', data)[0], true));
173 FormNoticeXHR: function(form) {
174 SN.C.I.NoticeDataGeo = {};
175 form.append('<input type="hidden" name="ajax" value="1"/>');
180 beforeSend: function(formData) {
181 if (form.find('#'+SN.C.S.NoticeDataText)[0].value.length === 0) {
182 form.addClass(SN.C.S.Warning);
186 .addClass(SN.C.S.Processing)
187 .find('#'+SN.C.S.NoticeActionSubmit)
188 .addClass(SN.C.S.Disabled)
189 .attr(SN.C.S.Disabled, SN.C.S.Disabled);
191 SN.C.I.NoticeDataGeo.NLat = $('#'+SN.C.S.NoticeLat).val();
192 SN.C.I.NoticeDataGeo.NLon = $('#'+SN.C.S.NoticeLon).val();
193 SN.C.I.NoticeDataGeo.NLNS = $('#'+SN.C.S.NoticeLocationNs).val();
194 SN.C.I.NoticeDataGeo.NLID = $('#'+SN.C.S.NoticeLocationId).val();
195 SN.C.I.NoticeDataGeo.NDG = $('#'+SN.C.S.NoticeDataGeo).attr('checked');
197 cookieValue = $.cookie(SN.C.S.NoticeDataGeoCookie);
199 if (cookieValue !== null && cookieValue != 'disabled') {
200 cookieValue = JSON.parse(cookieValue);
201 SN.C.I.NoticeDataGeo.NLat = $('#'+SN.C.S.NoticeLat).val(cookieValue.NLat).val();
202 SN.C.I.NoticeDataGeo.NLon = $('#'+SN.C.S.NoticeLon).val(cookieValue.NLon).val();
203 if ($('#'+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS)) {
204 SN.C.I.NoticeDataGeo.NLNS = $('#'+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS).val();
205 SN.C.I.NoticeDataGeo.NLID = $('#'+SN.C.S.NoticeLocationId).val(cookieValue.NLID).val();
208 if (cookieValue == 'disabled') {
209 SN.C.I.NoticeDataGeo.NDG = $('#'+SN.C.S.NoticeDataGeo).attr('checked', false).attr('checked');
212 SN.C.I.NoticeDataGeo.NDG = $('#'+SN.C.S.NoticeDataGeo).attr('checked', true).attr('checked');
217 error: function (xhr, textStatus, errorThrown) {
219 .removeClass(SN.C.S.Processing)
220 .find('#'+SN.C.S.NoticeActionSubmit)
221 .removeClass(SN.C.S.Disabled)
222 .removeAttr(SN.C.S.Disabled, SN.C.S.Disabled);
223 form.find('.form_response').remove();
224 if (textStatus == 'timeout') {
225 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>');
228 if ($('.'+SN.C.S.Error, xhr.responseXML).length > 0) {
229 form.append(document._importNode($('.'+SN.C.S.Error, xhr.responseXML)[0], true));
232 if (parseInt(xhr.status) === 0 || jQuery.inArray(parseInt(xhr.status), SN.C.I.HTTP20x30x) >= 0) {
234 SN.U.NoticeClearAttachments(form);
235 SN.C.I.UploadCounter = 0;
236 SN.U.NoticeNewAttachment($('fieldset', form));
237 SN.U.FormNoticeEnhancements(form);
240 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>');
245 success: function(data, textStatus) {
246 form.find('.form_response').remove();
248 if ($('#'+SN.C.S.Error, data).length > 0) {
249 result = document._importNode($('p', data)[0], true);
250 result = result.textContent || result.innerHTML;
251 form.append('<p class="form_response error">'+result+'</p>');
254 if($('body')[0].id == 'bookmarklet') {
258 if ($('#'+SN.C.S.CommandResult, data).length > 0) {
259 result = document._importNode($('p', data)[0], true);
260 result = result.textContent || result.innerHTML;
261 form.append('<p class="form_response success">'+result+'</p>');
264 var notices = $('#notices_primary .notices');
265 if (notices.length > 0) {
266 var notice = document._importNode($('li', data)[0], true);
267 if ($('#'+notice.id).length === 0) {
268 var notice_irt_value = $('#'+SN.C.S.NoticeInReplyTo).val();
269 var notice_irt = '#notices_primary #notice-'+notice_irt_value;
270 if($('body')[0].id == 'conversation') {
271 if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) {
272 $(notice_irt).append('<ul class="notices"></ul>');
274 $($(notice_irt+' .notices')[0]).append(notice);
277 notices.prepend(notice);
280 .css({display:'none'})
282 SN.U.NoticeWithAttachment($('#'+notice.id));
283 SN.U.NoticeReplyTo($('#'+notice.id));
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 SN.U.NoticeClearAttachments(form);
294 SN.C.I.UploadCounter = 0;
295 SN.U.NoticeNewAttachment($('fieldset', form));
296 SN.U.FormNoticeEnhancements(form);
299 complete: function(xhr, textStatus) {
301 .removeClass(SN.C.S.Processing)
302 .find('#'+SN.C.S.NoticeActionSubmit)
303 .removeAttr(SN.C.S.Disabled)
304 .removeClass(SN.C.S.Disabled);
306 $('#'+SN.C.S.NoticeLat).val(SN.C.I.NoticeDataGeo.NLat);
307 $('#'+SN.C.S.NoticeLon).val(SN.C.I.NoticeDataGeo.NLon);
308 if ($('#'+SN.C.S.NoticeLocationNs)) {
309 $('#'+SN.C.S.NoticeLocationNs).val(SN.C.I.NoticeDataGeo.NLNS);
310 $('#'+SN.C.S.NoticeLocationId).val(SN.C.I.NoticeDataGeo.NLID);
312 $('#'+SN.C.S.NoticeDataGeo).attr('checked', SN.C.I.NoticeDataGeo.NDG);
317 NoticeClearAttachments: function(form) {
318 $('input:file', form).remove();
319 $('div[class=' + SN.C.S.Success + ']', form).remove();
322 NoticeReply: function() {
323 if ($('#'+SN.C.S.NoticeDataText).length > 0 && $('#content .notice_reply').length > 0) {
324 $('#content .notice').each(function() { SN.U.NoticeReplyTo($(this)); });
328 NoticeReplyTo: function(notice) {
329 notice.find('.notice_reply').live('click', function() {
330 var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname.uid');
331 SN.U.NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
336 NoticeReplySet: function(nick,id) {
337 if (nick.match(SN.C.I.PatternUsername)) {
338 var text = $('#'+SN.C.S.NoticeDataText);
339 if (text.length > 0) {
340 replyto = '@' + nick + ' ';
341 text.val(replyto + text.val().replace(RegExp(replyto, 'i'), ''));
342 $('#'+SN.C.S.FormNotice+' #'+SN.C.S.NoticeInReplyTo).val(id);
345 if (text[0].setSelectionRange) {
346 var len = text.val().length;
347 text[0].setSelectionRange(len,len);
353 NoticeFavor: function() {
354 $('.form_favor').live('click', function() { SN.U.FormXHR($(this)); return false; });
355 $('.form_disfavor').live('click', function() { SN.U.FormXHR($(this)); return false; });
358 NoticeRepeat: function() {
359 $('.form_repeat').live('click', function(e) {
362 SN.U.NoticeRepeatConfirmation($(this));
367 NoticeRepeatConfirmation: function(form) {
368 var submit_i = form.find('.submit');
370 var submit = submit_i.clone();
372 .addClass('submit_dialogbox')
373 .removeClass('submit');
375 submit.bind('click', function() { SN.U.FormXHR(form); return false; });
380 .addClass('dialogbox')
381 .append('<button class="close">×</button>')
382 .closest('.notice-options')
385 form.find('button.close').click(function(){
389 .removeClass('dialogbox')
390 .closest('.notice-options')
391 .removeClass('opaque');
393 form.find('.submit_dialogbox').remove();
394 form.find('.submit').show();
400 NoticeAttachments: function() {
401 $('.notice a.attachment').each(function() {
402 SN.U.NoticeWithAttachment($(this).closest('.notice'));
406 NoticeWithAttachment: function(notice) {
407 if (notice.find('.attachment').length === 0) {
411 var attachment_more = notice.find('.attachment.more');
412 if (attachment_more.length > 0) {
413 $(attachment_more[0]).click(function() {
415 m.addClass(SN.C.S.Processing);
416 $.get(m.attr('href')+'/ajax', null, function(data) {
417 m.parent('.entry-content').html($(data).find('#attachment_view .entry-content').html());
424 $.fn.jOverlay.options = {
432 imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif',
433 bgClickToClose : true,
434 success : function() {
435 $('#jOverlayContent').append('<button class="close">×</button>');
436 $('#jOverlayContent button').click($.closeOverlay);
440 css : {'max-width':'542px', 'top':'5%', 'left':'32.5%'}
443 notice.find('a.attachment').click(function() {
444 var attachId = ($(this).attr('id').substring('attachment'.length + 1));
446 $().jOverlay({url: $('address .url')[0].href+'attachment/' + attachId + '/ajax'});
451 if ($('#shownotice').length == 0) {
453 notice.find('a.thumbnail').hover(
455 var anchor = $(this);
456 $('a.thumbnail').children('img').hide();
457 anchor.closest(".entry-title").addClass('ov');
459 if (anchor.children('img').length === 0) {
460 t = setTimeout(function() {
461 $.get($('address .url')[0].href+'attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
467 anchor.children('img').show();
472 $('a.thumbnail').children('img').hide();
473 $(this).closest('.entry-title').removeClass('ov');
480 NoticeDataAttach: function(NDANum) {
481 NDA = $('#'+SN.C.S.NoticeDataAttach+NDANum);
482 NDA.change(function() {
483 S = '<div id="'+SN.C.S.NoticeDataAttachSelected+SN.C.I.UploadCounter+'" class="'+SN.C.S.Success+'"><code>'+$(this).val()+'</code> <button class="close">×</button></div>';
484 $('#'+SN.C.S.FormNotice).append(S);
486 $('#'+SN.C.S.NoticeDataAttachSelected+SN.C.I.UploadCounter+' button').click(function(){
487 $('#'+this.parentNode.getAttribute("id")).remove();
488 $('#'+this.parentNode.getAttribute("id").replace("_selected", "")).remove();
493 SN.C.I.UploadCounter++;
494 NDA.attr('style', 'display: none;');
495 SN.U.NoticeNewAttachment(NDA.parent());
496 $('#notice_data-attach-label').attr('for', SN.C.S.NoticeDataAttach+SN.C.I.UploadCounter);
500 NoticeNewAttachment: function(parent) {
501 NEWFILE = '<input id="'+SN.C.S.NoticeDataAttach+SN.C.I.UploadCounter+'" class="attach" type="file" name="attach'+SN.C.I.UploadCounter+'" title="'+NoticeAttachment_text.AttachFile+'"/>';
502 parent.append(NEWFILE);
503 SN.U.NoticeDataAttach(SN.C.I.UploadCounter);
506 NoticeLocationAttach: function() {
507 var NLat = $('#'+SN.C.S.NoticeLat).val();
508 var NLon = $('#'+SN.C.S.NoticeLon).val();
509 var NLNS = $('#'+SN.C.S.NoticeLocationNs).val();
510 var NLID = $('#'+SN.C.S.NoticeLocationId).val();
511 var NLN = $('#'+SN.C.S.NoticeGeoName).text();
512 var NDGe = $('#'+SN.C.S.NoticeDataGeo);
514 function removeNoticeDataGeo() {
515 $('label[for='+SN.C.S.NoticeDataGeo+']')
516 .attr('title', jQuery.trim($('label[for='+SN.C.S.NoticeDataGeo+']').text()))
517 .removeClass('checked');
519 $('#'+SN.C.S.NoticeLat).val('');
520 $('#'+SN.C.S.NoticeLon).val('');
521 $('#'+SN.C.S.NoticeLocationNs).val('');
522 $('#'+SN.C.S.NoticeLocationId).val('');
523 $('#'+SN.C.S.NoticeDataGeo).attr('checked', false);
525 $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled', { path: '/' });
528 function getJSONgeocodeURL(geocodeURL, data) {
529 $.getJSON(geocodeURL, data, function(location) {
532 if (typeof(location.location_ns) != 'undefined') {
533 $('#'+SN.C.S.NoticeLocationNs).val(location.location_ns);
534 lns = location.location_ns;
537 if (typeof(location.location_id) != 'undefined') {
538 $('#'+SN.C.S.NoticeLocationId).val(location.location_id);
539 lid = location.location_id;
542 if (typeof(location.name) == 'undefined') {
543 NLN_text = data.lat + ';' + data.lon;
546 NLN_text = location.name;
549 $('label[for='+SN.C.S.NoticeDataGeo+']')
550 .attr('title', NoticeDataGeo_text.ShareDisable + ' (' + NLN_text + ')');
552 $('#'+SN.C.S.NoticeLat).val(data.lat);
553 $('#'+SN.C.S.NoticeLon).val(data.lon);
554 $('#'+SN.C.S.NoticeLocationNs).val(lns);
555 $('#'+SN.C.S.NoticeLocationId).val(lid);
556 $('#'+SN.C.S.NoticeDataGeo).attr('checked', true);
568 $.cookie(SN.C.S.NoticeDataGeoCookie, JSON.stringify(cookieValue), { path: '/' });
572 if (NDGe.length > 0) {
573 if ($.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') {
574 NDGe.attr('checked', false);
577 NDGe.attr('checked', true);
580 var NGW = $('#notice_data-geo_wrap');
581 var geocodeURL = NGW.attr('title');
582 NGW.removeAttr('title');
584 $('label[for='+SN.C.S.NoticeDataGeo+']')
585 .attr('title', jQuery.trim($('label[for='+SN.C.S.NoticeDataGeo+']').text()));
587 NDGe.change(function() {
588 if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === null) {
589 $('label[for='+SN.C.S.NoticeDataGeo+']')
590 .attr('title', NoticeDataGeo_text.ShareDisable)
591 .addClass('checked');
593 if ($.cookie(SN.C.S.NoticeDataGeoCookie) === null || $.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') {
594 if (navigator.geolocation) {
595 navigator.geolocation.getCurrentPosition(
597 $('#'+SN.C.S.NoticeLat).val(position.coords.latitude);
598 $('#'+SN.C.S.NoticeLon).val(position.coords.longitude);
601 lat: position.coords.latitude,
602 lon: position.coords.longitude,
603 token: $('#token').val()
606 getJSONgeocodeURL(geocodeURL, data);
611 case error.PERMISSION_DENIED:
612 removeNoticeDataGeo();
615 $('#'+SN.C.S.NoticeDataGeo).attr('checked', false);
626 if (NLat.length > 0 && NLon.length > 0) {
630 token: $('#token').val()
633 getJSONgeocodeURL(geocodeURL, data);
636 removeNoticeDataGeo();
637 $('#'+SN.C.S.NoticeDataGeo).remove();
638 $('label[for='+SN.C.S.NoticeDataGeo+']').remove();
643 var cookieValue = JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));
645 $('#'+SN.C.S.NoticeLat).val(cookieValue.NLat);
646 $('#'+SN.C.S.NoticeLon).val(cookieValue.NLon);
647 $('#'+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS);
648 $('#'+SN.C.S.NoticeLocationId).val(cookieValue.NLID);
649 $('#'+SN.C.S.NoticeDataGeo).attr('checked', cookieValue.NDG);
651 $('label[for='+SN.C.S.NoticeDataGeo+']')
652 .attr('title', NoticeDataGeo_text.ShareDisable + ' (' + cookieValue.NLN + ')')
653 .addClass('checked');
657 removeNoticeDataGeo();
663 NewDirectMessage: function() {
664 NDM = $('.entity_send-a-message a');
665 NDM.attr({'href':NDM.attr('href')+'&ajax=1'});
666 NDM.bind('click', function() {
667 var NDMF = $('.entity_send-a-message form');
668 if (NDMF.length === 0) {
669 $(this).addClass(SN.C.S.Processing);
670 $.get(NDM.attr('href'), null, function(data) {
671 $('.entity_send-a-message').append(document._importNode($('form', data)[0], true));
672 NDMF = $('.entity_send-a-message .form_notice');
673 SN.U.FormNoticeXHR(NDMF);
674 SN.U.FormNoticeEnhancements(NDMF);
675 NDMF.append('<button class="close">×</button>');
676 $('.entity_send-a-message button').click(function(){
680 NDM.removeClass(SN.C.S.Processing);
685 $('.entity_send-a-message textarea').focus();
691 GetFullYear: function(year, month, day) {
692 var date = new Date();
693 date.setFullYear(year, month, day);
699 Set: function(value) {
700 var SNI = SN.U.StatusNetInstance.Get();
702 value = $.extend(SNI, value);
706 SN.C.S.StatusNetInstance,
707 JSON.stringify(value),
710 expires: SN.U.GetFullYear(2029, 0, 1)
715 var cookieValue = $.cookie(SN.C.S.StatusNetInstance);
716 if (cookieValue !== null) {
717 return JSON.parse(cookieValue);
723 $.cookie(SN.C.S.StatusNetInstance, null);
729 NoticeForm: function() {
730 if ($('body.user_in').length > 0) {
731 SN.U.NoticeLocationAttach();
733 $('.'+SN.C.S.FormNotice).each(function() {
734 SN.U.FormNoticeXHR($(this));
735 SN.U.FormNoticeEnhancements($(this));
738 SN.U.NoticeDataAttach("");
742 Notices: function() {
743 if ($('body.user_in').length > 0) {
749 SN.U.NoticeAttachments();
752 EntityActions: function() {
753 if ($('body.user_in').length > 0) {
754 $('.form_user_subscribe').live('click', function() { SN.U.FormXHR($(this)); return false; });
755 $('.form_user_unsubscribe').live('click', function() { SN.U.FormXHR($(this)); return false; });
756 $('.form_group_join').live('click', function() { SN.U.FormXHR($(this)); return false; });
757 $('.form_group_leave').live('click', function() { SN.U.FormXHR($(this)); return false; });
758 $('.form_user_nudge').live('click', function() { SN.U.FormXHR($(this)); return false; });
760 SN.U.NewDirectMessage();
765 if (SN.U.StatusNetInstance.Get() !== null) {
766 var nickname = SN.U.StatusNetInstance.Get().Nickname;
767 if (nickname !== null) {
768 $('#form_login #nickname').val(nickname);
772 $('#form_login').bind('submit', function() {
773 SN.U.StatusNetInstance.Set({Nickname: $('#form_login #nickname').val()});
780 $(document).ready(function(){
781 if ($('.'+SN.C.S.FormNotice).length > 0) {
782 SN.Init.NoticeForm();
784 if ($('#content .notices').length > 0) {
787 if ($('#content .entity_actions').length > 0) {
788 SN.Init.EntityActions();
790 if ($('#form_login').length > 0) {