1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-07 03:28:31 +00:00
FrankerFaceZ/src/modules/main_menu/components/changelog.vue

48 lines
1 KiB
Vue
Raw Normal View History

2017-11-13 01:23:39 -05:00
<template lang="html">
<div class="ffz--changelog tw-border-t tw-pd-t-1">
<div class="tw-align-center">
<h2>{{ t('home.changelog', 'Changelog') }}</h2>
</div>
2017-11-13 01:23:39 -05:00
<div ref="changes" />
</div>
2017-11-13 01:23:39 -05:00
</template>
<script>
import {SERVER} from 'utilities/constants';
export default {
props: ['item', 'context'],
mounted() {
this.fetch(`${SERVER}/script/changelog.html`, this.$refs.changes);
},
2017-11-13 01:23:39 -05:00
methods: {
fetch(url, container) {
const done = data => {
if ( ! data )
data = 'There was an error loading this page from the server.';
container.innerHTML = data;
const btn = container.querySelector('#ffz-old-news-button');
if ( btn )
btn.addEventListener('click', () => {
btn.remove();
2017-11-13 01:23:39 -05:00
const old_news = container.querySelector('#ffz-old-news');
if ( old_news )
this.fetch(`${SERVER}/script/old_changes.html`, old_news);
});
}
fetch(url)
.then(resp => resp.ok ? resp.text() : null)
.then(done)
.catch(() => done(null));
2017-11-13 01:23:39 -05:00
}
}
}
</script>