@innovastudio/contentbox 1.4.16 → 1.4.17
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.
package/package.json
CHANGED
@@ -1143,10 +1143,15 @@ class SideBar {
|
|
1143
1143
|
pathReplace: '${item.pathReplace}',
|
1144
1144
|
},`;
|
1145
1145
|
});
|
1146
|
+
let sDefaultCategory = `{
|
1147
|
+
id: ${this.builder.defaultCategory.id},
|
1148
|
+
designId: ${this.builder.defaultCategory.designId},
|
1149
|
+
}`;
|
1146
1150
|
let sCategories = '';
|
1147
1151
|
this.builder.featuredCategories.forEach(item => {
|
1148
1152
|
sCategories += `{
|
1149
1153
|
id: '${item.id}',
|
1154
|
+
designId: '${item.designId}',
|
1150
1155
|
name: '${item.name}',
|
1151
1156
|
},`;
|
1152
1157
|
});
|
@@ -1451,7 +1456,7 @@ class SideBar {
|
|
1451
1456
|
const featuredCategories = [
|
1452
1457
|
${sCategories}
|
1453
1458
|
];
|
1454
|
-
const
|
1459
|
+
const defaultCategory = ${sDefaultCategory};
|
1455
1460
|
const navbar = ${this.builder.navbar ? 'true' : 'false'};
|
1456
1461
|
|
1457
1462
|
const slider = '${this.builder.slider}';
|
@@ -1650,7 +1655,7 @@ class SideBar {
|
|
1650
1655
|
});
|
1651
1656
|
}
|
1652
1657
|
|
1653
|
-
const showDesigns = (catId) => {
|
1658
|
+
const showDesigns = (catId, designId) => {
|
1654
1659
|
|
1655
1660
|
if(template_list.length>0) {
|
1656
1661
|
const wait = document.querySelector('.is-waiting');
|
@@ -1671,7 +1676,7 @@ class SideBar {
|
|
1671
1676
|
let isSelected = false;
|
1672
1677
|
let catSplit = item.category.split(',');
|
1673
1678
|
for (let j = 0; j < catSplit.length; j++) {
|
1674
|
-
if (parseInt(catSplit[j]) === parseInt(catId)) {
|
1679
|
+
if (parseInt(catSplit[j]) === parseInt(catId) && parseInt(gallery.designId) === parseInt(designId)) {
|
1675
1680
|
isSelected = true;
|
1676
1681
|
}
|
1677
1682
|
}
|
@@ -1747,13 +1752,14 @@ class SideBar {
|
|
1747
1752
|
// Set active Button
|
1748
1753
|
const menu = document.querySelector('.mega-menu');
|
1749
1754
|
menu.setAttribute('data-active-cat', catId);
|
1755
|
+
menu.setAttribute('data-active-design', designId);
|
1750
1756
|
const featuredCat = document.querySelector('.featured-categories');
|
1751
1757
|
const btnActive1 = menu.querySelector('button.on');
|
1752
1758
|
const btnActive2 = featuredCat.querySelector('button.on');
|
1753
1759
|
if(btnActive1) btnActive1.classList.remove('on');
|
1754
1760
|
if(btnActive2) btnActive2.classList.remove('on');
|
1755
|
-
const btn1 = menu.querySelector('
|
1756
|
-
const btn2 = featuredCat.querySelector('
|
1761
|
+
const btn1 = menu.querySelector('.item-'+catId+'-'+designId);
|
1762
|
+
const btn2 = featuredCat.querySelector('.item-'+catId+'-'+designId);
|
1757
1763
|
if(btn1) btn1.classList.add('on');
|
1758
1764
|
if(btn2) btn2.classList.add('on');
|
1759
1765
|
}
|
@@ -1775,13 +1781,15 @@ class SideBar {
|
|
1775
1781
|
let html = '<h2>'+parent._cb.out(gallery.name)+'</h2><div class="cat' +catNum+ '"></div>';
|
1776
1782
|
menuContent.insertAdjacentHTML('beforeend', html);
|
1777
1783
|
const catList = menuContent.querySelector('.cat'+catNum);
|
1784
|
+
|
1778
1785
|
categories.forEach(categoryItem=>{
|
1779
|
-
let html= '<button data-cat="'+categoryItem.id+'">'+parent._cb.out(categoryItem.name)+'</button>';
|
1786
|
+
let html= '<button class="item-'+categoryItem.id+'-'+gallery.designId+'" data-cat="'+categoryItem.id+'" data-design="'+gallery.designId+'">'+parent._cb.out(categoryItem.name)+'</button>';
|
1780
1787
|
catList.insertAdjacentHTML('beforeend', html);
|
1781
|
-
const btn = catList.querySelector('
|
1788
|
+
const btn = catList.querySelector('.item-'+categoryItem.id+'-'+gallery.designId);
|
1782
1789
|
btn.addEventListener('click', (e)=>{
|
1783
1790
|
const catId = btn.getAttribute('data-cat');
|
1784
|
-
|
1791
|
+
const designId = btn.getAttribute('data-design');
|
1792
|
+
showDesigns(catId, designId);
|
1785
1793
|
|
1786
1794
|
closeMegaMenu();
|
1787
1795
|
});
|
@@ -1792,10 +1800,11 @@ class SideBar {
|
|
1792
1800
|
|
1793
1801
|
// Set active Button
|
1794
1802
|
const catId = menu.getAttribute('data-active-cat');
|
1795
|
-
|
1803
|
+
const designId = menu.getAttribute('data-active-design');
|
1804
|
+
if(catId && designId) {
|
1796
1805
|
const btnActive = menu.querySelector('button.on');
|
1797
1806
|
if(btnActive) btnActive.classList.remove('on');
|
1798
|
-
const btn = menu.querySelector('
|
1807
|
+
const btn = menu.querySelector('.item-'+catId+'-'+designId);
|
1799
1808
|
if(btn) btn.classList.add('on');
|
1800
1809
|
}
|
1801
1810
|
}
|
@@ -1872,7 +1881,7 @@ class SideBar {
|
|
1872
1881
|
let html = '';
|
1873
1882
|
const div = document.querySelector('.featured-categories');
|
1874
1883
|
featuredCategories.forEach(item=>{
|
1875
|
-
html += '<button data-cat="'+item.id+'">'+parent._cb.out(item.name)+'</button>';
|
1884
|
+
html += '<button class="item-'+item.id+'-'+item.designId+'" data-cat="'+item.id+'" data-design="'+item.designId+'">'+parent._cb.out(item.name)+'</button>';
|
1876
1885
|
});
|
1877
1886
|
html += '<button data-cat="0">'+parent._cb.out('All Categories')+'</button>';
|
1878
1887
|
div.insertAdjacentHTML('beforeend', html);
|
@@ -1882,11 +1891,12 @@ class SideBar {
|
|
1882
1891
|
btns.forEach(btn=>{
|
1883
1892
|
btn.addEventListener('click', (e)=>{
|
1884
1893
|
const catId = btn.getAttribute('data-cat');
|
1894
|
+
const designId = btn.getAttribute('data-design');
|
1885
1895
|
if(catId==='0') {
|
1886
1896
|
// Show All Categories' Mega Menu
|
1887
1897
|
showMegaMenu();
|
1888
1898
|
} else {
|
1889
|
-
showDesigns(catId);
|
1899
|
+
showDesigns(catId, designId);
|
1890
1900
|
}
|
1891
1901
|
});
|
1892
1902
|
});`;
|
@@ -1907,19 +1917,14 @@ class SideBar {
|
|
1907
1917
|
wait.style.display = 'flex';
|
1908
1918
|
const wait2 = document.querySelector('.is-waiting2');
|
1909
1919
|
wait2.style.display = 'flex';
|
1910
|
-
|
1911
|
-
// renderMegaMenu();
|
1912
|
-
|
1913
|
-
// showDesigns(defaultCat); // If not ready (not loaded yet) will show empty
|
1914
1920
|
|
1915
|
-
let designId =
|
1921
|
+
let designId = 1;
|
1916
1922
|
loadJsFiles(templateJSON, (template)=>{
|
1917
1923
|
// console.log(template)
|
1918
1924
|
const templateAdded = template_list[template_list.length-1];
|
1919
1925
|
templateAdded.path = template.path;
|
1920
1926
|
templateAdded.pathReplace = template.pathReplace;
|
1921
1927
|
templateAdded.designId = designId;
|
1922
|
-
designId++;
|
1923
1928
|
// console.log(templateAdded);
|
1924
1929
|
|
1925
1930
|
renderMegaMenu();
|
@@ -1928,11 +1933,12 @@ class SideBar {
|
|
1928
1933
|
if(designList.innerHTML.trim()==='') { // first load
|
1929
1934
|
const cats = templateAdded.categories;
|
1930
1935
|
cats.forEach(cat=>{
|
1931
|
-
if(parseInt(cat.id)===
|
1932
|
-
showDesigns(
|
1936
|
+
if(parseInt(cat.id)===defaultCategory.id && designId===defaultCategory.designId) {
|
1937
|
+
showDesigns(defaultCategory.id, designId);
|
1933
1938
|
}
|
1934
1939
|
});
|
1935
1940
|
}
|
1941
|
+
designId++;
|
1936
1942
|
});
|
1937
1943
|
})
|
1938
1944
|
|
@@ -91184,10 +91190,13 @@ class ContentBox {
|
|
91184
91190
|
enableContentStyle: true,
|
91185
91191
|
disableStaticSection: false,
|
91186
91192
|
framework: '',
|
91193
|
+
// Old Template System:
|
91187
91194
|
designUrl1: 'assets/designs/basic.js',
|
91188
91195
|
designUrl2: 'assets/designs/examples.js',
|
91189
91196
|
designPath: 'assets/designs/',
|
91190
91197
|
designPathReplace: [],
|
91198
|
+
defaultDesignCategory: 5,
|
91199
|
+
// 101 for header
|
91191
91200
|
|
91192
91201
|
/*
|
91193
91202
|
Example:
|
@@ -91196,12 +91205,24 @@ class ContentBox {
|
|
91196
91205
|
designPath: 'https://.../assets/designs/',
|
91197
91206
|
designPathReplace: ['assets/', 'https://.../assets/'], // Only if needed
|
91198
91207
|
*/
|
91208
|
+
// New Template System: => this will replace the previous approach (designUrl1, designUrl2, designPath, designPathReplace & defaultDesignCategory)
|
91199
91209
|
templates: [],
|
91200
91210
|
// ver.5.3
|
91201
91211
|
|
91202
91212
|
/*
|
91203
|
-
Example:
|
91213
|
+
Example:
|
91204
91214
|
templates: [
|
91215
|
+
{
|
91216
|
+
url: 'assets/simplestart/examples.js',
|
91217
|
+
path: 'assets/simplestart/',
|
91218
|
+
pathReplace: []
|
91219
|
+
},
|
91220
|
+
{
|
91221
|
+
url: 'assets/quickstart/examples.js',
|
91222
|
+
path: 'assets/quickstart/',
|
91223
|
+
pathReplace: []
|
91224
|
+
},
|
91225
|
+
// If you want to include old templates:
|
91205
91226
|
{
|
91206
91227
|
url: 'assets/designs/basic.js',
|
91207
91228
|
path: 'assets/designs/',
|
@@ -91212,6 +91233,7 @@ class ContentBox {
|
|
91212
91233
|
path: 'assets/designs/',
|
91213
91234
|
pathReplace: []
|
91214
91235
|
},
|
91236
|
+
// If you're using Writing Set collection:
|
91215
91237
|
{
|
91216
91238
|
url: 'assets/writing-set/basic.js',
|
91217
91239
|
path: 'assets/writing-set/',
|
@@ -91220,25 +91242,31 @@ class ContentBox {
|
|
91220
91242
|
]
|
91221
91243
|
*/
|
91222
91244
|
featuredCategories: [{
|
91223
|
-
id: 5,
|
91224
|
-
name: 'Random'
|
91225
|
-
}, // If apos ' is used, use: \\\'
|
91226
|
-
{
|
91227
91245
|
id: 1,
|
91246
|
+
designId: 1,
|
91228
91247
|
name: 'Basic'
|
91229
|
-
},
|
91248
|
+
}, // If name has apos ' => use: \\\'
|
91249
|
+
{
|
91230
91250
|
id: 2,
|
91251
|
+
designId: 1,
|
91231
91252
|
name: 'Slider'
|
91232
91253
|
}, {
|
91233
|
-
id:
|
91254
|
+
id: 1,
|
91255
|
+
designId: 2,
|
91234
91256
|
name: 'Header'
|
91235
91257
|
}, {
|
91236
|
-
id:
|
91258
|
+
id: 2,
|
91259
|
+
designId: 2,
|
91237
91260
|
name: 'Article'
|
91238
91261
|
}, {
|
91239
|
-
id:
|
91262
|
+
id: 3,
|
91263
|
+
designId: 2,
|
91240
91264
|
name: 'Photos'
|
91241
91265
|
}],
|
91266
|
+
defaultCategory: {
|
91267
|
+
id: 1,
|
91268
|
+
designId: 1
|
91269
|
+
},
|
91242
91270
|
templateThumbnailSize: '',
|
91243
91271
|
//small, medium, large or '' (empty => dynamic)
|
91244
91272
|
// ContentBuilder
|
@@ -91343,8 +91371,6 @@ class ContentBox {
|
|
91343
91371
|
animatedSorting: false,
|
91344
91372
|
dragWithoutHandle: false,
|
91345
91373
|
addButtonPlacement: '',
|
91346
|
-
defaultDesignCategory: 5,
|
91347
|
-
// 101 for header
|
91348
91374
|
snippetCategories: [[120, 'Basic'], [118, 'Article'], [101, 'Headline'], [119, 'Buttons'], [102, 'Photos'], [103, 'Profile'], [116, 'Contact'], [104, 'Products'], [105, 'Features'], [106, 'Process'], [107, 'Pricing'], [108, 'Skills'], [109, 'Achievements'], [110, 'Quotes'], [111, 'Partners'], [112, 'As Featured On'], [113, 'Page Not Found'], [114, 'Coming Soon'], [115, 'Help, FAQ']],
|
91349
91375
|
defaultSnippetCategory: 101,
|
91350
91376
|
outlineMode: '',
|