baidu waimai get infomation

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

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

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

$(function() {
    $(".main-l").append('<div class="getinfomation"><button>获取菜单信息 HOHO</button></div><div><textarea class="infoarea" rows="20" style="width:90%"></textarea></div>');
    $(".main-l").append('<div>有问题反馈给我 [email protected]</div>');
    $(".main-l .getinfomation").click(function() {
        $(".infoarea").val('');
        var infotext='';
        $.each($(".list-wrap .title"),function(){
            //console.log($(this).text());
            if($(this).text()!='美食分类'){
                var ftypename=$.trim($(this).text());
                infotext+="#"+ftypename+"\n";
                $.each($(this).parents(".list-wrap").find("ul").children("li"),function(){
                    //console.log($(this));
                    var fname=$(this).find('.info h3').attr('data-title');
                    var fprice=$(this).find('.info .m-price').text();
                    if($.trim(fprice)==''){
                    	fprice=$(this).find('.info .m-break strong').text();
                    }
                    //console.log(fname+ $.trim(fprice).replace('餐厅休息',''));
                    infotext+=$.trim(fname).replace(/\s+/g,"")+" "+$.trim(fprice).replace('¥','').replace('已售完','')+"\n";
                })

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


});