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