Entrance Chat Gallery Guilds Search Everyone Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
October 14, 2025 - @460.69 (what is this?)
Activity rating: Two Stars Posts & Arts: 17/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts Start New Topic  Submit Art
News: :happy:  :pc: There are community newsletters here! :pc: :happy: Guild Events: There are no events!

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


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


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

Guild Memberships:
Artifacts:
coolest melon on the web!Emergency feel-good teaa silly heart 4 melon :)Hyperactive DonutGreat Posts PacmanThanks for being rad!
« 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

Artifact Swap: SapphirePeace MoonLurbyFrutiger Aero BallLive Slow Die Youngspring 2023!Rising Star of the Web AwardMessage Buddy
Lyonid
Full Member ⚓︎
***
View Profile WWWArt


Controlled Chaos ~ Please be kind.
⛺︎ My Room
SpaceHey: Friend Me!

Artifacts:
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
Memory
Guest

« 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
Memory
Guest

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

[removed by author]
« Last Edit: July 31, 2024 @651.27 by Memory » Logged
Yaya
Sr. Member
****
View Profile WWW


⛺︎ My Room
StatusCafe: yaya

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

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


transmasc cyberpunk ocs 🔛 🔝
⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: clowdywings
iMood: clowdywings
Itch.io: My Games

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

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

JINSBEK
Sr. Member ⚓︎
****
View Profile WWW


Yoroshiku.
⛺︎ My Room

Artifacts:
Great Posts PacmanJoined 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 ⚓︎
*
View Profile WWW


Welcome to Acme Bunny Solutions!
⛺︎ My Room
StatusCafe: VioletHeaven
iMood: VioletHeaven

Artifacts:
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
Hero Member ⚓︎
*****
View Profile WWWArt


Go to the tanterwomps for they are lost in time
⛺︎ My Room
XMPP: Chat!

Artifacts:
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
Full Member ⚓︎
***
View Profile WWWArt


Cat, I'm a kitty cat, and I dance dance dance...
⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: cielos-pasteles
iMood: Pastel_Skies
Matrix: Chat!
PicMix: Cielos-Pasteles
Itch.io: My Games
RSS: RSS

Guild Memberships:
Artifacts:
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 ⚓︎
*
View Profile WWW


⛺︎ My Room

« 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
Sr. Member ⚓︎
****
View Profile WWWArt


I may be dead but I am here
⛺︎ My Room
StatusCafe: skykristal

Guild Memberships:
Artifacts:
Uni-StarGreat 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


Nova
Full Member ⚓︎
***
View Profile WWWArt


Cat, I'm a kitty cat, and I dance dance dance...
⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: cielos-pasteles
iMood: Pastel_Skies
Matrix: Chat!
PicMix: Cielos-Pasteles
Itch.io: My Games
RSS: RSS

Guild Memberships:
Artifacts:
Best Wishes and Good Luck for your GED !Joined 2025!
« Reply #12 on: April 22, 2025 @315.47 »

Coming into this again to ask how to add how long a website can be closed for (Isay like, 11 PM tp 9 AM).

Asking cuz a friend of mine is getting into building his own website, and he wants this JS not just to shut down his site on certain days but at certain hours too (he wants to do a silly thing akin to those "3 AM challenges" for his site lmao)
Logged

"They/Them (Genderfluid flag)"
"Any Pronoun (Genderfluid flag)"

Monoki
Full Member ⚓︎
***
View Profile WWW


Traveling the vast stars of the internet
⛺︎ My Room
iMood: monoki_BUN_E
XMPP: Chat!

Guild Memberships:
Artifacts:
The One And Only MonokiJoined 2024!
« Reply #13 on: May 04, 2025 @951.77 »

Implemented this onto my own site to close it on Sundays. Great way to remind people to take a break from the internet for a day. Lol
Logged

Robot BUN-E//Run_diagnostics/
Corrupted Unicorn
Hero Member ⚓︎
*****
View Profile WWWArt


Obscure Niche Internet Mad Artist
⛺︎ My Room
iMood: moodyunicorn

Guild Memberships:
Artifacts:
Unicorn of the InternetSurbypink pigeon prizeyou are un-bear-ably cool!Rainbow Noodle Dance!Scrafty, I choose you!
« Reply #14 on: September 23, 2025 @635.24 »

I'd love to see if other variants of the idea could be implemented. Can you close a site for certain hours? The entire year except one month, one week, one week, one hour, one minute?  :dunno:

Of course, sounds kinda counterproductive, but it could lead to some fun ideas, methinks  :tongue:
Logged



Artifact Swap: CrystalGlass BeadDino FossilFeather StoneHam StoneStorm StoneCube StoneTurquoiseTopazOpalPeridotRubyPearlEmeraldAmethystGarnetRainbow StoneIce StoneWave StoneSun Stone
Pages: [1] 2 Print 
« previous next »
 

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