| 1 |
export default function ( $scope, $ ) { |
| 2 |
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 |
| 3 |
$('.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 |
| 4 |
let secondTopLayer = $($($($(this)?.parent())?.parent())?.parent())?.parent(); |
| 5 |
let topLayerMkbAttribute = $(secondTopLayer).attr('data-mkb-slug'); |
| 6 |
if( topLayerMkbAttribute?.length > 0 ) { |
| 7 |
var expiryDate = new Date(); |
| 8 |
var timeStamp = expiryDate.setDate(expiryDate.getDate() + 30).toString(); |
| 9 |
document.cookie = `last_knowledge_base=${topLayerMkbAttribute}; expires=${timeStamp}; path=/;` ; |
| 10 |
} |
| 11 |
}); |
| 12 |
|
| 13 |
$('.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 |
| 14 |
let secondTopLayer = $($($($($($(this).parent()).parent()).parent()).parent()).parent()).parent(); |
| 15 |
let topLayerMkbAttribute = $(secondTopLayer).attr('data-mkb-slug'); |
| 16 |
if( topLayerMkbAttribute?.length > 0 ) { |
| 17 |
var expiryDate = new Date(); |
| 18 |
var timeStamp = expiryDate.setDate(expiryDate.getDate() + 30).toString(); |
| 19 |
document.cookie = `last_knowledge_base=${topLayerMkbAttribute}; expires=${timeStamp}; path=/;` ; |
| 20 |
} |
| 21 |
}); |
| 22 |
} |
| 23 |
} |
| 24 |
|