Skip to content

Commit

Permalink
Hide instagram panel option
Browse files Browse the repository at this point in the history
  • Loading branch information
vankessel committed Aug 14, 2024
1 parent a77ee26 commit 9dae872
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
8 changes: 5 additions & 3 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,11 @@
<script src="//instant.page/5.2.0" type="module" integrity="sha384-jnZyxPjiipYXnSU0ygqeac2q7CVYMbh84q0uHVRRxEtvFPiQYbXWUorga2aqZJ0z"></script>
<script>
$(document).ready(() => {
let insta_posts = $('.insta-post-container');
let random_post = insta_posts.get(Math.floor(Math.random() * insta_posts.length));
$(random_post).css("display", "block");
if (localStorage.getItem('hide-insta') !== 'true') {
let insta_posts = $('.insta-post-container');
let random_post = insta_posts.get(Math.floor(Math.random() * insta_posts.length));
$(random_post).css("display", "block");
}
});
</script>
</body>
Expand Down
21 changes: 18 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@
</div>

<div data-tab-index="2" class="tab-content">
<input id="effects" name="effects" type="checkbox">
<label for="effects">Turn off effects</label>
<input id="effects-option" name="effects" type="checkbox">
<label for="effects-option">Turn off effects</label>
</br>
<input id="insta-option" name="effects" type="checkbox">
<label for="insta-option">Hide instagram panel</label>
</div>

</div>
Expand All @@ -55,14 +58,26 @@
$(document).ready(function () {
// Initialize effects checkbox and set click event
let simpleMode = localStorage.getItem('mode') === 'simple';
let effectsCheckbox = $('#effects');
let effectsCheckbox = $('#effects-option');
effectsCheckbox.prop('checked', simpleMode);

effectsCheckbox.click(function () {
localStorage.setItem('mode', $(this).prop('checked') ? 'simple' : 'normal');
location.reload();
});

// Insta visibility
console.log(localStorage.getItem('hide-insta'));
let hideInsta = localStorage.getItem('hide-insta') === 'true';
let instaCheckbox = $('#insta-option');
instaCheckbox.prop('checked', hideInsta);

instaCheckbox.click(function () {
console.log($(this).prop('checked'));
localStorage.setItem('hide-insta', $(this).prop('checked'));
location.reload();
});

// Set tab click events
let tabs = $('.tab[data-tab-index]');
let tabContents = $('.tab-content');
Expand Down

0 comments on commit 9dae872

Please sign in to comment.