diff --git a/src/scripts/app.js b/src/scripts/app.js index 0b73cdd..d44e636 100644 --- a/src/scripts/app.js +++ b/src/scripts/app.js @@ -1,5 +1,4 @@ import riot from 'riot' -import route from 'riot-route' import * as util from './lib/util' import preload_json from './config/preload' import history_json from './config/history' @@ -20,6 +19,7 @@ util.bindCloseBtn() util.startLoading(() => { util.preload(preload_json, () => { util.finLoad() + util.showSkipButton() }, data => {}) }) diff --git a/src/scripts/lib/util.js b/src/scripts/lib/util.js index 10a06d7..056e2b6 100644 --- a/src/scripts/lib/util.js +++ b/src/scripts/lib/util.js @@ -129,6 +129,34 @@ export const hiddenPage = () => { document.querySelector('.product-page').style.display = 'none' } +/** + * スキップボタンの表示 + */ +export const showSkipButton = () => { + const skip_button = document.getElementById('skip-button') + skip_button.setAttribute('data-state', 'true') + + /* click ---------------------------------------------------------------- */ + skip_button.addEventListener('click', e => { + e.target.setAttribute('data-state', 'false') + skipAnimation() + }) + + setTimeout(() => { skip_button.setAttribute('data-state', 'false') }, 5000) +} + +/** + * アニメーションをスキップ + */ +export const skipAnimation = () => { + if(load_view) root.removeChild(load_view) + if(gab_animation) root.removeChild(gab_animation) + if(calling) root.removeChild(calling) + if(end_animation) root.removeChild(end_animation) + + top_page.setAttribute('data-state', 'start') +} + /** * ロードの開始タイミングを取得 * @param fn : コールバック関数