Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Looking for a Monday-Friday J/S

9 views
Skip to first unread message
Message has been deleted

Jeff North

unread,
Feb 3, 2012, 10:58:41 PM2/3/12
to
On Fri, 03 Feb 2012 20:54:10 -0600, in comp.lang.javascript
denn...@dennism3.invalid (Dennis M)
<dennism3-ya0240800...@news.datemas.de> wrote:

>| One of my sites is a free link directory that's becoming increasingly
>| popular and so it doesn't drive me crazy approving new submissions I was
>| wanting to install a javascript on the link submission page that would load
>| that page on Monday through Friday, then on the weekends load a page where
>| I could say I "only accept new submissions M-F." Anybody? Looked around on
>| a well known javascript site but couldn't find what I want to do.

Bad idea. If the visitor has javascript turned off then your script
will not work.
Is the Mon-Fri your time, the ISP time? I'm in Australia so on *my*
Monday I still wouldn't be able make a submission.

You are better off doing this server-side an not display the
submission block.

But if you insist. Have a look at the Date object and getDay().
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getDay
Message has been deleted

Swifty

unread,
Feb 4, 2012, 3:56:25 AM2/4/12
to
On Fri, 03 Feb 2012 22:33:02 -0600, denn...@dennism3.invalid (Dennis
M) wrote:

>Yeah I'm fully aware of that. I was counting on people not wanting to make
>the effort to turn off JS if they can come back in a day or two and submit.

Depending on your audience, you could suppress the submission by
default and enable it with JavaScript Mon-Fri.

This would eliminate cheating, at the risk of alienating people who
run with JavaScript off.

The people who routinely turn JavaScript off is one of the worlds
smallest minorities, so it will probably be a few years before
disenfranchising them becomes a crime.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk

Evertjan.

unread,
Feb 4, 2012, 4:11:25 AM2/4/12
to
Swifty wrote on 04 feb 2012 in comp.lang.javascript:

> On Fri, 03 Feb 2012 22:33:02 -0600, denn...@dennism3.invalid (Dennis
> M) wrote:
>
>>Yeah I'm fully aware of that. I was counting on people not wanting to
>>make the effort to turn off JS if they can come back in a day or two
>>and submit.
>
> Depending on your audience, you could suppress the submission by
> default and enable it with JavaScript Mon-Fri.
>
> This would eliminate cheating, at the risk of alienating people who
> run with JavaScript off.
>
> The people who routinely turn JavaScript off is one of the worlds
> smallest minorities, so it will probably be a few years before
> disenfranchising them becomes a crime.

One could turn a blind eye to that,
or is that considered discrimination in some jurisdictions?

=============

However, such things should DEFINITELY be done serverside!!!

Serverside Javascript is a good possibility:

<%
d = new Date();
if (d.getDay()==6) { //Saturday in server timezone
%>
<b>Buy our Saturday Socks!</b>
<%
};
%>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Andrew Poulos

unread,
Feb 4, 2012, 4:13:20 AM2/4/12
to
On 4/02/2012 7:56 PM, Swifty wrote:
> On Fri, 03 Feb 2012 22:33:02 -0600, denn...@dennism3.invalid (Dennis
> M) wrote:
>
>> Yeah I'm fully aware of that. I was counting on people not wanting to make
>> the effort to turn off JS if they can come back in a day or two and submit.
>
> Depending on your audience, you could suppress the submission by
> default and enable it with JavaScript Mon-Fri.
>
> This would eliminate cheating, at the risk of alienating people who
> run with JavaScript off.
>
> The people who routinely turn JavaScript off is one of the worlds
> smallest minorities, so it will probably be a few years before
> disenfranchising them becomes a crime.

Ha, that's what you think. What about the hordes of people that run
NoScript and other similar add-ons?

Andrew Poulos

Thomas 'PointedEars' Lahn

unread,
Feb 4, 2012, 8:02:40 AM2/4/12
to
Jeff North wrote:

> (Dennis M) wrote:
>>| One of my sites is a free link directory that's becoming increasingly
>>| popular and so it doesn't drive me crazy approving new submissions I was
>>| wanting to install a javascript on the link submission page that would
>>| load that page on Monday through Friday, then on the weekends load a
>>| page where I could say I "only accept new submissions M-F." Anybody?
>>| Looked around on a well known javascript site but couldn't find what I
>>| want to do.
>
> Bad idea. If the visitor has javascript turned off then your script
> will not work.

ACK.

> Is the Mon-Fri your time, the ISP time? I'm in Australia so on *my*
> Monday I still wouldn't be able make a submission.

No, you would, because client-side scripts by default use your system-local
time, and _not_ that of the server. You would not be able to submit if this
was done on the server or the server time was used by the client-side
script, and it was still Sunday there, but not at your location.

Since the author's local time, the server's local time, and the visitor's
local time may all be different, it appears to be a good idea to settle on
UTC.

> But if you insist. Have a look at the Date object and getDay().
>
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getDay

That would be

<https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/getUTCDay>

then.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

Swifty

unread,
Feb 5, 2012, 5:01:20 AM2/5/12
to
On Sat, 04 Feb 2012 20:13:20 +1100, Andrew Poulos
<ap_...@hotmail.com> wrote:

>What about the hordes of people that run
>NoScript and other similar add-ons?

Would you care to guess that as a percentage of the people who use the
web?

Lest this degenerate into repartee, or worse... Is there anything that
is measuring the proportion of visitors who have JavaScript disabled?

I cannot do this as my visitors are strongly selected by the
organisation that I work for, and our users are unsupported if they
disable JavaScript. I chose my words carefully; we have the choice of
disabling it, but then you're on your own if webpages don't work.

Andrew Poulos

unread,
Feb 5, 2012, 4:00:01 PM2/5/12
to
On 5/02/2012 9:01 PM, Swifty wrote:
> On Sat, 04 Feb 2012 20:13:20 +1100, Andrew Poulos
> <ap_...@hotmail.com> wrote:
>
>> What about the hordes of people that run
>> NoScript and other similar add-ons?
>
> Would you care to guess that as a percentage of the people who use the
> web?

In my household, its 100%.

> Lest this degenerate into repartee, or worse... Is there anything that
> is measuring the proportion of visitors who have JavaScript disabled?

Don't know.

> I cannot do this as my visitors are strongly selected by the
> organisation that I work for, and our users are unsupported if they
> disable JavaScript. I chose my words carefully; we have the choice of
> disabling it, but then you're on your own if webpages don't work.

Can't do what?

Andrew Poulos

Dr J R Stockton

unread,
Feb 5, 2012, 12:41:54 PM2/5/12
to
In comp.lang.javascript message <dennism3-ya02408000R0302122054100001@ne
ws.datemas.de>, Fri, 3 Feb 2012 20:54:10, Dennis M
<denn...@dennism3.invalid> posted:

>One of my sites is a free link directory that's becoming increasingly
>popular and so it doesn't drive me crazy approving new submissions I was
>wanting to install a javascript on the link submission page that would load
>that page on Monday through Friday, then on the weekends load a page where
>I could say I "only accept new submissions M-F." Anybody? Looked around on
>a well known javascript site but couldn't find what I want to do.


The appropriate way to do it would be to put a sufficiently conspicuous
statement on the page stating, in GMT, what your working hours and days
actually are in a normal week, with a nearby site that shows your local
holidays and another for any holidays peculiar to any faith that you
might have.

None of that will actually help you very much, however, because many of
those who wanted to submit on Saturday or Sunday will all do so early on
Monday, and some of the rest will be lost users.

Just say that you work Monday to Friday, except for the usual
Potarneyland holidays, and submissions will be considered in order of
receipt. Don't be a control freak, Bung Ho!, etc.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Website <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.

Dr J R Stockton

unread,
Feb 5, 2012, 12:50:40 PM2/5/12
to
In comp.lang.javascript message <Xns9FEF67A9...@194.109.133.133>
, Sat, 4 Feb 2012 09:11:25, Evertjan. <exjxw.ha...@interxnl.net>
posted:

>if (d.getDay()==6) { //Saturday in server timezone

Misuse of the term "time zone".

The expression d.getDay()%6 detects the Western working week.

Evertjan.

unread,
Feb 6, 2012, 6:22:03 AM2/6/12
to
Dr J R Stockton wrote on 05 feb 2012 in comp.lang.javascript:

> In comp.lang.javascript message <Xns9FEF67A9...@194.109.133.133>
> , Sat, 4 Feb 2012 09:11:25, Evertjan. <exjxw.ha...@interxnl.net>
> posted:
>
>>if (d.getDay()==6) { //Saturday in server timezone
>
> Misuse of the term "time zone".

Happy misuse to show the difference between:

server-time zone and server time-zone.

> The expression d.getDay()%6 detects the Western working week.

Yes!

for (var i=0; i<7; i++)
document.write(i + " " + (0===i%6) + "<br>");

while this does not work as intended:

for (i=0;i<7;i++)
document.write(i + " " + 0===i%6 + "<br>");

Swifty

unread,
Feb 6, 2012, 7:20:45 AM2/6/12
to
On Mon, 06 Feb 2012 08:00:01 +1100, Andrew Poulos
<ap_...@hotmail.com> wrote:

>Can't do what?

Amongst other things, I cannot accurately gauge the proportion of web
users who are running with javascript off, as my webpages are
predominately visited by work colleagues, and our corporate default is
"Javascript ON", so my samples would be heavily biased.

The vast bulk of my pages are generated by CGI scripts, so I presume
it would be a trivial exercise to measure the proportion that have
JavaScript enabled. I'd just need to find some way of leaving a
"JavaScript is on mark" in the environment that my CGI scripts could
interrogate.
Message has been deleted

Captain Paralytic

unread,
Feb 7, 2012, 8:18:47 AM2/7/12
to
On Feb 4, 2:54 am, denni...@dennism3.invalid (Dennis M) wrote:
> One of my sites is a free link directory that's becoming increasingly
> popular and so it doesn't drive me crazy approving new submissions I was
> wanting to install a javascript on the link submission page that would load
> that page on Monday through Friday, then on the weekends load a page where
> I could say I "only accept new submissions M-F." Anybody? Looked around on
> a well known javascript site but couldn't find what I want to do.

Sorry that by replying to this, the data in your post will end up
getting archived!

Will doing this really help? Surely one of 2 things will happen:
1) All the folks who couldn't register over the weekend will register
on Monday (or at least in the following week) so you'll just have
loads more to do the.
2) They will go away and not register at all.

If (1) was to happen, is there any difference between that and simply
approving the ones submitted at the weekend throughout the following
week? If you just state on the site that approvals may take up to a
week then folks know what to expect.

If (2) was to happen then you might as well just switch off
registrations.

Dr J R Stockton

unread,
Feb 7, 2012, 5:17:28 PM2/7/12
to
In comp.lang.javascript message <Xns9FF17DCF...@194.109.133.133>
, Mon, 6 Feb 2012 11:22:03, Evertjan. <exjxw.ha...@interxnl.net>
posted:

>Dr J R Stockton wrote on 05 feb 2012 in comp.lang.javascript:
>
>> In comp.lang.javascript message <Xns9FEF67A9...@194.109.133.133>
>> , Sat, 4 Feb 2012 09:11:25, Evertjan. <exjxw.ha...@interxnl.net>
>> posted:
>>
>>>if (d.getDay()==6) { //Saturday in server timezone
>>
>> Misuse of the term "time zone".
>
>Happy misuse to show the difference between:
>
>server-time zone and server time-zone.

NO, that is another matter entirely.

The true meaning of "time zone" is "the set of places, wet or dry, which
all have the same difference from GMT except perhaps in their local
Summer" = "time zone" refers to "Standard Time".

The JavaScript Date Object's getTimezoneOffset is wrongly named; should
be getTimeOffset.

Those who remember the beginning of "'—And He Built a Crooked House—'"
will not be surprised.



>> The expression d.getDay()%6 detects the Western working week.
>
>Yes!
>
>for (var i=0; i<7; i++)
> document.write(i + " " + (0===i%6) + "<br>");
>
>while this does not work as intended:
>
>for (i=0;i<7;i++)
> document.write(i + " " + 0===i%6 + "<br>");

True. But it will rarely be necessary to list the classification of
days 0 to 6. Both of the following work well (but note that to detect
the working week requires the opposite answer).

X = !!(i%6)
i + " " + X + "<br>"

i + " " + !!(i%6) + "<br>"

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk DOS 3.3 6.20 ; WinXP.
Web <http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.

Evertjan.

unread,
Feb 8, 2012, 3:56:44 AM2/8/12
to
Dr J R Stockton wrote on 07 feb 2012 in comp.lang.javascript:

> In comp.lang.javascript message
> <Xns9FF17DCF...@194.109.133.133> , Mon, 6 Feb 2012 11:22:03,
> Evertjan. <exjxw.ha...@interxnl.net> posted:
>
>>Dr J R Stockton wrote on 05 feb 2012 in comp.lang.javascript:
>>
>>> In comp.lang.javascript message
>>> <Xns9FEF67A9...@194.109.133.133> , Sat, 4 Feb 2012 09:11:25,
>>> Evertjan. <exjxw.ha...@interxnl.net> posted:
>>>
>>>>if (d.getDay()==6) { //Saturday in server timezone
>>>
>>> Misuse of the term "time zone".
>>
>>Happy misuse to show the difference between:
>>
>>server-time zone and server time-zone.
>
> NO, that is another matter entirely.
>
> The true meaning of "time zone" is "the set of places, wet or dry,
> which all have the same difference from GMT except perhaps in their
> local Summer" = "time zone" refers to "Standard Time".

That may be so in the/your definition, John.

However,

Calling it "server-time setting" would be nice, whatever time correcty or
incorrecty it is set, but one also needs the summer-time definition of that
setting. If the server in Honolulu is set to Stockholm time does not matter
to the programmer as long as she/he knows the setting.

> The JavaScript Date Object's getTimezoneOffset is wrongly named;
> should be getTimeOffset.

That is the nice thing about serverside programming, you do not talk to
strangers, just to your own machine, and such errors are just a minor
nucance only to a purist like you and me.

Strange is, that in asp-vbs you cannot get this value,
so often I end a vbs-coded page with this js-derived variable,
to get to GMT,
[while keeping the fallacious naming]:

<% ' VBS
nowGMT = DateAdd("h", TimezoneOffset, Now)
%>
<script language='javascript' runat='server'>
var TimezoneOffset = new Date().getTimezoneOffset()/60;
</script>

[not for John, but for some of the others:]
Remember the runat-codes run before the main code.

===
We, John, discussed somethig like this on 05 sep 2007, among other times
in this NG, when you still thought:
"It's a good idea to read the newsgroup c.l.j and its FAQ. See below."
<http://bytes.com/topic/javascript/answers/703445-getting-gmt-particular-
format>
===


> Those who remember the beginning of "'鈥"And He Built a Crooked
> House鈥"'" will not be surprised.

I don't, both.

> [..]

Gene Wirchenko

unread,
Feb 8, 2012, 12:22:08 PM2/8/12
to
On 08 Feb 2012 08:56:44 GMT, "Evertjan."
<exjxw.ha...@interxnl.net> wrote:

>Dr J R Stockton wrote on 07 feb 2012 in comp.lang.javascript:

[snip]

>> Those who remember the beginning of "'â€"And He Built a Crooked
>> Houseâ€"'" will not be surprised.
>
>I don't, both.

It is a classic short story by Heinlein. It is very good, and
the opening is very excellent.

Sincerely,

Gene Wirchenko

Evertjan.

unread,
Feb 9, 2012, 11:49:55 AM2/9/12
to
Gene Wirchenko wrote on 08 feb 2012 in comp.lang.javascript:

>>> Those who remember the beginning of "'ƒ "And He Built a Crooked
>>> Houseƒ "'" will not be surprised.
>>
>>I don't, both.
>
> It is a classic short story by Heinlein. It is very good, and
> the opening is very excellent.

I am not so easily surprized.

I rerad all that could be read of his stories in the 50s,
but do not remember all the titles.

Dr J R Stockton

unread,
Feb 9, 2012, 1:53:20 PM2/9/12
to
In comp.lang.javascript message <Xns9FF3652B...@194.109.133.133>
, Wed, 8 Feb 2012 08:56:44, Evertjan. <exjxw.ha...@interxnl.net>
posted:

>Dr J R Stockton wrote on 07 feb 2012 in comp.lang.javascript:
>
>> In comp.lang.javascript message
>> <Xns9FF17DCF...@194.109.133.133> , Mon, 6 Feb 2012 11:22:03,
>> Evertjan. <exjxw.ha...@interxnl.net> posted:
>>
>>>Dr J R Stockton wrote on 05 feb 2012 in comp.lang.javascript:
>>>
>>>> In comp.lang.javascript message
>>>> <Xns9FEF67A9...@194.109.133.133> , Sat, 4 Feb 2012 09:11:25,
>>>> Evertjan. <exjxw.ha...@interxnl.net> posted:
>>>>
>>>>>if (d.getDay()==6) { //Saturday in server timezone
>>>>
>>>> Misuse of the term "time zone".
>>>
>>>Happy misuse to show the difference between:
>>>
>>>server-time zone and server time-zone.
>>
>> NO, that is another matter entirely.
>>
>> The true meaning of "time zone" is "the set of places, wet or dry,
>> which all have the same difference from GMT except perhaps in their
>> local Summer" = "time zone" refers to "Standard Time".
>
>That may be so in the/your definition, John.

Wikipedia says : "Een tijdzone is een gebied op aarde met gelijke
(standaard)tijd." - and I leave it to you to add the missing space.
Search the page for "zomer" - the first occurrence is wrong and the last
four are off-topic.

It also says "Als er in een land zomertijd gebruikt wordt, kan
standaardtijd verwijzen naar de wintertijd."



Even the Americans sometimes get it right - *Mountain Standard Time* is
used in Winter and Mountain Daylight Time in Summer. But what they use
during summer nights is not lexically obvious.


>> Those who remember the beginning of "'â€"And He Built a Crooked
>> Houseâ€"'" will not be surprised.
>
>I don't, both.

Well. you can read about it at
<http://fr.wikipedia.org/wiki/La_Maison_biscornue_(nouvelle)> or in the
obvious alternative. Apparently nl.wikipedia ignores it. Hut you need
Heinlein's original to see my point. Recommended - a short classic.




Servers on the world-wide Internet ought to be set to GMT, or UTC if
they can handle it. But I recall using the news server of a Californian
company with the NewNews protocol, and it became obvious that it was
"keeping" Local Civil Time (LCT) - or at least using GMT during part of
the year and being altered by an hour in Spring and Autumn.


FYI, I still want to locate the definitely definitive definition of the
chosen Lunar Correction expression in Clavius's Opera Mathematica V.

--

Evertjan.

unread,
Feb 10, 2012, 3:13:17 AM2/10/12
to
Dr J R Stockton wrote on 09 feb 2012 in comp.lang.javascript:

> FYI, I still want to locate the definitely definitive definition of the
> chosen Lunar Correction expression in Clavius's Opera Mathematica V.

I do not quite understand the ultrafinal implications
of a "definitely definitive definition".
Would that require indefinite validity?

However, next to your own demonic publications
and a nice scan at:
<http://mathematics.library.nd.edu/clavius/>

this might be of help in your lunar if not lunatic quest:

Lessons from reading Clavius
by Anders O. F. Hendrickson
<http://www.cord.edu/faculty/ahendric/presentations/PittsburghClavius.pdf>

John G Harris

unread,
Feb 10, 2012, 11:02:52 AM2/10/12
to
On Thu, 9 Feb 2012 at 18:53:20, in comp.lang.javascript, Dr J R Stockton
wrote:

<snip>
>Servers on the world-wide Internet ought to be set to GMT, or UTC if
>they can handle it.
<snip>

Do you really mean GMT ? The last I heard it takes several months to
determine the GMT time for a given atomic/UTC time. Also, if time
servers are tied to national standards they will not be serving GMT and
are unlikely to be serving a current guess at it.

John
--
John Harris

Dr J R Stockton

unread,
Feb 11, 2012, 6:12:32 PM2/11/12
to
In comp.lang.javascript message <Xns9FF55DCD...@194.109.133.133>
, Fri, 10 Feb 2012 08:13:17, Evertjan. <exjxw.ha...@interxnl.net>
posted:

>Dr J R Stockton wrote on 09 feb 2012 in comp.lang.javascript:
>
>> FYI, I still want to locate the definitely definitive definition of the
>> chosen Lunar Correction expression in Clavius's Opera Mathematica V.
>
>I do not quite understand the ultrafinal implications
>of a "definitely definitive definition".
>Would that require indefinite validity?

The Papal Bull defines the Gregorian Calendar /in perpetuo/, and Clavius
was authorised to do likewise. If the Civil Calendar is changed, it
will no longer be Gregorian. If calendar change is in the air, the
Roman Catholic Church should be careful about the naming of Popes.


>However, next to your own demonic publications
>and a nice scan at:
><http://mathematics.library.nd.edu/clavius/>

I know of that. But I have a better copy, which someone let me have by
FTP. As it is 383,527,728 bytes, I can only AFAIK send it to someone
with an open FTP server and that amount of spare space.

>this might be of help in your lunar if not lunatic quest:
>
>Lessons from reading Clavius
>by Anders O. F. Hendrickson
><http://www.cord.edu/faculty/ahendric/presentations/PittsburghClavius.pdf>

Interesting, but of no direct use. I have all of that, implemented
literally using JavaScript, from the Six Canons, on my site. Its "Table
of the equation of the perpetual cycle of Epacts", on page 22/51, does
not even cover one the full range of letters (which takes, as can
readily be seen from a different but functionally equivalent copy in the
Book of Common Prayer of the Church of England, about 6500 years, and I
think needs several cycles to repeat exactly (300,000 years?)). I need
the authority for the known algorithm for generating that table.

The Table takes one step along the cycle of about 30 letters for every
Leap Year omitted in the Gregorian Calendar (3 per 400 years), and one
step back - the Lunar Correction - 8 times per 2500 years. That can be
verified by inspection to be correct for 1583 to 4999 (1582 seems an
error - on Clavius' part : it is so in p.22 of the Calendarium - 1582
should precede -10 days).

There is no current doubt that the 8/2500 is perpetual, but that lack of
doubt may be wrong. Clavius considered better alternatives in Opera
Mathematica V, and that is why the fully definitive statement (if any)
is needed.

You might also like <http://www.merlyn.demon.co.uk/euler327.htm>.

Dr J R Stockton

unread,
Feb 11, 2012, 6:24:38 PM2/11/12
to
In comp.lang.javascript message <mGOVL1Hs...@J.A830F0FF37FB96852AD0
8924D9443D28E23ED5CD>, Fri, 10 Feb 2012 16:02:52, John G Harris
<jo...@nospam.demon.co.uk> posted:
I do. They should be set in close agreement, and they should use days
of 24 hours of 60 minutes and 60 seconds only, as most computers ignore
leap seconds. GMT is not a national standard, but a world-wide one.

It's not necessary for the GMT used to be very close to what, a few
months later, may be decided upon as what it ought to have been.

An alternative, however, would be for then to ignore years ... hours,
and all to use a common scale of SI seconds.

As well as being at fault in the naming getTimezoneOffset, it also errs
in using UTC within the names of Date methods, since it ignores Leap
Seconds. (in any case, there should be only one Method for each of the
existing pairs like getHours & getUTChours - see js-dobj2.htm & DATE2.
0 new messages