Skip to content

Commit 99c2bbe

Browse files
authored
Merge branch 'Develop' into cms-filter-updates
Signed-off-by: Jorch C. <jacortez_94@hotmail.com>
2 parents 6132d9b + e3bf1ad commit 99c2bbe

4 files changed

Lines changed: 55 additions & 15 deletions

File tree

.github/pull_request_template.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# New Feature: [Feature Title]
2+
3+
## Description
4+
Provide a brief summary of the new feature added to an existing script. Highlight what enhancement it brings or the new functionality introduced.
5+
6+
## Related Issues
7+
- Link any issues related to this feature (e.g., `Fixes #123`).
8+
9+
## Script Details
10+
- **Script Name**: [Name of the existing script]
11+
- **Purpose of Update**: Describe why this update was necessary.
12+
- **New Behavior**: Explain the new functionality added.
13+
14+
## Changes Made
15+
- List the key modifications or additions to the script.
16+
17+
## Features
18+
<!-- List your features here and the benefits they bring. Include images/codes if appropriate -->
19+
20+
**This PR closes NONE**
21+
<!-- List issues that this PR would close above. Ex: This PR closes #1, #2, #3. -->
22+
<!-- If your pull request does not fix any issue, it's best to make an issue OR remove this section, depending on your changes. -->
23+
24+
## Checklist
25+
<!-- Tick the checkboxes to ensure you've done everything correctly -->
26+
- [ ] Feature has been tested locally with all relevant use cases.
27+
- [ ] Documentation has been updated (if necessary).
28+
- [ ] PR does not match another non-stale PR currently opened
29+
- [ ] PR name matches the format *[ feature ]: <i>Feature Name</i> (<i>versions separated by comma</i>)*. More details [here](https://github.com/TheCodeRaccoons/WebTricks/wiki/Overview-on-Submitting-Features)
30+
- [ ] PR's base is the `develop` branch.
31+
- [ ] Your Feature matches the standards laid out [here](https://github.com/TheCodeRaccoons/WebTricks/wiki/Programming-Standards)
32+
<!-- Refer to the [contributing](https://github.com/TheCodeRaccoons/WebTricks/wiki/Contributing) guidelines for more details. -->
33+
34+
## Additional Notes
35+
Add any extra details or comments for reviewers.

Dist/WebflowOnly/HideContainer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ class HideContainer {
99
}
1010

1111
init = () => {
12-
this.container
1312
if(this.cmsEmptyState) {
1413
if(this.isRemoveContainer) {this.container.remove();}
1514
else{this.container.style.display = 'none';}

Dist/WebflowOnly/RenderStatic.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,27 @@ class RenderStatic {
2525

2626
let insertIndex = this.gap;
2727
const totalChildren = childrenArray.length;
28-
const totalInsertions = Math.round(totalChildren / this.gap);
2928
let cloneIndex = 0;
3029

31-
for (let i = 0; i <= totalChildren + totalInsertions; i++) {
32-
if (i === insertIndex) {
33-
this.insertChildAtIndex(this.container, this.cloneables[cloneIndex], insertIndex);
34-
cloneIndex = (cloneIndex < this.cloneables.length - 1) ? cloneIndex + 1 : 0;
35-
insertIndex = i + this.gap + 1;
36-
}
30+
const maxInsertions = Math.floor((totalChildren - 1) / this.gap);
31+
32+
for (let i = 0; i < maxInsertions; i++) {
33+
const currentIndex = i * (this.gap + 1) + this.gap;
34+
35+
if (currentIndex >= totalChildren) break;
36+
37+
this.insertChildAtIndex(this.container, this.cloneables[cloneIndex], currentIndex);
38+
cloneIndex = (cloneIndex < this.cloneables.length - 1) ? cloneIndex + 1 : 0;
3739
}
3840

3941
this.observeContainer();
4042
}
4143

4244
insertChildAtIndex(parent, child, index = 0) {
4345
if (!child) return;
44-
if (parent.children.length === index) return;
46+
47+
if (index >= parent.children.length) return;
48+
4549
let childClone = child.cloneNode(true);
4650
if (parent) {
4751
parent.insertBefore(childClone, parent.children[index]);
@@ -77,5 +81,5 @@ const initializeRenderStatic = () => {
7781
if (/complete|interactive|loaded/.test(document.readyState)) {
7882
initializeRenderStatic();
7983
} else {
80-
window.addEventListener('DOMContentLoaded',initializeRenderStatic )
81-
}
84+
window.addEventListener('DOMContentLoaded', initializeRenderStatic);
85+
}

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@
2727
<img src="https://raw.githubusercontent.com/TheCodeRaccoons/Imagery/16a395115ab598a94a7d1ab93f182218d8bbb751/wt-logo.svg" alt="WebTricks Logo" height="140" />
2828
</a>
2929
<h5 align="center">
30-
WebTricks aims to create easy to implement, reusable functionalities for the web. As it's name implies, the main platform this project targets is <a href="https://webflow.com/">Webflow</a>, but the majority of the scripts are made with general web development in mind. Meaning that most of this scripts should work without an issue on any website unless it is a CMS functionality or a Webflow specific script.
30+
WebTricks aims to create easy-to-implement, reusable functionalities for the web. The main platform this project was built for at the beginning was <a href="https://webflow.com/">Webflow</a>, but most of the scripts are made to work on any web development project. Meaning that most of the scripts should work without an issue on any website unless it is a CMS ONLY functionality or a Webflow-Specific script.
3131
</h5>
3232
<p align="center">
3333
<a target="_blank" href="https://github.com/TheCodeRaccoons/WebTricks/issues/new/choose">Request a functionality</a>
3434
&middot;
3535
<a href="#contribute">Contribute</a>
36+
&middot;
37+
<a href="https://www.thecoderaccoons.com/webtricks">See the documentation</a>
3638
</p>
3739
</div>
3840

@@ -68,15 +70,15 @@ All of the documentation is explained by functionality in <a href="https://theco
6870
Direct Import via jsDelivr: Webtricks is hosted on jsDelivr, making it simple to include in your project. You can import individual functionalities directly into your HTML file. For example:
6971

7072
```
71-
<script src="https://cdn.jsdelivr.net/gh/your-username/webtricks@latest/dist/Functional/CountUp.min.js"></script>
73+
<script src="https://cdn.jsdelivr.net/gh/TheCodeRaccoons/WebTricks@1/Dist/Functional/ReadTime.min.js"></script>
7274
```
7375
Replace CountUp.min.js with the specific script you want to include.
7476

7577
Multiple Scripts: Add as many scripts as you need to your project by referencing their respective paths. Example:
7678

7779
```
78-
<script src="https://cdn.jsdelivr.net/gh/your-username/webtricks@latest/dist/Functional/CMSFilter.min.js"></script>
79-
<script src="https://cdn.jsdelivr.net/gh/your-username/webtricks@latest/dist/Functional/FormCheck.min.js"></script>
80+
<script src="https://cdn.jsdelivr.net/gh/TheCodeRaccoons/webtricks@1/dist/Functional/CMSFilter.min.js"></script>
81+
<script src="https://cdn.jsdelivr.net/gh/TheCodeRaccoons/webtricks@1/dist/Functional/FormCheck.min.js"></script>
8082
```
8183
Ready to Use: Once imported, the scripts initialize automatically, provided the correct HTML attributes are in place.
8284

0 commit comments

Comments
 (0)