Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-05-06 04:56:57 +0400
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2009-05-06 04:56:57 +0400
commit7fb16fd18e885e823115cb18f34c82c260ac3caa (patch)
treedeba9f41b62f82879e9baacfe59215492e40f90e /plugins/CoreHome/templates/calendar.js
parent3bcf2b2f3b11f35b16a0ad928e26a36b3ad3bfe8 (diff)
- Refresh and back button now work! great contribution by Khanh Pham fixed #103
it's using the jquery history plugin. period, date, idsite, module and action are persisted across requests, making Piwik much nicer and faster to use.
Diffstat (limited to 'plugins/CoreHome/templates/calendar.js')
-rw-r--r--plugins/CoreHome/templates/calendar.js48
1 files changed, 13 insertions, 35 deletions
diff --git a/plugins/CoreHome/templates/calendar.js b/plugins/CoreHome/templates/calendar.js
index 774ba55ed2..686ff7e8d0 100644
--- a/plugins/CoreHome/templates/calendar.js
+++ b/plugins/CoreHome/templates/calendar.js
@@ -24,7 +24,7 @@ function isDateSelected( date )
var dateYear = date.getFullYear();
var dateDay = date.getDate();
var style = '';
-
+
if( date.toLocaleDateString() == todayDate.toLocaleDateString())
{
style = style + 'dateToday ';
@@ -36,13 +36,13 @@ function isDateSelected( date )
&& dateDay >= todayDay
)
{
- return [true, style];
+ return [true, style];
}
-
+
// we dont color dates before the minimum date
if( dateYear < piwik.minDateYear
|| ( dateYear == piwik.minDateYear
- &&
+ &&
(
(dateMonth == piwik.minDateMonth - 1
&& dateDay < piwik.minDateDay)
@@ -51,9 +51,9 @@ function isDateSelected( date )
)
)
{
- return [true, style];
+ return [true, style];
}
-
+
// we color all day of the month for the same year for the month period
if(piwik.period == "month"
&& dateMonth == currentMonth
@@ -76,7 +76,7 @@ function isDateSelected( date )
{
valid = true;
}
- else if( piwik.period == "day"
+ else if( piwik.period == "day"
&& dateDay == currentDay
&& dateMonth == currentMonth
&& dateYear == currentYear
@@ -84,7 +84,7 @@ function isDateSelected( date )
{
valid = true;
}
-
+
if(valid)
{
return [true, style+'dateUsedStats'];
@@ -96,34 +96,12 @@ function isDateSelected( date )
function updateDate()
{
var date = formatDate(popUpCal.getDateFor($('#calendar')[0]));
-
- // available in global scope
- var currentUrl = window.location.href;
- if((startStrDate = currentUrl.indexOf("date")) >= 0)
- {
- // look for the & after the date
- var endStrDate = currentUrl.indexOf("&", startStrDate);
- if(endStrDate == -1)
- {
- endStrDate = currentUrl.length;
- }
-
- var dateToReplace = currentUrl.substring(
- startStrDate + 4+1,
- endStrDate
- );
- regDateToReplace = new RegExp(dateToReplace, 'ig');
- currentUrl = currentUrl.replace( regDateToReplace, date );
- }
- else
- {
- currentUrl = currentUrl + '&date=' + date;
- }
-
- window.location.href = currentUrl;
+ // Let broadcast do it job:
+ // It will replace date value to both search query and hash and load the new page.
+ broadcast.propagateNewPage('date='+date);
}
-function formatDate(date)
+function formatDate(date)
{
var day = date.getDate();
var month = date.getMonth() + 1;
@@ -169,7 +147,7 @@ $(document).ready(function(){
_pk_translate('CoreHome_MonthDecember_js')]
},
currentDate);
-
+
$("#calendar").hide();
}
);