Entrance Events! Chat Gallery Search Everyone Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
March 29, 2025 - @95.15 (what is this?)
Activity rating: Three Stars Posts & Arts: 48/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts Start New Topic  Submit Art
News: :seal: Thank you for today! :seal: Super News: E-Zine #3 Accepting Entries till March 28th!

+  MelonLand Forum
|-+  World Wild Web
| |-+  ♺ ∙ Web Crafting Materials
| | |-+  Simple Site Closer Script!


« previous next »
Pages: [1] Print
Author Topic: Simple Site Closer Script!  (Read 3801 times)
Melooon
Hero Member ⚓︎
*****


So many stars!

⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: melon
iMood: Melonking
Itch.io: My Games
RSS: RSS

View Profile WWWArt

Hyperactive DonutGreat Posts PacmanOfficially DogThanks for being rad!a puppy for your travelsAlways My Pal
« on: May 18, 2023 @768.72 »

Site Closer Script
I made a very simple script that will allow you to close your site on Mondays (or any other day) like my sites do!  :pc:

It's not perfect because it depends on Javascript, so someone can bypass it if they disable JS, but since its mostly a fun feature I don't think that's actually a big deal!

To close your site on Mondays, just create your own closed.html page, then place this code on the HEAD of the page you wanna close (your index.html, or particular pages if you don't wanna close your whole site.)  :grin:

Code
<script src="https://melonking.net/scripts/site-closer.js"></script>
<script>
  // sc.closedPage = "closed.html"; // Optional: change the closed page URL
  // sc.closedDays = ["Monday"]; // Optional: change the days to close (default is Monday)
  shutItDown();
</script>
« Last Edit: April 10, 2024 @537.13 by Melooon » Logged


everything lost will be recovered, when you drift into the arms of the undiscovered
Lyonid
Jr. Member ⚓︎
**


Controlled Chaos ~ Please be kind.

⛺︎ My Room
SpaceHey: Friend Me!

View Profile WWW

First 1000 Members!Joined 2023!
« Reply #1 on: May 18, 2023 @786.23 »

 :4u: I love this, this is so fun. I will draw a little picture of a closed laboratorium to make everyone on my site take a breather on Fridays. This is the first step towards a great labour union for internet protocols.
Logged

xx <3
Icey!
Sr. Member ⚓︎
****


Icey/Iceys

⛺︎ My Room

View Profile WWW

Great Posts PacmanFirst 1000 Members!Pro Bug Finder!OG! Joined 2021!High Speed Ozwomp!
« Reply #2 on: April 10, 2024 @971.12 »

Thank melon!  :4u:  This is gonna make my site feel 100% more personal!... That is if I can revise it before Monday. Been months since I made a "true" update.
Logged



:ozwomp: my beloved

Memory
Guest
« Reply #3 on: April 10, 2024 @2.80 »

[removed by author]
« Last Edit: July 31, 2024 @651.27 by j » Logged
Yaya
Full Member
***


⛺︎ My Room
StatusCafe: yaya

View Profile WWW

Welcome Back !Joined 2024!
« Reply #4 on: April 10, 2024 @82.79 »

WOW~! Adding it now! This is so cool!
Logged
clowdywings
Casual Poster ⚓︎
*


transmasc cyberpunk ocs 🔛 🔝

⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: clowdywings
iMood: clowdywings
Itch.io: My Games

View Profile WWW

Joined 2024!
« Reply #5 on: April 30, 2024 @149.53 »

oooh this is really cool, thanks for the code!
Logged

JINSBEK
Full Member ⚓︎
***


Yoroshiku.

⛺︎ My Room

View Profile WWW

Joined 2024!
« Reply #6 on: December 08, 2024 @984.55 »

Hey, this is pretty cool. I always thought it was cool that Sprayground closed their website on Shabbat, and now we can, too. Haha. @VioletHeaven , take a look at this!
 :4u:
Logged

VioletHeaven
Casual Poster ⚓︎
*


Welcome to Acme Bunny Solutions!

⛺︎ My Room
StatusCafe: VioletHeaven
iMood: VioletHeaven

View Profile WWW

Joined 2024!
« Reply #7 on: December 10, 2024 @926.62 »

Hey, this is pretty cool. I always thought it was cool that Sprayground closed their website on Shabbat, and now we can, too. Haha. @VioletHeaven , take a look at this!
 :4u:
This script is awesome! I'm definitely going to use it to close my site for Shabbat, too! I really want my site to be fun and playful, and to gently remind myself (and others!) to take a break and disconnect. Plus I'll probably have a bunny of the week there, too!

Thank you for showing me this, Jinsbek!  :transport:
Logged

Paprika
Sr. Member ⚓︎
****


Go to the tanterwomps for they are lost in time

⛺︎ My Room
StatusCafe: matchaprika
XMPP: Chat!

View Profile WWW

Great Posts PacmanThanks for being rad!the one and only paprika!Giver of Many Welcomes!Joined 2024!
« Reply #8 on: January 14, 2025 @554.14 »

So it only "close" the page of the website it is put on or does it "close" the sub domains as well ? Imagine I'm making some kind of tea-party or swimming pool page, putting the script on it would only close that page, right ?
Logged

Nova
Casual Poster ⚓︎
*


Cat, I'm a kitty cat, and I dance dance dance...

⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: cielos-pasteles
iMood: Pastel_Skies
PicMix: Cielos-Pasteles

View Profile WWWArt

Best Wishes and Good Luck for your GED !Joined 2025!
« Reply #9 on: February 12, 2025 @393.43 »

I'm definitely adding this to my site.

But I am curious, how do you set it to it closes for a particular time zone? Considering the default is GMT.
Logged



"They/Them (Genderfluid flag)""Any Pronoun (Genderfluid flag)"
sen.fish
Casual Poster ⚓︎
*


⛺︎ My Room
View Profile WWW
« Reply #10 on: February 12, 2025 @459.42 »

But I am curious, how do you set it to it closes for a particular time zone? Considering the default is GMT.

The getDay() method uses the local time zone! See: "The getDay() method of Date instances returns the day of the week for this date according to local time" (MDN docs). If you want to use a specific timezone, you could try this code (replacing timeZone: "America/New_York" with the time zone of your choice):

Code
var sc = {};
sc.closedPage = "closed.html";
sc.closedDays = ["Monday"];
sc.weekDays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

var dayNow = new Date().toLocaleString("en-US", {
  timeZone: "America/New_York",
  weekday: 'long'
});

// Trigger this site closer!
function shutItDown() {
  sc.dayNow = new Date().toLocaleString("en-US", {timeZone: "America/New_York", weekday: 'long' });

  if (sc.closedDays.includes(sc.dayNow)) {
    console.log("Gordon Ramsay screams: Shut it Down!!!");
    window.location.replace(sc.closedPage);
  }
}

shutItDown();
Logged

Skykristal
Full Member ⚓︎
***


I may be dead but I am here

⛺︎ My Room
StatusCafe: skykristal

View Profile WWWArt

Great Posts PacmanFirst 1000 Members!Joined 2023!
« Reply #11 on: February 12, 2025 @584.11 »

ohh I didn't know you made this public. Very cool, thank you so much!  :4u: I will definitely use it in the future
Logged


Read My Blog ⋆。°✩ Punch my OCs  ⋆。°✩ View my Gallery
Pages: [1] Print 
« previous next »
 

Vaguely similar topics! (3)

GUIDE: Melon's Simple X3D World Tutorial

Started by MelooonBoard ♺ ∙ Web Crafting Materials

Replies: 5
Views: 5281
Last post February 17, 2022 @637.75
by demonologi
Best way to have a 2 column site?

Started by ObspogonBoard ☔︎ ∙ I need Help!

Replies: 3
Views: 2749
Last post February 13, 2023 @208.53
by fLaMEd
How do you prefer to keep your site organized (or not)

Started by NightdriftBoard ✁ ∙ Web Crafting

Replies: 30
Views: 10063
Last post August 02, 2024 @153.99
by candycanearter07

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | ~ Send Feedback ~ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi