[pydotorg-www] [PSF-Volunteers] International Symbol - request for addition
Jeremy Baron
jeremy at tuxmachine.com
Tue Apr 27 06:02:10 CEST 2010
Hi,
You'd probably want to throttle it so that it won't change more than
once in ~1/2 sec. (tunable)
The changes below should do it.
-Jeremy
before this line (function definition)
function language_rotator( Element ) {
add this:
var lastetime = 0;
and in the first line of that function definition add this:
var thisetime = (new Date()).getTime();
if ((thisetime - lastetime)<400) {
return;
}
lastetime = thisetime;
On Mon, Apr 26, 2010 at 14:47, <grubert at users.sourceforge.net> wrote:
> this way (i am javascript ignorant)
>
> <html>
> <head>
> <script type="text/javascript">
> var lang_idx = 0;
> var Languages = new Array(
> "Afrikaans", "Ahmara", "Algerian"
> );
> function language_rotator( Element ) {
> Element = document.getElementById("lang-img-ref");
> if (Element) {
> lang_idx += 1;
> if (lang_idx >= Languages.length) {
> lang_idx = 0;
> }
> Element.title = Languages[lang_idx];
> Element.href =
> "http://wiki.python.org/moin/"+Languages[lang_idx]+"Language";
> }
> }
> </script></head>
> <body>
> <div style="align:center; padding-top: 0.5em; padding-left: 2.5em">
> <a title="non-English" id="lang-img-ref"
> href="http://wiki.python.org/moin/Languages"><img
> id="lang-img" onmousemove="javascript:language_rotator(this);"
> style="align:center"
> width="94" height="46"
> src="http://www.python.org/images/worldmap.jpg" alt="[Python
> resources in languages other than English]" /></a>
> </div>
> </body>
> </html>
>
>
> On Mon, 26 Apr 2010, A.M. Kuchling wrote:
>
>> On Sun, Apr 25, 2010 at 01:18:11PM -0600, Carl Trachte wrote:
>>>>
>>>> An interesting exercise might be to implement a bit of JavaScript which
>>>> rotates the phrase "Non-English Resources" among several (four to six?)
>>>> languages: German, French, Chinese, Spanish, etc. The rotation need not
>>>> reflect the location of the cursor. Movement by a few pixels within the
>>>> map
>>>> would rotate to the next translation.
>>>
>>> This sounds cool, but I can't make it happen right now. It is always
>>> something we can augment with whatever gets implemented later, right?
>>
>> (cc'ing to psf-volunteers; this is a pydotorg-www thread about the new
>> non-English resources link and world-map graphic; you can see it on
>> http://www.python.org/dev/, for example. Does someone want to
>> volunteer to write the necessary JavaScript function?)
>>
>> Certainly it could be added later. If someone wants to assemble the
>> necessary list of translations and write the JavaScript, I can
>> certainly add it. Also, anchors could be added to the wiki page so
>> that the German text link could go straight to the German section with
>> /moin/Languages#de or whatever.
>>
>> --amk
More information about the pydotorg-www
mailing list