@peerboard/core
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -51,11 +51,11 @@ "use strict"; | ||
onTitleChanged: function (title) { return window.document.title = title; }, | ||
onPathChanged: function (newPath) { return window.history.replaceState({}, window.document.title, newPath); }, | ||
onPathChanged: function (newPath) { return window.history.replaceState({}, window.document.title, newPath); } | ||
}; | ||
exports.createForum = function (forumID, container, options) { | ||
var opts = __assign(__assign({}, defaultOptions), { scrollToTopOnNavigationChanged: true }); | ||
if (options.prefix) { | ||
if (!opts.usePathFromQs) { | ||
// Auto resolve redirect | ||
var prefixRgx = new RegExp("^/" + trimLeftSlash(options.prefix)); | ||
var pathnameWithoutPrefix = document.location.pathname.replace(prefixRgx, ''); | ||
opts.path = pathnameWithoutPrefix + document.location.search + document.location.hash; | ||
opts.path = ((options.prefix && options.prefix !== "/") | ||
? document.location.pathname.replace(new RegExp("^/" + trimLeftSlash(options.prefix)), '') | ||
: document.location.pathname) + document.location.search + document.location.hash; | ||
} | ||
@@ -62,0 +62,0 @@ Object.assign(opts, options); |
@@ -67,11 +67,11 @@ 'use strict'; | ||
onTitleChanged: function (title) { return window.document.title = title; }, | ||
onPathChanged: function (newPath) { return window.history.replaceState({}, window.document.title, newPath); }, | ||
onPathChanged: function (newPath) { return window.history.replaceState({}, window.document.title, newPath); } | ||
}; | ||
var createForum = function (forumID, container, options) { | ||
var opts = __assign(__assign({}, defaultOptions), { scrollToTopOnNavigationChanged: true }); | ||
if (options.prefix) { | ||
if (!opts.usePathFromQs) { | ||
// Auto resolve redirect | ||
var prefixRgx = new RegExp("^/" + trimLeftSlash(options.prefix)); | ||
var pathnameWithoutPrefix = document.location.pathname.replace(prefixRgx, ''); | ||
opts.path = pathnameWithoutPrefix + document.location.search + document.location.hash; | ||
opts.path = ((options.prefix && options.prefix !== "/") | ||
? document.location.pathname.replace(new RegExp("^/" + trimLeftSlash(options.prefix)), '') | ||
: document.location.pathname) + document.location.search + document.location.hash; | ||
} | ||
@@ -78,0 +78,0 @@ Object.assign(opts, options); |
@@ -69,11 +69,11 @@ (function (global, factory) { | ||
onTitleChanged: function (title) { return window.document.title = title; }, | ||
onPathChanged: function (newPath) { return window.history.replaceState({}, window.document.title, newPath); }, | ||
onPathChanged: function (newPath) { return window.history.replaceState({}, window.document.title, newPath); } | ||
}; | ||
var createForum = function (forumID, container, options) { | ||
var opts = __assign(__assign({}, defaultOptions), { scrollToTopOnNavigationChanged: true }); | ||
if (options.prefix) { | ||
if (!opts.usePathFromQs) { | ||
// Auto resolve redirect | ||
var prefixRgx = new RegExp("^/" + trimLeftSlash(options.prefix)); | ||
var pathnameWithoutPrefix = document.location.pathname.replace(prefixRgx, ''); | ||
opts.path = pathnameWithoutPrefix + document.location.search + document.location.hash; | ||
opts.path = ((options.prefix && options.prefix !== "/") | ||
? document.location.pathname.replace(new RegExp("^/" + trimLeftSlash(options.prefix)), '') | ||
: document.location.pathname) + document.location.search + document.location.hash; | ||
} | ||
@@ -80,0 +80,0 @@ Object.assign(opts, options); |
@@ -9,3 +9,2 @@ interface Options { | ||
onCustomProfile?: (url: string) => void; | ||
onExternalLogin?: (url: string) => void; | ||
onReady?: () => void; | ||
@@ -18,2 +17,3 @@ onFail?: () => void; | ||
hideMenu?: boolean; | ||
usePathFromQs?: boolean; | ||
} | ||
@@ -35,3 +35,2 @@ interface InternalSDKOptions { | ||
onCustomProfile?: (url: string) => void; | ||
onExternalLogin?: (url: string) => void; | ||
onReady?: () => void; | ||
@@ -41,2 +40,3 @@ onFail?: () => void; | ||
sendReferrer?: boolean; | ||
usePathFromQs?: boolean; | ||
} | ||
@@ -43,0 +43,0 @@ export interface ForumAPI { |
{ | ||
"name": "@peerboard/core", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "peerboard.com frontend components", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
35394