- Timestamp:
- 05/29/08 17:31:02 (6 months ago)
- Files:
-
- 1 modified
-
lang/vim/misc/mixi.vim (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/vim/misc/mixi.vim
r12348 r12692 19 19 end 20 20 21 def post(title, body )21 def post(title, body, images) 22 22 page = @agent.get 'http://mixi.jp/home.pl' 23 23 form = page.forms[0] … … 31 31 form.diary_title = title 32 32 form.diary_body = self.class.magic_body(body) 33 images[0, 3].each_with_index do |img, i| 34 eval "form.file_uploads[#{i}].file_name = '#{img}'" 35 end 33 36 page = @agent.submit form 34 37 page = @agent.submit page.forms[0] … … 37 40 def get_latest 38 41 page = @agent.get 'http://mixi.jp/list_diary.pl' 39 ["http://mixi.jp/" << page.links[3 5].uri.to_s.toutf8,40 page.links[35].text.toutf8]42 ["http://mixi.jp/" << page.links[37].uri.to_s.toutf8, 43 page.links[37].text.toutf8] 41 44 end 42 45 … … 51 54 endline = VIM.evaluate %[line("$")] 52 55 title = VIM.evaluate %[getline(1)] 53 body = VIM.evaluate %[join(getline(2, #{endline}), "\n")] 56 body = VIM.evaluate(%[join(getline(2, #{endline}), "\n")]).split "\n" 57 58 images = body.reverse.inject([]) {|r, l| r.unshift l[4..-1] if l =~ /^img:/; r } 59 body = body[0..-(images.length + 1)].join "\n" 54 60 55 61 m = Mixi.new 'YOUR_EMAIL', 'YOUR_PASSWORD' 56 62 # if you are mixi premium member: 57 63 # m = Mixi.new 'YOUR_EMAIL', 'YOUR_PASSWORD', true 58 m.post title.toeuc, body.toeuc 64 m.post title.toeuc, body.toeuc, images 59 65 m.get_latest.each do |line| 60 66 VIM.evaluate %[append(#{endline}, \"#{line.chomp}\")]
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)