Compare commits

...

3 Commits

Author SHA1 Message Date
eb4e1af399 Update mealiecompute.js 2025-12-02 14:40:12 +01:00
66a0b25e39 Add mealiecompute.js 2025-12-02 14:18:34 +01:00
9b687b7fc4 Update 'blokada_blacklist' 2020-05-16 11:24:11 +02:00
2 changed files with 58 additions and 0 deletions

View File

@@ -21,3 +21,5 @@
firebaseremoteconfig.googleapis.com
*appcenter.ms
*dsec.net
*giphy.com
*instagram.com

56
mealiecompute.js Normal file
View File

@@ -0,0 +1,56 @@
// ==UserScript==
// @name Mealie compute
// @namespace https://mealie.ilnee.com/
// @include https://mealie.ilnee.com/
// @version 2025-12-02
// @description accumulate the weight of ingredients on mealie.ilnee.com
// @author me
// @match https://*.ilnee.com/*
// @require https://code.jquery.com/jquery-3.7.1.slim.min.js
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant none
// ==/UserScript==
window.onload = function() {
if (window.jQuery) {
console.log("jQuery loaded");
}
}
var sum;
function summyshizzle() {
sum = 0;
var h2 = $('h2:contains("Ingredients"):first');
var items = h2.parent().parent().find('div.v-list-item-title > div.ingredient-item > div.d-inline > p');
//var items = $('div.text-subtitle-1.dense-markdown.ingredient-item > div.d-inline > p');
var match;
var firstNumber = 0;
items.each(function(i, obj) {
//console.log(i);
//console.log(obj.innerHTML);
match = obj.innerHTML.match(/\d+/);
firstNumber = match ? parseInt(match[0], 10) : null;
//console.log(firstNumber);
sum += firstNumber;
console.log(sum);
});
return sum;
}
$(document)
.ready(function() {
$('body').on('click', 'button[large="false"][type="button"]', (function(e) {
sum = 0;
sum = summyshizzle();
// console.log('sum: ' + sum);
$('div.ilneesum').remove();
$(this).parent().parent().parent().parent().parent().after('<div class="ilneesum">' + sum + '</div>');
}));
});