JoshyPHP
Well-known member
When releasing a new add-on, we add-on authors are asked to upload a file and enter the new version number. I found myself mistyping the latter around ~.5% of the time so I made this suggestion: https://xenforo.com/community/threads/autofill-the-version-number-when-uploading-a-new-file.224815/
Until this is implemented (if it even is) I'm doing it browser side in Chromium with the following extension:
manifest.json
update.js
If you use a Chrome-based browser, you can unzip the attached file wherever you please and load it in Developer Mode.
The code is a barely-tested second draft and anybody who tries for more than a few minutes can improve it, but nobody ain't got time for that.
Until this is implemented (if it even is) I'm doing it browser side in Chromium with the following extension:
manifest.json
JSON:
{
"manifest_version": 3,
"name": "site/xenforo",
"description": "",
"version": "0.1",
"content_scripts": [
{
"matches": [
"https://xenforo.com/community/resources/*/post-update"
],
"js": ["update.js"]
}
]
}
update.js
JavaScript:
const div = document.querySelector('div[data-xf-init="attachment-manager"]');
div.querySelector('input[type="file"]').addEventListener(
'change',
(e) =>
{
const versionInput = div.querySelector('input[name="version_string"]');
if (versionInput?.value !== '')
{
return;
}
const fileVersion = div.querySelector('.file-name')?.textContent ?? '',
m = /((?:\d+\.)*\d+(?:-\w+)?)\.zip$/.exec(fileVersion);
if (m)
{
versionInput.value = m[1];
}
}
);
If you use a Chrome-based browser, you can unzip the attached file wherever you please and load it in Developer Mode.
The code is a barely-tested second draft and anybody who tries for more than a few minutes can improve it, but nobody ain't got time for that.