mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-12 07:11:42 +09:00
20 lines
547 B
JavaScript
20 lines
547 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Remove comment_srl and unnecessary page number from short URL
|
|
*/
|
|
(function() {
|
|
var match = location.pathname.match(/\/([a-zA-Z0-9_]+)\/([0-9]+)\/(comment|page)\/([0-9]+)$/);
|
|
if (match && match[1] === window.current_mid) {
|
|
var newpath = location.pathname.replace(/\/(comment|page)\/([0-9]+)$/, '');
|
|
if (location.hash && location.hash !== '#') {
|
|
newpath += location.hash;
|
|
}
|
|
if (history.replaceState) {
|
|
history.replaceState({
|
|
rx_replaced: true,
|
|
prev: location.pathname,
|
|
}, '', newpath);
|
|
}
|
|
}
|
|
})();
|