ele.me get infomation

获取饿了么菜单页指定格式

  1. // ==UserScript==
  2. // @name ele.me get infomation
  3. // @namespace http://iamued.com
  4. // @version 0.4
  5. // @description 获取饿了么菜单页指定格式
  6. // @include http://r.ele.me/*
  7. // @copyright 2014
  8. // ==/UserScript==
  9.  
  10. $(function() {
  11. $("#rst_menus").append('<div class="getinfomation"><button>获取菜单信息 HOHO</button></div><div><textarea class="infoarea" rows="20"></textarea></div>');
  12. $("#rst_menus").append('<div>有问题反馈给我 liugang02@meituan.com</div>');
  13. $(".getinfomation").click(function() {
  14. $(".infoarea").val('');
  15. var infotext='';
  16. $.each($(".rst-menu-title"),function(){
  17. if($(this).text()!='美食分类'){
  18. var ftypename=$.trim($(this).text());
  19. infotext+="#"+ftypename+"\n";
  20. $.each($(this).parent("section").children("ul").children("li"),function(){
  21. var fname=$(this).find('.food_name').attr('title');
  22. var fprice=$(this).find('.symbol-rmb').text();
  23. //console.log(fname+ $.trim(fprice).replace('餐厅休息',''));
  24. infotext+=$.trim(fname).replace(/\s+/g,"")+" "+$.trim(fprice).replace('餐厅休息','').replace('已售完','')+"\n";
  25. })
  26.  
  27. }
  28. })
  29. $(".infoarea").val(infotext);
  30. })
  31.  
  32.  
  33. });