mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-02 16:52:16 +09:00
Clean up repeating code and add redirect() function
This commit is contained in:
parent
006474cb98
commit
9b5a17fb59
3 changed files with 29 additions and 58 deletions
|
|
@ -377,6 +377,21 @@ function sendMailTo(to) {
|
|||
location.href="mailto:"+to;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief url이동 (Rhymix 개선된 버전)
|
||||
*/
|
||||
function redirect(url) {
|
||||
if (url === window.location.href || url.indexOf(window.location.href.replace(/#.+$/, "") + "#") === 0)
|
||||
{
|
||||
window.location.href = url;
|
||||
window.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href = url;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief url이동 (open_window 값이 N 가 아니면 새창으로 띄움)
|
||||
**/
|
||||
|
|
@ -394,7 +409,7 @@ function move_url(url, open_window) {
|
|||
if(open_window) {
|
||||
winopen(url);
|
||||
} else {
|
||||
location.href=url;
|
||||
redirect(url);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -106,16 +106,7 @@
|
|||
data.redirect_url = data.redirect_url.replace(/&/g, "&");
|
||||
}
|
||||
if (data.redirect_url && !$.isFunction(callback_success)) {
|
||||
if (data.redirect_url.indexOf(window.location.href.replace(/#.+$/, "") + "#") === 0)
|
||||
{
|
||||
window.location = data.redirect_url;
|
||||
window.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location = data.redirect_url;
|
||||
}
|
||||
return;
|
||||
return redirect(data.redirect_url);
|
||||
}
|
||||
|
||||
// If there was a success callback, call it.
|
||||
|
|
@ -236,16 +227,7 @@
|
|||
data.redirect_url = data.redirect_url.replace(/&/g, "&");
|
||||
}
|
||||
if (data.redirect_url && !$.isFunction(callback_success)) {
|
||||
if (data.redirect_url.indexOf(window.location.href.replace(/#.+$/, "") + "#") === 0)
|
||||
{
|
||||
window.location = data.redirect_url;
|
||||
window.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location = data.redirect_url;
|
||||
}
|
||||
return;
|
||||
return redirect(data.redirect_url);
|
||||
}
|
||||
|
||||
// If there was a success callback, call it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue