Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

סקריפט שומר שבת לאתרים

NotificationsYou must be signed in to change notification settings

liad07/shabat-kodesh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This is a JavaScript and C# script that can be used to ensure that a website observes Shabbat, a Jewish day of rest, according to Jewish tradition. The scripts fetch the user's location data using the IPAPI service, and then retrieve the relevant Shabbat times from the Hebcal API. The scripts then compare the start and end times of Shabbat to the current time to determine whether it is currently Shabbat.

JavaScript Version

Usage

To use the script, simply include it in the section of your website:

<head><scriptsrc="https://liad07.github.io/shabat-kodesh/main.js"></script></head>

The script will automatically run every minute to check whether it is currently Shabbat. If it is, a message will be displayed in Hebrew to inform the user that the website is inaccessible during this time.

Dependencies

This script relies on external APIs to retrieve location and Shabbat information. Specifically, it uses the following APIs:

Contributing

If you have suggestions for how to improve this script, please open an issue or submit a pull request. Contributions of all kinds are welcome and appreciated!

C# Version

Usage

The api class now in file on this git called api.cs pls include in same directory

To use the script, simply include it in your C# ASP.NET project:

protectedasyncvoidPage_Load(objectsender,EventArgse){if((int)DateTime.Now.DayOfWeek==5||(int)DateTime.Now.DayOfWeek==6){apiapi=newapi();stringcontent=awaitapi.GetContent("http://ip-api.com/json/");JObjectresponseObj=JObject.Parse(content);stringcity=(string)responseObj["city"];stringhebcal=awaitapi.GetContent("https://www.hebcal.com/shabbat?cfg=json&city="+city+"&b=40&M=on");JObjecthebcal2=JObject.Parse(hebcal);JArrayitems=(JArray)hebcal2["items"];varchabatIn=DateTime.Parse(hebcal2["items"][0]["date"].ToString());varchabatOut=DateTime.Parse(hebcal2["items"][items.Count()-1]["date"].ToString());if(DateTime.Now>=chabatIn&&DateTime.Now<chabatOut&&(int)DateTime.Now.DayOfWeek==5||(int)DateTime.Now.DayOfWeek==6){Response.Clear();Response.StatusCode=702;Response.StatusDescription="שבת היום";Response.Write("<div style=\"display: flex; flex-direction: column; justify-content: center; align-items: center; width: 100%; height: 100vh; background-color: #f2f2f2;\">\n"+"  <img src=\"https://parashat.co.il/wp-content/uploads/2021/01/17.png\" alt=\"shabat shalom\" style=\"width: 50%; height: auto;\">\n"+"  <p style=\"margin-top: 10px; font-size: 30px; text-align: center; color: #4d4d4d;\">האתר אינו פעיל בשבת, נשמח לחזור לשרותכם במוצאי שבת</p>\n"+"  <p style=\"margin-top: 10px; font-size: 30px; text-align: center; color: #4d4d4d;\">צאת השבת: "+chabatOut+"</p>\n"+"</div>");Response.End();HttpContext.Current.ApplicationInstance.CompleteRequest();}}}

Dependencies

This script relies on external APIs to retrieve location and Shabbat information. Specifically, it uses the following APIs:

Contributing

If you have suggestions for how to improve this script, please open an issue or submit a pull request. Contributions of all kinds are welcome and appreciated!

About

סקריפט שומר שבת לאתרים

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp