]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge remote-tracking branch 'mainline/1.0.x' into people_tags_rebase
authorShashi Gowda <connect2shashi@gmail.com>
Wed, 30 Mar 2011 10:13:13 +0000 (15:43 +0530)
committerShashi Gowda <connect2shashi@gmail.com>
Wed, 30 Mar 2011 10:17:42 +0000 (15:47 +0530)
Conflicts:
actions/tagother.php
classes/Profile.php
classes/Profile_tag.php
js/util.min.js

21 files changed:
1  2 
actions/profilesettings.php
actions/public.php
classes/Notice.php
classes/Profile.php
classes/Profile_tag.php
classes/User.php
classes/statusnet.ini
db/core.php
js/util.js
js/util.min.js
lib/accountprofileblock.php
lib/action.php
lib/apiaction.php
lib/command.php
lib/default.php
lib/framework.php
lib/router.php
lib/subgroupnav.php
lib/util.php
plugins/OStatus/OStatusPlugin.php
theme/rebase/css/display.css

Simple merge
Simple merge
Simple merge
index f2f8fc123e71373fa74c7792decf8c39091c5466,73a98d4ff51541e1b4b4e05c9d99e3c37af97098..7ca0d0d338cd31a9f892394249effccfddbc5799
@@@ -642,32 -355,36 +532,61 @@@ class Profile extends Memcached_DataObj
          return new ArrayWrapper($profiles);
      }
  
 +    function getTaggedSubscribers($tag)
 +    {
 +        $qry =
 +          'SELECT profile.* ' .
 +          'FROM profile JOIN (subscription, profile_tag, profile_list) ' .
 +          'ON profile.id = subscription.subscriber ' .
 +          'AND profile.id = profile_tag.tagged ' .
 +          'AND profile_tag.tagger = profile_list.tagger AND profile_tag.tag = profile_list.tag ' .
 +          'WHERE subscription.subscribed = %d ' .
 +          'AND subscription.subscribed != subscription.subscriber ' .
 +          'AND profile_tag.tagger = %d AND profile_tag.tag = "%s" ' .
 +          'AND profile_list.private = false ' .
 +          'ORDER BY subscription.created DESC';
 +
 +        $profile = new Profile();
 +        $tagged = array();
 +
 +        $cnt = $profile->query(sprintf($qry, $this->id, $this->id, $tag));
 +
 +        while ($profile->fetch()) {
 +            $tagged[] = clone($profile);
 +        }
 +        return $tagged;
 +    }
 +
+     /**
+      * Get pending subscribers, who have not yet been approved.
+      *
+      * @param int $offset
+      * @param int $limit
+      * @return Profile
+      */
+     function getRequests($offset=0, $limit=null)
+     {
+         $qry =
+           'SELECT profile.* ' .
+           'FROM profile JOIN subscription_queue '.
+           'ON profile.id = subscription_queue.subscriber ' .
+           'WHERE subscription_queue.subscribed = %d ' .
+           'ORDER BY subscription_queue.created DESC ';
+         if ($limit != null) {
+             if (common_config('db','type') == 'pgsql') {
+                 $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
+             } else {
+                 $qry .= ' LIMIT ' . $offset . ', ' . $limit;
+             }
+         }
+         $members = new Profile();
+         $members->query(sprintf($qry, $this->id));
+         return $members;
+     }
      function subscriptionCount()
      {
          $c = Cache::instance();
index 183f79145a136463472eb3dec305131ff22809b0,bd45ce0b457b16a0148cde22e5bd4e7b31e3faca..eb583c98fe06f4f126921631e8c33a48ffa8b110
@@@ -99,14 -42,11 +99,14 @@@ class Profile_tag extends Memcached_Dat
          return $tags;
      }
  
 -    static function setTags($tagger, $tagged, $newtags) {
 +    static function setTags($tagger, $tagged, $newtags, $privacy=array()) {
 +
          $newtags = array_unique($newtags);
 -        $oldtags = Profile_tag::getTags($tagger, $tagged);
 +        $oldtags = self::getTagsArray($tagger, $tagged, $tagger);
 +
 +        $ptag = new Profile_tag();
  
-         # Delete stuff that's in old and not in new
 -        // Delete stuff that's old that not in new
++        // Delete stuff that's in old and not in new
  
          $to_delete = array_diff($oldtags, $newtags);
  
  
          $to_insert = array_diff($newtags, $oldtags);
  
 -        $profile_tag = new Profile_tag();
 +        foreach ($to_delete as $deltag) {
 +            self::unTag($tagger, $tagged, $deltag);
 +        }
  
 -        $profile_tag->tagger = $tagger;
 -        $profile_tag->tagged = $tagged;
 +        foreach ($to_insert as $instag) {
 +            $private = isset($privacy[$instag]) ? $privacy[$instag] : false;
 +            self::setTag($tagger, $tagged, $instag, null, $private);
 +        }
 +        return true;
 +    }
 +
 +    # set a single tag
 +    static function setTag($tagger, $tagged, $tag, $desc=null, $private=false) {
 +
 +        $ptag = Profile_tag::pkeyGet(array('tagger' => $tagger,
 +                                           'tagged' => $tagged,
 +                                           'tag' => $tag));
 +
 +        # if tag already exists, return it
 +        if(!empty($ptag)) {
 +            return $ptag;
 +        }
 +
 +        $tagger_profile = Profile::staticGet('id', $tagger);
 +        $tagged_profile = Profile::staticGet('id', $tagged);
 +
 +        if (Event::handle('StartTagProfile', array($tagger_profile, $tagged_profile, $tag))) {
 +
 +            if (!$tagger_profile->canTag($tagged_profile)) {
 +                throw new ClientException(_('You cannot tag this user.'));
 +                return false;
 +            }
 +
 +            $tags = new Profile_list();
 +            $tags->tagger = $tagger;
 +            $count = (int) $tags->count('distinct tag');
 +
 +            if ($count >= common_config('peopletag', 'maxtags')) {
 +                throw new ClientException(sprintf(_('You already have created %d or more tags ' .
 +                                                    'which is the maximum allowed number of tags. ' .
 +                                                    'Try using or deleting some existing tags.'),
 +                                                    common_config('peopletag', 'maxtags')));
 +                return false;
 +            }
 +
 +            $plist = new Profile_list();
 +            $plist->query('BEGIN');
 +
 +            $profile_list = Profile_list::ensureTag($tagger, $tag, $desc, $private);
 +
 +            if ($profile_list->taggedCount() >= common_config('peopletag', 'maxpeople')) {
 +                throw new ClientException(sprintf(_('You already have %d or more people tagged %s ' .
 +                                                    'which is the maximum allowed number.' .
 +                                                    'Try untagging others with the same tag first.'),
 +                                                    common_config('peopletag', 'maxpeople'), $tag));
 +                return false;
 +            }
 +
 +            $newtag = new Profile_tag();
 +
 +            $newtag->tagger = $tagger;
 +            $newtag->tagged = $tagged;
 +            $newtag->tag = $tag;
 +
 +            $result = $newtag->insert();
  
 -        $profile_tag->query('BEGIN');
  
 -        foreach ($to_delete as $deltag) {
 -            $profile_tag->tag = $deltag;
 -            $result = $profile_tag->delete();
              if (!$result) {
 -                common_log_db_error($profile_tag, 'DELETE', __FILE__);
 +                common_log_db_error($newtag, 'INSERT', __FILE__);
                  return false;
              }
 +
 +            try {
 +                $plist->query('COMMIT');
 +                Event::handle('EndTagProfile', array($newtag));
 +            } catch (Exception $e) {
 +                $newtag->delete();
 +                $profile_list->delete();
 +                throw $e;
 +                return false;
 +            }
 +
 +            $profile_list->taggedCount(true);
 +            self::blowCaches($tagger, $tagged);
          }
  
 -        foreach ($to_insert as $instag) {
 -            $profile_tag->tag = $instag;
 -            $result = $profile_tag->insert();
 +        return $newtag;
 +    }
 +
 +    static function unTag($tagger, $tagged, $tag) {
 +        $ptag = Profile_tag::pkeyGet(array('tagger' => $tagger,
 +                                           'tagged' => $tagged,
 +                                           'tag'    => $tag));
 +        if (!$ptag) {
 +            return true;
 +        }
 +
 +        if (Event::handle('StartUntagProfile', array($ptag))) {
 +            $orig = clone($ptag);
 +            $result = $ptag->delete();
              if (!$result) {
 -                common_log_db_error($profile_tag, 'INSERT', __FILE__);
 +                common_log_db_error($this, 'DELETE', __FILE__);
                  return false;
              }
 +            Event::handle('EndUntagProfile', array($orig));
 +            if ($result) {
 +                $profile_list = Profile_list::pkeyGet(array('tag' => $tag, 'tagger' => $tagger));
 +                $profile_list->taggedCount(true);
 +                self::blowCaches($tagger, $tagged);
 +                return true;
 +            }
 +            return false;
 +        }
 +    }
 +
 +    // @fixme: move this to Profile_list?
 +    static function cleanup($profile_list) {
 +        $ptag = new Profile_tag();
 +        $ptag->tagger = $profile_list->tagger;
 +        $ptag->tag = $profile_list->tag;
 +        $ptag->find();
 +
 +        while($ptag->fetch()) {
 +            if (Event::handle('StartUntagProfile', array($ptag))) {
 +                $orig = clone($ptag);
 +                $result = $ptag->delete();
 +                if (!$result) {
 +                    common_log_db_error($this, 'DELETE', __FILE__);
 +                }
 +                Event::handle('EndUntagProfile', array($orig));
 +            }
          }
 +    }
  
 -        $profile_tag->query('COMMIT');
 +    // move a tag!
 +    static function moveTag($orig, $new) {
 +        $tags = new Profile_tag();
 +        $qry = 'UPDATE profile_tag SET ' .
 +               'tag = "%s", tagger = "%s" ' .
 +               'WHERE tag = "%s" ' .
 +               'AND tagger = "%s"';
 +        $result = $tags->query(sprintf($qry, $new->tag, $new->tagger,
 +                                             $orig->tag, $orig->tagger));
  
 +        if (!$result) {
 +            common_log_db_error($tags, 'UPDATE', __FILE__);
 +            return false;
 +        }
 +        return true;
 +    }
 +
 +    static function blowCaches($tagger, $tagged) {
 +        foreach (array(0, 1) as $perm) {
 +            self::blow(sprintf('profile_tag:tagger_tagged_privacy:%d-%d-%d', $tagger, $tagged, $perm));
 +        }
          return true;
      }
 -        return $tagged;
+     // Return profiles with a given tag
+     static function getTagged($tagger, $tag) {
+         $profile = new Profile();
+         $profile->query('SELECT profile.* ' .
+                         'FROM profile JOIN profile_tag ' .
+                         'ON profile.id = profile_tag.tagged ' .
+                         'WHERE profile_tag.tagger = ' . $tagger . ' ' .
+                         'AND profile_tag.tag = "' . $tag . '" ');
+         $tagged = array();
+         while ($profile->fetch()) {
+             $tagged[] = clone($profile);
+         }
++        return true;
+     }
  }
Simple merge
Simple merge
diff --cc db/core.php
Simple merge
diff --cc js/util.js
Simple merge
diff --cc js/util.min.js
index cfc06cda5ac6f9df21f3a3fdf1ddb32019173172,5cc71c08036a2b8c2e237b18dc1c4cc9eab70590..64adcd478c41ff3e4464195a54a7ae7a088728ef
@@@ -1,1 -1,1 +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],NoticeFormMaster:null},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(".notice_data-text:first");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(".notice_data-text:first").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(d,e,c){var b=null;if(d.responseXML){b=$("#error",d.responseXML).text()}alert(b||c||e);a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).removeAttr(SN.C.S.Disabled)},success:function(b,c){if(typeof($("form",b)[0])!="undefined"){form_new=document._importNode($("form",b)[0],true);a.replaceWith(form_new)}else{if(typeof($("p",b)[0])!="undefined"){a.replaceWith(document._importNode($("p",b)[0],true))}else{alert("Unknown error.")}}}})},FormNoticeXHR:function(b){SN.C.I.NoticeDataGeo={};b.append('<input type="hidden" name="ajax" value="1"/>');b.attr("action",SN.U.RewriteAjaxAction(b.attr("action")));var c=function(d,e){b.append($('<p class="form_response"></p>').addClass(d).text(e))};var a=function(){b.find(".form_response").remove()};b.ajaxForm({dataType:"xml",timeout:"60000",beforeSend:function(d){if(b.find(".notice_data-text:first").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 o=$("#"+SN.C.S.Error,i);if(o.length>0){c("error",o.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 n=document._importNode($("li",i)[0],true);var j=$("#notices_primary .notices:first");var l=b.closest("li.notice-reply");if(l.length>0){var k=b.closest(".threaded-replies");var m=k.find(".notice-reply-placeholder");l.remove();var e=$(n).attr("id");if($("#"+e).length==0){$(n).insertBefore(m)}else{}m.show()}else{if(j.length>0&&SN.U.belongsOnTimeline(n)){if($("#"+n.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('<ul class="notices"></ul>')}$($(g+" .notices")[0]).append(n)}else{j.prepend(n)}$("#"+n.id).css({display:"none"}).fadeIn(2500);SN.U.NoticeWithAttachment($("#"+n.id));SN.U.switchInputFormTab("placeholder")}}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)}})},FormProfileSearchXHR:function(a){$.ajax({type:"POST",dataType:"xml",url: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(d,f){var b=$("#profile_search_results");if(typeof($("ul",d)[0])!="undefined"){var c=document._importNode($("ul",d)[0],true);b.replaceWith(c)}else{var e=$("<li/>").append(document._importNode($("p",d)[0],true));b.html(e)}a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,false)}})},FormPeopletagsXHR:function(a){$.ajax({type:"POST",dataType:"xml",url: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(d,e){var c=a.parents(".entity_tags");if(typeof($(".entity_tags",d)[0])!="undefined"){var b=document._importNode($(".entity_tags",d)[0],true);$(b).find(".editable").append($('<button class="peopletags_edit_button"/>'));c.replaceWith(b)}else{c.find("p").remove();c.append(document._importNode($("p",d)[0],true));a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,false)}}})},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(){$("#content .notice_reply").live("click",function(c){c.preventDefault();var b=$(this).closest("li.notice");var a=($(".author .nickname",b).length>0)?$($(".author .nickname",b)[0]):$(".author .nickname.uid");SN.U.NoticeInlineReplyTrigger(b,"@"+a.text());return false})},NoticeReplyTo:function(a){},NoticeInlineReplyTrigger:function(i,j){var b=$($(".notice_id",i)[0]).text();var e=i;var f=i.closest(".notices");if(f.hasClass("threaded-replies")){e=f.closest(".notice")}else{f=$("ul.threaded-replies",i);if(f.length==0){f=$('<ul class="notices threaded-replies xoxo"></ul>');i.append(f)}}var k=$(".notice-reply-form",f);var d=function(){k.find("input[name=inreplyto]").val(b);var n=k.find("textarea");if(n.length==0){throw"No textarea"}var m="";if(j){m=j+" "}n.val(m+n.val().replace(RegExp(m,"i"),""));n.data("initialText",$.trim(j+""));n.focus();if(n[0].setSelectionRange){var l=n.val().length;n[0].setSelectionRange(l,l)}};if(k.length>0){d()}else{var h=f.find("li.notice-reply-placeholder").hide();var g=$("li.notice-reply",f);if(g.length==0){g=$('<li class="notice-reply"></li>');var c=function(l){var m=document._importNode(l,true);g.append(m);f.append(g);var n=k=$(m);SN.Init.NoticeFormSetup(n);d()};if(SN.C.I.NoticeFormMaster){c(SN.C.I.NoticeFormMaster)}else{var a=$("#form_notice").attr("action");$.get(a,{ajax:1},function(l,n,m){c($("form",l)[0])})}}}},NoticeInlineReplyPlaceholder:function(b){var a=b.find("ul.threaded-replies");var c=$('<li class="notice-reply-placeholder"><input class="placeholder"></li>');c.find("input").val(SN.msg("reply_placeholder"));a.append(c)},NoticeInlineReplySetup:function(){$("li.notice-reply-placeholder input").live("focus",function(){var a=$(this).closest("li.notice");SN.U.NoticeInlineReplyTrigger(a);return false});$("li.notice-reply-comments a").live("click",function(){var a=$(this).attr("href");var b=$(this).closest(".threaded-replies");$.get(a,{ajax:1},function(d,f,e){var c=$(".threaded-replies",d);if(c.length){b.replaceWith(document._importNode(c[0],true))}});return false})},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('<button class="close">&#215;</button>').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=$('<div class="attach-status '+SN.C.S.Success+'"><code></code> <button class="close">&#215;</button></div>');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;e<this.files.length;e++){SN.U.PreviewAttach(b,this.files[e])}}})},maxFileSize:function(b){var a=$(b).find("input[name=MAX_FILE_SIZE]").attr("value");if(a){return parseInt(a)}else{return 0}},PreviewAttach:function(d,c){var e=c.type+" "+Math.round(c.size/1024)+"KB";var f=true;var h;if(typeof window.createObjectURL!="undefined"){h=function(i,j){j(window.createObjectURL(i))}}else{if(typeof window.FileReader!="undefined"){h=function(j,k){var i=new FileReader();i.onload=function(l){k(i.result)};i.readAsDataURL(j)}}else{f=false}}var a=["image/png","image/jpeg","image/gif","image/svg+xml"];if($.inArray(c.type,a)==-1){f=false}var g=8*1024*1024;if(c.size>g){f=false}if(f){h(c,function(j){var i=$("<img>").attr("title",e).attr("alt",e).attr("src",j).attr("style","height: 120px");d.find(".attach-status").append(i)})}else{var b=$("<div></div>").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("data-api");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=$('<div class="'+SN.C.S.Success+' geo_status_wrapper"><button class="close" style="float:right">&#215;</button><div class="geo_status"></div></div>');h.find("button.close").click(function(){e.find("[name=notice_data-geo]").removeAttr("checked").change();return false});e.append(h)}var b;if(c){b=$("<a></a>").attr("href",c)}else{b=$("<span></span>")}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('<button class="close">&#215;</button>');$(".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(".vcard.author a.url").attr("href");if(d==c){if(a=="all"||a=="showstream"){return true}}}return false},switchInputFormTab:function(a){$(".input_form_nav_tab.current").removeClass("current");if(a=="placeholder"){$("#input_form_nav_status").addClass("current")}else{$("#input_form_nav_"+a).addClass("current")}$(".input_form.current").removeClass("current");$("#input_form_"+a).addClass("current").find(".ajax-notice").each(function(){var b=$(this);SN.Init.NoticeFormSetup(b)}).find("textarea:first").focus()}},Init:{NoticeForm:function(){if($("body.user_in").length>0){$("#input_form_placeholder input.placeholder").focus(function(){SN.U.switchInputFormTab("status")});$("body").bind("click",function(g){var d=$("#content .input_forms div.current");if(d.length>0){if($("#content .input_forms").has(g.target).length==0){var a=d.find('textarea, input[type=text], input[type=""]');var c=false;a.each(function(){c=c||$(this).val()});if(!c){SN.U.switchInputFormTab("placeholder")}}}var b=$("li.notice-reply");if(b.length>0){var f=$(g.target);b.each(function(){var j=$(this);if(j.has(g.target).length==0){var h=j.find(".notice_data-text:first");var i=$.trim(h.val());if(i==""||i==h.data("initialText")){var e=j.closest("li.notice");j.remove();e.find("li.notice-reply-placeholder").show()}}})}})}},NoticeFormSetup:function(a){if(!a.data("NoticeFormSetup")){SN.U.NoticeLocationAttach(a);SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);SN.U.NoticeDataAttach(a);a.data("NoticeFormSetup",true)}},Notices:function(){if($("body.user_in").length>0){var a=$(".form_notice:first");if(a.length>0){SN.C.I.NoticeFormMaster=document._importNode(a[0],true)}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});$(".form_peopletag_subscribe").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_peopletag_unsubscribe").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_user_add_peopletag").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_user_remove_peopletag").live("click",function(){SN.U.FormXHR($(this));return false});SN.U.NewDirectMessage()}},ProfileSearch:function(){if($("body.user_in").length>0){$(".form_peopletag_edit_user_search input.submit").live("click",function(){SN.U.FormProfileSearchXHR($(this).parents("form"));return false})}},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})},PeopletagAutocomplete:function(){$(".form_tag_user #tags").tagInput({tags:SN.C.PtagACData,tagSeparator:" ",animate:false,formatLine:function(d,g,c,f){var a="<b>"+g.tag.substring(0,c.length)+"</b>"+g.tag.substring(c.length);var b=$("<div/>").addClass("mode-"+g.mode);b.append($("<div class='tagInputLineTag'>"+a+" <em class='privacy_mode'>"+g.mode+"</em></div>"));if(g.freq){b.append("<div class='tagInputLineFreq'>"+g.freq+"</div>")}return b}})},PeopleTags:function(){$(".user_profile_tags .editable").append($('<button class="peopletags_edit_button"/>'));$(".peopletags_edit_button").live("click",function(){var a=$(this).parents("dd").eq(0).find("form");if(typeof SN.C.PtagACData==="undefined"){$.getJSON(_peopletagAC+"?token="+$("#token").val(),function(b){SN.C.PtagACData=b;_loadTagInput(SN.Init.PeopletagAutocomplete)})}else{_loadTagInput(SN.Init.PeopletagAutocomplete)}$(this).parents("ul").eq(0).fadeOut(200,function(){a.fadeIn(200).find("input#tags")})});$(".user_profile_tags form .submit").live("click",function(){SN.U.FormPeopletagsXHR($(this).parents("form"));return false})},AjaxForms:function(){$("form.ajax").live("submit",function(){SN.U.FormXHR($(this));return false})},UploadForms:function(){$("input[type=file]").change(function(d){if(typeof this.files=="object"&&this.files.length>0){var c=0;for(var b=0;b<this.files.length;b++){c+=this.files[b].size}var a=SN.U.maxFileSize($(this.form));if(a>0&&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.AjaxForms();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($("#profile_search_results").length>0){SN.Init.ProfileSearch()}if($(".user_profile_tags .editable").length>0){SN.Init.PeopleTags()}});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;c<b;){if(e.attributes[c].nodeName=="class"){d.className=e.getAttribute(e.attributes[c++].nodeName)}else{d.setAttribute(e.attributes[c].nodeName,e.getAttribute(e.attributes[c++].nodeName))}}}if(a&&e.childNodes&&e.childNodes.length>0){for(var c=0,b=e.childNodes.length;c<b;){d.appendChild(document._importNode(e.childNodes[c++],a))}}return d;break;case document.TEXT_NODE:case document.CDATA_SECTION_NODE:case document.COMMENT_NODE:return document.createTextNode(e.nodeValue);break}};if(typeof navigator.geolocation=="undefined"||navigator.geolocation.shim){(function(){(function(){if(window.google&&google.gears){return}var c=null;if(typeof GearsFactory!="undefined"){c=new GearsFactory()}else{try{c=new ActiveXObject("Gears.Factory");if(c.getBuildInfo().indexOf("ie_mobile")!=-1){c.privateSetGlobalObject(this)}}catch(d){if((typeof navigator.mimeTypes!="undefined")&&navigator.mimeTypes["application/x-googlegears"]){c=document.createElement("object");c.style.display="none";c.width=0;c.height=0;c.type="application/x-googlegears";document.documentElement.appendChild(c)}}}if(!c){return}if(!window.google){google={}}if(!google.gears){google.gears={factory:c}}})();var a=(function(){var d=google.gears.factory.create("beta.geolocation");var c=function(f,e){return function(g){f(g);e.lastPosition=g}};return{shim:true,type:"Gears",lastPosition:null,getCurrentPosition:function(e,g,h){var f=this;var i=c(e,f);d.getCurrentPosition(i,g,h)},watchPosition:function(e,f,g){d.watchPosition(e,f,g)},clearWatch:function(e){d.clearWatch(e)},getPermission:function(g,e,f){d.getPermission(g,e,f)}}});var b=(function(){var i=false;var e=function(){if(!d()&&!i){i=true;var j=document.createElement("script");j.src=(document.location.protocol=="https:"?"https://":"http://")+"www.google.com/jsapi?callback=_google_loader_apiLoaded";j.type="text/javascript";document.getElementsByTagName("body")[0].appendChild(j)}};var c=[];var h=function(j){c.push(j)};var f=function(){if(d()){while(c.length>0){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()})()};
 -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],NoticeFormMaster:null},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(".notice_data-text:first");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(".notice_data-text:first").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(d,e,c){var b=null;if(d.responseXML){b=$("#error",d.responseXML).text()}alert(b||c||e);a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).removeAttr(SN.C.S.Disabled)},success:function(b,c){if(typeof($("form",b)[0])!="undefined"){form_new=document._importNode($("form",b)[0],true);a.replaceWith(form_new)}else{if(typeof($("p",b)[0])!="undefined"){a.replaceWith(document._importNode($("p",b)[0],true))}else{alert("Unknown error.")}}}})},FormNoticeXHR:function(b){SN.C.I.NoticeDataGeo={};b.append('<input type="hidden" name="ajax" value="1"/>');b.attr("action",SN.U.RewriteAjaxAction(b.attr("action")));var c=function(d,e){b.append($('<p class="form_response"></p>').addClass(d).text(e))};var a=function(){b.find(".form_response").remove()};b.ajaxForm({dataType:"xml",timeout:"60000",beforeSend:function(d){if(b.find(".notice_data-text:first").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 o=$("#"+SN.C.S.Error,i);if(o.length>0){c("error",o.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 n=document._importNode($("li",i)[0],true);var j=$("#notices_primary .notices:first");var l=b.closest("li.notice-reply");if(l.length>0){var k=b.closest(".threaded-replies");var m=k.find(".notice-reply-placeholder");l.remove();var e=$(n).attr("id");if($("#"+e).length==0){$(n).insertBefore(m)}else{}m.show()}else{if(j.length>0&&SN.U.belongsOnTimeline(n)){if($("#"+n.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('<ul class="notices"></ul>')}$($(g+" .notices")[0]).append(n)}else{j.prepend(n)}$("#"+n.id).css({display:"none"}).fadeIn(2500);SN.U.NoticeWithAttachment($("#"+n.id));SN.U.switchInputFormTab("placeholder")}}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(){$("#content .notice_reply").live("click",function(c){c.preventDefault();var b=$(this).closest("li.notice");var a=($(".author .nickname",b).length>0)?$($(".author .nickname",b)[0]):$(".author .nickname.uid");SN.U.NoticeInlineReplyTrigger(b,"@"+a.text());return false})},NoticeReplyTo:function(a){},NoticeInlineReplyTrigger:function(i,j){var b=$($(".notice_id",i)[0]).text();var e=i;var f=i.closest(".notices");if(f.hasClass("threaded-replies")){e=f.closest(".notice")}else{f=$("ul.threaded-replies",i);if(f.length==0){f=$('<ul class="notices threaded-replies xoxo"></ul>');i.append(f)}}var k=$(".notice-reply-form",f);var d=function(){k.find("input[name=inreplyto]").val(b);var n=k.find("textarea");if(n.length==0){throw"No textarea"}var m="";if(j){m=j+" "}n.val(m+n.val().replace(RegExp(m,"i"),""));n.data("initialText",$.trim(j+""));n.focus();if(n[0].setSelectionRange){var l=n.val().length;n[0].setSelectionRange(l,l)}};if(k.length>0){d()}else{var h=f.find("li.notice-reply-placeholder").hide();var g=$("li.notice-reply",f);if(g.length==0){g=$('<li class="notice-reply"></li>');var c=function(l){var m=document._importNode(l,true);g.append(m);f.append(g);var n=k=$(m);SN.Init.NoticeFormSetup(n);d()};if(SN.C.I.NoticeFormMaster){c(SN.C.I.NoticeFormMaster)}else{var a=$("#form_notice").attr("action");$.get(a,{ajax:1},function(l,n,m){c($("form",l)[0])})}}}},NoticeInlineReplyPlaceholder:function(b){var a=b.find("ul.threaded-replies");var c=$('<li class="notice-reply-placeholder"><input class="placeholder"></li>');c.find("input").val(SN.msg("reply_placeholder"));a.append(c)},NoticeInlineReplySetup:function(){$("li.notice-reply-placeholder input").live("focus",function(){var a=$(this).closest("li.notice");SN.U.NoticeInlineReplyTrigger(a);return false});$("li.notice-reply-comments a").live("click",function(){var a=$(this).attr("href");var b=$(this).closest(".threaded-replies");$.get(a,{ajax:1},function(d,f,e){var c=$(".threaded-replies",d);if(c.length){b.replaceWith(document._importNode(c[0],true))}});return false})},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('<button class="close">&#215;</button>').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=$('<div class="attach-status '+SN.C.S.Success+'"><code></code> <button class="close">&#215;</button></div>');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;e<this.files.length;e++){SN.U.PreviewAttach(b,this.files[e])}}})},maxFileSize:function(b){var a=$(b).find("input[name=MAX_FILE_SIZE]").attr("value");if(a){return parseInt(a)}else{return 0}},PreviewAttach:function(d,c){var e=c.type+" "+Math.round(c.size/1024)+"KB";var f=true;var h;if(typeof window.createObjectURL!="undefined"){h=function(i,j){j(window.createObjectURL(i))}}else{if(typeof window.FileReader!="undefined"){h=function(j,k){var i=new FileReader();i.onload=function(l){k(i.result)};i.readAsDataURL(j)}}else{f=false}}var a=["image/png","image/jpeg","image/gif","image/svg+xml"];if($.inArray(c.type,a)==-1){f=false}var g=8*1024*1024;if(c.size>g){f=false}if(f){h(c,function(j){var i=$("<img>").attr("title",e).attr("alt",e).attr("src",j).attr("style","height: 120px");d.find(".attach-status").append(i)})}else{var b=$("<div></div>").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("data-api");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=$('<div class="'+SN.C.S.Success+' geo_status_wrapper"><button class="close" style="float:right">&#215;</button><div class="geo_status"></div></div>');h.find("button.close").click(function(){e.find("[name=notice_data-geo]").removeAttr("checked").change();return false});e.append(h)}var b;if(c){b=$("<a></a>").attr("href",c)}else{b=$("<span></span>")}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('<button class="close">&#215;</button>');$(".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(".vcard.author a.url").attr("href");if(d==c){if(a=="all"||a=="showstream"){return true}}}return false},switchInputFormTab:function(a){$(".input_form_nav_tab.current").removeClass("current");if(a=="placeholder"){$("#input_form_nav_status").addClass("current")}else{$("#input_form_nav_"+a).addClass("current")}$(".input_form.current").removeClass("current");$("#input_form_"+a).addClass("current").find(".ajax-notice").each(function(){var b=$(this);SN.Init.NoticeFormSetup(b)}).find("textarea:first").focus()}},Init:{NoticeForm:function(){if($("body.user_in").length>0){$("#input_form_placeholder input.placeholder").focus(function(){SN.U.switchInputFormTab("status")});$("body").bind("click",function(g){var d=$("#content .input_forms div.current");if(d.length>0){if($("#content .input_forms").has(g.target).length==0){var a=d.find('textarea, input[type=text], input[type=""]');var c=false;a.each(function(){c=c||$(this).val()});if(!c){SN.U.switchInputFormTab("placeholder")}}}var b=$("li.notice-reply");if(b.length>0){var f=$(g.target);b.each(function(){var j=$(this);if(j.has(g.target).length==0){var h=j.find(".notice_data-text:first");var i=$.trim(h.val());if(i==""||i==h.data("initialText")){var e=j.closest("li.notice");j.remove();e.find("li.notice-reply-placeholder").show()}}})}})}},NoticeFormSetup:function(a){if(!a.data("NoticeFormSetup")){SN.U.NoticeLocationAttach(a);SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);SN.U.NoticeDataAttach(a);a.data("NoticeFormSetup",true)}},Notices:function(){if($("body.user_in").length>0){var a=$(".form_notice:first");if(a.length>0){SN.C.I.NoticeFormMaster=document._importNode(a[0],true)}SN.U.NoticeRepeat();SN.U.NoticeReply();SN.U.NoticeInlineReplySetup()}SN.U.NoticeAttachments()},EntityActions:function(){if($("body.user_in").length>0){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})},AjaxForms:function(){$("form.ajax").live("submit",function(){SN.U.FormXHR($(this));return false});$("form.ajax input[type=submit]").live("click",function(){var a=$(this);var b=a.closest("form");b.find(".hidden-submit-button").remove();$('<input class="hidden-submit-button" type="hidden" />').attr("name",a.attr("name")).val(a.val()).appendTo(b)})},UploadForms:function(){$("input[type=file]").change(function(d){if(typeof this.files=="object"&&this.files.length>0){var c=0;for(var b=0;b<this.files.length;b++){c+=this.files[b].size}var a=SN.U.maxFileSize($(this.form));if(a>0&&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.AjaxForms();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;c<b;){if(e.attributes[c].nodeName=="class"){d.className=e.getAttribute(e.attributes[c++].nodeName)}else{d.setAttribute(e.attributes[c].nodeName,e.getAttribute(e.attributes[c++].nodeName))}}}if(a&&e.childNodes&&e.childNodes.length>0){for(var c=0,b=e.childNodes.length;c<b;){d.appendChild(document._importNode(e.childNodes[c++],a))}}return d;break;case document.TEXT_NODE:case document.CDATA_SECTION_NODE:case document.COMMENT_NODE:return document.createTextNode(e.nodeValue);break}};if(typeof navigator.geolocation=="undefined"||navigator.geolocation.shim){(function(){(function(){if(window.google&&google.gears){return}var c=null;if(typeof GearsFactory!="undefined"){c=new GearsFactory()}else{try{c=new ActiveXObject("Gears.Factory");if(c.getBuildInfo().indexOf("ie_mobile")!=-1){c.privateSetGlobalObject(this)}}catch(d){if((typeof navigator.mimeTypes!="undefined")&&navigator.mimeTypes["application/x-googlegears"]){c=document.createElement("object");c.style.display="none";c.width=0;c.height=0;c.type="application/x-googlegears";document.documentElement.appendChild(c)}}}if(!c){return}if(!window.google){google={}}if(!google.gears){google.gears={factory:c}}})();var a=(function(){var d=google.gears.factory.create("beta.geolocation");var c=function(f,e){return function(g){f(g);e.lastPosition=g}};return{shim:true,type:"Gears",lastPosition:null,getCurrentPosition:function(e,g,h){var f=this;var i=c(e,f);d.getCurrentPosition(i,g,h)},watchPosition:function(e,f,g){d.watchPosition(e,f,g)},clearWatch:function(e){d.clearWatch(e)},getPermission:function(g,e,f){d.getPermission(g,e,f)}}});var b=(function(){var i=false;var e=function(){if(!d()&&!i){i=true;var j=document.createElement("script");j.src=(document.location.protocol=="https:"?"https://":"http://")+"www.google.com/jsapi?callback=_google_loader_apiLoaded";j.type="text/javascript";document.getElementsByTagName("body")[0].appendChild(j)}};var c=[];var h=function(j){c.push(j)};var f=function(){if(d()){while(c.length>0){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()})()};
++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],NoticeFormMaster:null},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(".notice_data-text:first");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(".notice_data-text:first").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(d,e,c){var b=null;if(d.responseXML){b=$("#error",d.responseXML).text()}alert(b||c||e);a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).removeAttr(SN.C.S.Disabled)},success:function(b,c){if(typeof($("form",b)[0])!="undefined"){form_new=document._importNode($("form",b)[0],true);a.replaceWith(form_new)}else{if(typeof($("p",b)[0])!="undefined"){a.replaceWith(document._importNode($("p",b)[0],true))}else{alert("Unknown error.")}}}})},FormNoticeXHR:function(b){SN.C.I.NoticeDataGeo={};b.append('<input type="hidden" name="ajax" value="1"/>');b.attr("action",SN.U.RewriteAjaxAction(b.attr("action")));var c=function(d,e){b.append($('<p class="form_response"></p>').addClass(d).text(e))};var a=function(){b.find(".form_response").remove()};b.ajaxForm({dataType:"xml",timeout:"60000",beforeSend:function(d){if(b.find(".notice_data-text:first").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 o=$("#"+SN.C.S.Error,i);if(o.length>0){c("error",o.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 n=document._importNode($("li",i)[0],true);var j=$("#notices_primary .notices:first");var l=b.closest("li.notice-reply");if(l.length>0){var k=b.closest(".threaded-replies");var m=k.find(".notice-reply-placeholder");l.remove();var e=$(n).attr("id");if($("#"+e).length==0){$(n).insertBefore(m)}else{}m.show()}else{if(j.length>0&&SN.U.belongsOnTimeline(n)){if($("#"+n.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('<ul class="notices"></ul>')}$($(g+" .notices")[0]).append(n)}else{j.prepend(n)}$("#"+n.id).css({display:"none"}).fadeIn(2500);SN.U.NoticeWithAttachment($("#"+n.id));SN.U.switchInputFormTab("placeholder")}}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)}})},FormProfileSearchXHR:function(a){$.ajax({type:"POST",dataType:"xml",url: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(d,f){var b=$("#profile_search_results");if(typeof($("ul",d)[0])!="undefined"){var c=document._importNode($("ul",d)[0],true);b.replaceWith(c)}else{var e=$("<li/>").append(document._importNode($("p",d)[0],true));b.html(e)}a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,false)}})},FormPeopletagsXHR:function(a){$.ajax({type:"POST",dataType:"xml",url: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(d,e){var c=a.parents(".entity_tags");if(typeof($(".entity_tags",d)[0])!="undefined"){var b=document._importNode($(".entity_tags",d)[0],true);$(b).find(".editable").append($('<button class="peopletags_edit_button"/>'));c.replaceWith(b)}else{c.find("p").remove();c.append(document._importNode($("p",d)[0],true));a.removeClass(SN.C.S.Processing).find(".submit").removeClass(SN.C.S.Disabled).attr(SN.C.S.Disabled,false)}}})},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(){$("#content .notice_reply").live("click",function(c){c.preventDefault();var b=$(this).closest("li.notice");var a=($(".author .nickname",b).length>0)?$($(".author .nickname",b)[0]):$(".author .nickname.uid");SN.U.NoticeInlineReplyTrigger(b,"@"+a.text());return false})},NoticeReplyTo:function(a){},NoticeInlineReplyTrigger:function(i,j){var b=$($(".notice_id",i)[0]).text();var e=i;var f=i.closest(".notices");if(f.hasClass("threaded-replies")){e=f.closest(".notice")}else{f=$("ul.threaded-replies",i);if(f.length==0){f=$('<ul class="notices threaded-replies xoxo"></ul>');i.append(f)}}var k=$(".notice-reply-form",f);var d=function(){k.find("input[name=inreplyto]").val(b);var n=k.find("textarea");if(n.length==0){throw"No textarea"}var m="";if(j){m=j+" "}n.val(m+n.val().replace(RegExp(m,"i"),""));n.data("initialText",$.trim(j+""));n.focus();if(n[0].setSelectionRange){var l=n.val().length;n[0].setSelectionRange(l,l)}};if(k.length>0){d()}else{var h=f.find("li.notice-reply-placeholder").hide();var g=$("li.notice-reply",f);if(g.length==0){g=$('<li class="notice-reply"></li>');var c=function(l){var m=document._importNode(l,true);g.append(m);f.append(g);var n=k=$(m);SN.Init.NoticeFormSetup(n);d()};if(SN.C.I.NoticeFormMaster){c(SN.C.I.NoticeFormMaster)}else{var a=$("#form_notice").attr("action");$.get(a,{ajax:1},function(l,n,m){c($("form",l)[0])})}}}},NoticeInlineReplyPlaceholder:function(b){var a=b.find("ul.threaded-replies");var c=$('<li class="notice-reply-placeholder"><input class="placeholder"></li>');c.find("input").val(SN.msg("reply_placeholder"));a.append(c)},NoticeInlineReplySetup:function(){$("li.notice-reply-placeholder input").live("focus",function(){var a=$(this).closest("li.notice");SN.U.NoticeInlineReplyTrigger(a);return false});$("li.notice-reply-comments a").live("click",function(){var a=$(this).attr("href");var b=$(this).closest(".threaded-replies");$.get(a,{ajax:1},function(d,f,e){var c=$(".threaded-replies",d);if(c.length){b.replaceWith(document._importNode(c[0],true))}});return false})},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('<button class="close">&#215;</button>').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=$('<div class="attach-status '+SN.C.S.Success+'"><code></code> <button class="close">&#215;</button></div>');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;e<this.files.length;e++){SN.U.PreviewAttach(b,this.files[e])}}})},maxFileSize:function(b){var a=$(b).find("input[name=MAX_FILE_SIZE]").attr("value");if(a){return parseInt(a)}else{return 0}},PreviewAttach:function(d,c){var e=c.type+" "+Math.round(c.size/1024)+"KB";var f=true;var h;if(typeof window.createObjectURL!="undefined"){h=function(i,j){j(window.createObjectURL(i))}}else{if(typeof window.FileReader!="undefined"){h=function(j,k){var i=new FileReader();i.onload=function(l){k(i.result)};i.readAsDataURL(j)}}else{f=false}}var a=["image/png","image/jpeg","image/gif","image/svg+xml"];if($.inArray(c.type,a)==-1){f=false}var g=8*1024*1024;if(c.size>g){f=false}if(f){h(c,function(j){var i=$("<img>").attr("title",e).attr("alt",e).attr("src",j).attr("style","height: 120px");d.find(".attach-status").append(i)})}else{var b=$("<div></div>").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("data-api");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=$('<div class="'+SN.C.S.Success+' geo_status_wrapper"><button class="close" style="float:right">&#215;</button><div class="geo_status"></div></div>');h.find("button.close").click(function(){e.find("[name=notice_data-geo]").removeAttr("checked").change();return false});e.append(h)}var b;if(c){b=$("<a></a>").attr("href",c)}else{b=$("<span></span>")}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('<button class="close">&#215;</button>');$(".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(".vcard.author a.url").attr("href");if(d==c){if(a=="all"||a=="showstream"){return true}}}return false},switchInputFormTab:function(a){$(".input_form_nav_tab.current").removeClass("current");if(a=="placeholder"){$("#input_form_nav_status").addClass("current")}else{$("#input_form_nav_"+a).addClass("current")}$(".input_form.current").removeClass("current");$("#input_form_"+a).addClass("current").find(".ajax-notice").each(function(){var b=$(this);SN.Init.NoticeFormSetup(b)}).find("textarea:first").focus()}},Init:{NoticeForm:function(){if($("body.user_in").length>0){$("#input_form_placeholder input.placeholder").focus(function(){SN.U.switchInputFormTab("status")});$("body").bind("click",function(g){var d=$("#content .input_forms div.current");if(d.length>0){if($("#content .input_forms").has(g.target).length==0){var a=d.find('textarea, input[type=text], input[type=""]');var c=false;a.each(function(){c=c||$(this).val()});if(!c){SN.U.switchInputFormTab("placeholder")}}}var b=$("li.notice-reply");if(b.length>0){var f=$(g.target);b.each(function(){var j=$(this);if(j.has(g.target).length==0){var h=j.find(".notice_data-text:first");var i=$.trim(h.val());if(i==""||i==h.data("initialText")){var e=j.closest("li.notice");j.remove();e.find("li.notice-reply-placeholder").show()}}})}})}},NoticeFormSetup:function(a){if(!a.data("NoticeFormSetup")){SN.U.NoticeLocationAttach(a);SN.U.FormNoticeXHR(a);SN.U.FormNoticeEnhancements(a);SN.U.NoticeDataAttach(a);a.data("NoticeFormSetup",true)}},Notices:function(){if($("body.user_in").length>0){var a=$(".form_notice:first");if(a.length>0){SN.C.I.NoticeFormMaster=document._importNode(a[0],true)}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});$(".form_peopletag_subscribe").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_peopletag_unsubscribe").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_user_add_peopletag").live("click",function(){SN.U.FormXHR($(this));return false});$(".form_user_remove_peopletag").live("click",function(){SN.U.FormXHR($(this));return false});SN.U.NewDirectMessage()}},ProfileSearch:function(){if($("body.user_in").length>0){$(".form_peopletag_edit_user_search input.submit").live("click",function(){SN.U.FormProfileSearchXHR($(this).parents("form"));return false})}},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})},PeopletagAutocomplete:function(){$(".form_tag_user #tags").tagInput({tags:SN.C.PtagACData,tagSeparator:" ",animate:false,formatLine:function(d,g,c,f){var a="<b>"+g.tag.substring(0,c.length)+"</b>"+g.tag.substring(c.length);var b=$("<div/>").addClass("mode-"+g.mode);b.append($("<div class='tagInputLineTag'>"+a+" <em class='privacy_mode'>"+g.mode+"</em></div>"));if(g.freq){b.append("<div class='tagInputLineFreq'>"+g.freq+"</div>")}return b}})},PeopleTags:function(){$(".user_profile_tags .editable").append($('<button class="peopletags_edit_button"/>'));$(".peopletags_edit_button").live("click",function(){var a=$(this).parents("dd").eq(0).find("form");if(typeof SN.C.PtagACData==="undefined"){$.getJSON(_peopletagAC+"?token="+$("#token").val(),function(b){SN.C.PtagACData=b;_loadTagInput(SN.Init.PeopletagAutocomplete)})}else{_loadTagInput(SN.Init.PeopletagAutocomplete)}$(this).parents("ul").eq(0).fadeOut(200,function(){a.fadeIn(200).find("input#tags")})});$(".user_profile_tags form .submit").live("click",function(){SN.U.FormPeopletagsXHR($(this).parents("form"));return false})},AjaxForms:function(){$("form.ajax").live("submit",function(){SN.U.FormXHR($(this));return false});$("form.ajax input[type=submit]").live("click",function(){var a=$(this);var b=a.closest("form");b.find(".hidden-submit-button").remove();$('<input class="hidden-submit-button" type="hidden" />').attr("name",a.attr("name")).val(a.val()).appendTo(b)})},UploadForms:function(){$("input[type=file]").change(function(d){if(typeof this.files=="object"&&this.files.length>0){var c=0;for(var b=0;b<this.files.length;b++){c+=this.files[b].size}var a=SN.U.maxFileSize($(this.form));if(a>0&&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.AjaxForms();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($("#profile_search_results").length>0){SN.Init.ProfileSearch()}if($(".user_profile_tags .editable").length>0){SN.Init.PeopleTags()}});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;c<b;){if(e.attributes[c].nodeName=="class"){d.className=e.getAttribute(e.attributes[c++].nodeName)}else{d.setAttribute(e.attributes[c].nodeName,e.getAttribute(e.attributes[c++].nodeName))}}}if(a&&e.childNodes&&e.childNodes.length>0){for(var c=0,b=e.childNodes.length;c<b;){d.appendChild(document._importNode(e.childNodes[c++],a))}}return d;break;case document.TEXT_NODE:case document.CDATA_SECTION_NODE:case document.COMMENT_NODE:return document.createTextNode(e.nodeValue);break}};if(typeof navigator.geolocation=="undefined"||navigator.geolocation.shim){(function(){(function(){if(window.google&&google.gears){return}var c=null;if(typeof GearsFactory!="undefined"){c=new GearsFactory()}else{try{c=new ActiveXObject("Gears.Factory");if(c.getBuildInfo().indexOf("ie_mobile")!=-1){c.privateSetGlobalObject(this)}}catch(d){if((typeof navigator.mimeTypes!="undefined")&&navigator.mimeTypes["application/x-googlegears"]){c=document.createElement("object");c.style.display="none";c.width=0;c.height=0;c.type="application/x-googlegears";document.documentElement.appendChild(c)}}}if(!c){return}if(!window.google){google={}}if(!google.gears){google.gears={factory:c}}})();var a=(function(){var d=google.gears.factory.create("beta.geolocation");var c=function(f,e){return function(g){f(g);e.lastPosition=g}};return{shim:true,type:"Gears",lastPosition:null,getCurrentPosition:function(e,g,h){var f=this;var i=c(e,f);d.getCurrentPosition(i,g,h)},watchPosition:function(e,f,g){d.watchPosition(e,f,g)},clearWatch:function(e){d.clearWatch(e)},getPermission:function(g,e,f){d.getPermission(g,e,f)}}});var b=(function(){var i=false;var e=function(){if(!d()&&!i){i=true;var j=document.createElement("script");j.src=(document.location.protocol=="https:"?"https://":"http://")+"www.google.com/jsapi?callback=_google_loader_apiLoaded";j.type="text/javascript";document.getElementsByTagName("body")[0].appendChild(j)}};var c=[];var h=function(j){c.push(j)};var f=function(){if(d()){while(c.length>0){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()})()};
Simple merge
diff --cc lib/action.php
Simple merge
Simple merge
diff --cc lib/command.php
Simple merge
diff --cc lib/default.php
Simple merge
index 4b99d296a205a89107dee681264dca785a074794,d85b99f5c87282a08acba33c028358d213818b60..f9aeb71a1081871e2f776a322d507db389cef0dd
@@@ -46,10 -46,9 +46,10 @@@ define('NOTICE_INBOX_SOURCE_SUB', 1)
  define('NOTICE_INBOX_SOURCE_GROUP', 2);
  define('NOTICE_INBOX_SOURCE_REPLY', 3);
  define('NOTICE_INBOX_SOURCE_FORWARD', 4);
 +define('NOTICE_INBOX_SOURCE_PROFILE_TAG', 5);
  define('NOTICE_INBOX_SOURCE_GATEWAY', -1);
  
# append our extlib dir as the last-resort place to find libs
// append our extlib dir as the last-resort place to find libs
  
  set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR . '/extlib/');
  
diff --cc lib/router.php
index 7f8752e885af17ab08dbfc5f16c43daa2365c3a7,6533e24e57ff672b578e23057e9bfdda775e4f53..a155c523724cf4c1d573bee5ffcf27036f5e908c
@@@ -963,77 -904,10 +968,80 @@@ class Route
                                  array('action' => $a),
                                  array('nickname' => Nickname::DISPLAY_FMT));
                  }
+                 $m->connect(':nickname/subscribers/pending',
+                             array('action' => 'subqueue'),
+                             array('nickname' => Nickname::DISPLAY_FMT));
  
 +                // people tags
 +
 +                $m->connect('peopletags', array('action' => 'publicpeopletagcloud'));
 +
 +                $m->connect('peopletag/:tag', array('action' => 'peopletag',
 +                                                    'tag'    => self::REGEX_TAG));
 +
 +                $m->connect('selftag/:tag', array('action' => 'selftag',
 +                                                  'tag'    => self::REGEX_TAG));
 +
 +                $m->connect('main/addpeopletag', array('action' => 'addpeopletag'));
 +
 +                $m->connect('main/removepeopletag', array('action' => 'removepeopletag'));
 +
 +                $m->connect('main/profilecompletion', array('action' => 'profilecompletion'));
 +
 +                $m->connect('main/peopletagautocomplete', array('action' => 'peopletagautocomplete'));
 +
 +                $m->connect(':nickname/peopletags',
 +                                array('action' => 'peopletagsbyuser',
 +                                      'nickname' => Nickname::DISPLAY_FMT));
 +
 +                $m->connect(':nickname/peopletags/private',
 +                                array('action' => 'peopletagsbyuser',
 +                                      'nickname' => Nickname::DISPLAY_FMT,
 +                                      'private' => 1));
 +
 +                $m->connect(':nickname/peopletags/public',
 +                                array('action' => 'peopletagsbyuser',
 +                                      'nickname' => Nickname::DISPLAY_FMT,
 +                                      'public' => 1));
 +
 +                $m->connect(':nickname/othertags',
 +                                array('action' => 'peopletagsforuser',
 +                                      'nickname' => Nickname::DISPLAY_FMT));
 +
 +                $m->connect(':nickname/peopletagsubscriptions',
 +                                array('action' => 'peopletagsubscriptions',
 +                                      'nickname' => Nickname::DISPLAY_FMT));
 +
 +                $m->connect(':tagger/all/:tag/subscribers',
 +                                array('action' => 'peopletagsubscribers',
 +                                      'tagger' => Nickname::DISPLAY_FMT,
 +                                      'tag' => self::REGEX_TAG));
 +
 +                $m->connect(':tagger/all/:tag/tagged',
 +                                array('action' => 'peopletagged',
 +                                      'tagger' => Nickname::DISPLAY_FMT,
 +                                      'tag' => self::REGEX_TAG));
 +
 +                $m->connect(':tagger/all/:tag/edit',
 +                                array('action' => 'editpeopletag',
 +                                      'tagger' => Nickname::DISPLAY_FMT,
 +                                      'tag' => self::REGEX_TAG));
 +
 +                foreach(array('subscribe', 'unsubscribe') as $v) {
 +                    $m->connect('peopletag/:id/'.$v,
 +                                    array('action' => $v.'peopletag',
 +                                          'id' => '[0-9]{1,64}'));
 +                }
 +                $m->connect('user/:tagger_id/profiletag/:id/id',
 +                                array('action' => 'profiletagbyid',
 +                                      'tagger_id' => '[0-9]+',
 +                                      'id' => '[0-9]+'));
 +
 +                $m->connect(':tagger/all/:tag',
 +                                array('action' => 'showprofiletag',
 +                                      'tagger' => Nickname::DISPLAY_FMT,
 +                                      'tag' => self::REGEX_TAG));
 +
                  foreach (array('subscriptions', 'subscribers') as $a) {
                      $m->connect(':nickname/'.$a.'/:tag',
                                  array('action' => $a),
index 0227e1fb5ed96b9c73a904356ce57c4fb883584a,bd03fe3e4508d330be063af3c7da44077e87743c..75c9a71c7ba176f4b03e8d83cdd570bb57aaefa7
@@@ -104,19 -127,13 +127,22 @@@ class SubGroupNav extends Men
                                           $this->user->nickname),
                                   $action == 'usergroups',
                                   'nav_usergroups');
 +            $this->out->menuItem(common_local_url('peopletagsbyuser',
 +                                                  array('nickname' =>
 +                                                        $this->user->nickname)),
 +                                 _('People tags'),
 +                                 sprintf(_('People tags by %s'),
 +                                         $this->user->nickname),
 +                                 in_array($action, array('peopletagsbyuser', 'peopletagsforuser')),
 +                                 'nav_timeline_peopletags');
 +
              if (common_config('invite', 'enabled') && !is_null($cur) && $this->user->id === $cur->id) {
                  $this->out->menuItem(common_local_url('invite'),
-                                      _('Invite'),
-                                      sprintf(_('Invite friends and colleagues to join you on %s'),
+                                      // TRANS: Menu item in local navigation menu.
+                                      _m('MENU','Invite'),
+                                      // TRANS: Menu item title in local navigation menu.
+                                      // TRANS: %s is a user nickname.
+                                      sprintf(_('Invite friends and colleagues to join you on %s.'),
                                               common_config('site', 'name')),
                                       $action == 'invite',
                                       'nav_invite');
diff --cc lib/util.php
Simple merge
Simple merge
Simple merge