PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.5
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 All 203 releases
betterdocs / react-src / public / category-grid.js

category-grid.js in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.5, at react-src/public/category-grid.js

32 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import categoryGrid from '../utils/categoryGrid'
2
3 (function ($) {
4 $(document).ready(function () {
5 document.querySelectorAll('.betterdocs-category-grid-inner-wrapper.masonry').forEach(grid => {
6 categoryGrid(grid.parentElement, $);
7 });
8
9 if( betterdocsCategoryGridConfig?.is_betterdocs_templates != 1 ) { //run this script only from outside betterdocs templates only, this script is made to determine set the kb and its value on cookie
10 $('.betterdocs-category-grid-inner-wrapper .betterdocs-single-category-wrapper .betterdocs-category-link-btn').on('click', function(e){ //this is triggerd when clicked on explore more on category grid
11 let secondTopLayer = $($($($(this)?.parent())?.parent())?.parent())?.parent();
12 let topLayerMkbAttribute = $(secondTopLayer).attr('data-mkb-slug');
13 if( topLayerMkbAttribute?.length > 0 ) {
14 var expiryDate = new Date();
15 var timeStamp = expiryDate.setDate(expiryDate.getDate() + 30).toString();
16 document.cookie = `last_knowledge_base=${topLayerMkbAttribute}; expires=${timeStamp}; path=/;` ;
17 }
18 });
19
20 $('.betterdocs-category-grid-inner-wrapper .betterdocs-single-category-wrapper .betterdocs-body .betterdocs-articles-list li a').on('click', function(e) { //this is triggerd when clicked on single doc list
21 let secondTopLayer = $($($($($($(this).parent()).parent()).parent()).parent()).parent()).parent();
22 let topLayerMkbAttribute = $(secondTopLayer).attr('data-mkb-slug');
23 if( topLayerMkbAttribute?.length > 0 ) {
24 var expiryDate = new Date();
25 var timeStamp = expiryDate.setDate(expiryDate.getDate() + 30).toString();
26 document.cookie = `last_knowledge_base=${topLayerMkbAttribute}; expires=${timeStamp}; path=/;` ;
27 }
28 })
29 }
30 });
31 })(jQuery);
32