Improvements :)
Former-commit-id: c1c1881302a241fdc7140e6aabeb9b49977bd7c6 [formerly 84bb454c2f34baffd9dfa91645b8aff149e52620] [formerly 29e258c7a16db1ca8a3fde7c5e4e3cffc47899a6 [formerly 84ddad027f]]
Former-commit-id: 0018a51df5bc801b783a3ffe17d9f33c504ce094 [formerly 0072c425cd4754e38f30007ab9f5272ea4b40370]
Former-commit-id: d298f006e58ef9e4987def4bc354818062b30fcd
This commit is contained in:
1 parent
7f5a361bc1
commit
346412eb2a
21 files changed
+467
-445
No files matched your search
+20
-6
@@ -1,5 +1,10 @@
|
||||
var $ = window.info
|
||||
|
||||
function open (url, history) {
|
||||
window.info.page.kind = ''
|
||||
// Reset info
|
||||
$.listing.selected.length = 0
|
||||
$.listing.selected.multiple = false
|
||||
$.req.kind = ''
|
||||
|
||||
let request = new window.XMLHttpRequest()
|
||||
request.open('GET', url, true)
|
||||
@@ -7,15 +12,15 @@ function open (url, history) {
|
||||
|
||||
request.onload = () => {
|
||||
if (request.status === 200) {
|
||||
window.info.page = JSON.parse(request.responseText)
|
||||
$.req = JSON.parse(request.responseText)
|
||||
|
||||
if (history) {
|
||||
window.history.pushState({
|
||||
name: window.info.page.name,
|
||||
name: $.req.name,
|
||||
url: url
|
||||
}, window.info.page.name, url)
|
||||
}, $.req.name, url)
|
||||
|
||||
document.title = window.info.page.name
|
||||
document.title = $.req.name
|
||||
}
|
||||
} else {
|
||||
console.log(request.responseText)
|
||||
@@ -26,11 +31,20 @@ function open (url, history) {
|
||||
request.send()
|
||||
}
|
||||
|
||||
function removeLastDir (url) {
|
||||
var arr = url.split('/')
|
||||
if (arr.pop() === '') {
|
||||
arr.pop()
|
||||
}
|
||||
return (arr.join('/'))
|
||||
}
|
||||
|
||||
export default {
|
||||
reload: () => {
|
||||
open(window.location.pathname, false)
|
||||
},
|
||||
open: (url) => {
|
||||
open(url, true)
|
||||
}
|
||||
},
|
||||
removeLastDir: removeLastDir
|
||||
}
|
||||
Reference in new issue
Block a user