Skip to content

Commit

Permalink
Merge branch 'master' into quick_categories
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesNepote authored Jan 10, 2025
2 parents 6ff619b + c83becd commit 5a57fa3
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 10 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/github-projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,75 @@ jobs:
with:
project-url: https://github.com/orgs/openfoodfacts/projects/79 # Add issue to the PUS project
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/36 # Add issue to the open pet food facts project
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: 🐾 Open Pet Food Facts
label-operator: OR
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/11 # Add issue to the open products facts project
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: 📸 Open Products Facts
label-operator: OR
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/37 # Add issue to the open beauty facts project
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: 🧴 Open Beauty Facts
label-operator: OR
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/4 # Add issue to the packaging project
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: 📦 Packaging
label-operator: OR
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/25 # Add issue to the documentation project
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: 📚 Documentation
label-operator: OR
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/5 # Add issue to the folksonomy project
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: 🏷️ Folksonomy Project
label-operator: OR
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/44 # Add issue to the data quality project
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: 🧽 Data quality
label-operator: OR
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/82 # Add issue to the search project
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: 🔎 Search
label-operator: OR
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/41 # Add issue to the producer platform project
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: 🏭 Producers Platform
label-operator: OR
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/92 # Add issue to the Nutri-Score project
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: 🚦 Nutri-Score
label-operator: OR
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/132 # Add issue to the Top upvoted issues board
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: ⭐ top issue, 👍 Top 10 Issue!
label-operator: OR
- uses: actions/add-to-project@main
with:
project-url: https://github.com/orgs/openfoodfacts/projects/57 # Add issue to the Most impactful issues board
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: 🎯 P0, 🎯 P1
label-operator: OR
27 changes: 27 additions & 0 deletions .github/workflows/top-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Top issues action.
#on:
# schedule:
# - cron: '0 0 */1 * *'
on:
issues:
types: [opened, transferred]

jobs:
ShowAndLabelTopIssues:
name: Display and label top issues.
runs-on: ubuntu-latest
steps:
- name: Run top issues action
uses: rickstaa/top-issues-action@v1
env:
github_token: ${{ secrets.GITHUB_TOKEN }}
with:
label: true
dashboard: true
dashboard_title: 👍 Top Issues Dashboard
dashboard_show_total_reactions: true
top_issues: true
top_bugs: true
top_features: true
top_pull_requests: true
top_list_size: 20
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

## 1.0.0 (2024-09-26)


### Bug Fixes

* 90 ([2783a69](https://github.com/openfoodfacts/power-user-script/commit/2783a696df69cd88c0c76593587e24cb0d0e3a2f))
* 92 ([b9b2c0a](https://github.com/openfoodfacts/power-user-script/commit/b9b2c0a9c70302e47ed5932f2905d57ed6eda50a))
* fix [#64](https://github.com/openfoodfacts/power-user-script/issues/64) ([1e76663](https://github.com/openfoodfacts/power-user-script/commit/1e76663f92f3ec55285ede4cd90a6010ef2f1f2e))
* fix script ([808bb42](https://github.com/openfoodfacts/power-user-script/commit/808bb42c916ccbf776aaf2dcf793e93469e7f81b))
* Hunger games button outside list barcodes ([33e0831](https://github.com/openfoodfacts/power-user-script/commit/33e0831b4fb9a894683d34b0d75ad3894f407c56))
* make links display again ([6538459](https://github.com/openfoodfacts/power-user-script/commit/6538459eab77292e65fb5a2f0a4254a9cfe1b186))
* quick-fix-sidebar ([1108171](https://github.com/openfoodfacts/power-user-script/commit/1108171f37208f270943c1890ff1fb62c80b3588))
* remove edit link in listByRow mode ([3081c2e](https://github.com/openfoodfacts/power-user-script/commit/3081c2ed5b8154da35ca0e5d076f3d6a3424c28a))


25 changes: 15 additions & 10 deletions OpenFoodFactsPower.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
// @include http://*.productopener.localhost/*
// @include http://*.openfoodfacts.localhost/*
// @include http://*.openfoodfacts.localhost:8080/*
// @include http://*.openpetfoodfacts.localhost:*/*
// @include http://*.openproductsfacts.localhost:*/*
// @include http://*.openbeautyfacts.localhost:*/*
// @exclude https://analytics.openfoodfacts.org/*
// @exclude https://api.folksonomy.openfoodfacts.org/*
// @exclude https://*.wiki.openfoodfacts.org/*
Expand All @@ -28,6 +31,8 @@
// @exclude https://*connect-test.openfoodfacts.org/*
// @exclude https://contents.openfoodfacts.org/*
// @exclude https://mirabelle.openfoodfacts.org/*
// @exclude https://prices.openfoodfacts.org/*
// @exclude https://search.openfoodfacts.org/*
//
// @icon http://world.openfoodfacts.org/favicon.ico
// @updateURL https://github.com/openfoodfacts/power-user-script/raw/master/OpenFoodFactsPower.user.js
Expand Down Expand Up @@ -755,6 +760,7 @@ textarea.monospace {

// https://fr.openfoodfacts.org/etat/marques-a-completer/code/506036745xxxx&json=1
var sameBrandProductsJSON = sameBrandProductsURL + "&json=1";
log("Get JSON from: " + sameBrandProductsJSON);
$.getJSON(sameBrandProductsJSON, function(data) {
var nbOfSameBrandProducts = data.count;
log("nbOfSameBrandProducts: " + nbOfSameBrandProducts);
Expand Down Expand Up @@ -1142,7 +1148,6 @@ textarea.monospace {
'<p><strong>Product issues:</strong></p>' +
'<ul id="issues" class="row" style="margin-bottom: 0.2rem; padding-left: 1rem;">' +
'</ul>' +
'<div class="row">→ <a href="'+editURL+'">Re-edit current product</a></div>' +
'<div id="furthermore" class="row" style="margin-top: 10px;"><strong>Going further:</strong></div>' +
'<ul id="going-further" class="row" style="padding-left: 1rem;">' +
'</ul>' +
Expand Down Expand Up @@ -1516,17 +1521,17 @@ ul#products_match_all > li > a > span { display: table-cell; width: 70%; vert

//Move product to OBF
$("#p_actions_obf_"+local_code).click(function(){
moveProductToSite( $(this).attr("value"), 'obf' );
moveProductToSite( $(this).attr("value"), 'beauty' );
});

//Move product to OPF
$("#p_actions_opf_"+local_code).click(function(){
moveProductToSite( $(this).attr("value"), 'opf' );
moveProductToSite( $(this).attr("value"), 'product' );
});

//Move product to OPFF
$("#p_actions_opff_"+local_code).click(function(){
moveProductToSite( $(this).attr("value"), 'opff' );
moveProductToSite( $(this).attr("value"), 'petfood' );
});

// Save ingredients
Expand Down Expand Up @@ -2686,7 +2691,7 @@ ul#products_match_all > li > a > span { display: table-cell; width: 70%; vert
* Move products between sites
*/
function moveProductToSite(_code, newSite) {
if (/^(obf|off|opf|opff)$/.test(newSite) !== true) {
if (/^(beauty|food|product|petfood)$/.test(newSite) !== true) {
log("moveProductToSite() > invalid site: " + newSite);
return false;
}
Expand All @@ -2697,7 +2702,7 @@ ul#products_match_all > li > a > span { display: table-cell; width: 70%; vert
}

var _url = encodeURI(document.location.protocol + "//" + document.location.host +
"/cgi/product_jqm.pl?type=edit&code=" + _code + "&new_code=" + newSite);
"/cgi/product_jqm.pl?type=edit&code=" + _code + "&product_type=" + newSite);
log("api call-> "+_url);
$("body").append('<div id="timed_alert_move_' + _code + '" class="timed_alert">Moving</div>');
var _d = $.getJSON(_url, function() {
Expand Down Expand Up @@ -2867,17 +2872,17 @@ ul#products_match_all > li > a > span { display: table-cell; width: 70%; vert
log("checkKJ() - kJ: " + j + ", kcal: " + c);
// If either KJ or Kcal does not exist: compute the missing value
if (j == "" && c != "") {
const cj = (c * 4.4).toFixed();
const cj = (c * 4.2).toFixed();
document.getElementById('kjtokcal').title = "Reverse the kj/kcal values -- kcal: " + c + "; computed kJ: ~" + cj;
}
if (c == "" && j != "") {
const cc = (j / 4.4).toFixed();
const cc = (j / 4.2).toFixed();
document.getElementById('kjtokcal').title = "Reverse the kj/kcal values -- kJ: " + j + "; computed kcal: ~" + cc;
}
if (c != "" && j != "") {
const ratio = (j / c).toFixed(1);
document.getElementById("kjtokcal").title = "Reverse the kj/kcal values -- ratio Kj/kcal (should be 4.4): " + ratio;
(ratio >= 4.8 || ratio <= 4.0) ?
document.getElementById("kjtokcal").title = "Reverse the kj/kcal values -- ratio Kj/kcal (should be 4.2): " + ratio;
(ratio >= 4.6 || ratio <= 4.0) ?
document.getElementById('kjtokcal').style.color = "red" : document.getElementById('kjtokcal').style.color = "black";
}
// CAREFUL: all of this might be false if values are per serving!!!!
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ Once your script manager is installed you can go to https://github.com/openfoodf
Just click on the Raw button and your script manager will ask you if you want to install the script.

# Changelog
### 2024-12-20T11:15
* Fix moving products to OPF, OBF, OPFF
### 2024-08-27T19:25
* Exclude search.openfoodfacts.org
### 2024-06-19T14:18
* Exclude prices.openfoodfacts.org
* Fix kJ/kcal ratio to 4.2 instead of 4.4
### 2024-02-02T20:39
* Product list: rotate images
### 2024-01-03T13:20
Expand Down

0 comments on commit 5a57fa3

Please sign in to comment.