/** Source: jquery.json-2.2.min.js **/
(function($){$.toJSON=function(o){if(typeof(JSON)=='object'&&JSON.stringify)return JSON.stringify(o);var type=typeof(o);if(o===null)return"null";if(type=="undefined")return undefined;if(type=="number"||type=="boolean")return o+"";if(type=="string")return $.quoteString(o);if(type=='object'){if(typeof o.toJSON=="function")return $.toJSON(o.toJSON());if(o.constructor===Date){var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+hours+':'+minutes+':'+seconds+'.'+milli+'Z"'}if(o.constructor===Array){var ret=[];for(var i=0;i<o.length;i++)ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]"}var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")name='"'+k+'"';else if(type=="string")name=$.quoteString(k);else continue;if(typeof o[k]=="function")continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val)}return"{"+pairs.join(", ")+"}"}};$.evalJSON=function(src){if(typeof(JSON)=='object'&&JSON.parse)return JSON.parse(src);return eval("("+src+")")};$.secureEvalJSON=function(src){if(typeof(JSON)=='object'&&JSON.parse)return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))return eval("("+src+")");else throw new SyntaxError("Error parsing JSON, source is not valid.")};$.quoteString=function(string){if(string.match(_escapeable)){return'"'+string.replace(_escapeable,function(a){var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"'}return'"'+string+'"'};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'}})(jQuery);

/** Source: code.min.js **/
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};function Filter(cfg){var _0={allow:null,deny:null};$.extend(_0,cfg);function _1(which,element){if(_0[which]==null){return false}var filter_has_matched=false;$.each(_0[which],function(outer,filter_set){var first_filter_check=true;var filter_set_length=filter_set.length;$.each(filter_set,function(index,filter_check){$.each(filter_check,function(filter_key,filter_match){var key_parts=filter_key.split('/');var filter_target=element[key_parts.shift()];if(typeof filter_target=='undefined'){throw filter_key+' does not match a path'}while(key_parts.length>0){filter_target=filter_target[key_parts.shift()];if(typeof filter_target=='undefined'){throw filter_key+' does not match a path'}}var expr=new RegExp(filter_match,'i');if(first_filter_check){filter_has_matched=filter_target.match(expr)!=null;first_filter_check=false}else{filter_has_matched=filter_has_matched&&(filter_target.match(expr)!=null)}});if(filter_has_matched&&index==filter_set_length-1){return false}});if(filter_has_matched){return false}});return filter_has_matched}return{test:function(){var me=this;try{$('.twitter_status').removeClass('filtered').each(function(index,value){var v=$(value);var data=v.data();if(me.filter(data)){v.addClass('filtered')}})}catch(e){$('.twitter_status').removeClass('filtered');alert(e)}},filter:function(node){var allow=_1('allow',node);var deny=_1('deny',node);return(!allow&&deny)},stringify:function(which){if(_0[which]==null){return which=='allow'?'any that are not explicitly denied':'none'}var filter=Array();$.each(_0[which],function(rule_num,value){var filter_set=Array();$.each(value,function(index,value){$.each(value,function(key,value){key=key=='user/screen_name'?'screen name':key;prefix='contains';if(value.match(/^\^.*\$/)){prefix='is exactly'}else if(value.match(/^\^/)){prefix='begins with'}else if(value.match(/\$/)){prefix='ends with'}filter_set[filter_set.length]='where '+key+' '+prefix+' '+value.replace(/^\^/,'').replace(/\$/,'')})});filter[filter.length]='<div class="filter_set">'+filter_set.join(' AND ')+'<a href="#" class="delete" title="Delete this rule"> </a></div>'});return filter.join('')},add:function(which,rule_set){if(_0[which]==null){_0[which]=Array()}_0[which][_0[which].length]=rule_set},del:function(which,index){if(_0[which][index]){_0[which].splice(index,1)}},fromJSON:function(which,content){try{_0[which]=$.parseJSON(content)}catch(e){alert('Unable to parse the '+name+' filter rules: '+e);throw e}},toJSON:function(which){var txt=$.toJSON(_0[which]);if(txt=='null'){return''}return txt}}}$(document).ready(function(){$.getScript('http://widgets.digg.com/buttons.js');$('.TweetMeMe').replaceWith('<iframe src="http://api.tweetmeme.com/button.js?url=http%3A%2F%2Fwww.neatweet.net&style=normal&source=Fremnet&service=bit.ly" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height: 61px;" allowTransparency="true"></iframe>');$('.StumbleUpon').replaceWith('<iframe src="http://www.stumbleupon.com/badge/embed/5/?url=http%3A%2F%2Fwww.neatweet.net" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height: 60px;" allowTransparency="true"></iframe>');if($('#allow').length==1){var filter=new Filter({allow:$.parseJSON($('#allow').val()),deny:$.parseJSON($('#deny').val())});$('div.deny').html(filter.stringify('deny'));$('div.allow').html(filter.stringify('allow'));$.ajax({url:'/feeds/friends',dataType:'json',complete:function(request,status){filter.test();$('.loader').hide('slow');$('#friends_feed .feed').show('slow')},error:function(request,status,error){console.log('Ajax error: '+status+' - '+error)},success:function(data,status,request){$.each(data,function(index,value){var element='<div class="twitter_status" id="ts_'+value.id+'">'+'<div class="screen_name">'+value.user.screen_name+'</div>'+'<div class="status">'+value.text+'</div>'+'<div class="source">'+value.source+'</div>';$('#friends_feed .feed').append(element);$('#ts_'+value.id).data(value)})}});$('#test_filter').click(function(){filter.fromJSON('allow',$('#allow').val());filter.fromJSON('deny',$('#deny').val());filter.test()});$('#save_filter').click(function(){if($('.tabs .selected').first().text().match(/Simple/)){$('#allow').val(filter.toJSON('allow'));$('#deny').val(filter.toJSON('deny'))}$('#filter_form').submit()});$('input[name=name]').keyup(function(){$('#save_filter')[0].disabled=this.value.length==0});$('input[name=name]').keyup();$('form.advanced_mode').submit(function(){try{filter.fromJSON('allow',$('#allow').val());filter.fromJSON('deny',$('#deny').val());$('#name').val($('input[name=name]').val());$('#substname').val($('input[name=substname]:checked').val());if($('#name').val().trim()==''){alert('Please provide a name for this filter')}else{return true}}catch(e){}return false});$('.twitter_status').live('click',function(){var data=$(this).data();$('span.simple_screen_name').text(data.user.screen_name);$('span.simple_source').text(data.source.replace(/<[^>]+>/g,''));$('span.simple_text').text(data.text);$('#simple_step_2 input[type=checkbox]').each(function(){this.checked=false});$('.simple_step').hide('fast');$('#simple_step_2').show('fast')});$('.filter_set a.delete').live('click',function(){var r=$(this).closest('div');var index=r.prevAll('div').length;var which=r.parent('div').hasClass('deny')?'deny':'allow';filter.del(which,index);r.remove();filter.test()});$('.simple_next').click(function(){$('#simple_step_2 input[type=checkbox]').each(function(){if(this.checked){$('#simple_step_3 [name='+this.name+']').val($('span.'+this.name).text());$('#simple_step_3 .'+this.name).show()}else{$('#simple_step_3 [name='+this.name+']').val('');$('#simple_step_3 .'+this.name).hide()}});$('.simple_step').hide('fast');$('#simple_step_3').show('fast')});$('.simple_add').click(function(){var rule={};var s=$('#simple_step_3');s.find('div:visible').each(function(){var input=$(this).find('input,textarea')[0];var name=input.name;var modifier=s.find('[name='+name+'_2]').length>0?s.find('[name='+name+'_2]').val():'';rule[(name=='simple_screen_name'?'user/screen_name':(name=='simple_source'?'source':'text'))]=(modifier.match('b')?'^':'')+$(input).val().replace('^','\\^').replace('$','\\$')+(modifier.match('e')?'$':'')});if(this.value.match('Allow')){filter.add('allow',Array(rule));$('div.allow').html(filter.stringify('allow'))}else{filter.add('deny',Array(rule));$('div.deny').html(filter.stringify('deny'))}filter.test();s.find('select').each(function(){this.selectedIndex=0});$('.simple_step').hide('fast');$('#simple_step_1').show()});$('.tabs a').click(function(){var selected=$('.tabs .selected');$('.tabs a').removeClass('selected');$('.editor .mode').hide();$(this).addClass('selected');if($(this).text().match(/Simple/)){if(selected.text().match(/Raw/)){$('#test_filter').click()}$('.simple').show();$('div.allow').html(filter.stringify('allow'));$('div.deny').html(filter.stringify('deny'))}else{$('.raw').show();$('#allow').val(filter.toJSON('allow'));$('#deny').val(filter.toJSON('deny'))}})}$('a[href=/login]').click(function(){$(this).html('Logging in via twitter').prev('img').show()})});


