mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Merge pull request #1229 from conory/pr/rhymix_alert
변경됨을 알리는 rhymix_alert 추가
This commit is contained in:
commit
d7b48eb5ad
4 changed files with 76 additions and 5 deletions
|
|
@ -157,6 +157,26 @@ 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%;
|
||||
min-width: 250px;
|
||||
max-width: 500px;
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
opacity: 0.6;
|
||||
padding: 12px 20px;
|
||||
border: 1px solid #fff;
|
||||
border-radius: 10px;
|
||||
transform: translateX(-50%);
|
||||
z-index: 999999999;
|
||||
}
|
||||
|
||||
/* Debug */
|
||||
#rhymix_debug_button {
|
||||
display: none;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,44 @@
|
|||
}
|
||||
};
|
||||
|
||||
window.rhymix_alert_close = function() {
|
||||
if($('#rhymix_alert').is(':hidden')) {
|
||||
return;
|
||||
}
|
||||
$('#rhymix_alert').fadeOut(500, function() {
|
||||
$(this).empty();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief display alert
|
||||
*/
|
||||
window.rhymix_alert = function(message, redirect_url, delay) {
|
||||
if(!delay) {
|
||||
delay = 2500;
|
||||
}
|
||||
if(!redirect_url) {
|
||||
$('#rhymix_alert').text(message).show();
|
||||
setTimeout(rhymix_alert_close, 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: '' });
|
||||
}
|
||||
$('#rhymix_alert').click(rhymix_alert_close);
|
||||
});
|
||||
|
||||
/* Array for pending debug data */
|
||||
window.rhymix_debug_pending_data = [];
|
||||
|
||||
|
|
@ -531,10 +569,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 +577,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