From 59c0cbcb36aa43db4181005358aec7150f8420ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Tu=CC=88ken?= Date: Mon, 30 Nov 2020 18:14:10 +0300 Subject: [PATCH] init cookie if not exists or coming directly url. --- .../Pages/Documents/Project/index.js | 65 ++++++++++++------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js index a65251a20e..33f0c96624 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js @@ -105,41 +105,41 @@ $('#TwitterShareLink').attr( 'href', 'https://twitter.com/intent/tweet?text=' + - encodeURI( - pageHeader + - ' | ' + - projectName + - ' | ' + - window.location.href - ) + encodeURI( + pageHeader + + ' | ' + + projectName + + ' | ' + + window.location.href + ) ); $('#LinkedinShareLink').attr( 'href', 'https://www.linkedin.com/shareArticle?' + - 'url=' + - encodeURI(window.location.href) + - '&' + - 'mini=true&' + - 'summary=' + - encodeURI(projectName) + - '&' + - 'title=' + - encodeURI(pageHeader) + - '&' + - 'source=' + - encodeURI($('#GoToMainWebSite').attr('href')) + 'url=' + + encodeURI(window.location.href) + + '&' + + 'mini=true&' + + 'summary=' + + encodeURI(projectName) + + '&' + + 'title=' + + encodeURI(pageHeader) + + '&' + + 'source=' + + encodeURI($('#GoToMainWebSite').attr('href')) ); $('#EmailShareLink').attr( 'href', 'mailto:?' + - 'body=' + - encodeURI('I want you to look at ' + window.location.href) + - '&' + - 'subject=' + - encodeURI(pageHeader + ' | ' + projectName) + - '&' + 'body=' + + encodeURI('I want you to look at ' + window.location.href) + + '&' + + 'subject=' + + encodeURI(pageHeader + ' | ' + projectName) + + '&' ); }; @@ -228,12 +228,27 @@ ); }; + var initCookies = function () { + var cookie = abp.utils.getCookieValue('AbpDocsPreferences'); + + if (!cookie || cookie == null || cookie === null) { + setCookies(); + } else { + var uri = window.location.href.toString(); + + if (uri.indexOf('?') > 0) { + setCookies(); + } + } + }; + $('.doc-section-combobox').change(function () { setCookies(); clearQueryString(); location.reload(); }); + initCookies(); setQueryString(); };