20bab04f8e098fdd3fc03b0e09b4a6d34e85e249.svn-base 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. window.Partials = window.Partials || {};
  2. $(function () {
  3. Globalize.culture(navigator.language || navigator.browserLanguage);
  4. DevExpress.data.utils.odata.keyConverters.DateTime = function (value) {
  5. return new DevExpress.data.EdmLiteral("datetime'" + moment(value).format('YYYY-MM-DDTHH:mm:ss') + "'");
  6. }
  7. ko.subscribable.fn.subscribeChanged = function (callback) {
  8. var previousValue;
  9. this.subscribe(function (_previousValue) {
  10. previousValue = _previousValue;
  11. }, undefined, 'beforeChange');
  12. this.subscribe(function (latestValue) {
  13. callback(latestValue, previousValue);
  14. });
  15. };
  16. Date.prototype.nextMonth = function () {
  17. var thisMonth = this.getMonth();
  18. this.setMonth(thisMonth + 1);
  19. if (this.getMonth() != thisMonth + 1 && this.getMonth() != 0)
  20. this.setDate(0);
  21. };
  22. Date.prototype.prevMonth = function () {
  23. var thisMonth = this.getMonth();
  24. this.setMonth(thisMonth - 1);
  25. if (this.getMonth() != thisMonth - 1 && (this.getMonth() != 11 || (thisMonth == 11 && this.getDate() == 1)))
  26. this.setDate(0);
  27. };
  28. Partials.app = new DevExpress.framework.html.HtmlApplication({
  29. namespace: Partials,
  30. layoutSet: DevExpress.framework.html.layoutSets[Partials.config.layoutSet],
  31. navigation: Partials.config.navigation,
  32. commandMapping: Partials.config.commandMapping
  33. });
  34. Partials.app.router.register(":view/:id", { view: "home", id: undefined });
  35. Partials.app.navigate();
  36. });