您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
获取美团外卖菜单页并指定格式输出 目前仅支持美团PC页面 后续会完成全外卖公司的转换功能 / 如果使用有问题 请安装最新Chrome浏览器 / Designed for my best university bro.
当前为
// ==UserScript== // @name 美团外卖菜单转换 // @namespace http://meituan.com // @version 0.0.1 // @description 获取美团外卖菜单页并指定格式输出 目前仅支持美团PC页面 后续会完成全外卖公司的转换功能 / 如果使用有问题 请安装最新Chrome浏览器 / Designed for my best university bro. // @include *://waimai.meituan.com/restaurant/* // @copyright 2016 // ==/UserScript== getMeituanMenu(); function getMeituanMenu() { const body = document.body; const btn = document.createElement('button'); btn.style.cssText = "position:fixed;z-index:100;left:0;bottom:400px;"; btn.innerHTML = "菜单信息/" body.appendChild(btn); const textarea = document.createElement('textarea'); textarea.style.cssText = "position:fixed;z-index:100;left:0;bottom:0px;height:380px;"; body.appendChild(textarea); btn.onclick = () => { let info = ''; const category = document.querySelectorAll('.food-nav .category'); for (let i = 0, categoryLength = category.length; i < categoryLength; i++) { const foodTypeName = category[i].querySelector('.title > span').textContent.trim(); info += "\n#" + foodTypeName + "\n"; const item = category[i].querySelectorAll('.pic-food'); for (let j = 0, itemLength = item.length; j < itemLength; j++) { const foodName = item[j].querySelector('.np .name').getAttribute('title').trim(); const foodPrice = item[j].querySelector('.labels .price .only').textContent.split('/')[0].substring(1).trim(); info += foodName + ' ' + foodPrice + '\n'; textarea.value = info; } } } }