author | ymh <ymh.work@gmail.com> |
Fri, 15 Sep 2017 11:26:43 +0200 | |
changeset 546 | 178f9add0784 |
parent 522 | c6cad1055714 |
permissions | -rw-r--r-- |
522
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
import Ember from 'ember'; |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
2 |
import ENV from 'app-client/config/environment'; |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
import URI from 'urijs'; |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
|
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
export function initialize(appInstance) { |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
// appInstance.inject('route', 'foo', 'service:foo'); |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
7 |
const player = appInstance.lookup('service:player'); |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
8 |
Ember.$(ENV.APP.navigationLinksSelector).click(function(e) { |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
9 |
const locHash = window.location.hash; |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
const uri = URI(Ember.$(e.target).prop('href')); |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
Ember.run(() => { |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
// close notice or transcript "window" |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
player.displayMetadata(false); |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
// if we do not navigate, force the router refresh |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
if(locHash === "#"+uri.fragment()) { |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
appInstance.get('router').router.refresh(); |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
} |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
}); |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
}); |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
} |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
|
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
export default { |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
name: 'nav-menu', |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
initialize |
c6cad1055714
force router refresh and close notice or transcript when clicking on navigation links. Fix #0025933
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
}; |