From 1c87e32cd14122eb7b7cdf2f275f77b71e787383 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 4 Mar 2011 16:09:59 -0500 Subject: [PATCH 01/10] 'link' to 'links' in feed document --- lib/activitystreamjsondocument.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/activitystreamjsondocument.php b/lib/activitystreamjsondocument.php index 2b99d19eb7..0c64ebb998 100644 --- a/lib/activitystreamjsondocument.php +++ b/lib/activitystreamjsondocument.php @@ -127,7 +127,7 @@ class ActivityStreamJSONDocument function addLink($url = null, $rel = null, $mediaType = null) { $link = new ActivityStreamsLink($url, $rel, $mediaType); - $this->doc['link'][] = $link->asArray(); + $this->doc['links'][] = $link->asArray(); } /* From 56d5c4a4d1a17d9dc561b4c37c5aba4db2ffe5f5 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 4 Mar 2011 13:40:33 -0800 Subject: [PATCH 02/10] More hardcoded id cleanup in notice form... --- js/util.js | 46 ++++++++++++++----------------- js/util.min.js | 2 +- lib/noticeform.php | 2 +- theme/base/css/display.css | 8 +++--- theme/biz/css/base.css | 8 +++--- theme/clean/css/display.css | 4 +-- theme/clean/css/ie.css | 4 +-- theme/cleaner/css/display.css | 6 ++-- theme/cleaner/css/ie.css | 4 +-- theme/cloudy/css/display.css | 6 ++-- theme/mnml/css/display.css | 8 +++--- theme/mnml/css/ie.css | 4 +-- theme/pigeonthoughts/css/base.css | 8 +++--- theme/rebase/css/display.css | 10 +++---- theme/rebase/css/ie.css | 4 +-- theme/shiny/css/display.css | 4 +-- theme/shiny/css/ie.css | 4 +-- 17 files changed, 64 insertions(+), 68 deletions(-) diff --git a/js/util.js b/js/util.js index 3cd4bbbe44..7c51eb645a 100644 --- a/js/util.js +++ b/js/util.js @@ -50,12 +50,6 @@ var SN = { // StatusNet Processing: 'processing', CommandResult: 'command_result', FormNotice: 'form_notice', - NoticeInReplyTo: 'notice_in-reply-to', - 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', @@ -395,7 +389,7 @@ var SN = { // StatusNet var notices = $('#notices_primary .notices:first'); if (notices.length > 0 && SN.U.belongsOnTimeline(notice)) { if ($('#'+notice.id).length === 0) { - var notice_irt_value = $('#'+SN.C.S.NoticeInReplyTo).val(); + var notice_irt_value = form.find('[name=inreplyto]').val(); var notice_irt = '#notices_primary #notice-'+notice_irt_value; if($('body')[0].id == 'conversation') { if(notice_irt_value.length > 0 && $(notice_irt+' .notices').length < 1) { @@ -972,12 +966,14 @@ var SN = { // StatusNet var NLon = form.find('[name=lon]') var NLNS = form.find('[name=location_ns]').val(); var NLID = form.find('[name=location_id]').val(); - var NLN = $('#'+SN.C.S.NoticeGeoName).text(); // @fixme does this exist? + var NLN = ''; // @fixme var NDGe = form.find('[name=notice_data-geo]'); + var check = form.find('[name=notice_data-geo]'); + var label = $('label[for='+check.attr('id')+']'); function removeNoticeDataGeo(error) { - $('label[for='+SN.C.S.NoticeDataGeo+']') - .attr('title', jQuery.trim($('label[for='+SN.C.S.NoticeDataGeo+']').text())) + label + .attr('title', jQuery.trim(label.text())) .removeClass('checked'); form.find('[name=lat]').val(''); @@ -989,10 +985,10 @@ var SN = { // StatusNet $.cookie(SN.C.S.NoticeDataGeoCookie, 'disabled', { path: '/' }); if (error) { - $('.geo_status_wrapper').removeClass('success').addClass('error'); - $('.geo_status_wrapper .geo_status').text(error); + form.find('.geo_status_wrapper').removeClass('success').addClass('error'); + form.find('.geo_status_wrapper .geo_status').text(error); } else { - $('.geo_status_wrapper').remove(); + form.find('.geo_status_wrapper').remove(); } } @@ -1042,24 +1038,24 @@ var SN = { // StatusNet }); } - if (NDGe.length > 0) { + if (check.length > 0) { if ($.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') { - NDGe.attr('checked', false); + check.attr('checked', false); } else { - NDGe.attr('checked', true); + check.attr('checked', true); } - var NGW = $('#notice_data-geo_wrap'); + var NGW = form.find('.notice_data-geo_wrap'); var geocodeURL = NGW.attr('title'); NGW.removeAttr('title'); - $('label[for='+SN.C.S.NoticeDataGeo+']') - .attr('title', jQuery.trim($('label[for='+SN.C.S.NoticeDataGeo+']').text())); + label + .attr('title', label.text()); - NDGe.change(function() { - if ($('#'+SN.C.S.NoticeDataGeo).attr('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === null) { - $('label[for='+SN.C.S.NoticeDataGeo+']') + check.change(function() { + if (check.attr('checked') === true || $.cookie(SN.C.S.NoticeDataGeoCookie) === null) { + label .attr('title', NoticeDataGeo_text.ShareDisable) .addClass('checked'); @@ -1109,8 +1105,8 @@ var SN = { // StatusNet } else { removeNoticeDataGeo(); - $('#'+SN.C.S.NoticeDataGeo).remove(); - $('label[for='+SN.C.S.NoticeDataGeo+']').remove(); + check.remove(); + label.remove(); } } } @@ -1124,7 +1120,7 @@ var SN = { // StatusNet form.find('[name=notice_data-geo]').attr('checked', cookieValue.NDG); SN.U.NoticeGeoStatus(cookieValue.NLN, cookieValue.NLat, cookieValue.NLon, cookieValue.NLNU); - $('label[for='+SN.C.S.NoticeDataGeo+']') + label .attr('title', NoticeDataGeo_text.ShareDisable + ' (' + cookieValue.NLN + ')') .addClass('checked'); } diff --git a/js/util.min.js b/js/util.min.js index 52a361bc13..7a2f35454b 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",NoticeInReplyTo:"notice_in-reply-to",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(".count").text();if(typeof(MaxLength)=="undefined"){MaxLength=SN.C.I.MaxLength}jQuery.data(b[0],"ElementData",{MaxLength:MaxLength});SN.U.Counter(b);NDT=b.find("[name=status_textarea]");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)}else{b.find(".count").text(jQuery.data(b[0],"ElementData").MaxLength)}},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(".count");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("[name=status_textarea]").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("[name=status_textarea]").val()==""){b.addClass(SN.C.S.Warning);return false}b.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled);SN.U.normalizeGeoData(b);return true},error:function(f,g,e){b.removeClass(SN.C.S.Processing).find(".submit").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(".attach-status").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("[name=inreplyto]").val("");b.find(".attach-status").remove();SN.U.FormNoticeEnhancements(b)}},complete:function(d,e){b.removeClass(SN.C.S.Processing).find(".submit").removeAttr(SN.C.S.Disabled).removeClass(SN.C.S.Disabled);b.find("[name=lat]").val(SN.C.I.NoticeDataGeo.NLat);b.find("[name=lon]").val(SN.C.I.NoticeDataGeo.NLon);b.find("[name=location_ns]").val(SN.C.I.NoticeDataGeo.NLNS);b.find("[name=location_id]").val(SN.C.I.NoticeDataGeo.NLID);b.find("[name=notice_data-geo]").attr("checked",SN.C.I.NoticeDataGeo.NDG)}})},normalizeGeoData:function(a){SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val();SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val();SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked");var b=$.cookie(SN.C.S.NoticeDataGeoCookie);if(b!==null&&b!="disabled"){b=JSON.parse(b);SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val(b.NLat).val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val(b.NLon).val();if(b.NLNS){SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val(b.NLNS).val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val(b.NLID).val()}else{a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("")}}if(b=="disabled"){SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",false).attr("checked")}else{SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",true).attr("checked")}},GetResponseXML:function(b){try{return b.responseXML}catch(a){return(new DOMParser()).parseFromString(b.responseText,"text/xml")}},NoticeReply:function(){if($("#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,r){var o=$("li",p)[0];if(o){var n=document._importNode(o,true);var q=$(n).attr("id");if($("#"+q).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)}},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_placeholder"));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(b){var a=b.find("input[type=file]");a.change(function(f){b.find(".attach-status").remove();var d=$(this).val();if(!d){return false}var c=$('
    ');c.find("code").text(d);c.find("button").click(function(){c.remove();a.val("");return false});b.append(c);if(typeof this.files=="object"){for(var e=0;eg){f=false}if(f){h(c,function(j){var i=$("").attr("title",e).attr("alt",e).attr("src",j).attr("style","height: 120px");d.find(".attach-status").append(i)})}else{var b=$("
    ").text(e);d.find(".attach-status").append(b)}},NoticeLocationAttach:function(a){var d=a.find("[name=lat]");var i=a.find("[name=lon]");var e=a.find("[name=location_ns]").val();var j=a.find("[name=location_id]").val();var b=$("#"+SN.C.S.NoticeGeoName).text();var c=a.find("[name=notice_data-geo]");function f(l){$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",jQuery.trim($("label[for="+SN.C.S.NoticeDataGeo+"]").text())).removeClass("checked");a.find("[name=lat]").val("");a.find("[name=lon]").val("");a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("");a.find("[name=notice_data-geo]").attr("checked",false);$.cookie(SN.C.S.NoticeDataGeoCookie,"disabled",{path:"/"});if(l){$(".geo_status_wrapper").removeClass("success").addClass("error");$(".geo_status_wrapper .geo_status").text(l)}else{$(".geo_status_wrapper").remove()}}function k(l,m){SN.U.NoticeGeoStatus("Looking up place name...");$.getJSON(l,m,function(n){var o,p;if(typeof(n.location_ns)!="undefined"){a.find("[name=location_ns]").val(n.location_ns);o=n.location_ns}if(typeof(n.location_id)!="undefined"){a.find("[name=location_id]").val(n.location_id);p=n.location_id}if(typeof(n.name)=="undefined"){NLN_text=m.lat+";"+m.lon}else{NLN_text=n.name}SN.U.NoticeGeoStatus(NLN_text,m.lat,m.lon,n.url);$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",NoticeDataGeo_text.ShareDisable+" ("+NLN_text+")");a.find("[name=lat]").val(m.lat);a.find("[name=lon]").val(m.lon);a.find("[name=location_ns]").val(o);a.find("[name=location_id]").val(p);a.find("[name=notice_data-geo]").attr("checked",true);var q={NLat:m.lat,NLon:m.lon,NLNS:o,NLID:p,NLN:NLN_text,NLNU:n.url,NDG:true};$.cookie(SN.C.S.NoticeDataGeoCookie,JSON.stringify(q),{path:"/"})})}if(c.length>0){if($.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){c.attr("checked",false)}else{c.attr("checked",true)}var g=$("#notice_data-geo_wrap");var h=g.attr("title");g.removeAttr("title");$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",jQuery.trim($("label[for="+SN.C.S.NoticeDataGeo+"]").text()));c.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){SN.U.NoticeGeoStatus("Requesting location from browser...");navigator.geolocation.getCurrentPosition(function(n){a.find("[name=lat]").val(n.coords.latitude);a.find("[name=lon]").val(n.coords.longitude);var o={lat:n.coords.latitude,lon:n.coords.longitude,token:$("#token").val()};k(h,o)},function(n){switch(n.code){case n.PERMISSION_DENIED:f("Location permission denied.");break;case n.TIMEOUT:f("Location lookup timeout.");break}},{timeout:10000})}else{if(d.length>0&&i.length>0){var l={lat:d,lon:i,token:$("#token").val()};k(h,l)}else{f();$("#"+SN.C.S.NoticeDataGeo).remove();$("label[for="+SN.C.S.NoticeDataGeo+"]").remove()}}}else{var m=JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));a.find("[name=lat]").val(m.NLat);a.find("[name=lon]").val(m.NLon);a.find("[name=location_ns]").val(m.NLNS);a.find("[name=location_id]").val(m.NLID);a.find("[name=notice_data-geo]").attr("checked",m.NDG);SN.U.NoticeGeoStatus(m.NLN,m.NLat,m.NLon,m.NLNU);$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",NoticeDataGeo_text.ShareDisable+" ("+m.NLN+")").addClass("checked")}}else{f()}}).change()}},NoticeGeoStatus:function(a,f,g,c){var e=$("#form_notice");var h=e.find(".geo_status_wrapper");if(h.length==0){h=$('
    ');h.find("button.close").click(function(){$("#"+SN.C.S.NoticeDataGeo).removeAttr("checked").change()});e.append(h)}var b;if(c){b=$("").attr("href",c)}else{b=$("")}b.text(a);if(f||g){var d=f+";"+g;b.attr("title",d);if(!a){b.text(d)}}h.find(".geo_status").empty().append(b)},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.C.S.FormNotice).each(function(){var a=$(this);SN.U.NoticeLocationAttach(a);SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);SN.U.NoticeDataAttach(a)})}},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",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(".count").text();if(typeof(MaxLength)=="undefined"){MaxLength=SN.C.I.MaxLength}jQuery.data(b[0],"ElementData",{MaxLength:MaxLength});SN.U.Counter(b);NDT=b.find("[name=status_textarea]");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)}else{b.find(".count").text(jQuery.data(b[0],"ElementData").MaxLength)}},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(".count");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("[name=status_textarea]").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("[name=status_textarea]").val()==""){b.addClass(SN.C.S.Warning);return false}b.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled);SN.U.normalizeGeoData(b);return true},error:function(f,g,e){b.removeClass(SN.C.S.Processing).find(".submit").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(".attach-status").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=b.find("[name=inreplyto]").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("[name=inreplyto]").val("");b.find(".attach-status").remove();SN.U.FormNoticeEnhancements(b)}},complete:function(d,e){b.removeClass(SN.C.S.Processing).find(".submit").removeAttr(SN.C.S.Disabled).removeClass(SN.C.S.Disabled);b.find("[name=lat]").val(SN.C.I.NoticeDataGeo.NLat);b.find("[name=lon]").val(SN.C.I.NoticeDataGeo.NLon);b.find("[name=location_ns]").val(SN.C.I.NoticeDataGeo.NLNS);b.find("[name=location_id]").val(SN.C.I.NoticeDataGeo.NLID);b.find("[name=notice_data-geo]").attr("checked",SN.C.I.NoticeDataGeo.NDG)}})},normalizeGeoData:function(a){SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val();SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val();SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked");var b=$.cookie(SN.C.S.NoticeDataGeoCookie);if(b!==null&&b!="disabled"){b=JSON.parse(b);SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val(b.NLat).val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val(b.NLon).val();if(b.NLNS){SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val(b.NLNS).val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val(b.NLID).val()}else{a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("")}}if(b=="disabled"){SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",false).attr("checked")}else{SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",true).attr("checked")}},GetResponseXML:function(b){try{return b.responseXML}catch(a){return(new DOMParser()).parseFromString(b.responseText,"text/xml")}},NoticeReply:function(){if($("#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,r){var o=$("li",p)[0];if(o){var n=document._importNode(o,true);var q=$(n).attr("id");if($("#"+q).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)}},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_placeholder"));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(b){var a=b.find("input[type=file]");a.change(function(f){b.find(".attach-status").remove();var d=$(this).val();if(!d){return false}var c=$('
        ');c.find("code").text(d);c.find("button").click(function(){c.remove();a.val("");return false});b.append(c);if(typeof this.files=="object"){for(var e=0;eg){f=false}if(f){h(c,function(j){var i=$("").attr("title",e).attr("alt",e).attr("src",j).attr("style","height: 120px");d.find(".attach-status").append(i)})}else{var b=$("
        ").text(e);d.find(".attach-status").append(b)}},NoticeLocationAttach:function(a){var e=a.find("[name=lat]");var k=a.find("[name=lon]");var g=a.find("[name=location_ns]").val();var l=a.find("[name=location_id]").val();var b="";var d=a.find("[name=notice_data-geo]");var c=a.find("[name=notice_data-geo]");var j=$("label[for="+c.attr("id")+"]");function f(n){j.attr("title",jQuery.trim(j.text())).removeClass("checked");a.find("[name=lat]").val("");a.find("[name=lon]").val("");a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("");a.find("[name=notice_data-geo]").attr("checked",false);$.cookie(SN.C.S.NoticeDataGeoCookie,"disabled",{path:"/"});if(n){a.find(".geo_status_wrapper").removeClass("success").addClass("error");a.find(".geo_status_wrapper .geo_status").text(n)}else{a.find(".geo_status_wrapper").remove()}}function m(n,o){SN.U.NoticeGeoStatus("Looking up place name...");$.getJSON(n,o,function(p){var q,r;if(typeof(p.location_ns)!="undefined"){a.find("[name=location_ns]").val(p.location_ns);q=p.location_ns}if(typeof(p.location_id)!="undefined"){a.find("[name=location_id]").val(p.location_id);r=p.location_id}if(typeof(p.name)=="undefined"){NLN_text=o.lat+";"+o.lon}else{NLN_text=p.name}SN.U.NoticeGeoStatus(NLN_text,o.lat,o.lon,p.url);$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",NoticeDataGeo_text.ShareDisable+" ("+NLN_text+")");a.find("[name=lat]").val(o.lat);a.find("[name=lon]").val(o.lon);a.find("[name=location_ns]").val(q);a.find("[name=location_id]").val(r);a.find("[name=notice_data-geo]").attr("checked",true);var s={NLat:o.lat,NLon:o.lon,NLNS:q,NLID:r,NLN:NLN_text,NLNU:p.url,NDG:true};$.cookie(SN.C.S.NoticeDataGeoCookie,JSON.stringify(s),{path:"/"})})}if(c.length>0){if($.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){c.attr("checked",false)}else{c.attr("checked",true)}var h=a.find(".notice_data-geo_wrap");var i=h.attr("title");h.removeAttr("title");j.attr("title",j.text());c.change(function(){if(c.attr("checked")===true||$.cookie(SN.C.S.NoticeDataGeoCookie)===null){j.attr("title",NoticeDataGeo_text.ShareDisable).addClass("checked");if($.cookie(SN.C.S.NoticeDataGeoCookie)===null||$.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){if(navigator.geolocation){SN.U.NoticeGeoStatus("Requesting location from browser...");navigator.geolocation.getCurrentPosition(function(p){a.find("[name=lat]").val(p.coords.latitude);a.find("[name=lon]").val(p.coords.longitude);var q={lat:p.coords.latitude,lon:p.coords.longitude,token:$("#token").val()};m(i,q)},function(p){switch(p.code){case p.PERMISSION_DENIED:f("Location permission denied.");break;case p.TIMEOUT:f("Location lookup timeout.");break}},{timeout:10000})}else{if(e.length>0&&k.length>0){var n={lat:e,lon:k,token:$("#token").val()};m(i,n)}else{f();c.remove();j.remove()}}}else{var o=JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));a.find("[name=lat]").val(o.NLat);a.find("[name=lon]").val(o.NLon);a.find("[name=location_ns]").val(o.NLNS);a.find("[name=location_id]").val(o.NLID);a.find("[name=notice_data-geo]").attr("checked",o.NDG);SN.U.NoticeGeoStatus(o.NLN,o.NLat,o.NLon,o.NLNU);j.attr("title",NoticeDataGeo_text.ShareDisable+" ("+o.NLN+")").addClass("checked")}}else{f()}}).change()}},NoticeGeoStatus:function(a,f,g,c){var e=$("#form_notice");var h=e.find(".geo_status_wrapper");if(h.length==0){h=$('
        ');h.find("button.close").click(function(){$("#"+SN.C.S.NoticeDataGeo).removeAttr("checked").change()});e.append(h)}var b;if(c){b=$("").attr("href",c)}else{b=$("")}b.text(a);if(f||g){var d=f+";"+g;b.attr("title",d);if(!a){b.text(d)}}h.find(".geo_status").empty().append(b)},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.C.S.FormNotice).each(function(){var a=$(this);SN.U.NoticeLocationAttach(a);SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);SN.U.NoticeDataAttach(a)})}},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/noticeform.php b/lib/noticeform.php index cd2d2cb979..ae8023275a 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -206,7 +206,7 @@ class NoticeForm extends Form $this->out->hidden('notice_data-location_id', empty($this->location_id) ? (empty($this->profile->location_id) ? null : $this->profile->location_id) : $this->location_id, 'location_id'); $this->out->hidden('notice_data-location_ns', empty($this->location_ns) ? (empty($this->profile->location_ns) ? null : $this->profile->location_ns) : $this->location_ns, 'location_ns'); - $this->out->elementStart('div', array('id' => 'notice_data-geo_wrap', + $this->out->elementStart('div', array('class' => 'notice_data-geo_wrap', 'title' => common_local_url('geocode'))); $this->out->checkbox('notice_data-geo', _('Share my location'), true); $this->out->elementEnd('div'); diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 3605a448c3..5ab64c6d26 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -664,8 +664,8 @@ float:right; font-size:0.8em; } -.form_notice #notice_data-geo_wrap label, -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap label, +.form_notice .notice_data-geo_wrap input { position:absolute; top:25px; right:4px; @@ -675,10 +675,10 @@ width:16px; height:16px; display:block; } -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap input { visibility:hidden; } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { font-weight:normal; font-size:1em; margin-bottom:0; diff --git a/theme/biz/css/base.css b/theme/biz/css/base.css index a92cc0b5ea..53aca59009 100644 --- a/theme/biz/css/base.css +++ b/theme/biz/css/base.css @@ -524,8 +524,8 @@ float:right; font-size:0.8em; } -.form_notice #notice_data-geo_wrap label, -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap label, +.form_notice .notice_data-geo_wrap input { position:absolute; top:25px; right:4px; @@ -535,10 +535,10 @@ width:16px; height:16px; display:block; } -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap input { visibility:hidden; } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { font-weight:normal; font-size:1em; margin-bottom:0; diff --git a/theme/clean/css/display.css b/theme/clean/css/display.css index 36d05d1a55..96a5c02a56 100644 --- a/theme/clean/css/display.css +++ b/theme/clean/css/display.css @@ -119,8 +119,8 @@ address { top: 27px; } -.form_notice #notice_data-geo_wrap label, -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap label, +.form_notice .notice_data-geo_wrap input { top: 52px; } diff --git a/theme/clean/css/ie.css b/theme/clean/css/ie.css index 7c8054b28c..994c1297d3 100644 --- a/theme/clean/css/ie.css +++ b/theme/clean/css/ie.css @@ -69,9 +69,9 @@ line-height:auto; background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px; } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1780px; } -.form_notice #notice_data-geo_wrap label.checked { +.form_notice .notice_data-geo_wrap label.checked { background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1846px; } diff --git a/theme/cleaner/css/display.css b/theme/cleaner/css/display.css index 37de39be88..214c821e59 100644 --- a/theme/cleaner/css/display.css +++ b/theme/cleaner/css/display.css @@ -167,8 +167,8 @@ address { right: 86px; } -.form_notice #notice_data-geo_wrap label, -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap label, +.form_notice .notice_data-geo_wrap input { top: 52px; right: 86px; } @@ -599,7 +599,7 @@ padding-right:0; top: 3px !important; } -.realtime-popup .form_notice #notice_data-geo_wrap label, .realtime-popup .form_notice #notice_data-geo_wrap input { +.realtime-popup .form_notice .notice_data-geo_wrap label, .realtime-popup .form_notice .notice_data-geo_wrap input { right: 8px; top: 3px !important; } diff --git a/theme/cleaner/css/ie.css b/theme/cleaner/css/ie.css index 8d9cf961dd..dbc72b1c22 100644 --- a/theme/cleaner/css/ie.css +++ b/theme/cleaner/css/ie.css @@ -73,9 +73,9 @@ line-height:auto; background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px; } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1780px; } -.form_notice #notice_data-geo_wrap label.checked { +.form_notice .notice_data-geo_wrap label.checked { background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1846px; } diff --git a/theme/cloudy/css/display.css b/theme/cloudy/css/display.css index 6347bab547..ab23896b2d 100644 --- a/theme/cloudy/css/display.css +++ b/theme/cloudy/css/display.css @@ -570,7 +570,7 @@ font-size:0.8em; float:left; } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { position:absolute; top:25px; right:4px; @@ -580,10 +580,10 @@ width:16px; height:16px; display:block; } -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap input { display:none; } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { font-weight:normal; font-size:1em; margin-bottom:0; diff --git a/theme/mnml/css/display.css b/theme/mnml/css/display.css index 7ee72fc4d5..f5b80b0e95 100644 --- a/theme/mnml/css/display.css +++ b/theme/mnml/css/display.css @@ -1005,8 +1005,8 @@ float:right; font-size:0.8em; } -.form_notice #notice_data-geo_wrap label, -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap label, +.form_notice .notice_data-geo_wrap input { position:absolute; top:3.25em; right:0.4em; @@ -1016,10 +1016,10 @@ width:1.6em; height:1.6em; display:block; } -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap input { visibility:hidden; } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { font-weight:normal; font-size:1em; margin-bottom:0; diff --git a/theme/mnml/css/ie.css b/theme/mnml/css/ie.css index c5fd2a122d..fed65f8b9a 100644 --- a/theme/mnml/css/ie.css +++ b/theme/mnml/css/ie.css @@ -48,11 +48,11 @@ padding:0 4px; .form_notice #notice_data-attach { filter: alpha(opacity=0); } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { background:transparent url(../images/icons/icons-01.png) no-repeat 0 -1780px; } -.form_notice #notice_data-geo_wrap label.checked { +.form_notice .notice_data-geo_wrap label.checked { background:transparent url(../images/icons/icons-01.png) no-repeat 0 -1846px; } diff --git a/theme/pigeonthoughts/css/base.css b/theme/pigeonthoughts/css/base.css index b4c79c4185..59cba446ac 100644 --- a/theme/pigeonthoughts/css/base.css +++ b/theme/pigeonthoughts/css/base.css @@ -519,8 +519,8 @@ float:right; font-size:0.8em; } -.form_notice #notice_data-geo_wrap label, -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap label, +.form_notice .notice_data-geo_wrap input { position:absolute; top:25px; right:4px; @@ -530,10 +530,10 @@ width:16px; height:16px; display:block; } -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap input { visibility:hidden; } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { font-weight:normal; font-size:1em; margin-bottom:0; diff --git a/theme/rebase/css/display.css b/theme/rebase/css/display.css index 5fbf5c3ba7..4038ab614a 100644 --- a/theme/rebase/css/display.css +++ b/theme/rebase/css/display.css @@ -317,8 +317,8 @@ address .poweredby { font-size:0.8em; } -.form_notice #notice_data-geo_wrap label, -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap label, +.form_notice .notice_data-geo_wrap input { position:absolute; top: 55px; right: 88px; @@ -329,11 +329,11 @@ address .poweredby { display:block; } -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap input { visibility:hidden; } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { font-weight:normal; font-size:1em; margin-bottom:0; @@ -1728,7 +1728,7 @@ body.realtime-popup { right: 70px; } -.realtime-popup .form_notice #notice_data-geo_wrap label, .form_notice #notice_data-geo_wrap input { +.realtime-popup .form_notice .notice_data-geo_wrap label, .form_notice .notice_data-geo_wrap input { right: 2px; } diff --git a/theme/rebase/css/ie.css b/theme/rebase/css/ie.css index c8820ab7a6..20e038998b 100644 --- a/theme/rebase/css/ie.css +++ b/theme/rebase/css/ie.css @@ -69,11 +69,11 @@ line-height:auto; background:transparent url(../images/icons/icons-01.gif) no-repeat 0 -328px; } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { background:transparent url(../images/icons/icons-01.gif) no-repeat 0 -1780px; } -.form_notice #notice_data-geo_wrap label.checked { +.form_notice .notice_data-geo_wrap label.checked { background:transparent url(../images/icons/icons-01.gif) no-repeat 0 -1846px; } diff --git a/theme/shiny/css/display.css b/theme/shiny/css/display.css index 1e8eb3f465..e027153dd7 100644 --- a/theme/shiny/css/display.css +++ b/theme/shiny/css/display.css @@ -236,8 +236,8 @@ h6 {font-size: 1em;} right: 86px; } -.form_notice #notice_data-geo_wrap label, -.form_notice #notice_data-geo_wrap input { +.form_notice .notice_data-geo_wrap label, +.form_notice .notice_data-geo_wrap input { top: 50px; right: 86px; } diff --git a/theme/shiny/css/ie.css b/theme/shiny/css/ie.css index da3a317fee..8145073db5 100644 --- a/theme/shiny/css/ie.css +++ b/theme/shiny/css/ie.css @@ -71,10 +71,10 @@ line-height:auto; background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -328px; } -.form_notice #notice_data-geo_wrap label { +.form_notice .notice_data-geo_wrap label { background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1780px; } -.form_notice #notice_data-geo_wrap label.checked { +.form_notice .notice_data-geo_wrap label.checked { background:transparent url(../../rebase/images/icons/icons-01.gif) no-repeat 0 -1846px; } From b68f8643a2fdfe55fe0cc70c7f03120c4255f625 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 4 Mar 2011 13:53:41 -0800 Subject: [PATCH 03/10] Kill some more hardcoded ids... --- js/util.js | 15 ++++++++------- js/util.min.js | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/js/util.js b/js/util.js index 7c51eb645a..6d0998aa42 100644 --- a/js/util.js +++ b/js/util.js @@ -993,7 +993,7 @@ var SN = { // StatusNet } function getJSONgeocodeURL(geocodeURL, data) { - SN.U.NoticeGeoStatus('Looking up place name...'); + SN.U.NoticeGeoStatus(form, 'Looking up place name...'); $.getJSON(geocodeURL, data, function(location) { var lns, lid; @@ -1014,8 +1014,8 @@ var SN = { // StatusNet NLN_text = location.name; } - SN.U.NoticeGeoStatus(NLN_text, data.lat, data.lon, location.url); - $('label[for='+SN.C.S.NoticeDataGeo+']') + SN.U.NoticeGeoStatus(form, NLN_text, data.lat, data.lon, location.url); + label .attr('title', NoticeDataGeo_text.ShareDisable + ' (' + NLN_text + ')'); form.find('[name=lat]').val(data.lat); @@ -1061,7 +1061,7 @@ var SN = { // StatusNet if ($.cookie(SN.C.S.NoticeDataGeoCookie) === null || $.cookie(SN.C.S.NoticeDataGeoCookie) == 'disabled') { if (navigator.geolocation) { - SN.U.NoticeGeoStatus('Requesting location from browser...'); + SN.U.NoticeGeoStatus(form, 'Requesting location from browser...'); navigator.geolocation.getCurrentPosition( function(position) { form.find('[name=lat]').val(position.coords.latitude); @@ -1119,7 +1119,7 @@ var SN = { // StatusNet form.find('[name=location_id]').val(cookieValue.NLID); form.find('[name=notice_data-geo]').attr('checked', cookieValue.NDG); - SN.U.NoticeGeoStatus(cookieValue.NLN, cookieValue.NLat, cookieValue.NLon, cookieValue.NLNU); + SN.U.NoticeGeoStatus(form, cookieValue.NLN, cookieValue.NLat, cookieValue.NLon, cookieValue.NLNU); label .attr('title', NoticeDataGeo_text.ShareDisable + ' (' + cookieValue.NLN + ')') .addClass('checked'); @@ -1135,19 +1135,20 @@ var SN = { // StatusNet /** * Create or update a geolocation status widget in this notice posting form. * + * @param {jQuery} form * @param {String} status * @param {String} lat (optional) * @param {String} lon (optional) * @param {String} url (optional) */ - NoticeGeoStatus: function(status, lat, lon, url) + NoticeGeoStatus: function(form, status, lat, lon, url) { var form = $('#form_notice'); var wrapper = form.find('.geo_status_wrapper'); if (wrapper.length == 0) { wrapper = $('
        '); wrapper.find('button.close').click(function() { - $('#'+SN.C.S.NoticeDataGeo).removeAttr('checked').change(); + form.find('[name=notice_data-geo]').removeAttr('checked').change(); }); form.append(wrapper); } diff --git a/js/util.min.js b/js/util.min.js index 7a2f35454b..bf73c4f54b 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",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(".count").text();if(typeof(MaxLength)=="undefined"){MaxLength=SN.C.I.MaxLength}jQuery.data(b[0],"ElementData",{MaxLength:MaxLength});SN.U.Counter(b);NDT=b.find("[name=status_textarea]");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)}else{b.find(".count").text(jQuery.data(b[0],"ElementData").MaxLength)}},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(".count");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("[name=status_textarea]").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("[name=status_textarea]").val()==""){b.addClass(SN.C.S.Warning);return false}b.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled);SN.U.normalizeGeoData(b);return true},error:function(f,g,e){b.removeClass(SN.C.S.Processing).find(".submit").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(".attach-status").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=b.find("[name=inreplyto]").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("[name=inreplyto]").val("");b.find(".attach-status").remove();SN.U.FormNoticeEnhancements(b)}},complete:function(d,e){b.removeClass(SN.C.S.Processing).find(".submit").removeAttr(SN.C.S.Disabled).removeClass(SN.C.S.Disabled);b.find("[name=lat]").val(SN.C.I.NoticeDataGeo.NLat);b.find("[name=lon]").val(SN.C.I.NoticeDataGeo.NLon);b.find("[name=location_ns]").val(SN.C.I.NoticeDataGeo.NLNS);b.find("[name=location_id]").val(SN.C.I.NoticeDataGeo.NLID);b.find("[name=notice_data-geo]").attr("checked",SN.C.I.NoticeDataGeo.NDG)}})},normalizeGeoData:function(a){SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val();SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val();SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked");var b=$.cookie(SN.C.S.NoticeDataGeoCookie);if(b!==null&&b!="disabled"){b=JSON.parse(b);SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val(b.NLat).val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val(b.NLon).val();if(b.NLNS){SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val(b.NLNS).val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val(b.NLID).val()}else{a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("")}}if(b=="disabled"){SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",false).attr("checked")}else{SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",true).attr("checked")}},GetResponseXML:function(b){try{return b.responseXML}catch(a){return(new DOMParser()).parseFromString(b.responseText,"text/xml")}},NoticeReply:function(){if($("#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,r){var o=$("li",p)[0];if(o){var n=document._importNode(o,true);var q=$(n).attr("id");if($("#"+q).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)}},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_placeholder"));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(b){var a=b.find("input[type=file]");a.change(function(f){b.find(".attach-status").remove();var d=$(this).val();if(!d){return false}var c=$('
            ');c.find("code").text(d);c.find("button").click(function(){c.remove();a.val("");return false});b.append(c);if(typeof this.files=="object"){for(var e=0;eg){f=false}if(f){h(c,function(j){var i=$("").attr("title",e).attr("alt",e).attr("src",j).attr("style","height: 120px");d.find(".attach-status").append(i)})}else{var b=$("
            ").text(e);d.find(".attach-status").append(b)}},NoticeLocationAttach:function(a){var e=a.find("[name=lat]");var k=a.find("[name=lon]");var g=a.find("[name=location_ns]").val();var l=a.find("[name=location_id]").val();var b="";var d=a.find("[name=notice_data-geo]");var c=a.find("[name=notice_data-geo]");var j=$("label[for="+c.attr("id")+"]");function f(n){j.attr("title",jQuery.trim(j.text())).removeClass("checked");a.find("[name=lat]").val("");a.find("[name=lon]").val("");a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("");a.find("[name=notice_data-geo]").attr("checked",false);$.cookie(SN.C.S.NoticeDataGeoCookie,"disabled",{path:"/"});if(n){a.find(".geo_status_wrapper").removeClass("success").addClass("error");a.find(".geo_status_wrapper .geo_status").text(n)}else{a.find(".geo_status_wrapper").remove()}}function m(n,o){SN.U.NoticeGeoStatus("Looking up place name...");$.getJSON(n,o,function(p){var q,r;if(typeof(p.location_ns)!="undefined"){a.find("[name=location_ns]").val(p.location_ns);q=p.location_ns}if(typeof(p.location_id)!="undefined"){a.find("[name=location_id]").val(p.location_id);r=p.location_id}if(typeof(p.name)=="undefined"){NLN_text=o.lat+";"+o.lon}else{NLN_text=p.name}SN.U.NoticeGeoStatus(NLN_text,o.lat,o.lon,p.url);$("label[for="+SN.C.S.NoticeDataGeo+"]").attr("title",NoticeDataGeo_text.ShareDisable+" ("+NLN_text+")");a.find("[name=lat]").val(o.lat);a.find("[name=lon]").val(o.lon);a.find("[name=location_ns]").val(q);a.find("[name=location_id]").val(r);a.find("[name=notice_data-geo]").attr("checked",true);var s={NLat:o.lat,NLon:o.lon,NLNS:q,NLID:r,NLN:NLN_text,NLNU:p.url,NDG:true};$.cookie(SN.C.S.NoticeDataGeoCookie,JSON.stringify(s),{path:"/"})})}if(c.length>0){if($.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){c.attr("checked",false)}else{c.attr("checked",true)}var h=a.find(".notice_data-geo_wrap");var i=h.attr("title");h.removeAttr("title");j.attr("title",j.text());c.change(function(){if(c.attr("checked")===true||$.cookie(SN.C.S.NoticeDataGeoCookie)===null){j.attr("title",NoticeDataGeo_text.ShareDisable).addClass("checked");if($.cookie(SN.C.S.NoticeDataGeoCookie)===null||$.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){if(navigator.geolocation){SN.U.NoticeGeoStatus("Requesting location from browser...");navigator.geolocation.getCurrentPosition(function(p){a.find("[name=lat]").val(p.coords.latitude);a.find("[name=lon]").val(p.coords.longitude);var q={lat:p.coords.latitude,lon:p.coords.longitude,token:$("#token").val()};m(i,q)},function(p){switch(p.code){case p.PERMISSION_DENIED:f("Location permission denied.");break;case p.TIMEOUT:f("Location lookup timeout.");break}},{timeout:10000})}else{if(e.length>0&&k.length>0){var n={lat:e,lon:k,token:$("#token").val()};m(i,n)}else{f();c.remove();j.remove()}}}else{var o=JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));a.find("[name=lat]").val(o.NLat);a.find("[name=lon]").val(o.NLon);a.find("[name=location_ns]").val(o.NLNS);a.find("[name=location_id]").val(o.NLID);a.find("[name=notice_data-geo]").attr("checked",o.NDG);SN.U.NoticeGeoStatus(o.NLN,o.NLat,o.NLon,o.NLNU);j.attr("title",NoticeDataGeo_text.ShareDisable+" ("+o.NLN+")").addClass("checked")}}else{f()}}).change()}},NoticeGeoStatus:function(a,f,g,c){var e=$("#form_notice");var h=e.find(".geo_status_wrapper");if(h.length==0){h=$('
            ');h.find("button.close").click(function(){$("#"+SN.C.S.NoticeDataGeo).removeAttr("checked").change()});e.append(h)}var b;if(c){b=$("").attr("href",c)}else{b=$("")}b.text(a);if(f||g){var d=f+";"+g;b.attr("title",d);if(!a){b.text(d)}}h.find(".geo_status").empty().append(b)},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.C.S.FormNotice).each(function(){var a=$(this);SN.U.NoticeLocationAttach(a);SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);SN.U.NoticeDataAttach(a)})}},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",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(".count").text();if(typeof(MaxLength)=="undefined"){MaxLength=SN.C.I.MaxLength}jQuery.data(b[0],"ElementData",{MaxLength:MaxLength});SN.U.Counter(b);NDT=b.find("[name=status_textarea]");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)}else{b.find(".count").text(jQuery.data(b[0],"ElementData").MaxLength)}},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(".count");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("[name=status_textarea]").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("[name=status_textarea]").val()==""){b.addClass(SN.C.S.Warning);return false}b.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled);SN.U.normalizeGeoData(b);return true},error:function(f,g,e){b.removeClass(SN.C.S.Processing).find(".submit").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(".attach-status").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=b.find("[name=inreplyto]").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("[name=inreplyto]").val("");b.find(".attach-status").remove();SN.U.FormNoticeEnhancements(b)}},complete:function(d,e){b.removeClass(SN.C.S.Processing).find(".submit").removeAttr(SN.C.S.Disabled).removeClass(SN.C.S.Disabled);b.find("[name=lat]").val(SN.C.I.NoticeDataGeo.NLat);b.find("[name=lon]").val(SN.C.I.NoticeDataGeo.NLon);b.find("[name=location_ns]").val(SN.C.I.NoticeDataGeo.NLNS);b.find("[name=location_id]").val(SN.C.I.NoticeDataGeo.NLID);b.find("[name=notice_data-geo]").attr("checked",SN.C.I.NoticeDataGeo.NDG)}})},normalizeGeoData:function(a){SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val();SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val();SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked");var b=$.cookie(SN.C.S.NoticeDataGeoCookie);if(b!==null&&b!="disabled"){b=JSON.parse(b);SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val(b.NLat).val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val(b.NLon).val();if(b.NLNS){SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val(b.NLNS).val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val(b.NLID).val()}else{a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("")}}if(b=="disabled"){SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",false).attr("checked")}else{SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",true).attr("checked")}},GetResponseXML:function(b){try{return b.responseXML}catch(a){return(new DOMParser()).parseFromString(b.responseText,"text/xml")}},NoticeReply:function(){if($("#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,r){var o=$("li",p)[0];if(o){var n=document._importNode(o,true);var q=$(n).attr("id");if($("#"+q).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)}},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_placeholder"));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(b){var a=b.find("input[type=file]");a.change(function(f){b.find(".attach-status").remove();var d=$(this).val();if(!d){return false}var c=$('
                ');c.find("code").text(d);c.find("button").click(function(){c.remove();a.val("");return false});b.append(c);if(typeof this.files=="object"){for(var e=0;eg){f=false}if(f){h(c,function(j){var i=$("").attr("title",e).attr("alt",e).attr("src",j).attr("style","height: 120px");d.find(".attach-status").append(i)})}else{var b=$("
                ").text(e);d.find(".attach-status").append(b)}},NoticeLocationAttach:function(a){var e=a.find("[name=lat]");var k=a.find("[name=lon]");var g=a.find("[name=location_ns]").val();var l=a.find("[name=location_id]").val();var b="";var d=a.find("[name=notice_data-geo]");var c=a.find("[name=notice_data-geo]");var j=$("label[for="+c.attr("id")+"]");function f(n){j.attr("title",jQuery.trim(j.text())).removeClass("checked");a.find("[name=lat]").val("");a.find("[name=lon]").val("");a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("");a.find("[name=notice_data-geo]").attr("checked",false);$.cookie(SN.C.S.NoticeDataGeoCookie,"disabled",{path:"/"});if(n){a.find(".geo_status_wrapper").removeClass("success").addClass("error");a.find(".geo_status_wrapper .geo_status").text(n)}else{a.find(".geo_status_wrapper").remove()}}function m(n,o){SN.U.NoticeGeoStatus(a,"Looking up place name...");$.getJSON(n,o,function(p){var q,r;if(typeof(p.location_ns)!="undefined"){a.find("[name=location_ns]").val(p.location_ns);q=p.location_ns}if(typeof(p.location_id)!="undefined"){a.find("[name=location_id]").val(p.location_id);r=p.location_id}if(typeof(p.name)=="undefined"){NLN_text=o.lat+";"+o.lon}else{NLN_text=p.name}SN.U.NoticeGeoStatus(a,NLN_text,o.lat,o.lon,p.url);j.attr("title",NoticeDataGeo_text.ShareDisable+" ("+NLN_text+")");a.find("[name=lat]").val(o.lat);a.find("[name=lon]").val(o.lon);a.find("[name=location_ns]").val(q);a.find("[name=location_id]").val(r);a.find("[name=notice_data-geo]").attr("checked",true);var s={NLat:o.lat,NLon:o.lon,NLNS:q,NLID:r,NLN:NLN_text,NLNU:p.url,NDG:true};$.cookie(SN.C.S.NoticeDataGeoCookie,JSON.stringify(s),{path:"/"})})}if(c.length>0){if($.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){c.attr("checked",false)}else{c.attr("checked",true)}var h=a.find(".notice_data-geo_wrap");var i=h.attr("title");h.removeAttr("title");j.attr("title",j.text());c.change(function(){if(c.attr("checked")===true||$.cookie(SN.C.S.NoticeDataGeoCookie)===null){j.attr("title",NoticeDataGeo_text.ShareDisable).addClass("checked");if($.cookie(SN.C.S.NoticeDataGeoCookie)===null||$.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){if(navigator.geolocation){SN.U.NoticeGeoStatus(a,"Requesting location from browser...");navigator.geolocation.getCurrentPosition(function(p){a.find("[name=lat]").val(p.coords.latitude);a.find("[name=lon]").val(p.coords.longitude);var q={lat:p.coords.latitude,lon:p.coords.longitude,token:$("#token").val()};m(i,q)},function(p){switch(p.code){case p.PERMISSION_DENIED:f("Location permission denied.");break;case p.TIMEOUT:f("Location lookup timeout.");break}},{timeout:10000})}else{if(e.length>0&&k.length>0){var n={lat:e,lon:k,token:$("#token").val()};m(i,n)}else{f();c.remove();j.remove()}}}else{var o=JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));a.find("[name=lat]").val(o.NLat);a.find("[name=lon]").val(o.NLon);a.find("[name=location_ns]").val(o.NLNS);a.find("[name=location_id]").val(o.NLID);a.find("[name=notice_data-geo]").attr("checked",o.NDG);SN.U.NoticeGeoStatus(a,o.NLN,o.NLat,o.NLon,o.NLNU);j.attr("title",NoticeDataGeo_text.ShareDisable+" ("+o.NLN+")").addClass("checked")}}else{f()}}).change()}},NoticeGeoStatus:function(e,a,f,g,c){var e=$("#form_notice");var h=e.find(".geo_status_wrapper");if(h.length==0){h=$('
                ');h.find("button.close").click(function(){e.find("[name=notice_data-geo]").removeAttr("checked").change()});e.append(h)}var b;if(c){b=$("").attr("href",c)}else{b=$("")}b.text(a);if(f||g){var d=f+";"+g;b.attr("title",d);if(!a){b.text(d)}}h.find(".geo_status").empty().append(b)},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.C.S.FormNotice).each(function(){var a=$(this);SN.U.NoticeLocationAttach(a);SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);SN.U.NoticeDataAttach(a)})}},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 From 9689bda21c0f001b3f331423805831ee1fd7801e Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 4 Mar 2011 14:11:11 -0800 Subject: [PATCH 04/10] Loading the original form instead of faking up our own. Sorta works but not pretty :D --- actions/newnotice.php | 33 ++++++++++++++++++++-- js/util.js | 65 ++++++++++++++++++++++++++++--------------- 2 files changed, 74 insertions(+), 24 deletions(-) diff --git a/actions/newnotice.php b/actions/newnotice.php index faafd9551d..bc7ab28950 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -269,6 +269,31 @@ class NewnoticeAction extends Action $this->elementEnd('html'); } + /** + * Show an Ajax-y notice form + * + * Goes back to the browser, where it's shown in a popup. + * + * @param string $msg Message to show + * + * @return void + */ + + function ajaxShowForm() + { + $this->startHTML('text/xml;charset=utf-8', true); + $this->elementStart('head'); + $this->element('title', null, _('New notice')); + $this->elementEnd('head'); + $this->elementStart('body'); + + $form = new NoticeForm($this); + $form->show(); + + $this->elementEnd('body'); + $this->elementEnd('html'); + } + /** * Formerly page output * @@ -286,8 +311,12 @@ class NewnoticeAction extends Action function showForm($msg=null) { - if ($msg && $this->boolean('ajax')) { - $this->ajaxErrorMsg($msg); + if ($this->boolean('ajax')) { + if ($msg) { + $this->ajaxErrorMsg($msg); + } else { + $this->ajaxShowForm(); + } return; } diff --git a/js/util.js b/js/util.js index 6d0998aa42..3a901b6c09 100644 --- a/js/util.js +++ b/js/util.js @@ -553,13 +553,54 @@ var SN = { // StatusNet // See if the form's already open... var replyForm = $('.notice-reply-form', list); - if (replyForm.length == 0) { + + var nextStep = function() { + // Override...? + replyForm.find('input[name=inreplyto]').val(id); + + // Set focus... + var text = replyForm.find('textarea'); + if (text.length == 0) { + throw "No textarea"; + } + var replyto = ''; + if (initialText) { + replyto = initialText + ' '; + } + text.val(replyto + text.val().replace(RegExp(replyto, 'i'), '')); + text.data('initialText', $.trim(initialText + '')); + text.focus(); + if (text[0].setSelectionRange) { + var len = text.val().length; + text[0].setSelectionRange(len,len); + } + }; + if (replyForm.length > 0) { + // Update the existing form... + nextStep(); + } else { // Remove placeholder if any $('li.notice-reply-placeholder').remove(); // Create the reply form entry at the end var replyItem = $('li.notice-reply', list); if (replyItem.length == 0) { + var url = $('#form_notice').attr('action'); + replyItem = $('
              • '); + $.get(url, {ajax: 1}, function(data, textStatus, xhr) { + var formEl = document._importNode($('form', data)[0], true); + replyItem.append(formEl); + list.append(replyItem); + + var form = replyForm = $(formEl); + SN.U.NoticeLocationAttach(form); + SN.U.FormNoticeXHR(form); + SN.U.FormNoticeEnhancements(form); + SN.U.NoticeDataAttach(form); + + nextStep(); + }); + /* replyItem = $('
              • ' + '
                ' + '' + @@ -570,7 +611,6 @@ var SN = { // StatusNet '' + '
                ' + '
              • '); - var baseForm = $('#form_notice'); replyForm = replyItem.find('form'); replyForm.attr('action', baseForm.attr('action')); @@ -630,28 +670,9 @@ var SN = { // StatusNet event.preventDefault(); return false; }); + */ } } - - // Override...? - replyForm.find('input[name=inreplyto]').val(id); - - // Set focus... - var text = replyForm.find('textarea'); - if (text.length == 0) { - throw "No textarea"; - } - var replyto = ''; - if (initialText) { - replyto = initialText + ' '; - } - text.val(replyto + text.val().replace(RegExp(replyto, 'i'), '')); - text.data('initialText', $.trim(initialText + '')); - text.focus(); - if (text[0].setSelectionRange) { - var len = text.val().length; - text[0].setSelectionRange(len,len); - } }, /** From 5358f78e824412919ddd8f3d7d2b0bf68a6292d4 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 4 Mar 2011 14:27:55 -0800 Subject: [PATCH 05/10] Reusable notice form fixes for geolocation --- js/util.js | 3 +-- lib/noticeform.php | 20 ++++++++++++++++++-- plugins/Realtime/realtimeupdate.css | 2 +- theme/biz/css/display.css | 6 +++--- theme/cloudy/css/display.css | 6 +++--- theme/default/css/display.css | 6 +++--- theme/identica/css/display.css | 6 +++--- theme/mnml/css/display.css | 6 +++--- theme/pigeonthoughts/css/display.css | 6 +++--- theme/rebase/css/display.css | 6 +++--- theme/victorian/css/display.css | 6 +++--- 11 files changed, 44 insertions(+), 29 deletions(-) diff --git a/js/util.js b/js/util.js index 3a901b6c09..1bd011cb0d 100644 --- a/js/util.js +++ b/js/util.js @@ -990,7 +990,7 @@ var SN = { // StatusNet var NLN = ''; // @fixme var NDGe = form.find('[name=notice_data-geo]'); var check = form.find('[name=notice_data-geo]'); - var label = $('label[for='+check.attr('id')+']'); + var label = form.find('label.notice_data-geo'); function removeNoticeDataGeo(error) { label @@ -1164,7 +1164,6 @@ var SN = { // StatusNet */ NoticeGeoStatus: function(form, status, lat, lon, url) { - var form = $('#form_notice'); var wrapper = form.find('.geo_status_wrapper'); if (wrapper.length == 0) { wrapper = $('
                '); diff --git a/lib/noticeform.php b/lib/noticeform.php index ae8023275a..0f13147d00 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -94,6 +94,8 @@ class NoticeForm extends Form function __construct($out=null, $action=null, $content=null, $user=null, $inreplyto=null, $lat=null, $lon=null, $location_id=null, $location_ns=null) { + $this->id_suffix = time(); + parent::__construct($out); $this->action = $action; @@ -125,7 +127,7 @@ class NoticeForm extends Form function id() { - return 'form_notice'; + return 'form_notice_' . $this->id_suffix; } /** @@ -208,7 +210,21 @@ class NoticeForm extends Form $this->out->elementStart('div', array('class' => 'notice_data-geo_wrap', 'title' => common_local_url('geocode'))); - $this->out->checkbox('notice_data-geo', _('Share my location'), true); + + // @fixme checkbox method allows no way to change the id without changing the name + //$this->out->checkbox('notice_data-geo', _('Share my location'), true); + $this->out->element('input', array( + 'name' => 'notice_data-geo', + 'type' => 'checkbox', + 'class' => 'checkbox', + 'id' => $this->id() . '-notice_data-geo', + 'checked' => true, // ? + )); + $this->out->text(' '); + $this->out->element('label', array('class' => 'notice_data-geo', + 'for' => $this->id() . '-notice_data-geo'), + _('Share my location')); + $this->out->elementEnd('div'); $this->out->inlineScript(' var NoticeDataGeo_text = {'. 'ShareDisable: ' .json_encode(_('Do not share my location')).','. diff --git a/plugins/Realtime/realtimeupdate.css b/plugins/Realtime/realtimeupdate.css index b277b30a14..7fd7fd5ed3 100644 --- a/plugins/Realtime/realtimeupdate.css +++ b/plugins/Realtime/realtimeupdate.css @@ -19,7 +19,7 @@ display:none; .realtime-popup #form_notice label[for=notice_data-attach], .realtime-popup #form_notice #notice_data-attach, -.realtime-popup #form_notice label[for=notice_data-geo] { +.realtime-popup #form_notice label.notice_data-geo { top:0; } diff --git a/theme/biz/css/display.css b/theme/biz/css/display.css index e562f7072a..0bb53f74a8 100644 --- a/theme/biz/css/display.css +++ b/theme/biz/css/display.css @@ -118,10 +118,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1); text-shadow:none; } -.form_notice label[for=notice_data-geo] { +.form_notice label.notice_data-geo { background-position:0 -1780px; } -.form_notice label[for=notice_data-geo].checked { +.form_notice label.notice_data-geo.checked { background-position:0 -1846px; } @@ -216,7 +216,7 @@ button.close, .entity_role_administrator input.submit, .entity_role_moderator input.submit, .notice-options .repeated, -.form_notice label[for=notice_data-geo], +.form_notice label.notice_data-geo, button.minimize, .form_reset_key input.submit, .entity_clear input.submit, diff --git a/theme/cloudy/css/display.css b/theme/cloudy/css/display.css index ab23896b2d..a5eabac4ad 100644 --- a/theme/cloudy/css/display.css +++ b/theme/cloudy/css/display.css @@ -1636,7 +1636,7 @@ button.close, .entity_silence input.submit, .entity_delete input.submit, .notice-options .repeated, -.form_notice label[for=notice_data-geo], +.form_notice label.notice_data-geo, button.minimize, .form_reset_key input.submit, .entity_clear input.submit, @@ -1746,10 +1746,10 @@ background-position:0 47%; .form_notice a#notice_data-geo_name { background-position:0 -1711px; } -.form_notice label[for=notice_data-geo] { +.form_notice label.notice_data-geo { background-position:0 -1780px; } -.form_notice label[for=notice_data-geo].checked { +.form_notice label.notice_data-geo.checked { background-position:0 -1846px; } diff --git a/theme/default/css/display.css b/theme/default/css/display.css index 63554aae18..fbd3afb12c 100644 --- a/theme/default/css/display.css +++ b/theme/default/css/display.css @@ -116,10 +116,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1); text-shadow:none; } -.form_notice label[for=notice_data-geo] { +.form_notice label.notice_data-geo { background-position:0 -1780px; } -.form_notice label[for=notice_data-geo].checked { +.form_notice label.notice_data-geo.checked { background-position:0 -1846px; } @@ -196,7 +196,7 @@ button.close, .entity_role_administrator input.submit, .entity_role_moderator input.submit, .notice-options .repeated, -.form_notice label[for=notice_data-geo], +.form_notice label.notice_data-geo, button.minimize, .form_reset_key input.submit, .entity_clear input.submit, diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index 211c539dcb..fba72a09d6 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -117,10 +117,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1); text-shadow:none; } -.form_notice label[for=notice_data-geo] { +.form_notice label.notice_data-geo { background-position:0 -1780px; } -.form_notice label[for=notice_data-geo].checked { +.form_notice label.notice_data-geo.checked { background-position:0 -1846px; } @@ -197,7 +197,7 @@ button.close, .entity_role_administrator input.submit, .entity_role_moderator input.submit, .notice-options .repeated, -.form_notice label[for=notice_data-geo], +.form_notice label.notice_data-geo, button.minimize, .form_reset_key input.submit, .entity_clear input.submit, diff --git a/theme/mnml/css/display.css b/theme/mnml/css/display.css index f5b80b0e95..57ad426c55 100644 --- a/theme/mnml/css/display.css +++ b/theme/mnml/css/display.css @@ -271,7 +271,7 @@ button.close, .entity_role_administrator input.submit, .entity_role_moderator input.submit, .notice-options .repeated, -.form_notice label[for=notice_data-geo], +.form_notice label.notice_data-geo, button.minimize, .form_reset_key input.submit, .entity_clear input.submit, @@ -286,10 +286,10 @@ button.minimize, background-color:transparent; } -.form_notice label[for=notice_data-geo] { +.form_notice label.notice_data-geo { background-position:0 -1780px; } -.form_notice label[for=notice_data-geo].checked { +.form_notice label.notice_data-geo.checked { background-position:0 -1846px; } .form_notice label[for=notice_data-attach] { diff --git a/theme/pigeonthoughts/css/display.css b/theme/pigeonthoughts/css/display.css index 155a473519..b4f2f297b0 100644 --- a/theme/pigeonthoughts/css/display.css +++ b/theme/pigeonthoughts/css/display.css @@ -84,10 +84,10 @@ box-shadow:3px 3px 3px rgba(194, 194, 194, 0.1); text-shadow:none; } -.form_notice label[for=notice_data-geo] { +.form_notice label.notice_data-geo { background-position:0 -1780px; } -.form_notice label[for=notice_data-geo].checked { +.form_notice label.notice_data-geo.checked { background-position:0 -1846px; } @@ -233,7 +233,7 @@ button.close, .entity_silence input.submit, .entity_delete input.submit, .notice-options .repeated, -.form_notice label[for=notice_data-geo], +.form_notice label.notice_data-geo, button.minimize, .form_reset_key input.submit, .entity_clear input.submit, diff --git a/theme/rebase/css/display.css b/theme/rebase/css/display.css index 4038ab614a..32df41b93a 100644 --- a/theme/rebase/css/display.css +++ b/theme/rebase/css/display.css @@ -1771,7 +1771,7 @@ button.close, .entity_role_administrator input.submit, .entity_role_moderator input.submit, .notice-options .repeated, -.form_notice label[for=notice_data-geo], +.form_notice label.notice_data-geo, button.minimize, .form_reset_key input.submit, .entity_clear input.submit, @@ -1924,10 +1924,10 @@ background-position:0 -1054px; .form_notice label[for=notice_data-attach] { background-position: 0 -328px; } -.form_notice label[for=notice_data-geo] { +.form_notice label.notice_data-geo { background-position: 0 -1780px; } -.form_notice label[for=notice_data-geo].checked { +.form_notice label.notice_data-geo.checked { background-position: 0 -1846px; } diff --git a/theme/victorian/css/display.css b/theme/victorian/css/display.css index 3ab7fc601a..6252fdf908 100644 --- a/theme/victorian/css/display.css +++ b/theme/victorian/css/display.css @@ -294,10 +294,10 @@ input.submit:focus { text-shadow:none; } -.form_notice label[for=notice_data-geo] { +.form_notice label.notice_data-geo { background-position:0 -1780px; } -.form_notice label[for=notice_data-geo].checked { +.form_notice label.notice_data-geo.checked { background-position:0 -1846px; } @@ -373,7 +373,7 @@ button.close, .entity_role_administrator input.submit, .entity_role_moderator input.submit, .notice-options .repeated, -.form_notice label[for=notice_data-geo], +.form_notice label.notice_data-geo, button.minimize, .form_reset_key input.submit, .entity_clear input.submit, From 97532a093ddf3da69753aa00584a5573a756b7d4 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 4 Mar 2011 14:30:30 -0800 Subject: [PATCH 06/10] style fixes for new notice form being reused in reply area --- theme/base/css/display.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 5ab64c6d26..16c2b6dce6 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -563,8 +563,10 @@ border-width:1px; border-style:solid; } -.form_notice { +#header .form_notice { width:45%; +} +.form_notice { float:left; position:relative; line-height:1; @@ -1120,7 +1122,6 @@ border-top-style:solid; .threaded-replies .notice-reply { margin: 8px; } -.threaded-replies .notice-reply textarea, .threaded-replies .notice-reply-placeholder input.placeholder { margin-left: 0; width: 95%; From a1002cc1078593f899db6c2c2559e0f42f01d725 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 4 Mar 2011 14:58:30 -0800 Subject: [PATCH 07/10] Work in progress: inline reply form reusing the main reply form now inserts the successful result more or less right --- js/util.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/js/util.js b/js/util.js index 1bd011cb0d..09ab23344b 100644 --- a/js/util.js +++ b/js/util.js @@ -387,7 +387,22 @@ var SN = { // StatusNet // New notice post was successful. If on our timeline, show it! var notice = document._importNode($('li', data)[0], true); var notices = $('#notices_primary .notices:first'); - if (notices.length > 0 && SN.U.belongsOnTimeline(notice)) { + var replyItem = form.closest('li.notice-reply'); + + if (replyItem.length > 0) { + // If this is an inline reply, insert it in place. + var id = $(notice).attr('id'); + if ($("#"+id).length == 0) { + var parentNotice = replyItem.closest('li.notice'); + replyItem.replaceWith(notice); + SN.U.NoticeInlineReplyPlaceholder(parentNotice); + } else { + // Realtime came through before us... + replyItem.remove(); + } + } else if (notices.length > 0 && SN.U.belongsOnTimeline(notice)) { + // Not a reply. If on our timeline, show it at the top! + if ($('#'+notice.id).length === 0) { var notice_irt_value = form.find('[name=inreplyto]').val(); var notice_irt = '#notices_primary #notice-'+notice_irt_value; @@ -406,10 +421,10 @@ var SN = { // StatusNet SN.U.NoticeWithAttachment($('#'+notice.id)); SN.U.NoticeReplyTo($('#'+notice.id)); } - } - else { + } else { // Not on a timeline that this belongs on? // Just show a success message. + // @fixme inline showFeedback('success', $('title', data).text()); } } From 2fa95144ed9ffa3f2845d18e3c5d758303d710e8 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 4 Mar 2011 15:00:20 -0800 Subject: [PATCH 08/10] Cleanup & minification for migration to reusable notice form in inline replies. Yay! --- js/util.js | 71 -------------------------------------------------- js/util.min.js | 2 +- 2 files changed, 1 insertion(+), 72 deletions(-) diff --git a/js/util.js b/js/util.js index 09ab23344b..cc94c5ced7 100644 --- a/js/util.js +++ b/js/util.js @@ -615,77 +615,6 @@ var SN = { // StatusNet nextStep(); }); - /* - replyItem = $('
              • ' + - '
                ' + - '' + - '
                ' + - '' + - '' + - '' + - '
                ' + - '
                ' + - '
              • '); - var baseForm = $('#form_notice'); - replyForm = replyItem.find('form'); - replyForm.attr('action', baseForm.attr('action')); - replyForm.find('input[name="token"]').val(baseForm.find('input[name=token]').val()); - replyForm.find('input[type="submit"]').val(SN.msg('reply_submit')); - list.append(replyItem); - - replyForm.find('textarea').blur(function() { - var textarea = $(this); - var txt = $.trim(textarea.val()); - if (txt == '' || txt == textarea.data('initialText')) { - // Nothing to say? Begone! - replyItem.remove(); - if (list.find('li').length > 0) { - SN.U.NoticeInlineReplyPlaceholder(parentNotice); - } else { - list.remove(); - } - } - }); - replyForm.submit(function(event) { - var form = replyForm; - $.ajax({ - type: 'POST', - dataType: 'xml', - url: SN.U.RewriteAjaxAction(form.attr('action')), - data: form.serialize() + '&ajax=1', - beforeSend: function(xhr) { - form - .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 (xhr, textStatus, errorThrown) { - alert(errorThrown || textStatus); - }, - success: function(data, textStatus) { - var orig_li = $('li', data)[0]; - if (orig_li) { - var li = document._importNode(orig_li, true); - var id = $(li).attr('id'); - if ($("#"+id).length == 0) { - replyItem.replaceWith(li); - SN.U.NoticeInlineReplyPlaceholder(parentNotice); - } else { - // Realtime came through before us... - replyItem.remove(); - } - } - } - }); - event.preventDefault(); - return false; - }); - */ } } }, diff --git a/js/util.min.js b/js/util.min.js index bf73c4f54b..280aca6a45 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",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(".count").text();if(typeof(MaxLength)=="undefined"){MaxLength=SN.C.I.MaxLength}jQuery.data(b[0],"ElementData",{MaxLength:MaxLength});SN.U.Counter(b);NDT=b.find("[name=status_textarea]");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)}else{b.find(".count").text(jQuery.data(b[0],"ElementData").MaxLength)}},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(".count");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("[name=status_textarea]").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("[name=status_textarea]").val()==""){b.addClass(SN.C.S.Warning);return false}b.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled);SN.U.normalizeGeoData(b);return true},error:function(f,g,e){b.removeClass(SN.C.S.Processing).find(".submit").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(".attach-status").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=b.find("[name=inreplyto]").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("[name=inreplyto]").val("");b.find(".attach-status").remove();SN.U.FormNoticeEnhancements(b)}},complete:function(d,e){b.removeClass(SN.C.S.Processing).find(".submit").removeAttr(SN.C.S.Disabled).removeClass(SN.C.S.Disabled);b.find("[name=lat]").val(SN.C.I.NoticeDataGeo.NLat);b.find("[name=lon]").val(SN.C.I.NoticeDataGeo.NLon);b.find("[name=location_ns]").val(SN.C.I.NoticeDataGeo.NLNS);b.find("[name=location_id]").val(SN.C.I.NoticeDataGeo.NLID);b.find("[name=notice_data-geo]").attr("checked",SN.C.I.NoticeDataGeo.NDG)}})},normalizeGeoData:function(a){SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val();SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val();SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked");var b=$.cookie(SN.C.S.NoticeDataGeoCookie);if(b!==null&&b!="disabled"){b=JSON.parse(b);SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val(b.NLat).val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val(b.NLon).val();if(b.NLNS){SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val(b.NLNS).val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val(b.NLID).val()}else{a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("")}}if(b=="disabled"){SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",false).attr("checked")}else{SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",true).attr("checked")}},GetResponseXML:function(b){try{return b.responseXML}catch(a){return(new DOMParser()).parseFromString(b.responseText,"text/xml")}},NoticeReply:function(){if($("#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,r){var o=$("li",p)[0];if(o){var n=document._importNode(o,true);var q=$(n).attr("id");if($("#"+q).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)}},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_placeholder"));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(b){var a=b.find("input[type=file]");a.change(function(f){b.find(".attach-status").remove();var d=$(this).val();if(!d){return false}var c=$('
                    ');c.find("code").text(d);c.find("button").click(function(){c.remove();a.val("");return false});b.append(c);if(typeof this.files=="object"){for(var e=0;eg){f=false}if(f){h(c,function(j){var i=$("").attr("title",e).attr("alt",e).attr("src",j).attr("style","height: 120px");d.find(".attach-status").append(i)})}else{var b=$("
                    ").text(e);d.find(".attach-status").append(b)}},NoticeLocationAttach:function(a){var e=a.find("[name=lat]");var k=a.find("[name=lon]");var g=a.find("[name=location_ns]").val();var l=a.find("[name=location_id]").val();var b="";var d=a.find("[name=notice_data-geo]");var c=a.find("[name=notice_data-geo]");var j=$("label[for="+c.attr("id")+"]");function f(n){j.attr("title",jQuery.trim(j.text())).removeClass("checked");a.find("[name=lat]").val("");a.find("[name=lon]").val("");a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("");a.find("[name=notice_data-geo]").attr("checked",false);$.cookie(SN.C.S.NoticeDataGeoCookie,"disabled",{path:"/"});if(n){a.find(".geo_status_wrapper").removeClass("success").addClass("error");a.find(".geo_status_wrapper .geo_status").text(n)}else{a.find(".geo_status_wrapper").remove()}}function m(n,o){SN.U.NoticeGeoStatus(a,"Looking up place name...");$.getJSON(n,o,function(p){var q,r;if(typeof(p.location_ns)!="undefined"){a.find("[name=location_ns]").val(p.location_ns);q=p.location_ns}if(typeof(p.location_id)!="undefined"){a.find("[name=location_id]").val(p.location_id);r=p.location_id}if(typeof(p.name)=="undefined"){NLN_text=o.lat+";"+o.lon}else{NLN_text=p.name}SN.U.NoticeGeoStatus(a,NLN_text,o.lat,o.lon,p.url);j.attr("title",NoticeDataGeo_text.ShareDisable+" ("+NLN_text+")");a.find("[name=lat]").val(o.lat);a.find("[name=lon]").val(o.lon);a.find("[name=location_ns]").val(q);a.find("[name=location_id]").val(r);a.find("[name=notice_data-geo]").attr("checked",true);var s={NLat:o.lat,NLon:o.lon,NLNS:q,NLID:r,NLN:NLN_text,NLNU:p.url,NDG:true};$.cookie(SN.C.S.NoticeDataGeoCookie,JSON.stringify(s),{path:"/"})})}if(c.length>0){if($.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){c.attr("checked",false)}else{c.attr("checked",true)}var h=a.find(".notice_data-geo_wrap");var i=h.attr("title");h.removeAttr("title");j.attr("title",j.text());c.change(function(){if(c.attr("checked")===true||$.cookie(SN.C.S.NoticeDataGeoCookie)===null){j.attr("title",NoticeDataGeo_text.ShareDisable).addClass("checked");if($.cookie(SN.C.S.NoticeDataGeoCookie)===null||$.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){if(navigator.geolocation){SN.U.NoticeGeoStatus(a,"Requesting location from browser...");navigator.geolocation.getCurrentPosition(function(p){a.find("[name=lat]").val(p.coords.latitude);a.find("[name=lon]").val(p.coords.longitude);var q={lat:p.coords.latitude,lon:p.coords.longitude,token:$("#token").val()};m(i,q)},function(p){switch(p.code){case p.PERMISSION_DENIED:f("Location permission denied.");break;case p.TIMEOUT:f("Location lookup timeout.");break}},{timeout:10000})}else{if(e.length>0&&k.length>0){var n={lat:e,lon:k,token:$("#token").val()};m(i,n)}else{f();c.remove();j.remove()}}}else{var o=JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));a.find("[name=lat]").val(o.NLat);a.find("[name=lon]").val(o.NLon);a.find("[name=location_ns]").val(o.NLNS);a.find("[name=location_id]").val(o.NLID);a.find("[name=notice_data-geo]").attr("checked",o.NDG);SN.U.NoticeGeoStatus(a,o.NLN,o.NLat,o.NLon,o.NLNU);j.attr("title",NoticeDataGeo_text.ShareDisable+" ("+o.NLN+")").addClass("checked")}}else{f()}}).change()}},NoticeGeoStatus:function(e,a,f,g,c){var e=$("#form_notice");var h=e.find(".geo_status_wrapper");if(h.length==0){h=$('
                    ');h.find("button.close").click(function(){e.find("[name=notice_data-geo]").removeAttr("checked").change()});e.append(h)}var b;if(c){b=$("").attr("href",c)}else{b=$("")}b.text(a);if(f||g){var d=f+";"+g;b.attr("title",d);if(!a){b.text(d)}}h.find(".geo_status").empty().append(b)},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.C.S.FormNotice).each(function(){var a=$(this);SN.U.NoticeLocationAttach(a);SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);SN.U.NoticeDataAttach(a)})}},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",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(".count").text();if(typeof(MaxLength)=="undefined"){MaxLength=SN.C.I.MaxLength}jQuery.data(b[0],"ElementData",{MaxLength:MaxLength});SN.U.Counter(b);NDT=b.find("[name=status_textarea]");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)}else{b.find(".count").text(jQuery.data(b[0],"ElementData").MaxLength)}},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(".count");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("[name=status_textarea]").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("[name=status_textarea]").val()==""){b.addClass(SN.C.S.Warning);return false}b.addClass(SN.C.S.Processing).find(".submit").addClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,SN.C.S.Disabled);SN.U.normalizeGeoData(b);return true},error:function(f,g,e){b.removeClass(SN.C.S.Processing).find(".submit").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(".attach-status").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,f){a();var n=$("#"+SN.C.S.Error,i);if(n.length>0){c("error",n.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 m=document._importNode($("li",i)[0],true);var k=$("#notices_primary .notices:first");var l=b.closest("li.notice-reply");if(l.length>0){var e=$(m).attr("id");if($("#"+e).length==0){var j=l.closest("li.notice");l.replaceWith(m);SN.U.NoticeInlineReplyPlaceholder(j)}else{l.remove()}}else{if(k.length>0&&SN.U.belongsOnTimeline(m)){if($("#"+m.id).length===0){var h=b.find("[name=inreplyto]").val();var g="#notices_primary #notice-"+h;if($("body")[0].id=="conversation"){if(h.length>0&&$(g+" .notices").length<1){$(g).append('
                      ')}$($(g+" .notices")[0]).append(m)}else{k.prepend(m)}$("#"+m.id).css({display:"none"}).fadeIn(2500);SN.U.NoticeWithAttachment($("#"+m.id));SN.U.NoticeReplyTo($("#"+m.id))}}else{c("success",$("title",i).text())}}}b.resetForm();b.find("[name=inreplyto]").val("");b.find(".attach-status").remove();SN.U.FormNoticeEnhancements(b)}},complete:function(d,e){b.removeClass(SN.C.S.Processing).find(".submit").removeAttr(SN.C.S.Disabled).removeClass(SN.C.S.Disabled);b.find("[name=lat]").val(SN.C.I.NoticeDataGeo.NLat);b.find("[name=lon]").val(SN.C.I.NoticeDataGeo.NLon);b.find("[name=location_ns]").val(SN.C.I.NoticeDataGeo.NLNS);b.find("[name=location_id]").val(SN.C.I.NoticeDataGeo.NLID);b.find("[name=notice_data-geo]").attr("checked",SN.C.I.NoticeDataGeo.NDG)}})},normalizeGeoData:function(a){SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val();SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val();SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked");var b=$.cookie(SN.C.S.NoticeDataGeoCookie);if(b!==null&&b!="disabled"){b=JSON.parse(b);SN.C.I.NoticeDataGeo.NLat=a.find("[name=lat]").val(b.NLat).val();SN.C.I.NoticeDataGeo.NLon=a.find("[name=lon]").val(b.NLon).val();if(b.NLNS){SN.C.I.NoticeDataGeo.NLNS=a.find("[name=location_ns]").val(b.NLNS).val();SN.C.I.NoticeDataGeo.NLID=a.find("[name=location_id]").val(b.NLID).val()}else{a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("")}}if(b=="disabled"){SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",false).attr("checked")}else{SN.C.I.NoticeDataGeo.NDG=a.find("[name=notice_data-geo]").attr("checked",true).attr("checked")}},GetResponseXML:function(b){try{return b.responseXML}catch(a){return(new DOMParser()).parseFromString(b.responseText,"text/xml")}},NoticeReply:function(){if($("#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(g,h){var b=$($(".notice_id",g)[0]).text();var d=g;var e=g.closest(".notices");if(e.hasClass("threaded-replies")){d=e.closest(".notice")}else{e=$("ul.threaded-replies",g);if(e.length==0){e=$('
                        ');g.append(e)}}var i=$(".notice-reply-form",e);var c=function(){i.find("input[name=inreplyto]").val(b);var l=i.find("textarea");if(l.length==0){throw"No textarea"}var k="";if(h){k=h+" "}l.val(k+l.val().replace(RegExp(k,"i"),""));l.data("initialText",$.trim(h+""));l.focus();if(l[0].setSelectionRange){var j=l.val().length;l[0].setSelectionRange(j,j)}};if(i.length>0){c()}else{$("li.notice-reply-placeholder").remove();var f=$("li.notice-reply",e);if(f.length==0){var a=$("#form_notice").attr("action");f=$('
                      • ');$.get(a,{ajax:1},function(l,n,m){var j=document._importNode($("form",l)[0],true);f.append(j);e.append(f);var k=i=$(j);SN.U.NoticeLocationAttach(k);SN.U.FormNoticeXHR(k);SN.U.FormNoticeEnhancements(k);SN.U.NoticeDataAttach(k);c()})}}},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_placeholder"));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(b){var a=b.find("input[type=file]");a.change(function(f){b.find(".attach-status").remove();var d=$(this).val();if(!d){return false}var c=$('
                        ');c.find("code").text(d);c.find("button").click(function(){c.remove();a.val("");return false});b.append(c);if(typeof this.files=="object"){for(var e=0;eg){f=false}if(f){h(c,function(j){var i=$("").attr("title",e).attr("alt",e).attr("src",j).attr("style","height: 120px");d.find(".attach-status").append(i)})}else{var b=$("
                        ").text(e);d.find(".attach-status").append(b)}},NoticeLocationAttach:function(a){var e=a.find("[name=lat]");var k=a.find("[name=lon]");var g=a.find("[name=location_ns]").val();var l=a.find("[name=location_id]").val();var b="";var d=a.find("[name=notice_data-geo]");var c=a.find("[name=notice_data-geo]");var j=a.find("label.notice_data-geo");function f(n){j.attr("title",jQuery.trim(j.text())).removeClass("checked");a.find("[name=lat]").val("");a.find("[name=lon]").val("");a.find("[name=location_ns]").val("");a.find("[name=location_id]").val("");a.find("[name=notice_data-geo]").attr("checked",false);$.cookie(SN.C.S.NoticeDataGeoCookie,"disabled",{path:"/"});if(n){a.find(".geo_status_wrapper").removeClass("success").addClass("error");a.find(".geo_status_wrapper .geo_status").text(n)}else{a.find(".geo_status_wrapper").remove()}}function m(n,o){SN.U.NoticeGeoStatus(a,"Looking up place name...");$.getJSON(n,o,function(p){var q,r;if(typeof(p.location_ns)!="undefined"){a.find("[name=location_ns]").val(p.location_ns);q=p.location_ns}if(typeof(p.location_id)!="undefined"){a.find("[name=location_id]").val(p.location_id);r=p.location_id}if(typeof(p.name)=="undefined"){NLN_text=o.lat+";"+o.lon}else{NLN_text=p.name}SN.U.NoticeGeoStatus(a,NLN_text,o.lat,o.lon,p.url);j.attr("title",NoticeDataGeo_text.ShareDisable+" ("+NLN_text+")");a.find("[name=lat]").val(o.lat);a.find("[name=lon]").val(o.lon);a.find("[name=location_ns]").val(q);a.find("[name=location_id]").val(r);a.find("[name=notice_data-geo]").attr("checked",true);var s={NLat:o.lat,NLon:o.lon,NLNS:q,NLID:r,NLN:NLN_text,NLNU:p.url,NDG:true};$.cookie(SN.C.S.NoticeDataGeoCookie,JSON.stringify(s),{path:"/"})})}if(c.length>0){if($.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){c.attr("checked",false)}else{c.attr("checked",true)}var h=a.find(".notice_data-geo_wrap");var i=h.attr("title");h.removeAttr("title");j.attr("title",j.text());c.change(function(){if(c.attr("checked")===true||$.cookie(SN.C.S.NoticeDataGeoCookie)===null){j.attr("title",NoticeDataGeo_text.ShareDisable).addClass("checked");if($.cookie(SN.C.S.NoticeDataGeoCookie)===null||$.cookie(SN.C.S.NoticeDataGeoCookie)=="disabled"){if(navigator.geolocation){SN.U.NoticeGeoStatus(a,"Requesting location from browser...");navigator.geolocation.getCurrentPosition(function(p){a.find("[name=lat]").val(p.coords.latitude);a.find("[name=lon]").val(p.coords.longitude);var q={lat:p.coords.latitude,lon:p.coords.longitude,token:$("#token").val()};m(i,q)},function(p){switch(p.code){case p.PERMISSION_DENIED:f("Location permission denied.");break;case p.TIMEOUT:f("Location lookup timeout.");break}},{timeout:10000})}else{if(e.length>0&&k.length>0){var n={lat:e,lon:k,token:$("#token").val()};m(i,n)}else{f();c.remove();j.remove()}}}else{var o=JSON.parse($.cookie(SN.C.S.NoticeDataGeoCookie));a.find("[name=lat]").val(o.NLat);a.find("[name=lon]").val(o.NLon);a.find("[name=location_ns]").val(o.NLNS);a.find("[name=location_id]").val(o.NLID);a.find("[name=notice_data-geo]").attr("checked",o.NDG);SN.U.NoticeGeoStatus(a,o.NLN,o.NLat,o.NLon,o.NLNU);j.attr("title",NoticeDataGeo_text.ShareDisable+" ("+o.NLN+")").addClass("checked")}}else{f()}}).change()}},NoticeGeoStatus:function(e,a,f,g,c){var h=e.find(".geo_status_wrapper");if(h.length==0){h=$('
                        ');h.find("button.close").click(function(){e.find("[name=notice_data-geo]").removeAttr("checked").change()});e.append(h)}var b;if(c){b=$("").attr("href",c)}else{b=$("")}b.text(a);if(f||g){var d=f+";"+g;b.attr("title",d);if(!a){b.text(d)}}h.find(".geo_status").empty().append(b)},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.C.S.FormNotice).each(function(){var a=$(this);SN.U.NoticeLocationAttach(a);SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);SN.U.NoticeDataAttach(a)})}},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 From b37e12ed3436e7616c491016a68342559752d178 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 5 Mar 2011 00:12:38 +0100 Subject: [PATCH 09/10] * translator documntation updated * superfluous whitespace remove * minor L10n and i18n updates --- actions/licenseadminpanel.php | 46 ++++++++++++++++++++++++++++------- actions/login.php | 17 ++++++++++++- actions/logout.php | 1 - actions/makeadmin.php | 14 +++++++++++ actions/microsummary.php | 12 +++++---- actions/newmessage.php | 19 +++++++++++++-- actions/newnotice.php | 5 ++++ actions/nudge.php | 5 +++- actions/oembed.php | 12 +++++++++ actions/opensearch.php | 2 +- 10 files changed, 113 insertions(+), 20 deletions(-) diff --git a/actions/licenseadminpanel.php b/actions/licenseadminpanel.php index 4adeb5c3c6..fda7cd4359 100644 --- a/actions/licenseadminpanel.php +++ b/actions/licenseadminpanel.php @@ -42,7 +42,6 @@ if (!defined('STATUSNET')) { */ class LicenseadminpanelAction extends AdminPanelAction { - /** * Returns the page title * @@ -62,6 +61,7 @@ class LicenseadminpanelAction extends AdminPanelAction */ function getInstructions() { + // TRANS: Form instructions for the site license admin panel. return _('License for this StatusNet site'); } @@ -131,7 +131,8 @@ class LicenseadminpanelAction extends AdminPanelAction $types = array('private', 'allrightsreserved', 'cc'); if (!in_array($values['license']['type'], $types)) { - $this->clientError(_("Invalid license selection.")); + // TRANS: Client error displayed selecting an invalid license in the license admin panel. + $this->clientError(_('Invalid license selection.')); } // Make sure the user has set an owner if the site has a private @@ -141,13 +142,15 @@ class LicenseadminpanelAction extends AdminPanelAction && empty($values['license']['owner']) ) { $this->clientError( - _("You must specify the owner of the content when using the All Rights Reserved license.") + // TRANS: Client error displayed when not specifying an owner for the all rights reserved license in the license admin panel. + _('You must specify the owner of the content when using the All Rights Reserved license.') ); } // Make sure the license title is not too long if (mb_strlen($values['license']['type']) > 255) { $this->clientError( + // TRANS: Client error displayed selecting a too long license title in the license admin panel. _('Invalid license title. Maximum length is 255 characters.') ); } @@ -160,10 +163,12 @@ class LicenseadminpanelAction extends AdminPanelAction if ($values['license']['type'] == 'cc') { if (!Validate::uri($values['license']['url'], $options)) { - $this->clientError(_("Invalid license URL.")); + // TRANS: Client error displayed specifying an invalid license URL in the license admin panel. + $this->clientError(_('Invalid license URL.')); } if (!Validate::uri($values['license']['image'], $options)) { - $this->clientError(_("Invalid license image URL.")); + // TRANS: Client error displayed specifying an invalid license image URL in the license admin panel. + $this->clientError(_('Invalid license image URL.')); } } @@ -171,7 +176,8 @@ class LicenseadminpanelAction extends AdminPanelAction if (!empty($values['license']['url'])) { if (!Validate::uri($values['license']['url'], $options)) { - $this->clientError(_("License URL must be blank or a valid URL.")); + // TRANS: Client error displayed specifying an invalid license URL in the license admin panel. + $this->clientError(_('License URL must be blank or a valid URL.')); } } @@ -179,7 +185,8 @@ class LicenseadminpanelAction extends AdminPanelAction if (!empty($values['license']['image'])) { if (!Validate::uri($values['license']['image'], $options)) { - $this->clientError(_("License image must be blank or valid URL.")); + // TRANS: Client error displayed specifying an invalid license image URL in the license admin panel. + $this->clientError(_('License image must be blank or valid URL.')); } } } @@ -229,22 +236,28 @@ class LicenseAdminPanelForm extends AdminForm $this->out->elementStart( 'fieldset', array('id' => 'settings_license-selection') ); + // TRANS: Form legend in the license admin panel. $this->out->element('legend', null, _('License selection')); $this->out->elementStart('ul', 'form_data'); $this->li(); $types = array( + // TRANS: License option in the license admin panel. 'private' => _('Private'), + // TRANS: License option in the license admin panel. 'allrightsreserved' => _('All Rights Reserved'), + // TRANS: License option in the license admin panel. 'cc' => _('Creative Commons') ); $this->out->dropdown( 'type', + // TRANS: Dropdown field label in the license admin panel. _('Type'), $types, - _('Select license'), + // TRANS: Dropdown field instructions in the license admin panel. + _('Select a license.'), false, $this->value('type', 'license') ); @@ -258,13 +271,16 @@ class LicenseAdminPanelForm extends AdminForm 'fieldset', array('id' => 'settings_license-details') ); + // TRANS: Form legend in the license admin panel. $this->out->element('legend', null, _('License details')); $this->out->elementStart('ul', 'form_data'); $this->li(); $this->input( 'owner', + // TRANS: Field label in the license admin panel. _('Owner'), + // TRANS: Field title in the license admin panel. _('Name of the owner of the site\'s content (if applicable).'), 'license' ); @@ -273,7 +289,9 @@ class LicenseAdminPanelForm extends AdminForm $this->li(); $this->input( 'title', + // TRANS: Field label in the license admin panel. _('License Title'), + // TRANS: Field title in the license admin panel. _('The title of the license.'), 'license' ); @@ -282,7 +300,9 @@ class LicenseAdminPanelForm extends AdminForm $this->li(); $this->input( 'url', + // TRANS: Field label in the license admin panel. _('License URL'), + // TRANS: Field title in the license admin panel. _('URL for more information about the license.'), 'license' ); @@ -290,7 +310,9 @@ class LicenseAdminPanelForm extends AdminForm $this->li(); $this->input( + // TRANS: Field label in the license admin panel. 'image', _('License Image URL'), + // TRANS: Field title in the license admin panel. _('URL for an image to display with the license.'), 'license' ); @@ -308,7 +330,13 @@ class LicenseAdminPanelForm extends AdminForm function formActions() { $this->out->submit( - 'submit', _('Save'), 'submit', null, _('Save license settings') + 'submit', + // TRANS: Button text in the license admin panel. + _m('BUTTON','Save'), + 'submit', + null, + // TRANS: Button title in the license admin panel. + _('Save license settings.') ); } } diff --git a/actions/login.php b/actions/login.php index 8d51a01449..768bc04cef 100644 --- a/actions/login.php +++ b/actions/login.php @@ -94,6 +94,7 @@ class LoginAction extends Action parent::handle($args); if (common_is_real_login()) { + // TRANS: Client error displayed when trying to log in while already logged in. $this->clientError(_('Already logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->checkLogin(); @@ -122,12 +123,14 @@ class LoginAction extends Action $user = common_check_user($nickname, $password); if (!$user) { + // TRANS: Form validation error displayed when trying to log in with incorrect credentials. $this->showForm(_('Incorrect username or password.')); return; } // success! if (!common_set_user($user)) { + // TRANS: Server error displayed when during login a server error occurs. $this->serverError(_('Error setting user. You are probably not authorized.')); return; } @@ -182,6 +185,7 @@ class LoginAction extends Action */ function title() { + // TRANS: Page title for login page. return _('Login'); } @@ -219,25 +223,32 @@ class LoginAction extends Action 'class' => 'form_settings', 'action' => common_local_url('login'))); $this->elementStart('fieldset'); + // TRANS: Form legend on login page. $this->element('legend', null, _('Login to site')); $this->elementStart('ul', 'form_data'); $this->elementStart('li'); + // TRANS: Field label on login page. $this->input('nickname', _('Nickname')); $this->elementEnd('li'); $this->elementStart('li'); + // TRANS: Field label on login page. $this->password('password', _('Password')); $this->elementEnd('li'); $this->elementStart('li'); + // TRANS: Checkbox label label on login page. $this->checkbox('rememberme', _('Remember me'), false, + // TRANS: Checkbox title on login page. _('Automatically login in the future; ' . 'not for shared computers!')); $this->elementEnd('li'); $this->elementEnd('ul'); - $this->submit('submit', _('Login')); + // TRANS: Button text for log in on login page. + $this->submit('submit', _m('BUTTON','Login')); $this->elementEnd('fieldset'); $this->elementEnd('form'); $this->elementStart('p'); $this->element('a', array('href' => common_local_url('recoverpassword')), + // TRANS: Link text for link to "reset password" on login page. _('Lost or forgotten password?')); $this->elementEnd('p'); } @@ -256,13 +267,17 @@ class LoginAction extends Action common_get_returnto()) { // rememberme logins have to reauthenticate before // changing any profile settings (cookie-stealing protection) + // TRANS: Form instructions on login page before being able to change user settings. return _('For security reasons, please re-enter your ' . 'user name and password ' . 'before changing your settings.'); } else { + // TRANS: Form instructions on login page. $prompt = _('Login with your username and password.'); if (!common_config('site', 'closed') && !common_config('site', 'inviteonly')) { $prompt .= ' '; + // TRANS: Form instructions on login page. This message contains Markdown links in the form [Link text](Link). + // TRANS: %%action.register%% is a link to the registration page. $prompt .= _('Don\'t have a username yet? ' . '[Register](%%action.register%%) a new account.'); } diff --git a/actions/logout.php b/actions/logout.php index f747371225..8e903db221 100644 --- a/actions/logout.php +++ b/actions/logout.php @@ -44,7 +44,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { */ class LogoutAction extends Action { - /** * This is read only. * diff --git a/actions/makeadmin.php b/actions/makeadmin.php index 4e6e97a569..3613e1eb70 100644 --- a/actions/makeadmin.php +++ b/actions/makeadmin.php @@ -58,6 +58,7 @@ class MakeadminAction extends RedirectingAction { parent::prepare($args); if (!common_logged_in()) { + // TRANS: Client error displayed when trying to access the "make admin" page while not logged in. $this->clientError(_('Not logged in.')); return false; } @@ -68,31 +69,38 @@ class MakeadminAction extends RedirectingAction } $id = $this->trimmed('profileid'); if (empty($id)) { + // TRANS: Client error displayed when not providing a profile ID on the Make Admin page. $this->clientError(_('No profile specified.')); return false; } $this->profile = Profile::staticGet('id', $id); if (empty($this->profile)) { + // TRANS: Client error displayed when specifying an invalid profile ID on the Make Admin page. $this->clientError(_('No profile with that ID.')); return false; } $group_id = $this->trimmed('groupid'); if (empty($group_id)) { + // TRANS: Client error displayed when not providing a group ID on the Make Admin page. $this->clientError(_('No group specified.')); return false; } $this->group = User_group::staticGet('id', $group_id); if (empty($this->group)) { + // TRANS: Client error displayed when providing an invalid group ID on the Make Admin page. $this->clientError(_('No such group.')); return false; } $user = common_current_user(); if (!$user->isAdmin($this->group) && !$user->hasRight(Right::MAKEGROUPADMIN)) { + // TRANS: Client error displayed when trying to make another user admin on the Make Admin page while not an admin. $this->clientError(_('Only an admin can make another user an admin.'), 401); return false; } if ($this->profile->isAdmin($this->group)) { + // TRANS: Client error displayed when trying to make another user admin on the Make Admin page who already is admin. + // TRANS: %1$s is the user that is already admin, %2$s is the group user is already admin for. $this->clientError(sprintf(_('%1$s is already an admin for group "%2$s".'), $this->profile->getBestName(), $this->group->getBestName()), @@ -130,6 +138,9 @@ class MakeadminAction extends RedirectingAction 'profile_id' => $this->profile->id)); if (empty($member)) { + // TRANS: Server error displayed when trying to make another user admin on the Make Admin page fails + // TRANS: because the group membership record could not be gotten. + // TRANS: %1$s is the to be admin user, %2$s is the group user should be admin for. $this->serverError(_('Can\'t get membership record for %1$s in group %2$s.'), $this->profile->getBestName(), $this->group->getBestName()); @@ -143,6 +154,9 @@ class MakeadminAction extends RedirectingAction if (!$result) { common_log_db_error($member, 'UPDATE', __FILE__); + // TRANS: Server error displayed when trying to make another user admin on the Make Admin page fails + // TRANS: because the group adminship record coud not be saved properly. + // TRANS: %1$s is the to be admin user, %2$s is the group user is already admin for. $this->serverError(_('Can\'t make %1$s an admin for group %2$s.'), $this->profile->getBestName(), $this->group->getBestName()); diff --git a/actions/microsummary.php b/actions/microsummary.php index d145dc3bc7..6d47e85c68 100644 --- a/actions/microsummary.php +++ b/actions/microsummary.php @@ -46,7 +46,7 @@ class MicrosummaryAction extends Action { /** * Class handler. - * + * * @param array $args array of arguments * * @return nothing @@ -59,18 +59,20 @@ class MicrosummaryAction extends Action $user = User::staticGet('nickname', $nickname); if (!$user) { + // TRANS: Client error displayed trying to make a micro summary without providing a valid user. $this->clientError(_('No such user.'), 404); return; } - + $notice = $user->getCurrentNotice(); - + if (!$notice) { + // TRANS: Client error displayed trying to make a micro summary without providing a status. $this->clientError(_('No current status.'), 404); } - + header('Content-Type: text/plain'); - + print $user->nickname . ': ' . $notice->content; } diff --git a/actions/newmessage.php b/actions/newmessage.php index 447a00580c..8a03aebfac 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -68,6 +68,7 @@ class NewmessageAction extends Action function title() { + // TRANS: Page title for new direct message page. return _('New message'); } @@ -84,6 +85,7 @@ class NewmessageAction extends Action parent::handle($args); if (!common_logged_in()) { + // TRANS: Client error displayed trying to create a new direct message while not logged in. $this->clientError(_('Not logged in.'), 403); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { $this->saveNewMessage(); @@ -113,12 +115,15 @@ class NewmessageAction extends Action $this->other = User::staticGet('id', $this->to); if (!$this->other) { + // TRANS: Client error displayed trying to send a direct message to a non-existing user. $this->clientError(_('No such user.'), 404); return false; } if (!$user->mutuallySubscribed($this->other)) { - $this->clientError(_('You can\'t send a message to this user.'), 404); + // TRANS: Client error displayed trying to send a direct message to a user while sender and + // TRANS: receiver are not subscribed to each other. + $this->clientError(_('You cannot send a message to this user.'), 404); return false; } } @@ -141,6 +146,7 @@ class NewmessageAction extends Action assert($user); // XXX: maybe an error instead... if (!$this->content) { + // TRANS: Form validator error displayed trying to send a direct message without content. $this->showForm(_('No content!')); return; } else { @@ -158,12 +164,16 @@ class NewmessageAction extends Action } if (!$this->other) { + // TRANS: Form validation error displayed trying to send a direct message without specifying a recipient. $this->showForm(_('No recipient specified.')); return; } else if (!$user->mutuallySubscribed($this->other)) { - $this->clientError(_('You can\'t send a message to this user.'), 404); + // TRANS: Client error displayed trying to send a direct message to a user while sender and + // TRANS: receiver are not subscribed to each other. + $this->clientError(_('You cannot send a message to this user.'), 404); return; } else if ($user->id == $this->other->id) { + // TRANS: Client error displayed trying to send a direct message to self. $this->clientError(_('Don\'t send a message to yourself; ' . 'just say it to yourself quietly instead.'), 403); return; @@ -181,10 +191,13 @@ class NewmessageAction extends Action if ($this->boolean('ajax')) { $this->startHTML('text/xml;charset=utf-8'); $this->elementStart('head'); + // TRANS: Page title after sending a direct message. $this->element('title', null, _('Message sent')); $this->elementEnd('head'); $this->elementStart('body'); $this->element('p', array('id' => 'command_result'), + // TRANS: Confirmation text after sending a direct message. + // TRANS: %s is the direct message recipient. sprintf(_('Direct message to %s sent.'), $this->other->nickname)); $this->elementEnd('body'); @@ -210,6 +223,7 @@ class NewmessageAction extends Action { $this->startHTML('text/xml;charset=utf-8', true); $this->elementStart('head'); + // TRANS: Page title after an AJAX error occurred on the "send direct message" page. $this->element('title', null, _('Ajax Error')); $this->elementEnd('head'); $this->elementStart('body'); @@ -231,6 +245,7 @@ class NewmessageAction extends Action $this->xw->startDocument('1.0', 'UTF-8'); $this->elementStart('html'); $this->elementStart('head'); + // TRANS: Page title on page for sending a direct message. $this->element('title', null, _('New message')); $this->elementEnd('head'); $this->elementStart('body'); diff --git a/actions/newnotice.php b/actions/newnotice.php index bc7ab28950..c145712f51 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -66,6 +66,7 @@ class NewnoticeAction extends Action function title() { + // TRANS: Page title for sending a new notice. return _('New notice'); } @@ -85,6 +86,7 @@ class NewnoticeAction extends Action function handle($args) { if (!common_logged_in()) { + // TRANS: Client error displayed trying to send a notice while not logged in. $this->clientError(_('Not logged in.')); } else if ($_SERVER['REQUEST_METHOD'] == 'POST') { // check for this before token since all POST and FILES data @@ -137,6 +139,7 @@ class NewnoticeAction extends Action Event::handle('StartSaveNewNoticeWeb', array($this, $user, &$content, &$options)); if (!$content) { + // TRANS: Client error displayed trying to send a notice without content. $this->clientError(_('No content!')); return; } @@ -227,6 +230,7 @@ class NewnoticeAction extends Action $this->xw->startDocument('1.0', 'UTF-8'); $this->elementStart('html'); $this->elementStart('head'); + // TRANS: Page title after sending a notice. $this->element('title', null, _('Notice posted')); $this->elementEnd('head'); $this->elementStart('body'); @@ -261,6 +265,7 @@ class NewnoticeAction extends Action { $this->startHTML('text/xml;charset=utf-8', true); $this->elementStart('head'); + // TRANS: Page title after an AJAX error occurs on the send notice page. $this->element('title', null, _('Ajax Error')); $this->elementEnd('head'); $this->elementStart('body'); diff --git a/actions/nudge.php b/actions/nudge.php index 219a8c9aba..61874c7505 100644 --- a/actions/nudge.php +++ b/actions/nudge.php @@ -60,6 +60,7 @@ class NudgeAction extends Action parent::handle($args); if (!common_logged_in()) { + // TRANS: Client error displayed trying to nudge a user without being logged in. $this->clientError(_('Not logged in.')); return; } @@ -82,6 +83,7 @@ class NudgeAction extends Action } if (!$other->email || !$other->emailnotifynudge) { + // TRANS: Client error displayed trying to nudge a user that cannot be nudged. $this->clientError(_('This user doesn\'t allow nudges or hasn\'t confirmed or set their email address yet.')); return; } @@ -91,9 +93,11 @@ class NudgeAction extends Action if ($this->boolean('ajax')) { $this->startHTML('text/xml;charset=utf-8'); $this->elementStart('head'); + // TRANS: Page title after sending a nudge. $this->element('title', null, _('Nudge sent')); $this->elementEnd('head'); $this->elementStart('body'); + // TRANS: Confirmation text after sending a nudge. $this->element('p', array('id' => 'nudge_response'), _('Nudge sent!')); $this->elementEnd('body'); $this->elementEnd('html'); @@ -129,4 +133,3 @@ class NudgeAction extends Action return true; } } - diff --git a/actions/oembed.php b/actions/oembed.php index 0d8be55656..e293e4d27d 100644 --- a/actions/oembed.php +++ b/actions/oembed.php @@ -61,6 +61,8 @@ class OembedAction extends Action $proxy_args = $r->map($path); if (!$proxy_args) { + // TRANS: Server error displayed in oEmbed action when path not found. + // TRANS: %s is a path. $this->serverError(sprintf(_('"%s" not found.'),$path), 404); } $oembed=array(); @@ -73,13 +75,17 @@ class OembedAction extends Action $id = $proxy_args['notice']; $notice = Notice::staticGet($id); if(empty($notice)){ + // TRANS: Server error displayed in oEmbed action when notice not found. + // TRANS: %s is a notice. $this->serverError(sprintf(_("Notice %s not found."),$id), 404); } $profile = $notice->getProfile(); if (empty($profile)) { + // TRANS: Server error displayed in oEmbed action when notice has not profile. $this->serverError(_('Notice has no profile.'), 500); } $authorname = $profile->getFancyName(); + // TRANS: oEmbed title. %1$s is the author name, %2$s is the creation date. $oembed['title'] = sprintf(_('%1$s\'s status on %2$s'), $authorname, common_exact_date($notice->created)); @@ -92,6 +98,8 @@ class OembedAction extends Action $id = $proxy_args['attachment']; $attachment = File::staticGet($id); if(empty($attachment)){ + // TRANS: Server error displayed in oEmbed action when attachment not found. + // TRANS: %d is an attachment ID. $this->serverError(sprintf(_('Attachment %s not found.'),$id), 404); } if(empty($attachment->filename) && $file_oembed = File_oembed::staticGet('file_id', $attachment->id)){ @@ -133,6 +141,8 @@ class OembedAction extends Action if($attachment->title) $oembed['title']=$attachment->title; break; default: + // TRANS: Server error displayed in oEmbed request when a path is not supported. + // TRANS: %s is a path. $this->serverError(sprintf(_('"%s" not supported for oembed requests.'),$path), 501); } switch($args['format']){ @@ -190,6 +200,7 @@ class OembedAction extends Action } break; default: + // TRANS: Server error displayed in oEmbed action when request specifies an unsupported data format. $this->serverError(_('Not a supported data format.'), 501); break; } @@ -209,6 +220,7 @@ class OembedAction extends Action } break; default: + // TRANS: Server error displayed in oEmbed action when request specifies an unsupported data format. $this->serverError(_('Not a supported data format.'), 501); break; } diff --git a/actions/opensearch.php b/actions/opensearch.php index 7bf32277bb..b1529860a8 100644 --- a/actions/opensearch.php +++ b/actions/opensearch.php @@ -63,8 +63,8 @@ class OpensearchAction extends Action // TRANS: ShortName in the OpenSearch interface when trying to find users. $short_name = _('People Search'); } else { - // TRANS: ShortName in the OpenSearch interface when trying to find notices. $type = 'noticesearch'; + // TRANS: ShortName in the OpenSearch interface when trying to find notices. $short_name = _('Notice Search'); } header('Content-Type: application/opensearchdescription+xml'); From a127ba78a8177f453e9184633a1a90602e1b121e Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sat, 5 Mar 2011 00:24:19 +0100 Subject: [PATCH 10/10] * translator documentation updated. * superfluous whitespace removed. * small refactoring in noticeform.php to allow proper translator hints. --- actions/newnotice.php | 10 ---------- lib/noticeform.php | 27 +++++++++++++++------------ 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/actions/newnotice.php b/actions/newnotice.php index c145712f51..3e601ae362 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -47,13 +47,11 @@ require_once INSTALLDIR . '/lib/mediafile.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class NewnoticeAction extends Action { /** * Error message, if any */ - var $msg = null; /** @@ -63,7 +61,6 @@ class NewnoticeAction extends Action * * @return string page title */ - function title() { // TRANS: Page title for sending a new notice. @@ -129,7 +126,6 @@ class NewnoticeAction extends Action * * @return void */ - function saveNewNotice() { $user = common_current_user(); @@ -260,7 +256,6 @@ class NewnoticeAction extends Action * * @return void */ - function ajaxErrorMsg($msg) { $this->startHTML('text/xml;charset=utf-8', true); @@ -283,7 +278,6 @@ class NewnoticeAction extends Action * * @return void */ - function ajaxShowForm() { $this->startHTML('text/xml;charset=utf-8', true); @@ -313,7 +307,6 @@ class NewnoticeAction extends Action * * @return void */ - function showForm($msg=null) { if ($this->boolean('ajax')) { @@ -336,7 +329,6 @@ class NewnoticeAction extends Action * * @return void */ - function showNoticeForm() { $content = $this->trimmed('status_textarea'); @@ -365,7 +357,6 @@ class NewnoticeAction extends Action * * @todo maybe show some instructions? */ - function showPageNotice() { if ($this->msg) { @@ -382,7 +373,6 @@ class NewnoticeAction extends Action * * @return void */ - function showNotice($notice) { $nli = new NoticeListItem($notice, $this); diff --git a/lib/noticeform.php b/lib/noticeform.php index 0f13147d00..ace8e5582b 100644 --- a/lib/noticeform.php +++ b/lib/noticeform.php @@ -48,31 +48,26 @@ require_once INSTALLDIR.'/lib/form.php'; * * @see HTMLOutputter */ - class NoticeForm extends Form { /** * Current action, used for returning to this page. */ - var $action = null; /** * Pre-filled content of the form */ - var $content = null; /** * The current user */ - var $user = null; /** * The notice being replied to */ - var $inreplyto = null; /** @@ -91,7 +86,6 @@ class NoticeForm extends Form * @param string $action action to return to, if any * @param string $content content to pre-fill */ - function __construct($out=null, $action=null, $content=null, $user=null, $inreplyto=null, $lat=null, $lon=null, $location_id=null, $location_ns=null) { $this->id_suffix = time(); @@ -159,6 +153,7 @@ class NoticeForm extends Form */ function formLegend() { + // TRANS: Form legend for notice form. $this->out->element('legend', null, _('Send a notice')); } @@ -167,12 +162,12 @@ class NoticeForm extends Form * * @return void */ - function formData() { if (Event::handle('StartShowNoticeFormData', array($this))) { $this->out->element('label', array('for' => 'notice_data-text', 'id' => 'notice_data-text-label'), + // TRANS: Title for notice label. %s is the user's nickname. sprintf(_('What\'s up, %s?'), $this->user->nickname)); // XXX: vary by defined max size $this->out->element('textarea', array('id' => 'notice_data-text', @@ -184,18 +179,20 @@ class NoticeForm extends Form $contentLimit = Notice::maxContent(); if ($contentLimit > 0) { - $this->out->element('span', + $this->out->element('span', array('class' => 'count'), $contentLimit); } if (common_config('attachments', 'uploads')) { $this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota')); + // TRANS: Input label in notice form for adding an attachment. $this->out->element('label', array('for' => 'notice_data-attach'),_('Attach')); $this->out->element('input', array('id' => 'notice_data-attach', 'type' => 'file', 'name' => 'attach', - 'title' => _('Attach a file'))); + // TRANS: Title for input field to attach a file to a notice. + 'title' => _('Attach a file.'))); } if ($this->action) { $this->out->hidden('notice_return-to', $this->action, 'returnto'); @@ -223,12 +220,17 @@ class NoticeForm extends Form $this->out->text(' '); $this->out->element('label', array('class' => 'notice_data-geo', 'for' => $this->id() . '-notice_data-geo'), + // TRANS: Field label to add location to a notice. _('Share my location')); $this->out->elementEnd('div'); + // TRANS: Text to not share location for a notice in notice form. + $share_disable_text = _('Do not share my location'); + // TRANS: Timeout error text for location retrieval in notice form. + $error_timeout_text = _('Sorry, retrieving your geo location is taking longer than expected, please try again later'); $this->out->inlineScript(' var NoticeDataGeo_text = {'. - 'ShareDisable: ' .json_encode(_('Do not share my location')).','. - 'ErrorTimeout: ' .json_encode(_('Sorry, retrieving your geo location is taking longer than expected, please try again later')). + 'ShareDisable: ' .json_encode($share_disable_text).','. + 'ErrorTimeout: ' .json_encode($error_timeout_text). '}'); } @@ -248,6 +250,7 @@ class NoticeForm extends Form 'class' => 'submit', 'name' => 'status_submit', 'type' => 'submit', - 'value' => _m('Send button for sending notice', 'Send'))); + // TRANS: Button text for sending notice. + 'value' => _m('BUTTON', 'Send'))); } }