craig 0.0.1.pre → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. data/README.md +165 -28
  2. data/Rakefile +7 -0
  3. data/craig.gemspec +2 -2
  4. data/lib/craig/categories.rb +169 -0
  5. data/lib/craig/cities.rb +262 -0
  6. data/lib/craig/craigslist.rb +49 -0
  7. data/lib/craig/listing.rb +73 -0
  8. data/lib/craig/node.rb +151 -0
  9. data/lib/craig/page.rb +50 -0
  10. data/lib/craig/tasks/update_cities.rb +95 -0
  11. data/lib/craig/version.rb +1 -1
  12. data/lib/craig.rb +24 -1
  13. data/test/community_events_test.rb +56 -0
  14. data/test/for_sale_cars_trucks_test.rb +38 -0
  15. data/test/for_sale_photo_video_test.rb +24 -0
  16. data/test/parsing_test.rb +119 -0
  17. data/test/personals_casual_encounters_test.rb +36 -0
  18. data/test/resumes_test.rb +24 -0
  19. data/test/sample_html/community_event-one-page_files/craigslist.css +1487 -0
  20. data/test/sample_html/community_event-one-page_files/formats.js +100 -0
  21. data/test/sample_html/community_event-one-page_files/jquery-1.7.2.js +632 -0
  22. data/test/sample_html/community_event-one-page_files/jquery.form-defaults.js +2 -0
  23. data/test/sample_html/community_event-one-page_files/toChecklist.js +47 -0
  24. data/test/sample_html/community_event-one-page_files/tocs.js +30 -0
  25. data/test/sample_html/community_events-one-page.html +294 -0
  26. data/test/sample_html/community_events.html +1077 -0
  27. data/test/sample_html/community_events_files/craigslist.css +1487 -0
  28. data/test/sample_html/community_events_files/formats.js +100 -0
  29. data/test/sample_html/community_events_files/jquery-1.7.2.js +632 -0
  30. data/test/sample_html/community_events_files/jquery-1.js +632 -0
  31. data/test/sample_html/community_events_files/jquery.form-defaults.js +2 -0
  32. data/test/sample_html/community_events_files/jquery.js +2 -0
  33. data/test/sample_html/community_events_files/toChecklist.js +47 -0
  34. data/test/sample_html/community_events_files/tocs.js +30 -0
  35. data/test/sample_html/for_sale.html +1478 -0
  36. data/test/sample_html/for_sale_cars_trucks.html +1483 -0
  37. data/test/sample_html/for_sale_cars_trucks_files/craigslist.css +1487 -0
  38. data/test/sample_html/for_sale_cars_trucks_files/formats.js +100 -0
  39. data/test/sample_html/for_sale_cars_trucks_files/jquery-1.7.2.js +632 -0
  40. data/test/sample_html/for_sale_cars_trucks_files/jquery.form-defaults.js +2 -0
  41. data/test/sample_html/for_sale_cars_trucks_files/toChecklist.js +47 -0
  42. data/test/sample_html/for_sale_cars_trucks_files/tocs.js +30 -0
  43. data/test/sample_html/for_sale_files/craigslist.css +1474 -0
  44. data/test/sample_html/for_sale_files/formats.js +107 -0
  45. data/test/sample_html/for_sale_files/jquery-1.js +632 -0
  46. data/test/sample_html/for_sale_files/jquery.js +2 -0
  47. data/test/sample_html/for_sale_files/toChecklist.js +47 -0
  48. data/test/sample_html/for_sale_files/tocs.js +30 -0
  49. data/test/sample_html/for_sale_photo_video.html +674 -0
  50. data/test/sample_html/for_sale_photo_video_files/craigslist.css +1487 -0
  51. data/test/sample_html/for_sale_photo_video_files/formats.js +100 -0
  52. data/test/sample_html/for_sale_photo_video_files/jquery-1.7.2.js +632 -0
  53. data/test/sample_html/for_sale_photo_video_files/jquery.form-defaults.js +2 -0
  54. data/test/sample_html/for_sale_photo_video_files/toChecklist.js +47 -0
  55. data/test/sample_html/for_sale_photo_video_files/tocs.js +30 -0
  56. data/test/sample_html/gigs.html +1047 -0
  57. data/test/sample_html/gigs_files/craigslist.css +1474 -0
  58. data/test/sample_html/gigs_files/formats.js +107 -0
  59. data/test/sample_html/gigs_files/jquery-1.js +632 -0
  60. data/test/sample_html/gigs_files/jquery.js +2 -0
  61. data/test/sample_html/gigs_files/toChecklist.js +47 -0
  62. data/test/sample_html/gigs_files/tocs.js +30 -0
  63. data/test/sample_html/housing.html +1406 -0
  64. data/test/sample_html/housing_vacation_rentals_files/craigslist.css +1474 -0
  65. data/test/sample_html/housing_vacation_rentals_files/formats.js +107 -0
  66. data/test/sample_html/housing_vacation_rentals_files/jquery-1.7.2.js +632 -0
  67. data/test/sample_html/housing_vacation_rentals_files/jquery.form-defaults.js +2 -0
  68. data/test/sample_html/housing_vacation_rentals_files/toChecklist.js +47 -0
  69. data/test/sample_html/housing_vacation_rentals_files/tocs.js +30 -0
  70. data/test/sample_html/jobs.html +1120 -0
  71. data/test/sample_html/jobs_files/craigslist.css +1474 -0
  72. data/test/sample_html/jobs_files/formats.js +107 -0
  73. data/test/sample_html/jobs_files/jquery-1.js +632 -0
  74. data/test/sample_html/jobs_files/jquery.js +2 -0
  75. data/test/sample_html/jobs_files/toChecklist.js +47 -0
  76. data/test/sample_html/jobs_files/tocs.js +30 -0
  77. data/test/sample_html/personals.html +1096 -0
  78. data/test/sample_html/personals_casual_encounters.html +1086 -0
  79. data/test/sample_html/personals_casual_encounters_files/craigslist.css +1487 -0
  80. data/test/sample_html/personals_casual_encounters_files/formats.js +100 -0
  81. data/test/sample_html/personals_casual_encounters_files/jquery-1.7.2.js +632 -0
  82. data/test/sample_html/personals_casual_encounters_files/jquery.form-defaults.js +2 -0
  83. data/test/sample_html/personals_casual_encounters_files/toChecklist.js +47 -0
  84. data/test/sample_html/personals_casual_encounters_files/tocs.js +30 -0
  85. data/test/sample_html/personals_strictly_platonic_files/craigslist.css +1474 -0
  86. data/test/sample_html/personals_strictly_platonic_files/formats.js +107 -0
  87. data/test/sample_html/personals_strictly_platonic_files/jquery-1.js +632 -0
  88. data/test/sample_html/personals_strictly_platonic_files/jquery.js +2 -0
  89. data/test/sample_html/personals_strictly_platonic_files/toChecklist.js +47 -0
  90. data/test/sample_html/personals_strictly_platonic_files/tocs.js +30 -0
  91. data/test/sample_html/resumes.html +811 -0
  92. data/test/sample_html/resumes_files/craigslist.css +1487 -0
  93. data/test/sample_html/resumes_files/formats.js +100 -0
  94. data/test/sample_html/resumes_files/jquery-1.7.2.js +632 -0
  95. data/test/sample_html/resumes_files/jquery.form-defaults.js +2 -0
  96. data/test/sample_html/resumes_files/toChecklist.js +47 -0
  97. data/test/sample_html/resumes_files/tocs.js +30 -0
  98. data/test/sample_html/services.html +1096 -0
  99. data/test/sample_html/services_files/craigslist.css +1487 -0
  100. data/test/sample_html/services_files/formats.js +100 -0
  101. data/test/sample_html/services_files/jquery-1.7.2.js +632 -0
  102. data/test/sample_html/services_files/jquery.form-defaults.js +2 -0
  103. data/test/sample_html/services_files/toChecklist.js +47 -0
  104. data/test/sample_html/services_files/tocs.js +30 -0
  105. data/test/sample_html/test.rb +309 -0
  106. data/test/services_test.rb +25 -0
  107. data/test/test_helper.rb +26 -0
  108. metadata +205 -9
@@ -0,0 +1,100 @@
1
+ $(document).ready(function(){formats_autosize(pagetype);});function get_domain(hostname){var m=((hostname||'')+'').match(/craigslist.[\w.]+$/);return m?m[0]:null;}
2
+ function extract_posting_id(text){var m=((text||'')+'').match(/[\d]+/);return m?m[0]:null;}
3
+ function formats_autosize(pagetype){var mode=get_format_cookie();var offerformats=0;if(mode==='auto'){mode=autodetect_format();}
4
+ if((mode==='mobile')||(mode==='tablet')){viewport=document.querySelector("meta[name=viewport]");viewport.setAttribute('content','width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;');}
5
+ else if(mode==='none'){if((navigator.userAgent.indexOf('Android')!=-1)||(navigator.userAgent.indexOf('Mobile')!=-1)){offerformats=1;}}
6
+ if(mode==='none'){mode='regular';}
7
+ if(pagetype==='homepage'){homepage_autosize(mode);}
8
+ if(pagetype==='tocs'){tocs_autosize(mode);}
9
+ if(pagetype==='posting'){posting_autosize(mode);}
10
+ if(pagetype==='post'){post_autosize(mode);}
11
+ if(pagetype==='simple'){simple_autosize(mode);}
12
+ if(pagetype==='login'){login_autosize(mode);}
13
+ if(pagetype==='interstitial'){interstitial_autosize(mode);}
14
+ if(pagetype==='sites'){sites_autosize(mode);}
15
+ if(pagetype==='account'){account_autosize(mode);}
16
+ if(offerformats&&(pagetype==='homepage')){$('body').prepend('<ul id="fmtsel">'+
17
+ '<li><b>want to try our new mobile-friendly layout?&nbsp;</b></li>'+
18
+ '<li class="fsel" id="fmtsel_mobile" title="format suitable for phones and small mobile devices">yes</li>'+
19
+ '<li class="fsel" id="fmtsel_regular">no</li>'+
20
+ '</ul>');update_format_selector('none');}
21
+ return false;}
22
+ function autodetect_format(){var mode='regular';var xdim=window.innerWidth;var ydim=window.innerHeight;if(ydim>=1440){mode='super';}
23
+ if(xdim<=480){mode='mobile';}
24
+ return mode;}
25
+ function get_format_cookie(){var mode='none';var C=document.cookie.split(';');for(i=0;i<C.length;i++){var c=$.trim(C[i]);if(c.indexOf('cl_fmt=')===0){mode=c.substring(7);}}
26
+ return mode;}
27
+ function issue_format_cookie(format){var date=new Date();var domain=get_domain(document.location.hostname);date.setTime(date.getTime()+(365*24*60*60*1000));document.cookie='cl_fmt='+format+
28
+ '; domain='+domain+'; expires='+
29
+ date.toGMTString()+'; path=/';window.location.href=window.location.href;}
30
+ function append_format_selector(obj){var selector='<ul id="fmtsel">'+
31
+ '<li><b>FORMAT:</b></li>'+
32
+ '<li class="fsel" id="fmtsel_mobile" title="format suitable for phones and small mobile devices">mobile</li>'+
33
+ '<li class="fsel" id="fmtsel_regular">regular</li>'+
34
+ '</ul>';obj.append(selector);var mode=get_format_cookie();update_format_selector(mode);}
35
+ function update_format_selector(mode){var currFmt=$('#fmtsel_'+mode);$('#fmtsel .fsel').addClass('a');currFmt.removeClass('a');$('#fmtsel .fsel.a').click(function(){var myFmt=$(this).attr('id').replace('fmtsel_','');issue_format_cookie(myFmt);});$('#fmtsel_'+mode).unbind('click');}
36
+ function homepage_autosize(mode){if(mode==='mobile'){homepage_size_mobile();}
37
+ append_format_selector($('body'));}
38
+ function build_sorted_cat_list(obj,catabbr,catname){$('#'+catabbr).appendTo('body');var catlist=[];$('#'+catabbr+'0>li>a,#'+catabbr+'1>li>a').each(function(){catlist.push($(this).html());});catlist=catlist.sort();var excludePattern=/^\[/;for(var i=0;i<catlist.length;i++){$('#'+catabbr+'0>li,#'+catabbr+'1>li').filter(function(){if($(this).find('a').html().match(excludePattern)){return false;}
39
+ return!($(this).find('a').html()===catlist[i]);}).prependTo('#'+catabbr+'0');}
40
+ $('#'+catabbr+' .cats').hide();$('#'+catabbr+'0>li').first().clone().prependTo('#'+catabbr+'0');var allHref=$('#'+catabbr+' .ban a').attr('href');$('#'+catabbr+'0>li>a').first().attr('href',allHref);$('#'+catabbr+'0>li>a').first().html('all '+catname);$('#'+catabbr+' .ban a').click(function(e){e.preventDefault();this.href='#';$('#'+catabbr+' .cats').slideToggle();});}
41
+ function homepage_size_mobile(){$('body').removeClass('tablet').addClass('mobile');$('#topban').appendTo('body');$('.sublinks').appendTo('body');$('#rightbar').appendTo('body');var areaText=$('#topban h2').first().html();$('#topban a').first().hide();$('#topban h2').first().html('<a href="#">'+areaText+'</a>');$('#topban h2 a').prepend('CL > ');$('#topban h2 a').first().click(function(e){$(this).css('background','#eee');e.preventDefault();$('#rightbar').slideToggle();$('.sublinks').slideToggle();});$('#search').appendTo('body');$('#search>div:first').hide();$('#postlks').appendTo('body');build_sorted_cat_list($(this),'sss','for sale');build_sorted_cat_list($(this),'jjj','jobs');build_sorted_cat_list($(this),'hhh','housing');build_sorted_cat_list($(this),'ppp','personals');$('#ppp0>li').first().remove();$('#ppp .ban').html('<a href="#">personals</a>');$('#ppp .ban a').click(function(e){e.preventDefault();this.href='#';$('#ppp .cats').slideToggle();});build_sorted_cat_list($(this),'ccc','community');build_sorted_cat_list($(this),'bbb','services');build_sorted_cat_list($(this),'ggg','gigs');$('#res').appendTo('body');$('#forums').appendTo('body');$('body').append('<br>');$('.cal').appendTo('body');$('.cal').before('<h4 class="ban" id="calban"><a href="#">'+
42
+ $('#calttl a').html()+'</a></h4>');$('#calban').click(function(e){e.preventDefault();$('.cal').slideToggle();});$('#leftlinks').appendTo('body');$('body').append('<br><hr>');if($('.container').html()===null){$('#copy').appendTo('body');}
43
+ return false;}
44
+ function tocs_autosize(mode){if(mode==='mobile'){tocs_autosize_init();tocs_size_mobile();append_format_selector($('body'));return false;}
45
+ $('.itemcg').each(function(){$(this).click(function(e){e.preventDefault();var catAbbr=$(this).attr('title');flipCatAndSubmit(catAbbr);});});}
46
+ function tocs_autosize_init(){$('body').children().hide();return false;}
47
+ function tocs_size_mobile(){$(window).bind('orientationchange',function(){$('body').css('width','100%');});showImgs();build_tocs_searchform();build_tocs_messages();build_tocs_results();$('#copy').appendTo('body');$('#copy').css({'font-size':'9px','width':'100%','float':'right'});$('body').children().wrapAll('<div id="todos" />');$('#todos').css({'margin':'0','padding':'0'});return false;}
48
+ function tocs_orientation_flip_portrait(){$('#tocsright').appendTo('body');$('#tocsleft').css({'width':'100%','height':'40%','border-bottom':'4px solid #888'});$('#tocsright').css({'width':'100%','height':'59%'});$('.searchhead').css({'width':'100%'});}
49
+ function tocs_orientation_flip_landscape(){$('#tocsleft').appendTo('body');$('#tocsleft').css({'width':'40%','height':'100%','border-bottom':'0px'});$('#tocsright').css({'width':'59%','height':'100%'});$('.searchhead').css({'width':'40%'});}
50
+ function reformat_posting_images(obj){var imagesDiv=obj.find('.imagehole');var mainImg=obj.find('#iwi');if(mainImg.length){if(obj.find('#thumbs').html()===null){obj.find('.iw').css('width','100%');obj.find('#ci').css({'width':'100%','border':'0px','margin':'0px'});var imgHref=mainImg.attr('src');imagesDiv.append('<a href="'+imgHref+'"><img class="postingimg" width="100%" src="'+imgHref+'"></a><br>');mainImg.remove();}else{obj.find('.iw').hide();obj.find('#thumbs a').each(function(){var imgHref=$(this).attr('href');imagesDiv.append('<a href="'+imgHref+'"><img class="postingimg" width="100%" src="'+imgHref+'"></a><br>');});}}
51
+ obj.find('#userbody img').css('width','100%');}
52
+ function build_tocs_searchform(){$('body').prepend('<div class="searchhead"></div>');$('body').css('margin','0');$('.searchhead').css({'background-color':'#fff','width':'100%','margin-top':'4px'});$('.bchead>a').css({'width':'100%','background-color':'#fff'});$('.bchead>span').remove();$('.bchead').css('display','inline');$('.bchead>#satabs').hide();$('.bchead').appendTo('.searchhead');$('.bchead').css({'font-size':'10px','background-color':'#fff','border':'0px','width':'100%'});$('.bchead a,.bchead b').css('font-size','16px');$('#searchform').appendTo('.searchhead');$('#searchform').css({'width':'100%','margin-top':'10px','background-color':'#fff'});$('#query').prependTo('#searchfieldset');$('#searchfieldset').css({'border-left':'0px','border-right':'0px','margin':'0px'});$('#searchfieldset').prepend('<a id="expandosearch" href="#">[+]</a>');$('#searchfieldset').append('<input id="topsubmit" type="submit" value="&gt;">');$('#searchlegend').prependTo('#searchfieldset');$('#searchfieldset>table').appendTo('#searchfieldset');$('#expandosearch').css({'text-decoration':'none','font-size':'20px'});$('#expandosearch').bind('click',function(event){event.preventDefault();if($('#expandosearch').html()==='[+]'){$('#expandosearch').html('[&ndash;]');}else{$('#expandosearch').html('[+]');}
53
+ $('#searchtable').slideToggle();});$('#searchlegend').css('font-size','10px');$('#searchlegend a').css('font-size','14px');$('#searchtable').css({'width':'100%','display':'none','font-size':'12px'});$('#searchtable td').first().hide();$('#searchtable tr td').each(function(){var tr=$('<tr></tr>').insertAfter($(this));tr.append(this);});$('#searchtable').append('<tr><td id="searchtd" width="100%"></td></tr>');$('#searchtable tr td').css('text-align','left');$('#searchtable :submit').appendTo('#searchtd');$('#searchtable :submit').css('float','right');$('#searchtable input,select').css('font-size','12px');if($('#satabs').html()!=null){if($('#satabs b').html()===null){$('#searchtable tbody').prepend('<tr><td id="#sasel"><a href="#">'+
54
+ $('#satabs a:first').html()+'</a>:<div id="#saselli">'+
55
+ $('#satabs').html()+'</div></td></tr>');$('#searchtable>tbody>tr>td>div>a:first').hide();}else{$('#searchtable tbody').prepend('<tr><td id="#sasel"><a href="#">'+
56
+ $('#satabs b').html()+'</a>:<div id="#saselli">'+
57
+ $('#satabs').html()+'</div></td></tr>');$('#searchtable>tbody>tr>td>div>b').hide();}}
58
+ $('#searchtable>tbody>tr>td').css('font-size','16px');$('#searchtable>tbody>tr>td>div>a').css('font-size','16px');$('#searchtable>tbody>tr>td>div').hide();$('#searchtable>tbody>tr>td>div>a').after('<br>');$('#searchtable>tbody>tr>td>a').click(function(e){e.preventDefault();$('#searchtable>tbody>tr>td>div').slideToggle();});$('#query').css('display','inline');$('#query').prepend('<div id="searchquery">');$('#query').append('</div>');$('#query').attr('size','20');$('#query').css({'width':'80%','font-size':'20px'});}
59
+ function build_tocs_messages(){if($('#messagestable #messages').html()!=''){if($('.container').html()===null){$('body').append('<h4 id="warns">warnings, notices, useful links</h4>');}
60
+ $('#warns').css({'font-size':'10px','color':'#f00','padding':'1','margin':'2','background-color':'#ffc','cursor':'pointer'});$('#warns').click(function(e){e.preventDefault();$('#messagestable').slideToggle();});$('.modetabrow').appendTo('body');$('#messagestable').appendTo('body');$('#messagestable td span').append('<br>');$('#messagestable td span a').css('white-space','normal');$('#messages').css('text-align','left');}}
61
+ function expand_row_load_posting(obj){var clickHref=obj.find('a').attr('href');obj.children().filter('a').attr('href','#');obj.children().filter('a').click(function(e){e.preventDefault();});if(obj.next('div').css('display')!='none'){obj.next('div').slideToggle();obj.children().css('white-space','nowrap');obj.css({'background':'#fff','overflow':'hidden','padding':'0px','border':'0px','border':'2px solid #fff','border-bottom':'1px solid #eee'});obj.find('.itempp').css('left','0px');obj.find('.itemcg').css('padding-bottom','5px');return false;}
62
+ else{obj.next('div').slideToggle();obj.css('height',null);obj.css({'overflow':'visible','background':'#eee','border':'2px solid #80f','border-bottom':'1px solid #80f','padding':'2px'});obj.children().css('white-space','normal');obj.find('.itempp').css('left','4px');obj.find('.itemcg').css('padding-bottom','0px');if(obj.next('div').css('background-color')!='rgb(238, 238, 238)'){return false;}}
63
+ obj.next('div').load(clickHref+' .tsb,.dateReplyBar,#flags,#userbody,.postinginfo',function(){$.getScript('http://www.craigslist.org/js/postings.js',function(){pID=extract_posting_id($('.postinginfo').html());initFlag(extract_posting_id($('.postinginfo').html()));});$(this).find('.dateReplyBar').children('div,sup,#ef').remove();$(this).css('background','#ddd');$(this).children().hide();$(this).find('.dateReplyBar').before('<a href="'+clickHref+'" class="fullscrbtn">[+]</a>&nbsp;&nbsp;');$(this).find('.dateReplyBar').before('<a href="#" class="closebtn">[&ndash;]&nbsp;</a>');$(this).find('.closebtn').click(function(e){e.preventDefault();expand_row_load_posting($(this).parent().prev());return false;});$('.closebtn').css({'float':'right','text-decoration':'none','font-size':'20px'});$('.fullscrbtn').css({'float':'right','text-decoration':'none','font-size':'20px'});$(this).find('.postinginfo').first().appendTo('.dateReplyBar');$(this).find('.postinginfo').css('display','inline');$(this).find('.dateReplyBar').css({'display':'inline','font-size':'10px'});$(this).find('dateReplyBar').after('<br>');$(this).find('dateReplyBar').css({'display':'block','font-size':'10px'});$(this).find('dateReplyBar a').css({'font-size':'12px','align':'center'});$(this).find('dateReplyBar').after('<hr>');$(this).find('#userbody').css({'width':'100%','max-width':'100%','display':'inline','font-size':'14px'});$(this).append('<div width="100%" class="imagehole"></div>');$(this).find('#userbody .blurbs').appendTo($(this));$(this).find('.blurbs').css('font-size','10px');reformat_posting_images($(this));$(this).find('#flags').appendTo($(this));$(this).find('#flags').css({'display':'inline','font-size':'10px','margin-top':'2px','padding-top':'0px','border':'2px solid #80f','border-top':'0px','background':'#ddd'});$(this).find('#flags .fl').css('font-size','12px');});}
64
+ function build_tocs_results(){$('#nextpage').appendTo('body');if($('.container .row').html()){$('.container').appendTo('body');return;}
65
+ $('.row,.ban').appendTo('body');$('.ban').css({'padding':'0','margin-bottom':'8px','font-size':'10px'});$('.ban>span>a>b').css('font-size','18px');$('.row').css({'background-color':'#fff','margin':'0','margin-top':'4px','font-size':'10px','white-space':'normal','min-height':'4.4em','overflow':'hidden','border':'2px solid #fff','border-bottom':'1px solid #eee','white-space':'nowrap','vertical-align':'text-top','cursor':'pointer'});$('.row>a').css('font-size','22px');$('.row a').css({'text-decoration':'none'});$('.row font').css('font-size','10px');$('.row br.c').hide();$('.row .itempp').css({'z-index':'100','background':'#080','color':'#fff','font-weight':'bold','font-family':'sans-serif','border':'1px solid #fff','padding':'1px','margin-top':'3em','border-radius':'6px'});$('.row').each(function(){$(this).find('.i img').prependTo($(this));$(this).find('.itemsep').hide();$(this).find('.itemsep').last().html('<br>');$(this).find('.itemsep').last().css('display','inline');$(this).find('.itemcg').prependTo($(this).find('.itempn'));if($(this).find('.i').attr('id')===''){$(this).find('.i').css('display','inline');}else{$(this).find('.i').hide();}
66
+ if($(this).find('.itempp').html()===''){$(this).find('.itempp').hide();}else{$(this).find('.itempp').prependTo($(this));$(this).find('.itempp').css({'position':'absolute','left':'0px'});}});$('.row .i').css({'background':'#eee','height':'4.4em','width':'4.4em','margin-right':'1px','margin-top':'1px'});$('.row img').css({'float':'left','width':null,'height':'4.4em','vertical-align':'top','margin-right':'1px'});$('.row .itemdate').hide();$('.row .itemcg a').css('padding-bottom','5px');$('.row').click(function(e){e.preventDefault();expand_row_load_posting($(this));});$('.row').after('<div class="loadposting"><div class="pleasewait"><br><img src="http://www.craigslist.org/favicon.ico"><br>CL<br><img src="http://www.craigslist.org/favicon.ico"><br><br></div></div>');$('.loadposting').css({'display':'none','background':'#eee','border':'2px solid #80f','border-top':'0px','padding':'2px','overflow':'auto'});$('.pleasewait').css({'color':'#80f','font-size':'96px','width':'100%','text-align':'center'});$('#nextpage').clone().appendTo('body');$('#nextpage').css({'float':'right','margin-bottom':'2'});$('#nextpage a').css('text-decoration','none');$('#nextpage font').css('font-size','12px');}
67
+ function posting_autosize(mode){if(mode==='mobile'){posting_size_mobile();append_format_selector($('body'));}
68
+ }
69
+ function posting_size_mobile(){$('body').removeClass('tablet').addClass('mobile');$('.iw').after('<br clear="all">');$('.cltags').before($('#attributes'));}
70
+ function post_autosize(mode){if(mode==='mobile'){post_autosize_init();post_size_mobile();}
71
+ append_format_selector($('body'));}
72
+ function post_autosize_init(){return false;}
73
+ function post_size_mobile(){$('body').children().wrapAll('<div class="todos" />');$('.todos').css('width','100%');$('table#header').css({'font-size':'10px','background':'#eee','padding':'3px','font-family':'sans-serif','border-bottom':'2px #ccc solid','margin-bottom':'1em'});$('table#header').append('<tr></tr>');$('table#header a').css('font-size','14px');$('table#header td:last').appendTo('table#header tr:last');$('table#header td:last').css('text-align','center');$('table#header td:last a').css('white-space','nowrap');$('table#header td:last br').hide();$('table#header font').css('font-size','12px');$('table#header .highlight').css('float','none');$('table#header .highlight').children().css({'white-space':'normal','font-size':'8px'});$('hr').hide();$('.highlight').css({'font-size':'10px','margin':'0px','padding':'0px','width':'100%'});$('.highlight>ol').css({'background':'#ffc','margin':'0px'});$('.managestatus').css({'width':'100%','margin':'0px','padding':'0px'});$('.managestatus table').css({'width':'100%','font-size':'12px'});$('.managestatus a').css('font-size','14px');$('.managestatus a').prepend('<br>');$('.managestatus form').prepend('<br>');$('.managestatus table td').wrap('<tr />');$('blockquote').css({'margin':'8px','font-size':'20px'});$('blockquote>i').css({'margin-left':'20px','font-size':'10px'});$('blockquote>i').each(function(){$(this).find('sup').each(function(){$(this).replaceWith($(this).html());});$(this).prev('label').append('<br>');$(this).appendTo($(this).prev('label'));});if($('form table').attr('summary')==='neighborhood picker'){$('form table td:last').prependTo('form table td blockquote');}
74
+ if($('form table').attr('summary')==='flava picka'){$('form table td fieldset').last().appendTo($('form table td:first'));$('form table td:first').append('<br>');$('form table td:last').children().appendTo($('form table td:first'));}
75
+ if($('textarea.toutext').attr('cols')==='80'){$('textarea').attr('cols',null);$('textarea').css('width','100%');$('table form').append('<br><br>');$('table form').appendTo('body');}
76
+ if($('form').first().attr('id')==='postingForm'){$('input[size=80]').css('width','100%');$('input[size=80]').attr('size',null);$('input[size=30]').css('width','100%');$('input[size=30]').attr('size',null);$('input[size=20]').css('width','100%');$('input[size=20]').attr('size',null);}
77
+ $('.bchead').hide();$('div.row').css('width','100%');$('label.req').css('font-size','10px');$('#userbody').append('<div width="100%" class="imagehole"></div>');$('.iw').hide();var imagesDiv=$('.imagehole');$('.tn a').each(function(){var imgHref=$(this).attr('href');imagesDiv.append('<a href="'+imgHref+'"><img class="postingimg" width="100%" src="'+imgHref+'"></a><br>');});$('#userbody img').css('width','100%');$('#leaflet').css('height','250px');return false;}
78
+ function simple_autosize(mode){if(mode==='mobile'){simple_size_mobile();}
79
+ append_format_selector($('body'));}
80
+ function simple_size_mobile(){$('body').addClass('mobile');if($('table:first').css('width')==='706px'){$('table:first>tbody>tr>td').appendTo('table:first');$('table:first>td').wrap('<tr />');$('input[size=60]').css('width','100%');$('input[size=60]').attr('size',null);$('table').css('width','100%');$('table strong').css('font-size','12px');$('table a').css('font-size','12px');}
81
+ if($('table:first').css('width')==='500px'){$('table:first>tbody>tr>td:even').appendTo('table:first');$('table:first>tbody>tr>td:odd').appendTo('table:first');$('table:first>td').wrap('<tr />');$('table').css({'width':'100%','font-size':'10px'});$('table strong').hide();$('table a').css('font-size','12px');}
82
+ return false;}
83
+ function login_autosize(mode){if(mode==='mobile'){$('body').addClass('mobile');}
84
+ append_format_selector($('body'));}
85
+ function interstitial_autosize(mode){if(mode==='mobile'){interstitial_autosize_init();interstitial_size_mobile();}
86
+ append_format_selector($('body'));}
87
+ function interstitial_autosize_init(){return false;}
88
+ function interstitial_size_mobile(){$('h3').css('font-size','10px');$('h3 a').css('font-size','12px');$('blockquote').css({'width':'100%','margin':'2px','font-size':'10px'});$('blockquote a').css('font-size','14px');$('blockquote>blockquote').css({'width':'100%','white-space':'normal'});$('blockquote>blockquote>span>a').css('font-size','20px');$('blockquote>blockquote>span').css('width','100%');$('blockquote>blockquote').after('<br>');$('blockquote>blockquote>a:first').before('<br>');$('blockquote>blockquote>a').after(' ');$('blockquote>blockquote>small>a').after(' ');return false;}
89
+ function sites_autosize(mode){if(mode==='mobile'){sites_size_mobile();}
90
+ append_format_selector($('body'));}
91
+ function sites_size_mobile(){$('body').addClass('mobile')
92
+ .prepend('<div class="topban"><a href="#">CL&nbsp;&gt;</a></div><br>');$('.colleft').each(function(){$(this).find('.box_2').children().appendTo($(this).find('.box_1'));$(this).find('.box_3').children().appendTo($(this).find('.box_1'));$(this).find('.box_4').children().appendTo($(this).find('.box_1'));});$('.colmask').each(function(){$(this).find('.box_1').appendTo($(this));$(this).find('.continent_header').appendTo('body');$(this).appendTo('body');});$('.state_delimiter').click(function(e){e.preventDefault();var menu=$(this).next('ul');menu.slideToggle();$(this).parent().find('ul:visible').not(menu).slideUp();});$('.continent_header').click(function(e){var menu=$(this).next('.colmask');menu.slideToggle();$(this).parent().find('.colmask:visible').not(menu).slideUp();});$('.footer').appendTo('body');$('.footer>span:first').after('<hr>');return false;}
93
+ function account_autosize(mode){if(mode==='mobile'){account_size_mobile();}
94
+ append_format_selector($('body'));}
95
+ function account_size_mobile(){$('body').removeClass('toc').addClass('mobile');$('.bchead').appendTo('body');$('.bchead>#ef>a:first').appendTo('.bchead>#satabs');$('.bchead>#satabs').append(' ');$('.bchead>#ef>a:first').appendTo('.bchead>#satabs');$('.bchead>#ef').remove();$('.bchead>#satabs').appendTo('body');$('blockquote>br').remove();$('blockquote').children().appendTo('body');$('form').each(function(){$(this).find('table td').children().appendTo($(this).find('table td:first'));});$('select').before('<br>');$('#paginator>table>tbody>tr').first().remove();$('#paginator>table>tbody>tr').each(function(){var newDiv=$('<div class="postingrow"></div>');var posttitle=$(this).find('.title');newDiv.append(posttitle.html())
96
+ .append($(this).find('.areacat').html())
97
+ .append('&bull;')
98
+ .append($(this).find('.dates').html())
99
+ .append('<br>')
100
+ .append($(this).find('.status').html());newDiv.css({'background':posttitle.css('background'),'border':posttitle.css('border'),'font-size':posttitle.css('font-size'),'font-family':posttitle.css('font-family')});$('#paginator').append(newDiv);newDiv.click(function(e){e.preventDefault;window.location.href=posttitle.find('a').attr('href');});});$('#paginator>table').remove();$('#paginator>.postingrow').appendTo('body');$('#paginator').clone().appendTo('body');$('p>em').appendTo('body');$('#footer').appendTo('body');return false;}