Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #29044 > unrolled thread
| Started by | super70s <super70s@super70s.invalid> |
|---|---|
| First post | 2015-12-27 12:03 -0600 |
| Last post | 2016-02-06 10:59 +0100 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.lang.javascript
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: "weekly" javascript? super70s <super70s@super70s.invalid> - 2015-12-27 12:03 -0600
Re: "weekly" javascript? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-28 12:26 +0100
Re: "weekly" javascript? RobG <rgqld@iinet.net.au> - 2016-02-06 17:06 +1000
Re: "weekly" javascript? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2016-02-06 10:59 +0100
| From | super70s <super70s@super70s.invalid> |
|---|---|
| Date | 2015-12-27 12:03 -0600 |
| Subject | Re: "weekly" javascript? |
| Message-ID | <super70s-2E4557.12031327122015@reader.albasani.net> |
In article
<XmlHttpRequest-JSON-DHTML-20151227174128@ram.dialup.fu-berlin.de>,
ram@zedat.fu-berlin.de (Stefan Ram) wrote:
> super70s <super70s@super70s.invalid> writes:
> >I was just wondering if there's a good JS I could use for this, say put
> >all 52 weekly items in a separate file and then have the appropriate
> >item come up according to what week it is?
> >I just don't know if this could work with the HTML markup that's
> >required for the above, when I tried to insert HTML (say, bold text) for
> >the birthday one, it wouldn't work at all.
>
> The following example shows how to insert a strong element
> read from a file »example«.
>
> <!DOCTYPE HTML><html><head><meta charset="UTF-8">
> <title>Main</title>
> </head><body>
> <p id="id201512271754350100"></p>
> <pre><code>
> <script type="application/javascript;version=1.8">
> ( { "main": function()
> { "use strict";
> let mainThis = this;
> var xmlhttp = new XMLHttpRequest();
> xmlhttp.onreadystatechange = function()
> { if( xmlhttp.readyState == 4 && xmlhttp.status == 200 )
> { console.log( this.insert );
> mainThis.insert( JSON.parse( xmlhttp.responseText )); }};
> xmlhttp.open
> ( "GET", "http://userpage.fu-berlin.de/~ram/pub/JSON/example",
> true );
> xmlhttp.send(); },
> "insert" : function( object )
> { "use strict";
> let e = document.createElement( 'strong' );
> let t = document.createTextNode( object[ 0 ] );
> e.appendChild( t );
> document.getElementById( 'id201512271754350100' ).
> appendChild( e ); }}.main() );
> </script></code></pre></body></html>
OK, but how do I indicate the appropriate element to come up according
to the week of year?
I think it would be way too complicated to pull off the more I think
about it, in some years it would be "week ending Jan. 1, Jan. 8, Jan.
15...," then in another one it would be something like "week ending Jan.
3, Jan. 11, Jan. 17...."
For each of the 5 groups (1970/75, 1971/76, 1972/1977, 1973/1978 and
1974/1979), I would need to indicate a firm date (plus 7 days since it's
"week ending...") to pull up the appropriate element, I guess.
[toc] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2015-12-28 12:26 +0100 |
| Message-ID | <1543804.bpBUuldlzj@PointedEars.de> |
| In reply to | #29044 |
Stefan Ram wrote: > super70s <super70s@super70s.invalid> writes: >>OK, but how do I indicate the appropriate element to come up according >>to the week of year? > > The rules for the determination of the week of the year > depend on the culture (locale). Germany (»Kalenderwoche«) > might have other rules than the United States of America. The reason for that, however, is only secondary the locale. Germany, like all EU countries, “most of other European countries, most of Asia and Oceania”, uses the ISO week numbering, while the U.S. locale uses another numbering that is also used in “Canada, […], China, Japan, Israel, South Africa, [and] most of Latin America.” <https://en.wikipedia.org/wiki/Week#Week_numbering> JSX:date.js provides jsx.date.isoWeekNumber(), Date.prototype.getISOWeekNumber(), and jsx.date.strftime() and Date.prototype.strftime() with the "%V" format string, and jsx.date.format() and Date.prototype.format() with the "ww" format string, respectively. <http://PointedEars.de/wsvn/JSX/trunk/date.js> <http://PointedEars.de/scripts/test/date> -- PointedEars FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix> Please do not cc me. / Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | RobG <rgqld@iinet.net.au> |
|---|---|
| Date | 2016-02-06 17:06 +1000 |
| Message-ID | <VdSdndHTUI4MBijLnZ2dnUU7-SmdnZ2d@westnet.com.au> |
| In reply to | #29044 |
On 28/12/2015 04:27, Stefan Ram wrote: > super70s <super70s@super70s.invalid> writes: >> OK, but how do I indicate the appropriate element to come up according >> to the week of year? > > The rules for the determination of the week of the year > depend on the culture (locale). Germany (»Kalenderwoche«) > might have other rules than the United States of America. Culture and locale are distinctly different concepts. Germany and USA are countries defined by administrative boundaries, each encompassing a great many locales and cultures. > So, you first need to decide which culture to use. Culture? My grandmother thought I had none, so better to not start there. A better place might be the administrative areas in which most of your users reside (perhaps countries or continental regions) and then look to the systems the administrators of those areas have chosen. If you have a truly global audience, then chose the one most administrations have chosen, which is likely ISO 8601. -- Rob
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2016-02-06 10:59 +0100 |
| Message-ID | <XnsA5A66FBDC37C4eejj99@194.109.6.166> |
| In reply to | #29555 |
RobG <rgqld@iinet.net.au> wrote on 06 Feb 2016 in comp.lang.javascript: > On 28/12/2015 04:27, Stefan Ram wrote: >> super70s <super70s@super70s.invalid> writes: >>> OK, but how do I indicate the appropriate element to come up according >>> to the week of year? >> >> The rules for the determination of the week of the year >> depend on the culture (locale). Germany (»Kalenderwoche«) >> might have other rules than the United States of America. > > Culture and locale are distinctly different concepts. Germany and USA > are countries defined by administrative boundaries, each encompassing a > great many locales and cultures. > > >> So, you first need to decide which culture to use. > > Culture? My grandmother thought I had none, so better to not start there. > > A better place might be the administrative areas in which most of your > users reside (perhaps countries or continental regions) and then look to > the systems the administrators of those areas have chosen. > > If you have a truly global audience, then chose the one most > administrations have chosen, which is likely ISO 8601. This ISO being a child of DIN [Deutche Industri Norm] ??? -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web