Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Last active December 3, 2025 13:52
Show Gist options
  • Select an option

  • Save ThomasG77/7b804ccec918a5e37f9f660fa392115d to your computer and use it in GitHub Desktop.

Select an option

Save ThomasG77/7b804ccec918a5e37f9f660fa392115d to your computer and use it in GitHub Desktop.

Bookmarklet pour avoir les urls réels sur du type https://console.object.files.data.gouv.fr/browser/meteofrance-drias/

Allez sur https://gist.githack.com/ThomasG77/7b804ccec918a5e37f9f660fa392115d/raw/db15d58773cacef1948fd13844369f5a24f1298f/bookmarklets-minio.html

Installer le bookmarklet/favori en faisant comme sur https://gist.github.com/ThomasG77/7b804ccec918a5e37f9f660fa392115d#file-install-et-demo-bookmarklet-gif

Ensuite, à chaque fois, il faudra dans le dossier où vous naviguer, si un fichier est présent, recliquer sur ce favori pour faire apparaître ce lien.

<!DOCTYPE html>
<html>
<head>
<title>Bookmark pour Minio data.gouv.fr</title>
</head>
<body>
<p>Ajouter en favoris ce <a title="Url Minio data gouv réelles" href="javascript:function hasExtension(filename) { return filename.split('.').length > 1};function createElementFromHTML(htmlString){var div=document.createElement('div');return div.innerHTML=htmlString.trim(),div.firstChild}function baseUrl(){var browserPosition=window.location.href.split('/').indexOf('browser');let browserBucketPath=window.location.href.split('/').slice(0,browserPosition+2).join('/');window.location.href.split('/').slice(browserPosition+1,browserPosition+2),window.location.href.split('/').slice(browserPosition+2)[0];let encodedPath=window.location.href.split('/').slice(-1)[0];[...document.querySelector('#object-list-wrapper').querySelectorAll('span.fileNameText')].forEach(el=>{let link='';hasExtension(el.innerText)&&(link='<a href='+browserBucketPath.replace('object.infra.data.gouv.fr','object.data.gouv.fr').replace('console.object.files.data.gouv.fr','object.data.gouv.fr').split('/').filter(el=>'browser'!=el).join('/')+'/'+decodeURIComponent(encodedPath.replace(/\+/g,' '))+el.innerText+'><span>Link</span></a>',console.log(link));var row=el.closest('div[role=row]');3===row.children.length&&(row.appendChild(createElementFromHTML(`<div aria-colindex=4 class=ReactVirtualized__Table__rowColumn role=gridcell style=overflow: hidden; flex: 0 1 100px;>${link}</div>`)),console.log(el.innerText,hasExtension(el.innerText)))})}baseUrl();">bookmarket Minio url réel</a> et quand sur la page comme <a href="https://console.object.files.data.gouv.fr/browser/meteofrance-drias/SocleM-Climat-2025%2FCPRCM%2FMETROPOLE%2FALPX-3%2FCNRM-ESM2-1%2Fr1i1p1f2%2FCNRM-AROME46t1%2Fssp370%2Fday%2FprAdjust%2Fversion-hackathon-102025%2F">https://console.object.files.data.gouv.fr/browser/meteofrance-drias/SocleM-Climat-2025%2FCPRCM%2FMETROPOLE%2FALPX-3%2FCNRM-ESM2-1%2Fr1i1p1f2%2FCNRM-AROME46t1%2Fssp370%2Fday%2FprAdjust%2Fversion-hackathon-102025%2F</a>, cliquez pour voir un lien apparaitre à droite de l'URL</p>
</body>
</html>
function hasExtension(filename) { return filename.split('.').length > 1}
function createElementFromHTML(htmlString) {
var div = document.createElement('div');
div.innerHTML = htmlString.trim();
// Change this to div.childNodes to support multiple top-level nodes.
return div.firstChild;
}
function baseUrl() {
const browserPosition = window.location.href.split('/').indexOf('browser')
const browserBucketPath = window.location.href.split('/').slice(0, browserPosition + 2).join('/')
const bucketName = window.location.href.split('/').slice(browserPosition + 1, browserPosition + 2)
const subPath = window.location.href.split('/').slice(browserPosition + 2)[0]
const encodedPath = window.location.href.split('/').slice(-1)[0]
const rowsContent = [...document.querySelector('#object-list-wrapper').querySelectorAll('span.fileNameText')];
rowsContent.forEach(el => {
let link = ''
if (hasExtension(el.innerText)) {
link = '<a href="' + browserBucketPath.replace('object.infra.data.gouv.fr','object.data.gouv.fr').replace('console.object.files.data.gouv.fr','object.data.gouv.fr').split('/').filter(el => el != 'browser').join('/') + '/' + decodeURIComponent(encodedPath.replace(/\+/g, ' ')) + el.innerText + '"><span class="">Link</span></a>'
console.log(link);
}
const row = el.closest('div[role="row"]')
if (row.children.length === 3) {
row.appendChild(createElementFromHTML(`<div aria-colindex="4" class="ReactVirtualized__Table__rowColumn" role="gridcell" style="overflow: hidden; flex: 0 1 100px;">${link}</div>`))
console.log(el.innerText, hasExtension(el.innerText))
}
})
}
baseUrl()
javascript:function hasExtension(filename) { return filename.split('.').length > 1};function createElementFromHTML(htmlString){var div=document.createElement('div');return div.innerHTML=htmlString.trim(),div.firstChild}function baseUrl(){var browserPosition=window.location.href.split('/').indexOf('browser');let browserBucketPath=window.location.href.split('/').slice(0,browserPosition+2).join('/');window.location.href.split('/').slice(browserPosition+1,browserPosition+2),window.location.href.split('/').slice(browserPosition+2)[0];let encodedPath=window.location.href.split('/').slice(-1)[0];[...document.querySelector('#object-list-wrapper').querySelectorAll('span.fileNameText')].forEach(el=>{let link='';hasExtension(el.innerText)&&(link='<a href="'+browserBucketPath.replace('object.infra.data.gouv.fr','object.data.gouv.fr').replace('console.object.files.data.gouv.fr','object.data.gouv.fr').split('/').filter(el=>'browser'!=el).join('/')+'/'+decodeURIComponent(encodedPath.replace(/\+/g,' '))+el.innerText+'"><span class="">Link</span></a>',console.log(link));var row=el.closest('div[role="row"]');3===row.children.length&&(row.appendChild(createElementFromHTML(`<div aria-colindex="4" class="ReactVirtualized__Table__rowColumn" role="gridcell" style="overflow: hidden; flex: 0 1 100px;">${link}</div>`)),console.log(el.innerText,hasExtension(el.innerText)))})}baseUrl();
npm install uglify-js -g
jscontent=$(uglifyjs --compress -- bookmarklets-minio.js)
echo "javascript:$jscontent" >| bookmarklets-minio.min.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment