Skip to content

Instantly share code, notes, and snippets.

@kourindouhime
Last active April 28, 2019 16:20
Show Gist options
  • Save kourindouhime/8968187 to your computer and use it in GitHub Desktop.
Save kourindouhime/8968187 to your computer and use it in GitHub Desktop.
// tanuki 2019
havka = [];
s = __NEXT_DATA__.props.initialState.products.data
for (key of Object.keys(s)) {
p = s[key];
havka.push([p.title, p.weight/p.price, p.price, p.weight, p.calories])
}
havka = havka.sort(function(a, b){ var x=a[1]; var y=b[1]; return y-x; });
eblo = "";
for (var i in havka) {
eblo += "Цена: "+havka[i][2]+" Вес: "+havka[i][3]+" Калории: "+havka[i][4]+" "+havka[i][0]+"\n";
}
// delivery-club.ru 1
jrat = []; $(".dish").each(function() { jrat.push([$($(this).find("span")[0]).html(), parseInt($($(this).find("span")[0]).html().match(/\d+/g)), parseInt($(this).find("strong > span").html()), 0]) }); for (var i in jrat) { jrat[i][3] = parseInt(jrat[i][2])/parseInt(jrat[i][1]); }; jrat = jrat.sort(function(a, b){ var x=a[3]; var y=b[3]; return y-x; }); eblo = ""; for (var i in jrat) { eblo += "Цена: " + jrat[i][2] + " Вес: " + jrat[i][1] + " " + jrat[i][0] + "\n" }
// delivery-club.ru 2
t = []; $(".dish").each(function() { var s = $(this).find(".dish_detail").find("p").html(); if (s != null) { t.push([parseInt($(this).find("form").find("p").find("strong").find("span").html())/parseInt(s.split("\n")[1]), $(this).find(".product_title").find("span").html()]); } }); t = t.sort(function(a, b){ var x=a[0]; var y=b[0]; return y-x; }); $.each(t, function() { console.log(this); });
// mypizza.ru (mysushi.ru, pizzasushiwok.ru)
it = []; $(".menu-positions-li").each(function() { it.push([$(this).find(".title-position-menu").html(), parseInt($(this).find(".price-position-menu").html())/parseInt($(this).find(".weight-change-menu").html())]); }); it = it.sort(function(a, b){ var x=a[1]; var y=b[1]; return y-x; }); $.each(it, function() { console.log(this); })
// niyama.ru
t = []; $(".one-col").each(function() { k = $(this).find(".weight").find("span").html().split(/\/|\./); if (k[0].indexOf("шт") == -1) { k = k[0] } else { k = k[1] }; t.push([parseInt($(this).find(".price").html())/k, $(this).find("h3").html()]); }); $.each(t.sort(function(a, b){ var x=a[0]; var y=b[0]; return y-x; }), function() { console.log(this); } );
// bigfish.su
it = []; $(".Items").find("li").each(function() { it.push([$(this).find("h3").html(), parseInt($(this).find("span").find("b").html())/parseInt($(this).find(".veskal").html().split(",")[1])]); }); it = it.sort(function(a, b){ var x=a[1]; var y=b[1]; return y-x; }); $.each(it, function() { console.log(this); })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment