2017-08-22 10:53:26 +03:00
|
|
|
import HashLocation from '@ember/routing/hash-location';
|
2015-10-28 14:36:45 +03:00
|
|
|
|
2017-03-14 19:04:46 +03:00
|
|
|
let trailingHash = HashLocation.extend({
|
2015-10-28 14:36:45 +03:00
|
|
|
formatURL() {
|
2016-04-28 14:41:23 +03:00
|
|
|
let url = this._super(...arguments);
|
|
|
|
|
|
|
|
if (url.indexOf('?') > 0) {
|
|
|
|
return url.replace(/([^\/])\?/, '$1/?');
|
|
|
|
} else {
|
|
|
|
return url.replace(/\/?$/, '/');
|
|
|
|
}
|
2014-05-14 05:52:31 +04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-08-19 14:55:40 +03:00
|
|
|
export default {
|
2017-03-14 19:04:46 +03:00
|
|
|
name: 'registerTrailingHashLocation',
|
2014-05-14 05:52:31 +04:00
|
|
|
|
2015-11-30 21:23:47 +03:00
|
|
|
initialize(application) {
|
2017-03-14 19:04:46 +03:00
|
|
|
application.register('location:trailing-hash', trailingHash);
|
2014-05-14 05:52:31 +04:00
|
|
|
}
|
|
|
|
};
|