mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-05 14:40:44 -04:00
Put the javascript initialization into a ready function so its invoked after the dom has been created. Fixes ticket #839
This commit is contained in:
@@ -2,26 +2,28 @@
|
||||
<script type="text/javascript">
|
||||
var old_default_locale = <?= html::js_string($default_locale) ?>;
|
||||
|
||||
$("input[name='installed_locales[]']").change(function (event) {
|
||||
if (this.checked) {
|
||||
$("input[type='radio'][value='" + this.value + "']").enable();
|
||||
} else {
|
||||
if ($("input[type='radio'][value='" + this.value + "']").selected()) { // if you deselect your default language, switch to some other installed language
|
||||
$("input[type='radio'][value='" + old_default_locale + "']").attr("checked", "checked");
|
||||
$("#g-languages-form").ready(function() {
|
||||
$("input[name='installed_locales[]']").change(function (event) {
|
||||
if (this.checked) {
|
||||
$("input[type='radio'][value='" + this.value + "']").enable();
|
||||
} else {
|
||||
if ($("input[type='radio'][value='" + this.value + "']").selected()) { // if you deselect your default language, switch to some other installed language
|
||||
$("input[type='radio'][value='" + old_default_locale + "']").attr("checked", "checked");
|
||||
}
|
||||
$("input[type='radio'][value='" + this.value + "']").attr("disabled", "disabled");
|
||||
}
|
||||
$("input[type='radio'][value='" + this.value + "']").attr("disabled", "disabled");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("g-languages-form").ajaxForm({
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.result == "success") {
|
||||
el = $('<a href="' + <?= html::js_string(url::site("admin/maintenance/start/gallery_task::update_l10n?csrf=$csrf")) ?> + '"></a>'); // this is a little hack to trigger the update_l10n task in a dialog
|
||||
el.gallery_dialog();
|
||||
el.trigger('click');
|
||||
$("#g-languages-form").ajaxForm({
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
if (data.result == "success") {
|
||||
el = $('<a href="' + <?= html::js_string(url::site("admin/maintenance/start/gallery_task::update_l10n?csrf=$csrf")) ?> + '"></a>'); // this is a little hack to trigger the update_l10n task in a dialog
|
||||
el.gallery_dialog();
|
||||
el.trigger('click');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user