Commit 4db42a02 authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Merge branch 'raos_work' into Typo3integrated

parents 049c9b3e f227d985
......@@ -53,6 +53,19 @@ module.exports = function (grunt) {
}
]
},
jquery_devel: {
files: [
{
cwd: 'bower_components/jquery/dist/',
src: [
'jquery.min.js'
],
expand: true,
dest: "js/",
flatten: true
}
]
},
jqwidgets: {
files: [
{
......
......@@ -12,6 +12,7 @@ if (!QfqNS) {
n.PageState = function () {
this.pageState = location.hash.slice(1);
this.data = null;
this.inPoppingHandler = false;
this.userPopStateHandlers = [];
......@@ -29,10 +30,11 @@ if (!QfqNS) {
this.inPoppingHandler = true;
this.pageState = location.hash.slice(1);
this.data = window.history.state;
QfqNS.Log.debug("PageState.popStateHandler(): invoke user pop state handler(s)");
this.userPopStateHandlers.forEach(function (handler) {
handler(this.pageState);
handler(this);
}, this);
this.inPoppingHandler = false;
......@@ -44,24 +46,31 @@ if (!QfqNS) {
return this.pageState;
};
n.PageState.prototype.setPageState = function (state) {
n.PageState.prototype.getPageData = function () {
return this.data;
};
n.PageState.prototype.setPageState = function (state, data) {
if (state.startsWith('#')) {
this.pageState = state.slice(1);
window.history.replaceState(null, null, state);
window.history.replaceState(data, null, state);
} else {
this.pageState = state;
window.history.replaceState(null, null, '#' + state);
window.history.replaceState(data, null, '#' + state);
}
this.data = data;
};
n.PageState.prototype.newPageState = function (state) {
n.PageState.prototype.newPageState = function (state, data) {
if (state.startsWith('#')) {
this.pageState = state.slice(1);
window.history.pushState(null, null, state);
window.history.pushState(data, null, state);
} else {
this.pageState = state;
window.history.pushState(null, null, '#' + state);
window.history.pushState(data, null, '#' + state);
}
this.data = data;
};
n.PageState.prototype.addStateActivationHandler = function (handler) {
......
......@@ -22,8 +22,12 @@ if (!QfqNS) {
this.bsTabs = new QfqNS.BSTabs(this.settings.tabsId);
if (this.settings.pageState.getPageState() !== "") {
this.bsTabs.activateTab(this.settings.pageState.getPageState());
var currentState = this.settings.pageState.getPageState();
if (currentState !== "") {
this.bsTabs.activateTab(currentState);
QfqNS.PageTitle.setSubTitle(this.bsTabs.getTabName(currentState));
} else {
this.settings.pageState.setPageState(this.bsTabs.getCurrentTab(), QfqNS.PageTitle.get());
}
this.bsTabs.addTabShowHandler(this.tabShowHandler.bind(this));
......@@ -37,18 +41,20 @@ if (!QfqNS) {
// Therefore, we have to make sure, that tabShowHandler() does not save the page state while we're restoring
// a previous state, i.e. we're called because of the popStateHandler() below.
if (this.settings.pageState.inPoppingHandler) {
QfqNS.Log.debug("Prematurely terminating QfqPage.tabShowHandler(): called while due to page state" +
QfqNS.Log.debug("Prematurely terminating QfqPage.tabShowHandler(): called due to page state" +
" restoration.");
return;
}
var currentTabId = bsTabs.getCurrentTab();
QfqNS.Log.debug('Saving state: ' + currentTabId);
this.settings.pageState.newPageState(currentTabId);
QfqNS.PageTitle.setSubTitle(bsTabs.getTabName(currentTabId));
this.settings.pageState.newPageState(currentTabId, QfqNS.PageTitle.get());
};
n.QfqPage.prototype.popStateHandler = function (state) {
this.bsTabs.activateTab(state);
n.QfqPage.prototype.popStateHandler = function (pageState) {
this.bsTabs.activateTab(pageState.getPageState());
QfqNS.PageTitle.set(pageState.getPageData());
};
})(QfqNS);
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment