Changeset 21239 for lang/vim/ruby

Show
Ignore:
Timestamp:
10/13/08 16:34:13 (6 years ago)
Author:
ujihisa
Message:

fit current lang-8.com specification

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/vim/ruby/lang8.vim

    r14722 r21239  
    2727 
    2828  def post(title, body) 
    29     page = @agent.get "http://lang-8.com/?m=pc&l=en&a=page_h_diary_add" 
    30     form = page.forms[0] 
     29    page = @agent.get "http://lang-8.com/?a=page_h_diary_add" 
     30    form = page.forms.action('./').first 
     31    form.lang_option = '2-2' # Language: English 
    3132    form.subject = title 
    3233    form.body = body 
     34    form.radiobuttons.value('5').check # Show with all Internet Users 
    3335    page = @agent.submit form 
    34     page = @agent.submit page.forms[0] 
     36    page = @agent.submit page.forms.action('./').first 
    3537  end 
    3638 
    3739  def get_latest 
    3840    page = @agent.get 'http://lang-8.com/?m=pc&a=page_fh_diary_list&l=en' 
    39     [ @agent.get(page.links[43].uri).title, 
    40       "http://lang-8.com/" << page.links[43].uri.to_s.toutf8[2..-1] ] 
     41    title = (page/'.heading').first.innerText 
     42    [title, "http://lang-8.com/" << page.links[41].uri.to_s.toutf8[2..-1]] 
    4143  end 
    4244end