@osimatic/helpers-js 1.1.13 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/paging.js +13 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.1.13",
3
+ "version": "1.1.14",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/paging.js CHANGED
@@ -143,6 +143,19 @@ class Navigation {
143
143
  let tab = new bootstrap.Tab(a[0]);
144
144
  tab.show();
145
145
  }
146
+
147
+ static addTabInHistory(tabId, queryStringKey, replace) {
148
+ queryStringKey = typeof queryStringKey != 'undefined' && null !== queryStringKey ? queryStringKey : 'tab';
149
+ replace = typeof replace != 'undefined' && null !== replace ? replace : true;
150
+ let url = window.location.href;
151
+ url = UrlAndQueryString.setParamOfUrl(queryStringKey, tabId, url);
152
+ if (replace) {
153
+ window.history.replaceState('', document.title, url);
154
+ }
155
+ else {
156
+ window.history.pushState("", "", newUrl);
157
+ }
158
+ }
146
159
  }
147
160
 
148
161
  module.exports = { Pagination, Navigation };