mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
add rhymix_alert
This commit is contained in:
parent
9e6005ccbc
commit
40e35a9451
4 changed files with 68 additions and 5 deletions
|
|
@ -157,6 +157,24 @@ a img {
|
|||
background: #333 url("../../common/img/msg.loading.gif") no-repeat center 15px;
|
||||
}
|
||||
|
||||
/* alert */
|
||||
#rhymix_alert {
|
||||
display: none;
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
bottom: 20%;
|
||||
width: 350px;
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
opacity: 0.6;
|
||||
padding: 12px 20px;
|
||||
border-radius: 10px;
|
||||
transform: translateX(-50%);
|
||||
z-index: 999999999;
|
||||
}
|
||||
|
||||
/* Debug */
|
||||
#rhymix_debug_button {
|
||||
display: none;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,38 @@
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief display alert
|
||||
*/
|
||||
window.rhymix_alert = function(message, redirect_url, delay) {
|
||||
if(!delay) {
|
||||
delay = 2500;
|
||||
}
|
||||
if(!redirect_url) {
|
||||
$('#rhymix_alert').text(message).show();
|
||||
setTimeout(function() {
|
||||
$('#rhymix_alert').fadeOut(1000, function() {
|
||||
$(this).empty();
|
||||
});
|
||||
}, delay);
|
||||
}
|
||||
else if(isSameOrigin(location.href, redirect_url)) {
|
||||
Cookies.set('rhymix_alert_message', message, { expires: 1 / 1440, path: '' });
|
||||
Cookies.set('rhymix_alert_delay', delay, { expires: 1 / 1440, path: '' });
|
||||
}
|
||||
else {
|
||||
alert(message);
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
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: '' });
|
||||
}
|
||||
});
|
||||
|
||||
/* Array for pending debug data */
|
||||
window.rhymix_debug_pending_data = [];
|
||||
|
||||
|
|
@ -531,10 +563,7 @@ function sendMailTo(to) {
|
|||
* @brief url이동 (Rhymix 개선된 버전)
|
||||
*/
|
||||
function redirect(url) {
|
||||
var absolute_url = window.location.href;
|
||||
var relative_url = window.location.pathname + window.location.search;
|
||||
if (url === absolute_url || url.indexOf(absolute_url.replace(/#.+$/, "") + "#") === 0 ||
|
||||
url === relative_url || url.indexOf(relative_url.replace(/#.+$/, "") + "#") === 0) {
|
||||
if (isCurrentPageUrl(url)) {
|
||||
window.location.href = url;
|
||||
window.location.reload();
|
||||
} else {
|
||||
|
|
@ -542,6 +571,13 @@ function redirect(url) {
|
|||
}
|
||||
}
|
||||
|
||||
function isCurrentPageUrl(url) {
|
||||
var absolute_url = window.location.href;
|
||||
var relative_url = window.location.pathname + window.location.search;
|
||||
return url === absolute_url || url.indexOf(absolute_url.replace(/#.+$/, "") + "#") === 0 ||
|
||||
url === relative_url || url.indexOf(relative_url.replace(/#.+$/, "") + "#") === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief url이동 (open_window 값이 N 가 아니면 새창으로 띄움)
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -376,7 +376,15 @@
|
|||
if (callback_success && window[callback_success] && $.isFunction(window[callback_success])) {
|
||||
callback_success = window[callback_success];
|
||||
} else {
|
||||
callback_success = null;
|
||||
callback_success = function(data) {
|
||||
if (data['message'] === 'success') {
|
||||
return;
|
||||
}
|
||||
rhymix_alert(data['message'], data['redirect_url']);
|
||||
if (data['redirect_url']) {
|
||||
redirect(data.redirect_url);
|
||||
}
|
||||
};
|
||||
}
|
||||
var callback_error = form.data('callback-error');
|
||||
if (callback_error && window[callback_error] && $.isFunction(window[callback_error])) {
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@
|
|||
|
||||
<!-- ETC -->
|
||||
<div id="rhymix_waiting" class="wfsr" cond="!$m">{$lang->msg_call_server}</div>
|
||||
<div id="rhymix_alert"></div>
|
||||
<div id="rhymix_debug_panel"></div>
|
||||
<div id="rhymix_debug_button"></div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue