diff --git a/js/util.js b/js/util.js index e64472b986..d007281223 100644 --- a/js/util.js +++ b/js/util.js @@ -575,16 +575,16 @@ var SN = { // StatusNet // Find the threaded replies view we'll be adding to... var list = notice.closest('.notices'); - if (list.hasClass('threaded-notices')) { + if (list.hasClass('threaded-replies')) { // We're replying to a reply; use reply form on the end of this list. // We'll add our form at the end of this; grab the root notice. parentNotice = list.closest('.notice'); } else { // We're replying to a parent notice; pull its threaded list // and we'll add on the end of it. Will add if needed. - list = $('ul.threaded-notices', notice); + list = $('ul.threaded-replies', notice); if (list.length == 0) { - list = $(''); + list = $(''); notice.append(list); } } @@ -731,7 +731,7 @@ var SN = { // StatusNet }, NoticeInlineReplyPlaceholder: function(notice) { - var list = notice.find('ul.threaded-notices'); + var list = notice.find('ul.threaded-replies'); var placeholder = $('
  • ' + '' + '
  • '); @@ -749,7 +749,7 @@ var SN = { // StatusNet * Uses 'live' rather than 'bind', so applies to future as well as present items. */ NoticeInlineReplySetup: function() { - $('.threaded-notices').each(function() { + $('.threaded-replies').each(function() { var list = $(this); var notice = list.closest('.notice'); SN.U.NoticeInlineReplyPlaceholder(notice); diff --git a/js/util.min.js b/js/util.min.js index c47f3ba3db..7b1410159e 100644 --- a/js/util.min.js +++ b/js/util.min.js @@ -1 +1 @@ -var SN={C:{I:{CounterBlackout:false,MaxLength:140,PatternUsername:/^[0-9a-zA-Z\-_.]*$/,HTTP20x30x:[200,201,202,203,204,205,206,300,301,302,303,304,305,306,307]},S:{Disabled:"disabled",Warning:"warning",Error:"error",Success:"success",Processing:"processing",CommandResult:"command_result",FormNotice:"form_notice",NoticeDataText:"notice_data-text",NoticeTextCount:"notice_text-count",NoticeInReplyTo:"notice_in-reply-to",NoticeDataAttach:"notice_data-attach",NoticeDataAttachSelected:"notice_data-attach_selected",NoticeActionSubmit:"notice_action-submit",NoticeLat:"notice_data-lat",NoticeLon:"notice_data-lon",NoticeLocationId:"notice_data-location_id",NoticeLocationNs:"notice_data-location_ns",NoticeGeoName:"notice_data-geo_name",NoticeDataGeo:"notice_data-geo",NoticeDataGeoCookie:"NoticeDataGeo",NoticeDataGeoSelected:"notice_data-geo_selected",StatusNetInstance:"StatusNetInstance"}},messages:{},msg:function(a){if(typeof SN.messages[a]=="undefined"){return"["+a+"]"}else{return SN.messages[a]}},U:{FormNoticeEnhancements:function(b){if(jQuery.data(b[0],"ElementData")===undefined){MaxLength=b.find("#"+SN.C.S.NoticeTextCount).text();if(typeof(MaxLength)=="undefined"){MaxLength=SN.C.I.MaxLength}jQuery.data(b[0],"ElementData",{MaxLength:MaxLength});SN.U.Counter(b);NDT=b.find("#"+SN.C.S.NoticeDataText);NDT.bind("keyup",function(c){SN.U.Counter(b)});var a=function(c){window.setTimeout(function(){SN.U.Counter(b)},50)};NDT.bind("cut",a).bind("paste",a);NDT.bind("keydown",function(c){SN.U.SubmitOnReturn(c,b)})}else{b.find("#"+SN.C.S.NoticeTextCount).text(jQuery.data(b[0],"ElementData").MaxLength)}if($("body")[0].id!="conversation"&&window.location.hash.length===0&&$(window).scrollTop()==0){b.find("textarea").focus()}},SubmitOnReturn:function(b,a){if(b.keyCode==13||b.keyCode==10){a.submit();b.preventDefault();b.stopPropagation();$("#"+a[0].id+" #"+SN.C.S.NoticeDataText).blur();$("body").focus();return false}return true},Counter:function(d){SN.C.I.FormNoticeCurrent=d;var b=jQuery.data(d[0],"ElementData").MaxLength;if(b<=0){return}var c=b-SN.U.CharacterCount(d);var a=d.find("#"+SN.C.S.NoticeTextCount);if(c.toString()!=a.text()){if(!SN.C.I.CounterBlackout||c===0){if(a.text()!=String(c)){a.text(c)}if(c<0){d.addClass(SN.C.S.Warning)}else{d.removeClass(SN.C.S.Warning)}if(!SN.C.I.CounterBlackout){SN.C.I.CounterBlackout=true;SN.C.I.FormNoticeCurrent=d;window.setTimeout("SN.U.ClearCounterBlackout(SN.C.I.FormNoticeCurrent);",500)}}}},CharacterCount:function(a){return a.find("#"+SN.C.S.NoticeDataText).val().length},ClearCounterBlackout:function(a){SN.C.I.CounterBlackout=false;SN.U.Counter(a)},RewriteAjaxAction:function(a){if(document.location.protocol=="https:"&&a.substr(0,5)=="http:"){return a.replace(/^http:\/\/[^:\/]+/,"https://"+document.location.host)}else{return a}},FormXHR:function(a){$.ajax({type:"POST",dataType:"xml",url:SN.U.RewriteAjaxAction(a.attr("action")),data:a.serialize()+"&ajax=1",beforeSend:function(b){a.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled)},error:function(c,d,b){alert(b||d)},success:function(b,c){if(typeof($("form",b)[0])!="undefined"){form_new=document._importNode($("form",b)[0],true);a.replaceWith(form_new)}else{a.replaceWith(document._importNode($("p",b)[0],true))}}})},FormNoticeXHR:function(b){SN.C.I.NoticeDataGeo={};b.append('');b.attr("action",SN.U.RewriteAjaxAction(b.attr("action")));var c=function(d,e){b.append($('

    ').addClass(d).text(e))};var a=function(){b.find(".form_response").remove()};b.ajaxForm({dataType:"xml",timeout:"60000",beforeSend:function(d){if(b.find("#"+SN.C.S.NoticeDataText)[0].value.length===0){b.addClass(SN.C.S.Warning);return false}b.addClass(SN.C.S.Processing).find("#"+SN.C.S.NoticeActionSubmit).addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled);SN.C.I.NoticeDataGeo.NLat=$("#"+SN.C.S.NoticeLat).val();SN.C.I.NoticeDataGeo.NLon=$("#"+SN.C.S.NoticeLon).val();SN.C.I.NoticeDataGeo.NLNS=$("#"+SN.C.S.NoticeLocationNs).val();SN.C.I.NoticeDataGeo.NLID=$("#"+SN.C.S.NoticeLocationId).val();SN.C.I.NoticeDataGeo.NDG=$("#"+SN.C.S.NoticeDataGeo).attr("checked");cookieValue=$.cookie(SN.C.S.NoticeDataGeoCookie);if(cookieValue!==null&&cookieValue!="disabled"){cookieValue=JSON.parse(cookieValue);SN.C.I.NoticeDataGeo.NLat=$("#"+SN.C.S.NoticeLat).val(cookieValue.NLat).val();SN.C.I.NoticeDataGeo.NLon=$("#"+SN.C.S.NoticeLon).val(cookieValue.NLon).val();if($("#"+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS)){SN.C.I.NoticeDataGeo.NLNS=$("#"+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS).val();SN.C.I.NoticeDataGeo.NLID=$("#"+SN.C.S.NoticeLocationId).val(cookieValue.NLID).val()}}if(cookieValue=="disabled"){SN.C.I.NoticeDataGeo.NDG=$("#"+SN.C.S.NoticeDataGeo).attr("checked",false).attr("checked")}else{SN.C.I.NoticeDataGeo.NDG=$("#"+SN.C.S.NoticeDataGeo).attr("checked",true).attr("checked")}return true},error:function(f,g,e){b.removeClass(SN.C.S.Processing).find("#"+SN.C.S.NoticeActionSubmit).removeClass(SN.C.S.Disabled).removeAttr(SN.C.S.Disabled,SN.C.S.Disabled);a();if(g=="timeout"){c("error","Sorry! We had trouble sending your notice. The servers are overloaded. Please try again, and contact the site administrator if this problem persists.")}else{var d=SN.U.GetResponseXML(f);if($("."+SN.C.S.Error,d).length>0){b.append(document._importNode($("."+SN.C.S.Error,d)[0],true))}else{if(parseInt(f.status)===0||jQuery.inArray(parseInt(f.status),SN.C.I.HTTP20x30x)>=0){b.resetForm().find("#"+SN.C.S.NoticeDataAttachSelected).remove();SN.U.FormNoticeEnhancements(b)}else{c("error","(Sorry! We had trouble sending your notice ("+f.status+" "+f.statusText+"). Please report the problem to the site administrator if this happens again.")}}}},success:function(i,k){a();var e=$("#"+SN.C.S.Error,i);if(e.length>0){c("error",e.text())}else{if($("body")[0].id=="bookmarklet"){self.close()}var d=$("#"+SN.C.S.CommandResult,i);if(d.length>0){c("success",d.text())}else{var h=document._importNode($("li",i)[0],true);var j=$("#notices_primary .notices:first");if(j.length>0&&SN.U.belongsOnTimeline(h)){if($("#"+h.id).length===0){var f=$("#"+SN.C.S.NoticeInReplyTo).val();var g="#notices_primary #notice-"+f;if($("body")[0].id=="conversation"){if(f.length>0&&$(g+" .notices").length<1){$(g).append('')}$($(g+" .notices")[0]).append(h)}else{j.prepend(h)}$("#"+h.id).css({display:"none"}).fadeIn(2500);SN.U.NoticeWithAttachment($("#"+h.id));SN.U.NoticeReplyTo($("#"+h.id))}}else{c("success",$("title",i).text())}}b.resetForm();b.find("#"+SN.C.S.NoticeInReplyTo).val("");b.find("#"+SN.C.S.NoticeDataAttachSelected).remove();SN.U.FormNoticeEnhancements(b)}},complete:function(d,e){b.removeClass(SN.C.S.Processing).find("#"+SN.C.S.NoticeActionSubmit).removeAttr(SN.C.S.Disabled).removeClass(SN.C.S.Disabled);$("#"+SN.C.S.NoticeLat).val(SN.C.I.NoticeDataGeo.NLat);$("#"+SN.C.S.NoticeLon).val(SN.C.I.NoticeDataGeo.NLon);if($("#"+SN.C.S.NoticeLocationNs)){$("#"+SN.C.S.NoticeLocationNs).val(SN.C.I.NoticeDataGeo.NLNS);$("#"+SN.C.S.NoticeLocationId).val(SN.C.I.NoticeDataGeo.NLID)}$("#"+SN.C.S.NoticeDataGeo).attr("checked",SN.C.I.NoticeDataGeo.NDG)}})},GetResponseXML:function(b){try{return b.responseXML}catch(a){return(new DOMParser()).parseFromString(b.responseText,"text/xml")}},NoticeReply:function(){if($("#"+SN.C.S.NoticeDataText).length>0&&$("#content .notice_reply").length>0){$("#content .notice").each(function(){SN.U.NoticeReplyTo($(this))})}},NoticeReplyTo:function(a){a.find(".notice_reply").live("click",function(c){c.preventDefault();var b=($(".author .nickname",a).length>0)?$($(".author .nickname",a)[0]):$(".author .nickname.uid");SN.U.NoticeInlineReplyTrigger(a,"@"+b.text());return false})},NoticeInlineReplyTrigger:function(h,i){var c=$($(".notice_id",h)[0]).text();var d=h;var f=h.closest(".notices");if(f.hasClass("threaded-notices")){d=f.closest(".notice")}else{f=$("ul.threaded-notices",h);if(f.length==0){f=$('');h.append(f)}}var k=$(".notice-reply-form",f);if(k.length==0){$("li.notice-reply-placeholder").remove();var g=$("li.notice-reply",f);if(g.length==0){g=$('
  • ');var b=$("#form_notice");k=g.find("form");k.attr("action",b.attr("action"));k.find('input[name="token"]').val(b.find("input[name=token]").val());k.find('input[type="submit"]').val(SN.msg("reply_submit"));f.append(g);k.find("textarea").blur(function(){var m=$(this);var l=$.trim(m.val());if(l==""||l==m.data("initialText")){g.remove();if(f.find("li").length>0){SN.U.NoticeInlineReplyPlaceholder(d)}else{f.remove()}}});k.submit(function(m){var l=k;$.ajax({type:"POST",dataType:"xml",url:SN.U.RewriteAjaxAction(l.attr("action")),data:l.serialize()+"&ajax=1",beforeSend:function(n){l.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled).end().find("textarea").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled)},error:function(o,p,n){alert(n||p)},success:function(p,q){var o=$("li",p)[0];if(o){var n=document._importNode(o,true);if($("#notice-"+c).length==0){g.replaceWith(n);SN.U.NoticeInlineReplyPlaceholder(d)}else{g.remove()}}}});m.preventDefault();return false})}}k.find("input[name=inreplyto]").val(c);var j=k.find("textarea");if(j.length==0){throw"No textarea"}var a="";if(i){a=i+" "}j.val(a+j.val().replace(RegExp(a,"i"),""));j.data("initialText",$.trim(i+""));j.focus();if(j[0].setSelectionRange){var e=j.val().length;j[0].setSelectionRange(e,e)}},NoticeReplySet:function(b,d){if(b.match(SN.C.I.PatternUsername)){var c=$("#"+SN.C.S.NoticeDataText);if(c.length>0){replyto="@"+b+" ";c.val(replyto+c.val().replace(RegExp(replyto,"i"),""));$("#"+SN.C.S.FormNotice+" #"+SN.C.S.NoticeInReplyTo).val(d);c[0].focus();if(c[0].setSelectionRange){var a=c.val().length;c[0].setSelectionRange(a,a)}}}},NoticeFavor:function(){$(".form_favor").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_disfavor").live("click",function(){SN.U.FormXHR($(this));return false})},NoticeInlineReplyPlaceholder:function(b){var a=b.find("ul.threaded-notices");var c=$('
  • ');c.click(function(){SN.U.NoticeInlineReplyTrigger(b)});c.find("input").val(SN.msg("reply_comment"));a.append(c)},NoticeInlineReplySetup:function(){$(".threaded-notices").each(function(){var b=$(this);var a=b.closest(".notice");SN.U.NoticeInlineReplyPlaceholder(a)})},NoticeRepeat:function(){$(".form_repeat").live("click",function(a){a.preventDefault();SN.U.NoticeRepeatConfirmation($(this));return false})},NoticeRepeatConfirmation:function(a){var c=a.find(".submit");var b=c.clone();b.addClass("submit_dialogbox").removeClass("submit");a.append(b);b.bind("click",function(){SN.U.FormXHR(a);return false});c.hide();a.addClass("dialogbox").append('').closest(".notice-options").addClass("opaque");a.find("button.close").click(function(){$(this).remove();a.removeClass("dialogbox").closest(".notice-options").removeClass("opaque");a.find(".submit_dialogbox").remove();a.find(".submit").show();return false})},NoticeAttachments:function(){$(".notice a.attachment").each(function(){SN.U.NoticeWithAttachment($(this).closest(".notice"))})},NoticeWithAttachment:function(b){if(b.find(".attachment").length===0){return}var a=b.find(".attachment.more");if(a.length>0){$(a[0]).click(function(){var c=$(this);c.addClass(SN.C.S.Processing);$.get(c.attr("href")+"/ajax",null,function(d){c.parent(".entry-content").html($(d).find("#attachment_view .entry-content").html())});return false}).attr("title",SN.msg("showmore_tooltip"))}},NoticeDataAttach:function(){NDA=$("#"+SN.C.S.NoticeDataAttach);NDA.change(function(c){var a=$(this).val();if(!a){$("#"+SN.C.S.NoticeDataAttachSelected).remove();return false}S='
    '+a+'
    ';NDAS=$("#"+SN.C.S.NoticeDataAttachSelected);if(NDAS.length>0){NDAS.replaceWith(S)}else{$("#"+SN.C.S.FormNotice).append(S)}$("#"+SN.C.S.NoticeDataAttachSelected+" button").click(function(){$("#"+SN.C.S.NoticeDataAttachSelected).remove();NDA.val("");return false});if(typeof this.files=="object"){for(var b=0;bf){e=false}if(e){g(c,function(i){var h=$("").attr("title",d).attr("alt",d).attr("src",i).attr("style","height: 120px");$("#"+SN.C.S.NoticeDataAttachSelected).append(h)})}else{var b=$("
    ").text(d);$("#"+SN.C.S.NoticeDataAttachSelected).append(b)}},NoticeLocationAttach:function(){var c=$("#"+SN.C.S.NoticeLat).val();var h=$("#"+SN.C.S.NoticeLon).val();var d=$("#"+SN.C.S.NoticeLocationNs).val();var i=$("#"+SN.C.S.NoticeLocationId).val();var a=$("#"+SN.C.S.NoticeGeoName).text();var b=$("#"+SN.C.S.NoticeDataGeo);function e(){$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",jQuery.trim($("label[for="+SN.C.S.NoticeDataGeo+"]").text())).removeClass("checked");$("#"+SN.C.S.NoticeLat).val("");$("#"+SN.C.S.NoticeLon).val("");$("#"+SN.C.S.NoticeLocationNs).val("");$("#"+SN.C.S.NoticeLocationId).val("");$("#"+SN.C.S.NoticeDataGeo).attr("checked",false);$.cookie(SN.C.S.NoticeDataGeoCookie,"disabled",{path:"/"})}function j(k,l){$.getJSON(k,l,function(m){var n,o;if(typeof(m.location_ns)!="undefined"){$("#"+SN.C.S.NoticeLocationNs).val(m.location_ns);n=m.location_ns}if(typeof(m.location_id)!="undefined"){$("#"+SN.C.S.NoticeLocationId).val(m.location_id);o=m.location_id}if(typeof(m.name)=="undefined"){NLN_text=l.lat+";"+l.lon}else{NLN_text=m.name}$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",NoticeDataGeo_text.ShareDisable+" ("+NLN_text+")");$("#"+SN.C.S.NoticeLat).val(l.lat);$("#"+SN.C.S.NoticeLon).val(l.lon);$("#"+SN.C.S.NoticeLocationNs).val(n);$("#"+SN.C.S.NoticeLocationId).val(o);$("#"+SN.C.S.NoticeDataGeo).attr("checked",true);var p={NLat:l.lat,NLon:l.lon,NLNS:n,NLID:o,NLN:NLN_text,NLNU:m.url,NDG:true};$.cookie(SN.C.S.NoticeDataGeoCookie,JSON.stringify(p),{path:"/"})})}if(b.length>0){if($.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){b.attr("checked",false)}else{b.attr("checked",true)}var f=$("#notice_data-geo_wrap");var g=f.attr("title");f.removeAttr("title");$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",jQuery.trim($("label[for="+SN.C.S.NoticeDataGeo+"]").text()));b.change(function(){if($("#"+SN.C.S.NoticeDataGeo).attr("checked")===true||$.cookie(SN.C.S.NoticeDataGeoCookie)===null){$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",NoticeDataGeo_text.ShareDisable).addClass("checked");if($.cookie(SN.C.S.NoticeDataGeoCookie)===null||$.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(m){$("#"+SN.C.S.NoticeLat).val(m.coords.latitude);$("#"+SN.C.S.NoticeLon).val(m.coords.longitude);var n={lat:m.coords.latitude,lon:m.coords.longitude,token:$("#token").val()};j(g,n)},function(m){switch(m.code){case m.PERMISSION_DENIED:e();break;case m.TIMEOUT:$("#"+SN.C.S.NoticeDataGeo).attr("checked",false);break}},{timeout:10000})}else{if(c.length>0&&h.length>0){var k={lat:c,lon:h,token:$("#token").val()};j(g,k)}else{e();$("#"+SN.C.S.NoticeDataGeo).remove();$("label[for="+SN.C.S.NoticeDataGeo+"]").remove()}}}else{var l=JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));$("#"+SN.C.S.NoticeLat).val(l.NLat);$("#"+SN.C.S.NoticeLon).val(l.NLon);$("#"+SN.C.S.NoticeLocationNs).val(l.NLNS);$("#"+SN.C.S.NoticeLocationId).val(l.NLID);$("#"+SN.C.S.NoticeDataGeo).attr("checked",l.NDG);$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",NoticeDataGeo_text.ShareDisable+" ("+l.NLN+")").addClass("checked")}}else{e()}}).change()}},NewDirectMessage:function(){NDM=$(".entity_send-a-message a");NDM.attr({href:NDM.attr("href")+"&ajax=1"});NDM.bind("click",function(){var a=$(".entity_send-a-message form");if(a.length===0){$(this).addClass(SN.C.S.Processing);$.get(NDM.attr("href"),null,function(b){$(".entity_send-a-message").append(document._importNode($("form",b)[0],true));a=$(".entity_send-a-message .form_notice");SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);a.append('');$(".entity_send-a-message button").click(function(){a.hide();return false});NDM.removeClass(SN.C.S.Processing)})}else{a.show();$(".entity_send-a-message textarea").focus()}return false})},GetFullYear:function(c,d,a){var b=new Date();b.setFullYear(c,d,a);return b},StatusNetInstance:{Set:function(b){var a=SN.U.StatusNetInstance.Get();if(a!==null){b=$.extend(a,b)}$.cookie(SN.C.S.StatusNetInstance,JSON.stringify(b),{path:"/",expires:SN.U.GetFullYear(2029,0,1)})},Get:function(){var a=$.cookie(SN.C.S.StatusNetInstance);if(a!==null){return JSON.parse(a)}return null},Delete:function(){$.cookie(SN.C.S.StatusNetInstance,null)}},belongsOnTimeline:function(b){var a=$("body").attr("id");if(a=="public"){return true}var c=$("#nav_profile a").attr("href");if(c){var d=$(b).find(".entry-title .author a.url").attr("href");if(d==c){if(a=="all"||a=="showstream"){return true}}}return false}},Init:{NoticeForm:function(){if($("body.user_in").length>0){SN.U.NoticeLocationAttach();$("."+SN.C.S.FormNotice).each(function(){SN.U.FormNoticeXHR($(this));SN.U.FormNoticeEnhancements($(this))});SN.U.NoticeDataAttach()}},Notices:function(){if($("body.user_in").length>0){SN.U.NoticeFavor();SN.U.NoticeRepeat();SN.U.NoticeReply();SN.U.NoticeInlineReplySetup()}SN.U.NoticeAttachments()},EntityActions:function(){if($("body.user_in").length>0){$(".form_user_subscribe").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_user_unsubscribe").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_group_join").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_group_leave").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_user_nudge").live("click",function(){SN.U.FormXHR($(this));return false});SN.U.NewDirectMessage()}},Login:function(){if(SN.U.StatusNetInstance.Get()!==null){var a=SN.U.StatusNetInstance.Get().Nickname;if(a!==null){$("#form_login #nickname").val(a)}}$("#form_login").bind("submit",function(){SN.U.StatusNetInstance.Set({Nickname:$("#form_login #nickname").val()});return true})},UploadForms:function(){$("input[type=file]").change(function(d){if(typeof this.files=="object"&&this.files.length>0){var c=0;for(var b=0;b0&&c>a){var e="File too large: maximum upload size is %d bytes.";alert(e.replace("%d",a));$(this).val("");d.preventDefault();return false}}})}}};$(document).ready(function(){SN.Init.UploadForms();if($("."+SN.C.S.FormNotice).length>0){SN.Init.NoticeForm()}if($("#content .notices").length>0){SN.Init.Notices()}if($("#content .entity_actions").length>0){SN.Init.EntityActions()}if($("#form_login").length>0){SN.Init.Login()}});if(!document.ELEMENT_NODE){document.ELEMENT_NODE=1;document.ATTRIBUTE_NODE=2;document.TEXT_NODE=3;document.CDATA_SECTION_NODE=4;document.ENTITY_REFERENCE_NODE=5;document.ENTITY_NODE=6;document.PROCESSING_INSTRUCTION_NODE=7;document.COMMENT_NODE=8;document.DOCUMENT_NODE=9;document.DOCUMENT_TYPE_NODE=10;document.DOCUMENT_FRAGMENT_NODE=11;document.NOTATION_NODE=12}document._importNode=function(e,a){switch(e.nodeType){case document.ELEMENT_NODE:var d=document.createElement(e.nodeName);if(e.attributes&&e.attributes.length>0){for(var c=0,b=e.attributes.length;c0){for(var c=0,b=e.childNodes.length;c0){var j=c.pop();j()}}};window._google_loader_apiLoaded=function(){f()};var d=function(){return(window.google&&google.loader)};var g=function(j){if(d()){return true}h(j);e();return false};e();return{shim:true,type:"ClientLocation",lastPosition:null,getCurrentPosition:function(k,n,o){var m=this;if(!g(function(){m.getCurrentPosition(k,n,o)})){return}if(google.loader.ClientLocation){var l=google.loader.ClientLocation;var j={coords:{latitude:l.latitude,longitude:l.longitude,altitude:null,accuracy:43000,altitudeAccuracy:null,heading:null,speed:null},address:{city:l.address.city,country:l.address.country,country_code:l.address.country_code,region:l.address.region},timestamp:new Date()};k(j);this.lastPosition=j}else{if(n==="function"){n({code:3,message:"Using the Google ClientLocation API and it is not able to calculate a location."})}}},watchPosition:function(j,l,m){this.getCurrentPosition(j,l,m);var k=this;var n=setInterval(function(){k.getCurrentPosition(j,l,m)},10000);return n},clearWatch:function(j){clearInterval(j)},getPermission:function(l,j,k){return true}}});navigator.geolocation=(window.google&&google.gears)?a():b()})()}; \ No newline at end of file +var SN={C:{I:{CounterBlackout:false,MaxLength:140,PatternUsername:/^[0-9a-zA-Z\-_.]*$/,HTTP20x30x:[200,201,202,203,204,205,206,300,301,302,303,304,305,306,307]},S:{Disabled:"disabled",Warning:"warning",Error:"error",Success:"success",Processing:"processing",CommandResult:"command_result",FormNotice:"form_notice",NoticeDataText:"notice_data-text",NoticeTextCount:"notice_text-count",NoticeInReplyTo:"notice_in-reply-to",NoticeDataAttach:"notice_data-attach",NoticeDataAttachSelected:"notice_data-attach_selected",NoticeActionSubmit:"notice_action-submit",NoticeLat:"notice_data-lat",NoticeLon:"notice_data-lon",NoticeLocationId:"notice_data-location_id",NoticeLocationNs:"notice_data-location_ns",NoticeGeoName:"notice_data-geo_name",NoticeDataGeo:"notice_data-geo",NoticeDataGeoCookie:"NoticeDataGeo",NoticeDataGeoSelected:"notice_data-geo_selected",StatusNetInstance:"StatusNetInstance"}},messages:{},msg:function(a){if(typeof SN.messages[a]=="undefined"){return"["+a+"]"}else{return SN.messages[a]}},U:{FormNoticeEnhancements:function(b){if(jQuery.data(b[0],"ElementData")===undefined){MaxLength=b.find("#"+SN.C.S.NoticeTextCount).text();if(typeof(MaxLength)=="undefined"){MaxLength=SN.C.I.MaxLength}jQuery.data(b[0],"ElementData",{MaxLength:MaxLength});SN.U.Counter(b);NDT=b.find("#"+SN.C.S.NoticeDataText);NDT.bind("keyup",function(c){SN.U.Counter(b)});var a=function(c){window.setTimeout(function(){SN.U.Counter(b)},50)};NDT.bind("cut",a).bind("paste",a);NDT.bind("keydown",function(c){SN.U.SubmitOnReturn(c,b)})}else{b.find("#"+SN.C.S.NoticeTextCount).text(jQuery.data(b[0],"ElementData").MaxLength)}if($("body")[0].id!="conversation"&&window.location.hash.length===0&&$(window).scrollTop()==0){b.find("textarea").focus()}},SubmitOnReturn:function(b,a){if(b.keyCode==13||b.keyCode==10){a.submit();b.preventDefault();b.stopPropagation();$("#"+a[0].id+" #"+SN.C.S.NoticeDataText).blur();$("body").focus();return false}return true},Counter:function(d){SN.C.I.FormNoticeCurrent=d;var b=jQuery.data(d[0],"ElementData").MaxLength;if(b<=0){return}var c=b-SN.U.CharacterCount(d);var a=d.find("#"+SN.C.S.NoticeTextCount);if(c.toString()!=a.text()){if(!SN.C.I.CounterBlackout||c===0){if(a.text()!=String(c)){a.text(c)}if(c<0){d.addClass(SN.C.S.Warning)}else{d.removeClass(SN.C.S.Warning)}if(!SN.C.I.CounterBlackout){SN.C.I.CounterBlackout=true;SN.C.I.FormNoticeCurrent=d;window.setTimeout("SN.U.ClearCounterBlackout(SN.C.I.FormNoticeCurrent);",500)}}}},CharacterCount:function(a){return a.find("#"+SN.C.S.NoticeDataText).val().length},ClearCounterBlackout:function(a){SN.C.I.CounterBlackout=false;SN.U.Counter(a)},RewriteAjaxAction:function(a){if(document.location.protocol=="https:"&&a.substr(0,5)=="http:"){return a.replace(/^http:\/\/[^:\/]+/,"https://"+document.location.host)}else{return a}},FormXHR:function(a){$.ajax({type:"POST",dataType:"xml",url:SN.U.RewriteAjaxAction(a.attr("action")),data:a.serialize()+"&ajax=1",beforeSend:function(b){a.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled)},error:function(c,d,b){alert(b||d)},success:function(b,c){if(typeof($("form",b)[0])!="undefined"){form_new=document._importNode($("form",b)[0],true);a.replaceWith(form_new)}else{a.replaceWith(document._importNode($("p",b)[0],true))}}})},FormNoticeXHR:function(b){SN.C.I.NoticeDataGeo={};b.append('');b.attr("action",SN.U.RewriteAjaxAction(b.attr("action")));var c=function(d,e){b.append($('

    ').addClass(d).text(e))};var a=function(){b.find(".form_response").remove()};b.ajaxForm({dataType:"xml",timeout:"60000",beforeSend:function(d){if(b.find("#"+SN.C.S.NoticeDataText)[0].value.length===0){b.addClass(SN.C.S.Warning);return false}b.addClass(SN.C.S.Processing).find("#"+SN.C.S.NoticeActionSubmit).addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled);SN.C.I.NoticeDataGeo.NLat=$("#"+SN.C.S.NoticeLat).val();SN.C.I.NoticeDataGeo.NLon=$("#"+SN.C.S.NoticeLon).val();SN.C.I.NoticeDataGeo.NLNS=$("#"+SN.C.S.NoticeLocationNs).val();SN.C.I.NoticeDataGeo.NLID=$("#"+SN.C.S.NoticeLocationId).val();SN.C.I.NoticeDataGeo.NDG=$("#"+SN.C.S.NoticeDataGeo).attr("checked");cookieValue=$.cookie(SN.C.S.NoticeDataGeoCookie);if(cookieValue!==null&&cookieValue!="disabled"){cookieValue=JSON.parse(cookieValue);SN.C.I.NoticeDataGeo.NLat=$("#"+SN.C.S.NoticeLat).val(cookieValue.NLat).val();SN.C.I.NoticeDataGeo.NLon=$("#"+SN.C.S.NoticeLon).val(cookieValue.NLon).val();if($("#"+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS)){SN.C.I.NoticeDataGeo.NLNS=$("#"+SN.C.S.NoticeLocationNs).val(cookieValue.NLNS).val();SN.C.I.NoticeDataGeo.NLID=$("#"+SN.C.S.NoticeLocationId).val(cookieValue.NLID).val()}}if(cookieValue=="disabled"){SN.C.I.NoticeDataGeo.NDG=$("#"+SN.C.S.NoticeDataGeo).attr("checked",false).attr("checked")}else{SN.C.I.NoticeDataGeo.NDG=$("#"+SN.C.S.NoticeDataGeo).attr("checked",true).attr("checked")}return true},error:function(f,g,e){b.removeClass(SN.C.S.Processing).find("#"+SN.C.S.NoticeActionSubmit).removeClass(SN.C.S.Disabled).removeAttr(SN.C.S.Disabled,SN.C.S.Disabled);a();if(g=="timeout"){c("error","Sorry! We had trouble sending your notice. The servers are overloaded. Please try again, and contact the site administrator if this problem persists.")}else{var d=SN.U.GetResponseXML(f);if($("."+SN.C.S.Error,d).length>0){b.append(document._importNode($("."+SN.C.S.Error,d)[0],true))}else{if(parseInt(f.status)===0||jQuery.inArray(parseInt(f.status),SN.C.I.HTTP20x30x)>=0){b.resetForm().find("#"+SN.C.S.NoticeDataAttachSelected).remove();SN.U.FormNoticeEnhancements(b)}else{c("error","(Sorry! We had trouble sending your notice ("+f.status+" "+f.statusText+"). Please report the problem to the site administrator if this happens again.")}}}},success:function(i,k){a();var e=$("#"+SN.C.S.Error,i);if(e.length>0){c("error",e.text())}else{if($("body")[0].id=="bookmarklet"){self.close()}var d=$("#"+SN.C.S.CommandResult,i);if(d.length>0){c("success",d.text())}else{var h=document._importNode($("li",i)[0],true);var j=$("#notices_primary .notices:first");if(j.length>0&&SN.U.belongsOnTimeline(h)){if($("#"+h.id).length===0){var f=$("#"+SN.C.S.NoticeInReplyTo).val();var g="#notices_primary #notice-"+f;if($("body")[0].id=="conversation"){if(f.length>0&&$(g+" .notices").length<1){$(g).append('
      ')}$($(g+" .notices")[0]).append(h)}else{j.prepend(h)}$("#"+h.id).css({display:"none"}).fadeIn(2500);SN.U.NoticeWithAttachment($("#"+h.id));SN.U.NoticeReplyTo($("#"+h.id))}}else{c("success",$("title",i).text())}}b.resetForm();b.find("#"+SN.C.S.NoticeInReplyTo).val("");b.find("#"+SN.C.S.NoticeDataAttachSelected).remove();SN.U.FormNoticeEnhancements(b)}},complete:function(d,e){b.removeClass(SN.C.S.Processing).find("#"+SN.C.S.NoticeActionSubmit).removeAttr(SN.C.S.Disabled).removeClass(SN.C.S.Disabled);$("#"+SN.C.S.NoticeLat).val(SN.C.I.NoticeDataGeo.NLat);$("#"+SN.C.S.NoticeLon).val(SN.C.I.NoticeDataGeo.NLon);if($("#"+SN.C.S.NoticeLocationNs)){$("#"+SN.C.S.NoticeLocationNs).val(SN.C.I.NoticeDataGeo.NLNS);$("#"+SN.C.S.NoticeLocationId).val(SN.C.I.NoticeDataGeo.NLID)}$("#"+SN.C.S.NoticeDataGeo).attr("checked",SN.C.I.NoticeDataGeo.NDG)}})},GetResponseXML:function(b){try{return b.responseXML}catch(a){return(new DOMParser()).parseFromString(b.responseText,"text/xml")}},NoticeReply:function(){if($("#"+SN.C.S.NoticeDataText).length>0&&$("#content .notice_reply").length>0){$("#content .notice").each(function(){SN.U.NoticeReplyTo($(this))})}},NoticeReplyTo:function(a){a.find(".notice_reply").live("click",function(c){c.preventDefault();var b=($(".author .nickname",a).length>0)?$($(".author .nickname",a)[0]):$(".author .nickname.uid");SN.U.NoticeInlineReplyTrigger(a,"@"+b.text());return false})},NoticeInlineReplyTrigger:function(h,i){var c=$($(".notice_id",h)[0]).text();var d=h;var f=h.closest(".notices");if(f.hasClass("threaded-replies")){d=f.closest(".notice")}else{f=$("ul.threaded-replies",h);if(f.length==0){f=$('
        ');h.append(f)}}var k=$(".notice-reply-form",f);if(k.length==0){$("li.notice-reply-placeholder").remove();var g=$("li.notice-reply",f);if(g.length==0){g=$('
      • ');var b=$("#form_notice");k=g.find("form");k.attr("action",b.attr("action"));k.find('input[name="token"]').val(b.find("input[name=token]").val());k.find('input[type="submit"]').val(SN.msg("reply_submit"));f.append(g);k.find("textarea").blur(function(){var m=$(this);var l=$.trim(m.val());if(l==""||l==m.data("initialText")){g.remove();if(f.find("li").length>0){SN.U.NoticeInlineReplyPlaceholder(d)}else{f.remove()}}});k.submit(function(m){var l=k;$.ajax({type:"POST",dataType:"xml",url:SN.U.RewriteAjaxAction(l.attr("action")),data:l.serialize()+"&ajax=1",beforeSend:function(n){l.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled).end().find("textarea").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled)},error:function(o,p,n){alert(n||p)},success:function(p,q){var o=$("li",p)[0];if(o){var n=document._importNode(o,true);if($("#notice-"+c).length==0){g.replaceWith(n);SN.U.NoticeInlineReplyPlaceholder(d)}else{g.remove()}}}});m.preventDefault();return false})}}k.find("input[name=inreplyto]").val(c);var j=k.find("textarea");if(j.length==0){throw"No textarea"}var a="";if(i){a=i+" "}j.val(a+j.val().replace(RegExp(a,"i"),""));j.data("initialText",$.trim(i+""));j.focus();if(j[0].setSelectionRange){var e=j.val().length;j[0].setSelectionRange(e,e)}},NoticeReplySet:function(b,d){if(b.match(SN.C.I.PatternUsername)){var c=$("#"+SN.C.S.NoticeDataText);if(c.length>0){replyto="@"+b+" ";c.val(replyto+c.val().replace(RegExp(replyto,"i"),""));$("#"+SN.C.S.FormNotice+" #"+SN.C.S.NoticeInReplyTo).val(d);c[0].focus();if(c[0].setSelectionRange){var a=c.val().length;c[0].setSelectionRange(a,a)}}}},NoticeFavor:function(){$(".form_favor").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_disfavor").live("click",function(){SN.U.FormXHR($(this));return false})},NoticeInlineReplyPlaceholder:function(b){var a=b.find("ul.threaded-replies");var c=$('
      • ');c.click(function(){SN.U.NoticeInlineReplyTrigger(b)});c.find("input").val(SN.msg("reply_comment"));a.append(c)},NoticeInlineReplySetup:function(){$(".threaded-replies").each(function(){var b=$(this);var a=b.closest(".notice");SN.U.NoticeInlineReplyPlaceholder(a)})},NoticeRepeat:function(){$(".form_repeat").live("click",function(a){a.preventDefault();SN.U.NoticeRepeatConfirmation($(this));return false})},NoticeRepeatConfirmation:function(a){var c=a.find(".submit");var b=c.clone();b.addClass("submit_dialogbox").removeClass("submit");a.append(b);b.bind("click",function(){SN.U.FormXHR(a);return false});c.hide();a.addClass("dialogbox").append('').closest(".notice-options").addClass("opaque");a.find("button.close").click(function(){$(this).remove();a.removeClass("dialogbox").closest(".notice-options").removeClass("opaque");a.find(".submit_dialogbox").remove();a.find(".submit").show();return false})},NoticeAttachments:function(){$(".notice a.attachment").each(function(){SN.U.NoticeWithAttachment($(this).closest(".notice"))})},NoticeWithAttachment:function(b){if(b.find(".attachment").length===0){return}var a=b.find(".attachment.more");if(a.length>0){$(a[0]).click(function(){var c=$(this);c.addClass(SN.C.S.Processing);$.get(c.attr("href")+"/ajax",null,function(d){c.parent(".entry-content").html($(d).find("#attachment_view .entry-content").html())});return false}).attr("title",SN.msg("showmore_tooltip"))}},NoticeDataAttach:function(){NDA=$("#"+SN.C.S.NoticeDataAttach);NDA.change(function(c){var a=$(this).val();if(!a){$("#"+SN.C.S.NoticeDataAttachSelected).remove();return false}S='
        '+a+'
        ';NDAS=$("#"+SN.C.S.NoticeDataAttachSelected);if(NDAS.length>0){NDAS.replaceWith(S)}else{$("#"+SN.C.S.FormNotice).append(S)}$("#"+SN.C.S.NoticeDataAttachSelected+" button").click(function(){$("#"+SN.C.S.NoticeDataAttachSelected).remove();NDA.val("");return false});if(typeof this.files=="object"){for(var b=0;bf){e=false}if(e){g(c,function(i){var h=$("").attr("title",d).attr("alt",d).attr("src",i).attr("style","height: 120px");$("#"+SN.C.S.NoticeDataAttachSelected).append(h)})}else{var b=$("
        ").text(d);$("#"+SN.C.S.NoticeDataAttachSelected).append(b)}},NoticeLocationAttach:function(){var c=$("#"+SN.C.S.NoticeLat).val();var h=$("#"+SN.C.S.NoticeLon).val();var d=$("#"+SN.C.S.NoticeLocationNs).val();var i=$("#"+SN.C.S.NoticeLocationId).val();var a=$("#"+SN.C.S.NoticeGeoName).text();var b=$("#"+SN.C.S.NoticeDataGeo);function e(){$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",jQuery.trim($("label[for="+SN.C.S.NoticeDataGeo+"]").text())).removeClass("checked");$("#"+SN.C.S.NoticeLat).val("");$("#"+SN.C.S.NoticeLon).val("");$("#"+SN.C.S.NoticeLocationNs).val("");$("#"+SN.C.S.NoticeLocationId).val("");$("#"+SN.C.S.NoticeDataGeo).attr("checked",false);$.cookie(SN.C.S.NoticeDataGeoCookie,"disabled",{path:"/"})}function j(k,l){$.getJSON(k,l,function(m){var n,o;if(typeof(m.location_ns)!="undefined"){$("#"+SN.C.S.NoticeLocationNs).val(m.location_ns);n=m.location_ns}if(typeof(m.location_id)!="undefined"){$("#"+SN.C.S.NoticeLocationId).val(m.location_id);o=m.location_id}if(typeof(m.name)=="undefined"){NLN_text=l.lat+";"+l.lon}else{NLN_text=m.name}$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",NoticeDataGeo_text.ShareDisable+" ("+NLN_text+")");$("#"+SN.C.S.NoticeLat).val(l.lat);$("#"+SN.C.S.NoticeLon).val(l.lon);$("#"+SN.C.S.NoticeLocationNs).val(n);$("#"+SN.C.S.NoticeLocationId).val(o);$("#"+SN.C.S.NoticeDataGeo).attr("checked",true);var p={NLat:l.lat,NLon:l.lon,NLNS:n,NLID:o,NLN:NLN_text,NLNU:m.url,NDG:true};$.cookie(SN.C.S.NoticeDataGeoCookie,JSON.stringify(p),{path:"/"})})}if(b.length>0){if($.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){b.attr("checked",false)}else{b.attr("checked",true)}var f=$("#notice_data-geo_wrap");var g=f.attr("title");f.removeAttr("title");$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",jQuery.trim($("label[for="+SN.C.S.NoticeDataGeo+"]").text()));b.change(function(){if($("#"+SN.C.S.NoticeDataGeo).attr("checked")===true||$.cookie(SN.C.S.NoticeDataGeoCookie)===null){$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",NoticeDataGeo_text.ShareDisable).addClass("checked");if($.cookie(SN.C.S.NoticeDataGeoCookie)===null||$.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(m){$("#"+SN.C.S.NoticeLat).val(m.coords.latitude);$("#"+SN.C.S.NoticeLon).val(m.coords.longitude);var n={lat:m.coords.latitude,lon:m.coords.longitude,token:$("#token").val()};j(g,n)},function(m){switch(m.code){case m.PERMISSION_DENIED:e();break;case m.TIMEOUT:$("#"+SN.C.S.NoticeDataGeo).attr("checked",false);break}},{timeout:10000})}else{if(c.length>0&&h.length>0){var k={lat:c,lon:h,token:$("#token").val()};j(g,k)}else{e();$("#"+SN.C.S.NoticeDataGeo).remove();$("label[for="+SN.C.S.NoticeDataGeo+"]").remove()}}}else{var l=JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));$("#"+SN.C.S.NoticeLat).val(l.NLat);$("#"+SN.C.S.NoticeLon).val(l.NLon);$("#"+SN.C.S.NoticeLocationNs).val(l.NLNS);$("#"+SN.C.S.NoticeLocationId).val(l.NLID);$("#"+SN.C.S.NoticeDataGeo).attr("checked",l.NDG);$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",NoticeDataGeo_text.ShareDisable+" ("+l.NLN+")").addClass("checked")}}else{e()}}).change()}},NewDirectMessage:function(){NDM=$(".entity_send-a-message a");NDM.attr({href:NDM.attr("href")+"&ajax=1"});NDM.bind("click",function(){var a=$(".entity_send-a-message form");if(a.length===0){$(this).addClass(SN.C.S.Processing);$.get(NDM.attr("href"),null,function(b){$(".entity_send-a-message").append(document._importNode($("form",b)[0],true));a=$(".entity_send-a-message .form_notice");SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);a.append('');$(".entity_send-a-message button").click(function(){a.hide();return false});NDM.removeClass(SN.C.S.Processing)})}else{a.show();$(".entity_send-a-message textarea").focus()}return false})},GetFullYear:function(c,d,a){var b=new Date();b.setFullYear(c,d,a);return b},StatusNetInstance:{Set:function(b){var a=SN.U.StatusNetInstance.Get();if(a!==null){b=$.extend(a,b)}$.cookie(SN.C.S.StatusNetInstance,JSON.stringify(b),{path:"/",expires:SN.U.GetFullYear(2029,0,1)})},Get:function(){var a=$.cookie(SN.C.S.StatusNetInstance);if(a!==null){return JSON.parse(a)}return null},Delete:function(){$.cookie(SN.C.S.StatusNetInstance,null)}},belongsOnTimeline:function(b){var a=$("body").attr("id");if(a=="public"){return true}var c=$("#nav_profile a").attr("href");if(c){var d=$(b).find(".entry-title .author a.url").attr("href");if(d==c){if(a=="all"||a=="showstream"){return true}}}return false}},Init:{NoticeForm:function(){if($("body.user_in").length>0){SN.U.NoticeLocationAttach();$("."+SN.C.S.FormNotice).each(function(){SN.U.FormNoticeXHR($(this));SN.U.FormNoticeEnhancements($(this))});SN.U.NoticeDataAttach()}},Notices:function(){if($("body.user_in").length>0){SN.U.NoticeFavor();SN.U.NoticeRepeat();SN.U.NoticeReply();SN.U.NoticeInlineReplySetup()}SN.U.NoticeAttachments()},EntityActions:function(){if($("body.user_in").length>0){$(".form_user_subscribe").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_user_unsubscribe").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_group_join").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_group_leave").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_user_nudge").live("click",function(){SN.U.FormXHR($(this));return false});SN.U.NewDirectMessage()}},Login:function(){if(SN.U.StatusNetInstance.Get()!==null){var a=SN.U.StatusNetInstance.Get().Nickname;if(a!==null){$("#form_login #nickname").val(a)}}$("#form_login").bind("submit",function(){SN.U.StatusNetInstance.Set({Nickname:$("#form_login #nickname").val()});return true})},UploadForms:function(){$("input[type=file]").change(function(d){if(typeof this.files=="object"&&this.files.length>0){var c=0;for(var b=0;b0&&c>a){var e="File too large: maximum upload size is %d bytes.";alert(e.replace("%d",a));$(this).val("");d.preventDefault();return false}}})}}};$(document).ready(function(){SN.Init.UploadForms();if($("."+SN.C.S.FormNotice).length>0){SN.Init.NoticeForm()}if($("#content .notices").length>0){SN.Init.Notices()}if($("#content .entity_actions").length>0){SN.Init.EntityActions()}if($("#form_login").length>0){SN.Init.Login()}});if(!document.ELEMENT_NODE){document.ELEMENT_NODE=1;document.ATTRIBUTE_NODE=2;document.TEXT_NODE=3;document.CDATA_SECTION_NODE=4;document.ENTITY_REFERENCE_NODE=5;document.ENTITY_NODE=6;document.PROCESSING_INSTRUCTION_NODE=7;document.COMMENT_NODE=8;document.DOCUMENT_NODE=9;document.DOCUMENT_TYPE_NODE=10;document.DOCUMENT_FRAGMENT_NODE=11;document.NOTATION_NODE=12}document._importNode=function(e,a){switch(e.nodeType){case document.ELEMENT_NODE:var d=document.createElement(e.nodeName);if(e.attributes&&e.attributes.length>0){for(var c=0,b=e.attributes.length;c0){for(var c=0,b=e.childNodes.length;c0){var j=c.pop();j()}}};window._google_loader_apiLoaded=function(){f()};var d=function(){return(window.google&&google.loader)};var g=function(j){if(d()){return true}h(j);e();return false};e();return{shim:true,type:"ClientLocation",lastPosition:null,getCurrentPosition:function(k,n,o){var m=this;if(!g(function(){m.getCurrentPosition(k,n,o)})){return}if(google.loader.ClientLocation){var l=google.loader.ClientLocation;var j={coords:{latitude:l.latitude,longitude:l.longitude,altitude:null,accuracy:43000,altitudeAccuracy:null,heading:null,speed:null},address:{city:l.address.city,country:l.address.country,country_code:l.address.country_code,region:l.address.region},timestamp:new Date()};k(j);this.lastPosition=j}else{if(n==="function"){n({code:3,message:"Using the Google ClientLocation API and it is not able to calculate a location."})}}},watchPosition:function(j,l,m){this.getCurrentPosition(j,l,m);var k=this;var n=setInterval(function(){k.getCurrentPosition(j,l,m)},10000);return n},clearWatch:function(j){clearInterval(j)},getPermission:function(l,j,k){return true}}});navigator.geolocation=(window.google&&google.gears)?a():b()})()}; \ No newline at end of file diff --git a/lib/threadednoticelist.php b/lib/threadednoticelist.php index 1298f179f9..645f15438f 100644 --- a/lib/threadednoticelist.php +++ b/lib/threadednoticelist.php @@ -64,7 +64,7 @@ class ThreadedNoticeList extends NoticeList { $this->out->elementStart('div', array('id' =>'notices_primary')); $this->out->element('h2', null, _('Notices')); - $this->out->elementStart('ol', array('class' => 'notices xoxo')); + $this->out->elementStart('ol', array('class' => 'notices threaded-notices xoxo')); $cnt = 0; $conversations = array(); @@ -182,7 +182,7 @@ class ThreadedNoticeListItem extends NoticeListItem } if ($notices) { - $this->out->elementStart('ul', 'notices threaded-notices xoxo'); + $this->out->elementStart('ul', 'notices threaded-replies xoxo'); if ($moreCutoff) { $item = new ThreadedNoticeListMoreItem($moreCutoff, $this->out); $item->show(); diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 4befb05771..e615895cab 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -169,7 +169,7 @@ RealtimeUpdate = { var list = $("#notices_primary .notices:first") var prepend = true; - var threaded = true; + var threaded = list.hasClass('threaded-notices'); if (threaded && data.in_reply_to_status_id) { // aho! var parent = $('#notice-' + data.in_reply_to_status_id); @@ -179,12 +179,12 @@ RealtimeUpdate = { // Check the parent notice to make sure it's not a reply itself. // If so, use it's parent as the parent. var parentList = parent.closest('.notices'); - if (parentList.hasClass('threaded-notices')) { + if (parentList.hasClass('threaded-replies')) { parent = parentList.closest('.notice'); } - list = parent.find('.threaded-notices'); + list = parent.find('.threaded-replies'); if (list.length == 0) { - list = $('
          '); + list = $('
            '); parent.append(list); } prepend = false; diff --git a/plugins/Realtime/realtimeupdate.min.js b/plugins/Realtime/realtimeupdate.min.js index 549bc77596..931de982ef 100644 --- a/plugins/Realtime/realtimeupdate.min.js +++ b/plugins/Realtime/realtimeupdate.min.js @@ -1 +1 @@ -RealtimeUpdate={_userid:0,_replyurl:"",_favorurl:"",_repeaturl:"",_deleteurl:"",_updatecounter:0,_maxnotices:50,_windowhasfocus:true,_documenttitle:"",_paused:false,_queuedNotices:[],init:function(c,b,d,e,a){RealtimeUpdate._userid=c;RealtimeUpdate._replyurl=b;RealtimeUpdate._favorurl=d;RealtimeUpdate._repeaturl=e;RealtimeUpdate._deleteurl=a;RealtimeUpdate._documenttitle=document.title;$(window).bind("focus",function(){RealtimeUpdate._windowhasfocus=true;RealtimeUpdate._updatecounter=0;RealtimeUpdate.removeWindowCounter()});$(window).bind("blur",function(){$("#notices_primary .notice").removeClass("mark-top");$("#notices_primary .notice:first").addClass("mark-top");RealtimeUpdate._windowhasfocus=false;return false})},receive:function(a){if(RealtimeUpdate.isNoticeVisible(a.id)){return}if(RealtimeUpdate._paused===false){RealtimeUpdate.purgeLastNoticeItem();RealtimeUpdate.insertNoticeItem(a)}else{RealtimeUpdate._queuedNotices.push(a);RealtimeUpdate.updateQueuedCounter()}RealtimeUpdate.updateWindowCounter()},insertNoticeItem:function(b){if(RealtimeUpdate.isNoticeVisible(b.id)){return}var a=RealtimeUpdate.makeNoticeItem(b);var c=$(a).attr("id");var d=$("#notices_primary .notices:first");var j=true;var e=true;if(e&&b.in_reply_to_status_id){var g=$("#notice-"+b.in_reply_to_status_id);if(g.length==0){}else{var h=g.closest(".notices");if(h.hasClass("threaded-notices")){g=h.closest(".notice")}d=g.find(".threaded-notices");if(d.length==0){d=$('
              ');g.append(d)}j=false}}var i=$(a);if(j){d.prepend(i)}else{var f=d.find("li.notice-reply-placeholder");if(f.length>0){i.insertBefore(f)}else{i.appendTo(d);SN.U.NoticeInlineReplyPlaceholder(g)}}i.css({display:"none"}).fadeIn(1000);SN.U.NoticeReplyTo($("#"+c));SN.U.NoticeWithAttachment($("#"+c))},isNoticeVisible:function(a){return($("#notice-"+a).length>0)},purgeLastNoticeItem:function(){if($("#notices_primary .notice").length>RealtimeUpdate._maxnotices){$("#notices_primary .notice:last").remove()}},updateWindowCounter:function(){if(RealtimeUpdate._windowhasfocus===false){RealtimeUpdate._updatecounter+=1;document.title="("+RealtimeUpdate._updatecounter+") "+RealtimeUpdate._documenttitle}},removeWindowCounter:function(){document.title=RealtimeUpdate._documenttitle},makeNoticeItem:function(c){if(c.hasOwnProperty("retweeted_status")){original=c.retweeted_status;repeat=c;c=original;unique=repeat.id;responsible=repeat.user}else{original=null;repeat=null;unique=c.id;responsible=c.user}user=c.user;html=c.html.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&");source=c.source.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&");ni='
            • '+user.screen_name+''+user.screen_name+'

              '+html+'

              a few seconds ago from '+source+"";if(c.conversation_url){ni=ni+' in context'}if(repeat){ru=repeat.user;ni=ni+'Repeated by '+ru.screen_name+""}ni=ni+"
              ";ni=ni+'
              ';if(RealtimeUpdate._userid!=0){var a=$("form#form_notice fieldset input#token");var b=a.val();ni=ni+RealtimeUpdate.makeFavoriteForm(c.id,b);ni=ni+RealtimeUpdate.makeReplyLink(c.id,c.user["screen_name"]);if(RealtimeUpdate._userid==responsible.id){ni=ni+RealtimeUpdate.makeDeleteLink(c.id)}else{if(RealtimeUpdate._userid!=user.id){ni=ni+RealtimeUpdate.makeRepeatForm(c.id,b)}}}ni=ni+"
              ";ni=ni+"
            • ";return ni},makeFavoriteForm:function(c,b){var a;a='
              Favor this notice
              ';return a},makeReplyLink:function(c,a){var b;b='Reply '+c+"";return b},makeRepeatForm:function(c,b){var a;a='
              Repeat this notice?
              ';return a},makeDeleteLink:function(c){var b,a;a=RealtimeUpdate._deleteurl.replace("0000000000",c);b='Delete';return b},initActions:function(a,b,c){$("#notices_primary").prepend('
              ');RealtimeUpdate._pluginPath=c;RealtimeUpdate.initPlayPause();RealtimeUpdate.initAddPopup(a,b,RealtimeUpdate._pluginPath)},initPlayPause:function(){if(typeof(localStorage)=="undefined"){RealtimeUpdate.showPause()}else{if(localStorage.getItem("RealtimeUpdate_paused")==="true"){RealtimeUpdate.showPlay()}else{RealtimeUpdate.showPause()}}},showPause:function(){RealtimeUpdate.setPause(false);RealtimeUpdate.showQueuedNotices();RealtimeUpdate.addNoticesHover();$("#realtime_playpause").remove();$("#realtime_actions").prepend('
            • ');$("#realtime_pause").text(SN.msg("realtime_pause")).attr("title",SN.msg("realtime_pause_tooltip")).bind("click",function(){RealtimeUpdate.removeNoticesHover();RealtimeUpdate.showPlay();return false})},showPlay:function(){RealtimeUpdate.setPause(true);$("#realtime_playpause").remove();$("#realtime_actions").prepend('
            • ');$("#realtime_play").text(SN.msg("realtime_play")).attr("title",SN.msg("realtime_play_tooltip")).bind("click",function(){RealtimeUpdate.showPause();return false})},setPause:function(a){RealtimeUpdate._paused=a;if(typeof(localStorage)!="undefined"){localStorage.setItem("RealtimeUpdate_paused",RealtimeUpdate._paused)}},showQueuedNotices:function(){$.each(RealtimeUpdate._queuedNotices,function(a,b){RealtimeUpdate.insertNoticeItem(b)});RealtimeUpdate._queuedNotices=[];RealtimeUpdate.removeQueuedCounter()},updateQueuedCounter:function(){$("#realtime_playpause #queued_counter").html("("+RealtimeUpdate._queuedNotices.length+")")},removeQueuedCounter:function(){$("#realtime_playpause #queued_counter").empty()},addNoticesHover:function(){$("#notices_primary .notices").hover(function(){if(RealtimeUpdate._paused===false){RealtimeUpdate.showPlay()}},function(){if(RealtimeUpdate._paused===true){RealtimeUpdate.showPause()}})},removeNoticesHover:function(){$("#notices_primary .notices").unbind()},initAddPopup:function(a,b,c){$("#realtime_timeline").append('');$("#realtime_popup").text(SN.msg("realtime_popup")).attr("title",SN.msg("realtime_popup_tooltip")).bind("click",function(){window.open(a,"","toolbar=no,resizable=yes,scrollbars=yes,status=no,menubar=no,personalbar=no,location=no,width=500,height=550");return false})},initPopupWindow:function(){$(".notices .entry-title a, .notices .entry-content a").bind("click",function(){window.open(this.href,"");return false});$("#showstream .entity_profile").css({width:"69%"})}}; \ No newline at end of file +RealtimeUpdate={_userid:0,_replyurl:"",_favorurl:"",_repeaturl:"",_deleteurl:"",_updatecounter:0,_maxnotices:50,_windowhasfocus:true,_documenttitle:"",_paused:false,_queuedNotices:[],init:function(c,b,d,e,a){RealtimeUpdate._userid=c;RealtimeUpdate._replyurl=b;RealtimeUpdate._favorurl=d;RealtimeUpdate._repeaturl=e;RealtimeUpdate._deleteurl=a;RealtimeUpdate._documenttitle=document.title;$(window).bind("focus",function(){RealtimeUpdate._windowhasfocus=true;RealtimeUpdate._updatecounter=0;RealtimeUpdate.removeWindowCounter()});$(window).bind("blur",function(){$("#notices_primary .notice").removeClass("mark-top");$("#notices_primary .notice:first").addClass("mark-top");RealtimeUpdate._windowhasfocus=false;return false})},receive:function(a){if(RealtimeUpdate.isNoticeVisible(a.id)){return}if(RealtimeUpdate._paused===false){RealtimeUpdate.purgeLastNoticeItem();RealtimeUpdate.insertNoticeItem(a)}else{RealtimeUpdate._queuedNotices.push(a);RealtimeUpdate.updateQueuedCounter()}RealtimeUpdate.updateWindowCounter()},insertNoticeItem:function(b){if(RealtimeUpdate.isNoticeVisible(b.id)){return}var a=RealtimeUpdate.makeNoticeItem(b);var c=$(a).attr("id");var d=$("#notices_primary .notices:first");var j=true;var e=d.hasClass("threaded-notices");if(e&&b.in_reply_to_status_id){var g=$("#notice-"+b.in_reply_to_status_id);if(g.length==0){}else{var h=g.closest(".notices");if(h.hasClass("threaded-replies")){g=h.closest(".notice")}d=g.find(".threaded-replies");if(d.length==0){d=$('
                ');g.append(d)}j=false}}var i=$(a);if(j){d.prepend(i)}else{var f=d.find("li.notice-reply-placeholder");if(f.length>0){i.insertBefore(f)}else{i.appendTo(d);SN.U.NoticeInlineReplyPlaceholder(g)}}i.css({display:"none"}).fadeIn(1000);SN.U.NoticeReplyTo($("#"+c));SN.U.NoticeWithAttachment($("#"+c))},isNoticeVisible:function(a){return($("#notice-"+a).length>0)},purgeLastNoticeItem:function(){if($("#notices_primary .notice").length>RealtimeUpdate._maxnotices){$("#notices_primary .notice:last").remove()}},updateWindowCounter:function(){if(RealtimeUpdate._windowhasfocus===false){RealtimeUpdate._updatecounter+=1;document.title="("+RealtimeUpdate._updatecounter+") "+RealtimeUpdate._documenttitle}},removeWindowCounter:function(){document.title=RealtimeUpdate._documenttitle},makeNoticeItem:function(c){if(c.hasOwnProperty("retweeted_status")){original=c.retweeted_status;repeat=c;c=original;unique=repeat.id;responsible=repeat.user}else{original=null;repeat=null;unique=c.id;responsible=c.user}user=c.user;html=c.html.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&");source=c.source.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&");ni='
              • '+user.screen_name+''+user.screen_name+'

                '+html+'

                a few seconds ago from '+source+"";if(c.conversation_url){ni=ni+' in context'}if(repeat){ru=repeat.user;ni=ni+'Repeated by '+ru.screen_name+""}ni=ni+"
                ";ni=ni+'
                ';if(RealtimeUpdate._userid!=0){var a=$("form#form_notice fieldset input#token");var b=a.val();ni=ni+RealtimeUpdate.makeFavoriteForm(c.id,b);ni=ni+RealtimeUpdate.makeReplyLink(c.id,c.user["screen_name"]);if(RealtimeUpdate._userid==responsible.id){ni=ni+RealtimeUpdate.makeDeleteLink(c.id)}else{if(RealtimeUpdate._userid!=user.id){ni=ni+RealtimeUpdate.makeRepeatForm(c.id,b)}}}ni=ni+"
                ";ni=ni+"
              • ";return ni},makeFavoriteForm:function(c,b){var a;a='
                Favor this notice
                ';return a},makeReplyLink:function(c,a){var b;b='Reply '+c+"";return b},makeRepeatForm:function(c,b){var a;a='
                Repeat this notice?
                ';return a},makeDeleteLink:function(c){var b,a;a=RealtimeUpdate._deleteurl.replace("0000000000",c);b='Delete';return b},initActions:function(a,b,c){$("#notices_primary").prepend('
                ');RealtimeUpdate._pluginPath=c;RealtimeUpdate.initPlayPause();RealtimeUpdate.initAddPopup(a,b,RealtimeUpdate._pluginPath)},initPlayPause:function(){if(typeof(localStorage)=="undefined"){RealtimeUpdate.showPause()}else{if(localStorage.getItem("RealtimeUpdate_paused")==="true"){RealtimeUpdate.showPlay()}else{RealtimeUpdate.showPause()}}},showPause:function(){RealtimeUpdate.setPause(false);RealtimeUpdate.showQueuedNotices();RealtimeUpdate.addNoticesHover();$("#realtime_playpause").remove();$("#realtime_actions").prepend('
              • ');$("#realtime_pause").text(SN.msg("realtime_pause")).attr("title",SN.msg("realtime_pause_tooltip")).bind("click",function(){RealtimeUpdate.removeNoticesHover();RealtimeUpdate.showPlay();return false})},showPlay:function(){RealtimeUpdate.setPause(true);$("#realtime_playpause").remove();$("#realtime_actions").prepend('
              • ');$("#realtime_play").text(SN.msg("realtime_play")).attr("title",SN.msg("realtime_play_tooltip")).bind("click",function(){RealtimeUpdate.showPause();return false})},setPause:function(a){RealtimeUpdate._paused=a;if(typeof(localStorage)!="undefined"){localStorage.setItem("RealtimeUpdate_paused",RealtimeUpdate._paused)}},showQueuedNotices:function(){$.each(RealtimeUpdate._queuedNotices,function(a,b){RealtimeUpdate.insertNoticeItem(b)});RealtimeUpdate._queuedNotices=[];RealtimeUpdate.removeQueuedCounter()},updateQueuedCounter:function(){$("#realtime_playpause #queued_counter").html("("+RealtimeUpdate._queuedNotices.length+")")},removeQueuedCounter:function(){$("#realtime_playpause #queued_counter").empty()},addNoticesHover:function(){$("#notices_primary .notices").hover(function(){if(RealtimeUpdate._paused===false){RealtimeUpdate.showPlay()}},function(){if(RealtimeUpdate._paused===true){RealtimeUpdate.showPause()}})},removeNoticesHover:function(){$("#notices_primary .notices").unbind()},initAddPopup:function(a,b,c){$("#realtime_timeline").append('');$("#realtime_popup").text(SN.msg("realtime_popup")).attr("title",SN.msg("realtime_popup_tooltip")).bind("click",function(){window.open(a,"","toolbar=no,resizable=yes,scrollbars=yes,status=no,menubar=no,personalbar=no,location=no,width=500,height=550");return false})},initPopupWindow:function(){$(".notices .entry-title a, .notices .entry-content a").bind("click",function(){window.open(this.href,"");return false});$("#showstream .entity_profile").css({width:"69%"})}}; \ No newline at end of file diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 456d7be4b0..3306b8add3 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -1106,38 +1106,38 @@ border-top-style:solid; } /* Threaded notices sublist */ -#content .notices .threaded-notices { +#content .notices .threaded-replies { margin-left: 10%; width: 90%; background: #e4e8f1; } -#content .threaded-notices .notice .author .photo { +#content .threaded-replies .notice .author .photo { left: 8px; width: 32px; height: 32px; } -.threaded-notices .notice-reply { +.threaded-replies .notice-reply { margin: 8px; } -.threaded-notices .notice-reply textarea, -.threaded-notices .notice-reply-placeholder input.placeholder { +.threaded-replies .notice-reply textarea, +.threaded-replies .notice-reply-placeholder input.placeholder { margin-left: 0; width: 95%; } -.threaded-notices .notice-reply-placeholder input.placeholder { +.threaded-replies .notice-reply-placeholder input.placeholder { color: gray; margin-left: 8px; /* ?? */ margin-bottom: 8px; } -.threaded-notices .notice-reply .controls { +.threaded-replies .notice-reply .controls { text-align: right; } -.threaded-notices .notice-reply-comments { +.threaded-replies .notice-reply-comments { margin: 8px; } -.threaded-notices .response, -.threaded-notices .source { +.threaded-replies .response, +.threaded-replies .source { /* Hide these for ajax/realtime sourced notices */ display: none; }