This repository has been archived by the owner on May 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove inline Javascript for administrator/components/com_languages/t…
…mpl/language/edit.php (#94) * Jquery es6 remove inline * corrections * easier way * dont use script options * Revert "dont use script options" This reverts commit 80fcd898d0ea862c806fe32dc6adda0cde925930. * use global script option as discussed in glip * use global script option as discussed in glip
- Loading branch information
1 parent
c0bdb92
commit 28f2ab0
Showing
3 changed files
with
46 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
media/com_languages/js/admin-language-edit-change-flag.es6.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
document.addEventListener('DOMContentLoaded', () => { | ||
document.getElementById('jform_image').addEventListener('change', (event) => { | ||
const flagSelectedValue = event.currentTarget.value; | ||
const flagimage = document.getElementById('flag').querySelector('img'); | ||
const src = `${Joomla.getOptions('system.paths').rootFull}/media/mod_languages/images/${flagSelectedValue}.gif`; | ||
|
||
if (flagSelectedValue) { | ||
flagimage.setAttribute('src', src); | ||
flagimage.setAttribute('alt', flagSelectedValue); | ||
} else { | ||
flagimage.removeAttribute('src'); | ||
flagimage.setAttribute('alt', ''); | ||
} | ||
}, false); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* PLEASE DO NOT MODIFY THIS FILE. WORK ON THE ES6 VERSION. | ||
* OTHERWISE YOUR CHANGES WILL BE REPLACED ON THE NEXT BUILD. | ||
**/ | ||
|
||
/** | ||
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
document.addEventListener('DOMContentLoaded', function () { | ||
document.getElementById('jform_image').addEventListener('change', function (event) { | ||
var flagSelectedValue = event.currentTarget.value; | ||
var flagimage = document.getElementById('flag').querySelector('img'); | ||
var src = Joomla.getOptions('system.paths').rootFull + '/media/mod_languages/images/' + flagSelectedValue + '.gif'; | ||
|
||
if (flagSelectedValue) { | ||
flagimage.setAttribute('src', src); | ||
flagimage.setAttribute('alt', flagSelectedValue); | ||
} else { | ||
flagimage.removeAttribute('src'); | ||
flagimage.setAttribute('alt', ''); | ||
} | ||
}, false); | ||
}); |