Gentoo Archives: gentoo-commits

From: "Alex Alexander (wired)" <wired@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in xml/htdocs/proj/en/council: utctolocal.html
Date: Mon, 23 Aug 2010 06:37:13
Message-Id: 20100823063706.A6D022004E@flycatcher.gentoo.org
1 wired 10/08/23 06:37:06
2
3 Modified: utctolocal.html
4 Log:
5 utctolocal.html: updated getQueryParams function because it crashed latest chromium
6
7 Revision Changes Path
8 1.2 xml/htdocs/proj/en/council/utctolocal.html
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/proj/en/council/utctolocal.html?rev=1.2&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/proj/en/council/utctolocal.html?rev=1.2&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/proj/en/council/utctolocal.html?r1=1.1&r2=1.2
13
14 Index: utctolocal.html
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo/xml/htdocs/proj/en/council/utctolocal.html,v
17 retrieving revision 1.1
18 retrieving revision 1.2
19 diff -u -r1.1 -r1.2
20 --- utctolocal.html 23 Aug 2010 06:04:00 -0000 1.1
21 +++ utctolocal.html 23 Aug 2010 06:37:06 -0000 1.2
22 @@ -3,6 +3,9 @@
23 this page converts UTC time to the user system's timezone
24 using javascript
25
26 + v1.1
27 + updated getQueryParams function because it crashed latest chromium!
28 +
29 v1.0
30
31 written by Alex Alexander <wired@g.o>
32 @@ -41,15 +44,16 @@
33
34 <script>
35 function getQueryParams(qs) {
36 - qs = qs.split("+").join(" ");
37 - var params = {};
38 - var tokens;
39 + var vars = [], hash;
40 + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
41
42 - while (tokens = /[?&]?([^=]+)=([^&]*)/g.exec(qs)) {
43 - params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
44 + for(var i = 0; i < hashes.length; i++) {
45 + hash = hashes[i].split('=');
46 + vars.push(hash[0]);
47 + vars[hash[0]] = hash[1];
48 }
49
50 - return params;
51 + return vars;
52 }
53
54 function get_time_zone_offset( ) {
55 @@ -89,7 +93,7 @@
56 }
57
58 $().ready(function() {
59 - var GET = getQueryParams(document.location.search);
60 + var GET = getQueryParams();
61
62 var tz = get_time_zone_offset()*-1;
63 if ( tz > 0 ) tz = "+"+tz; else if ( tz == 0 ) tz = "";