-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
241 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | ||
"http://www.w3.org/TR/html4/strict.dtd"> | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<title>dcalendar</title> | ||
<meta name="generator" content="TextMate http://macromates.com/"> | ||
<meta name="author" content="nowa"> | ||
<script src="../src/core/jplus.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/core/browser.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/core/object.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/core/function.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/class/class.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/native/string.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/native/enumerable.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/native/array.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/native/number.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/native/hash.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/native/date.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/dom/element.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/event/event.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/dom/element.event.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/request/request.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="../src/utilities/dcalendar.js" type="text/javascript" charset="utf-8"></script> | ||
<!-- Date: 2008-07-17 --> | ||
<style type="text/css" media="screen"> | ||
#main { | ||
width: 950px; | ||
margin: 0 auto; | ||
} | ||
|
||
h3 .author{ | ||
font-size: 12px; | ||
font-weight: normal; | ||
} | ||
|
||
.dcalendar{ | ||
background-color:#CCCCCC; | ||
text-align:center; | ||
} | ||
|
||
.dcalendar td{ | ||
background: #fff; | ||
} | ||
|
||
.dcalendar .dcal-days td{ | ||
width: 20px; | ||
height: 30px; | ||
line-height: 30px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div id="main"> | ||
<h3>DCalendar <span class="author">by <a href="http://nowazhu.com/blog/">nowa</a></span></h3> | ||
|
||
<div jpc="dcalendar"></div> | ||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// | ||
// 支持拖动选择的横向日历 | ||
// JPlus -> dcalendar.js | ||
// | ||
// Created by nowa on 2008-07-17. | ||
// Copyright 2008 jplus.nowazhu.com. All rights reserved. | ||
// | ||
|
||
var DCalendar = { | ||
DCID: 0 | ||
}; | ||
|
||
DCalendar.core = Class.create({ | ||
|
||
implement: Event.Customs, | ||
|
||
options: { | ||
autoshow: true, | ||
showfix: false, | ||
wrapper: null | ||
}, | ||
|
||
days_of_month: [31,28,31,30,31,30,31,31,30,31,30,31], | ||
|
||
containers: [], | ||
|
||
defaultc: null, | ||
|
||
on_days_line: false, | ||
|
||
onmouse_start: 0, | ||
|
||
onmouse_end: 0, | ||
|
||
initialize: function(options) { | ||
this.options = Object.extend(this.options, options || {}); | ||
this.today = Date.now(); | ||
this.year = this.today.year(); | ||
this.month = this.today.month(); | ||
this.day = this.today.day(); | ||
|
||
var _wrapper = this.options.wrapper ? this.options.wrapper : document; | ||
var divs = _wrapper.getElementsByTagName('div'); | ||
$A(divs).each(function(div) { | ||
if (div.getAttribute('jpc') == 'dcalendar') { | ||
div = $(div); | ||
div.set('DCID', div.get('DCID') || DCalendar.DCID++); | ||
div.id = 'dcid_' + div.get('DCID'); | ||
this.containers.push(div); | ||
} | ||
}, this); | ||
}, | ||
|
||
show: function() { | ||
this.containers.each(function(cal) { | ||
this.defaultc = cal; | ||
this.options = Object.extend(this.options, cal.get('options') || {}); | ||
this.create(); | ||
}, this); | ||
}, | ||
|
||
before_create: function() { | ||
this.fireEvent('beforeCreate'); | ||
}, | ||
|
||
create: function() { | ||
this.before_create(); | ||
var _days = this.get_month_days(this.month-1); | ||
var _html = '<table class="dcalendar" border="0" cellspacing="1" cellpadding="4"><tbody><tr class="dcal-title"><td colspan="' + _days + '">' + this.today.strftime('%Y年%m月') + '</td></tr><tr class="dcal-days" id="' + this.defaultc.id + '_days">'; | ||
_days.times(function(i) { | ||
_html += '<td>' + (i + 1) + '</td>'; | ||
}); | ||
_html += '</tr></tbody></table>'; | ||
this.defaultc.innerHTML = _html; | ||
|
||
this.enabled(); | ||
}, | ||
|
||
enabled: function() { | ||
var days_line = $(this.defaultc.id + '_days'); | ||
this.on_days_line = false; | ||
this.onmouse_start = 0; | ||
this.onmouse_end = 0; | ||
|
||
var _dcal = this, _tds = days_line.getElementsByTagName('td'); | ||
$A(_tds).each(function(td) { | ||
td.observe('click', function(e) { | ||
this.className = this.className == 'selected' ? '' : 'selected'; | ||
_dcal.refresh_selected(this.parentNode.parentNode.parentNode.parentNode); | ||
}) | ||
}); | ||
}, | ||
|
||
refresh_selected: function(container) { | ||
|
||
}, | ||
|
||
get_month_days: function(month) { | ||
var _days = this.days_of_month[month]; | ||
if (month==1 && (year%4==0 && year%100!=0 || year%400==0)) _days++; | ||
return _days; | ||
} | ||
|
||
}); | ||
|
||
document.observe('dom:ready', function() { | ||
var dcal = new DCalendar.core({wrapper: $('main')}); | ||
dcal.show(); | ||
}); |