mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 21:12:15 +09:00
Reorder event handlers defined at document.ready
This commit is contained in:
parent
e7fbeee414
commit
a778c46afa
1 changed files with 47 additions and 48 deletions
|
|
@ -811,7 +811,7 @@ $(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('body').on('click', 'a[target]', function(event) {
|
$(document).on('click', 'a[target]', function(event) {
|
||||||
const $this = $(this);
|
const $this = $(this);
|
||||||
const href = String($this.attr('href')).trim();
|
const href = String($this.attr('href')).trim();
|
||||||
const target = String($this.attr('target')).trim();
|
const target = String($this.attr('target')).trim();
|
||||||
|
|
@ -831,47 +831,6 @@ $(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Display any pending alert messages
|
|
||||||
*/
|
|
||||||
if(Cookies.get('rhymix_alert_message')) {
|
|
||||||
rhymix_alert(Cookies.get('rhymix_alert_message'), null, Cookies.get('rhymix_alert_delay'));
|
|
||||||
Cookies.remove('rhymix_alert_message', { path: '/' });
|
|
||||||
Cookies.remove('rhymix_alert_delay', { path: '/' });
|
|
||||||
}
|
|
||||||
$('#rhymix_alert').on('click', rhymix_alert_close);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Intercept form submission and handle them with AJAX
|
|
||||||
*/
|
|
||||||
$(document).on('submit', 'form.rx_ajax', function(event) {
|
|
||||||
if (!$(this).attr('target')) {
|
|
||||||
event.preventDefault();
|
|
||||||
Rhymix.ajaxForm(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Editor preview replacement
|
|
||||||
*/
|
|
||||||
$('.editable_preview').addClass('rhymix_content xe_content').attr('tabindex', 0);
|
|
||||||
$('.editable_preview').on('click', function() {
|
|
||||||
var input = $(this).siblings('.editable_preview_content');
|
|
||||||
if (input.size()) {
|
|
||||||
$(this).off('click').off('focus').hide();
|
|
||||||
input = input.first();
|
|
||||||
if (input.attr('type') !== 'hidden') {
|
|
||||||
input.hide();
|
|
||||||
}
|
|
||||||
var iframe = $('<iframe class="editable_preview_iframe"></iframe>');
|
|
||||||
iframe.attr('src', current_url.setQuery('module', 'editor').setQuery('act', 'dispEditorFrame').setQuery('parent_input_id', input.attr('id')).replace(/^https?:/, ''));
|
|
||||||
iframe.insertAfter(input);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('.editable_preview').on('focus', function() {
|
|
||||||
$(this).triggerHandler('click');
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enforce max filesize on file uploaeds
|
* Enforce max filesize on file uploaeds
|
||||||
*/
|
*/
|
||||||
|
|
@ -891,17 +850,26 @@ $(function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Intercept form submission and handle them with AJAX
|
||||||
|
*/
|
||||||
|
$(document).on('submit', 'form.rx_ajax', function(event) {
|
||||||
|
if (!$(this).attr('target')) {
|
||||||
|
event.preventDefault();
|
||||||
|
Rhymix.ajaxForm(this);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent repeated click on submit button
|
* Prevent repeated click on submit button
|
||||||
*/
|
*/
|
||||||
$('input[type="submit"],button[type="submit"]').on('click', function(e) {
|
$(document).on('click', 'input[type="submit"],button[type="submit"]', function(e) {
|
||||||
const target = $(e.currentTarget);
|
|
||||||
const timeout = 3000;
|
const timeout = 3000;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
target.prop('disabled', true);
|
$(this).prop('disabled', true);
|
||||||
}, 0);
|
}, 100);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
target.prop('disabled', false);
|
$(this).prop('disabled', false);
|
||||||
}, timeout);
|
}, timeout);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -977,7 +945,7 @@ $(function() {
|
||||||
/**
|
/**
|
||||||
* Create popup windows automatically for _xe_popup links
|
* Create popup windows automatically for _xe_popup links
|
||||||
*/
|
*/
|
||||||
$('body').on('click', 'a._xe_popup', function(e) {
|
$(document).on('click', 'a._xe_popup', function(e) {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var name = $this.attr('name');
|
var name = $this.attr('name');
|
||||||
var href = $this.attr('href');
|
var href = $this.attr('href');
|
||||||
|
|
@ -988,6 +956,27 @@ $(function() {
|
||||||
winopen(href, name, 'left=10,top=10,width=10,height=10,resizable=no,scrollbars=no,toolbars=no');
|
winopen(href, name, 'left=10,top=10,width=10,height=10,resizable=no,scrollbars=no,toolbars=no');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Editor preview replacement
|
||||||
|
*/
|
||||||
|
$('.editable_preview').addClass('rhymix_content xe_content').attr('tabindex', 0);
|
||||||
|
$('.editable_preview').on('click', function() {
|
||||||
|
var input = $(this).siblings('.editable_preview_content');
|
||||||
|
if (input.size()) {
|
||||||
|
$(this).off('click').off('focus').hide();
|
||||||
|
input = input.first();
|
||||||
|
if (input.attr('type') !== 'hidden') {
|
||||||
|
input.hide();
|
||||||
|
}
|
||||||
|
var iframe = $('<iframe class="editable_preview_iframe"></iframe>');
|
||||||
|
iframe.attr('src', current_url.setQuery('module', 'editor').setQuery('act', 'dispEditorFrame').setQuery('parent_input_id', input.attr('id')).replace(/^https?:/, ''));
|
||||||
|
iframe.insertAfter(input);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.editable_preview').on('focus', function() {
|
||||||
|
$(this).triggerHandler('click');
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Datepicker default settings
|
* Datepicker default settings
|
||||||
*/
|
*/
|
||||||
|
|
@ -997,6 +986,16 @@ $(function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display any pending alert messages
|
||||||
|
*/
|
||||||
|
if(Cookies.get('rhymix_alert_message')) {
|
||||||
|
rhymix_alert(Cookies.get('rhymix_alert_message'), null, Cookies.get('rhymix_alert_delay'));
|
||||||
|
Cookies.remove('rhymix_alert_message', { path: '/' });
|
||||||
|
Cookies.remove('rhymix_alert_delay', { path: '/' });
|
||||||
|
}
|
||||||
|
$('#rhymix_alert').on('click', rhymix_alert_close);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue