文件操作 - history.js
返回文件管理
返回主菜单
删除本文件
文件: /home/www/public/wp-content/plugins/ionos-journey/js/journey/helpers/history.js
编辑文件内容
import UrlHelper from './url-helper.js'; import Progress from './progress.js'; export default class History { static historyKey = 'ionos-journey-history'; static store( history ) { sessionStorage.setItem( History.historyKey, JSON.stringify( history ) ); } static push( index ) { const history = History.get(); const params = UrlHelper.convertToJson( UrlHelper.getAllParams() ); if ( Object.prototype.hasOwnProperty.call( params, 'autoplay' ) ) { delete params.autoplay; } history.push( { pageName: UrlHelper.getPageName(), index, urlParams: params, } ); History.store( history ); } static getLast() { const history = History.get(); return history.pop(); } static getFirst() { const history = History.get(); return history[ 0 ] || null; } static pop() { const history = History.get(); const item = history.pop(); History.store( history ); return item; } static get() { return JSON.parse( sessionStorage.getItem( History.historyKey ) ) || []; } static clear( saveProgress = true ) { if ( History.get().length > 0 && saveProgress ) { Progress.store( History.get() ); } sessionStorage.removeItem( History.historyKey ); } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件