Skip to content

Commit

Permalink
Merge pull request #11 from ticktackk/develop
Browse files Browse the repository at this point in the history
1.0.3
  • Loading branch information
ticktackk authored Apr 8, 2024
2 parents c75755b + 82391ba commit 06e4c4a
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 29 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
==========================

## 1.0.3 (`1000370`)

- **Fix:** Incompatibility with XenForo 2.3 (#9)
- **Fix:** Extended `avatar.js` is loaded even without permission to upload avatar from URL (#10)

## 1.0.2 (`1000270`)

- **Change:** Minor code improvement and clean up (#7)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 TickTackk
Copyright (c) 2020-2024 TickTackk

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Requirements
Permissions
-----------

| Group | Permission |
| ------------------- | ------------------------- |
| General permissions | Upload an avatar from URL |
#### General permissions

- Upload an avatar from URL

License
-------
Expand Down
2 changes: 2 additions & 0 deletions _dev/resource_description.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>Upload Avatar From URL for XenForo 2.1.10.2+</h1><h2>Description</h2><p>This add-on allows users with permission to upload avatar from URL.</p><h2>Requirements</h2><ul><li>PHP 7.3+</li></ul><h2>Permissions</h2><h4>General permissions</h4><ul><li>Upload an avatar from URL</li></ul><h2>License</h2>
This project is licensed under the MIT License - see the <a href="https://github.com/ticktackk/UploadAvatarFromUrlForXF2/blob/master/LICENSE.md">LICENSE.md</a> file for details.
28 changes: 9 additions & 19 deletions _dev/resource_description.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
[SIZE=6][B]Upload Avatar From URL for XenForo 2.1.10.2+[/B][/SIZE]

[SIZE=5][B]Description[/B][/SIZE]
[HEADING=1]Upload Avatar From URL for XenForo 2.1.10.2+[/HEADING]
[HEADING=1]Description[/HEADING]
This add-on allows users with permission to upload avatar from URL.

[SIZE=5][B]Requirements[/B][/SIZE]
[HEADING=1]Requirements[/HEADING]
[LIST]
[*]PHP 7.3+
[/LIST]

[SIZE=5][B]Permissions[/B][/SIZE]
[TABLE]
[TR]
[TH]Group[/TH]
[TH]Permission[/TH]
[/TR]
[TR]
[TD]General permissions[/TD]
[TD]Upload an avatar from URL[/TD]
[/TR]
[/TABLE]

[SIZE=5][B]License[/B][/SIZE]
[HEADING=1]Permissions[/HEADING]
[HEADING=3]General permissions[/HEADING]
[LIST]
[*]Upload an avatar from URL
[/LIST]
[HEADING=1]License[/HEADING]
This project is licensed under the MIT License - see the [URL='https://github.com/ticktackk/UploadAvatarFromUrlForXF2/blob/master/LICENSE.md']LICENSE.md[/URL] file for details.
28 changes: 28 additions & 0 deletions _files/js/ticktackk/upload_avatar_from_url/xf/avatar.23x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var TickTackk = window.TickTackk || {};
TickTackk.UploadAvatarFromUrl = TickTackk.UploadAvatarFromUrl || {};

;((window, document) =>
{
'use strict'

XF.AvatarUpload = XF.extend(XF.AvatarUpload, {
__backup: {
'ajaxResponse': 'tckUploadAvatarFromUrl__ajaxResponse'
},

ajaxResponse: function(e, data)
{
this.tckUploadAvatarFromUrl__ajaxResponse(e, data);

const form = this.target
const customType = form.querySelector('.js-tckUploadAvatarFromUrl_customType:checked')
const urlField = form.querySelector('.js-tckUploadAvatarFromUrl_urlField')
const useCustom = (form.querySelector('input[name="use_custom"]:checked').value == 1)

if ((customType !== undefined) && (customType.value === 'url') && (urlField !== undefined) && useCustom)
{
urlField.value = '';
}
}
})
})(window, document)
1 change: 1 addition & 0 deletions _output/extension_hint.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

/** @noinspection PhpIllegalPsrClassPathInspection */
// ################## THIS IS A GENERATED FILE ##################
// DO NOT EDIT DIRECTLY. EDIT THE CLASS EXTENSIONS IN THE CONTROL PANEL.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"execution_order": 10,
"enabled": true,
"action": "preg_replace",
"find": "#<xf:js prod=\"xf\\/avatar-compiled\\.js\".*?\\/>#si",
"replace": "$0\n<xf:js src=\"ticktackk/upload_avatar_from_url/xf/avatar.js\" min=\"1\" addon=\"TickTackk/UploadAvatarFromUrl\" />"
"find": "{^<xf:js (?:src|prod)=\"xf\\/avatar(?:-compiled)?\\.js\".*?\\/>$}m",
"replace": "$0\n\n<xf:if is=\"$xf.visitor.canUploadAvatarFromUrl()\">\n\t<xf:if is=\"$xf.versionId >= 2030000\">\n\t\t<xf:js src=\"ticktackk/upload_avatar_from_url/xf/avatar.23x.js\" min=\"1\" addon=\"TickTackk/UploadAvatarFromUrl\" />\n\t<xf:else />\n\t\t<xf:js src=\"ticktackk/upload_avatar_from_url/xf/avatar.js\" min=\"1\" addon=\"TickTackk/UploadAvatarFromUrl\" />\n\t</xf:if>\n</xf:if>"
}
4 changes: 2 additions & 2 deletions addon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"legacy_addon_id": "",
"title": "Upload Avatar From URL",
"description": "This add-on allows users with permission to upload avatar from URL.",
"version_id": 1000270,
"version_string": "1.0.2",
"version_id": 1000370,
"version_string": "1.0.3",
"dev": "TickTackk",
"dev_url": "https://xenforo.com/community/members/ticktackk.90375/",
"faq_url": "",
Expand Down
6 changes: 4 additions & 2 deletions build.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"additional_files": [
"js/ticktackk/upload_avatar_from_url/xf/avatar.js"
"js/ticktackk/upload_avatar_from_url/xf/avatar.js",
"js/ticktackk/upload_avatar_from_url/xf/avatar.23x.js"
],
"minify": [
"js/ticktackk/upload_avatar_from_url/xf/avatar.js"
"js/ticktackk/upload_avatar_from_url/xf/avatar.js",
"js/ticktackk/upload_avatar_from_url/xf/avatar.23x.js"
],
"exec": [
"composer install --working-dir=_build/upload/src/addons/{addon_id}/ --no-dev --optimize-autoloader"
Expand Down

0 comments on commit 06e4c4a

Please sign in to comment.