ele.me get infomation

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name       ele.me get infomation
// @namespace  http://iamued.com
// @version    0.4
// @description  获取饿了么菜单页指定格式
// @include    http://r.ele.me/*
// @copyright  2014
// ==/UserScript==

$(function() {
    $("#rst_menus").append('<div class="getinfomation"><button>获取菜单信息 HOHO</button></div><div><textarea class="infoarea" rows="20"></textarea></div>');
    $("#rst_menus").append('<div>有问题反馈给我 [email protected]</div>');
    $(".getinfomation").click(function() {
        $(".infoarea").val('');
        var infotext='';
        $.each($(".rst-menu-title"),function(){
            if($(this).text()!='美食分类'){
                var ftypename=$.trim($(this).text());
                infotext+="#"+ftypename+"\n";
                $.each($(this).parent("section").children("ul").children("li"),function(){
                    var fname=$(this).find('.food_name').attr('title');
                    var fprice=$(this).find('.symbol-rmb').text();
                    //console.log(fname+ $.trim(fprice).replace('餐厅休息',''));
                    infotext+=$.trim(fname).replace(/\s+/g,"")+" "+$.trim(fprice).replace('餐厅休息','').replace('已售完','')+"\n";
                })

            }
        })
        $(".infoarea").val(infotext);
    })


});