Changeset 1564460
- Timestamp:
- 12/29/2016 04:28:50 PM (9 years ago)
- Location:
- patro/trunk
- Files:
-
- 2 edited
-
css/patro.css (modified) (1 diff)
-
js/patro.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
patro/trunk/css/patro.css
r1472023 r1564460 101 101 } 102 102 103 t h.Next {103 table#NepaliPatro th.Next { 104 104 105 105 background: url("../images/next.png") no-repeat center; 106 106 } 107 107 108 t h.Next:hover {108 table#NepaliPatro th.Next:hover { 109 109 background: url("../images/next_hover.png") no-repeat center; 110 110 111 111 } 112 112 113 t h.Prev {113 table#NepaliPatro th.Prev { 114 114 115 115 background: url("../images/prev.png") no-repeat center; 116 116 } 117 117 118 t h.Prev:hover {118 table#NepaliPatro th.Prev:hover { 119 119 background: url("../images/prev_hover.png") no-repeat center; 120 120 121 121 } 122 123 #NepaliPatro tbody td { 124 cursor: pointer; 125 } 126 127 .PatroCenter.CurrentDateAndMonth { 128 cursor: pointer; 129 } 130 131 #NepaliPatro .yearSelectionDropDown, #NepaliPatro .monthSelectionDropDown { 132 border: 1px solid #e1e1e1; 133 border-radius: 5px; 134 margin-right: 5px; 135 height: 26px; 136 padding: 0 0px; 137 text-align: center; 138 } -
patro/trunk/js/patro.js
r1472028 r1564460 255 255 this.CreateCalenderElement(); 256 256 257 this.bindCalenderEvents(); 258 257 259 this.getDate(); 258 260 259 261 260 262 }, 261 262 263 bindCalenderEvents: function () { 264 265 266 $selector.on('click', '.PatroCenter.CurrentDateAndMonth', function () { 267 268 var $obj = $(this); 269 if ($obj.find('select').length > 0) { 270 271 return; 272 } 273 274 275 var yearSelectionTab = $('<select class="yearSelectionDropDown">'); 276 277 $.each(BS, function (key, val) { 278 279 yearSelectionTab.append('<option data-year="' + key + '">' + self.NumberToLanguageDigit(key) + '</option>'); 280 281 }); 282 283 var monthSelectionTab = $('<select class="monthSelectionDropDown">'); 284 285 for (var i = 0; i < 12; i++) { 286 287 monthSelectionTab.append('<option data-month="' + (i + 1) + '">' + NPMonth[i] + '</option>'); 288 289 } 290 291 $obj.html(yearSelectionTab); 292 293 $obj.append(monthSelectionTab); 294 295 var $currentDate = $obj.attr('data-date'); 296 297 var currentDateArray = $currentDate.split('/'); 298 299 $obj.find(".yearSelectionDropDown").find('option[data-year="' + currentDateArray[0] + '"]').prop("selected", true); 300 301 $obj.find(".monthSelectionDropDown").find('option[data-month="' + currentDateArray[1] + '"]').prop("selected", true); 302 303 var $currentDateObj = $selector.find(".PatroCenter.CurrentDateAndMonth"); 304 305 var yearDropDownValue = $currentDateObj.find(".yearSelectionDropDown").find("option:selected").attr("data-year"); 306 307 var monthDropDownValue = $currentDateObj.find(".monthSelectionDropDown").find("option:selected").attr("data-month"); 308 309 $currentDateObj.find(".yearSelectionDropDown").on("change", function () { 310 311 yearDropDownValue = $(this).find("option:selected").attr("data-year"); 312 313 self.JumpToDate(yearDropDownValue + "/" + monthDropDownValue + "/1"); 314 }); 315 $currentDateObj.find(".monthSelectionDropDown").on("change", function () { 316 317 monthDropDownValue = $(this).find("option:selected").attr("data-month"); 318 319 self.JumpToDate(yearDropDownValue + "/" + monthDropDownValue + "/1"); 320 }); 321 }); 322 323 324 }, 325 326 327 JumpToDate: function (currDate) { 328 329 var dateSplit = currDate.split("/"); 330 331 var month = dateSplit[1] - 1; 332 333 if (month == 0) { 334 dateSplit[1] = 12; 335 dateSplit[0] = dateSplit[0] - 1; 336 } else { 337 338 dateSplit[1] = dateSplit[1] - 1; 339 } 340 $selector.find('.CurrentDateAndMonth').attr('data-date', dateSplit[0] + "/" + dateSplit[1] + "/" + dateSplit[2]); 341 342 $selector.find("th.Next").trigger("click"); 343 }, 263 344 CreateCalenderElement: function () { 264 345 … … 272 353 Element += '<tr style="background:#F39A9A" ><th>' + PatroLang.FirstDay + '</th><th>' + PatroLang.SecondDay + '</th><th>' + PatroLang.ThirdDay + '</th><th>' + PatroLang.FourthDay + '</th><th>' + 273 354 274 PatroLang.FifthDay + '</th><th>' + PatroLang.SixthDay + '</th><th>' + PatroLang.SeventhDay + '</th></tr></thead>';355 PatroLang.FifthDay + '</th><th>' + PatroLang.SixthDay + '</th><th>' + PatroLang.SeventhDay + '</th></tr></thead>'; 275 356 276 357 Element += '<tbody>'; 277 358 278 279 359 Element += '</tbody>'; 280 360 281 361 Element += '</table>'; 282 362 283 284 //$('body').find(selector).append(Element);285 363 $selector.append(Element); 286 364 … … 291 369 getDate: function () { 292 370 293 294 371 var FullDate = self.GlobalDate.split('/'); 295 372 … … 300 377 301 378 302 //if (GlobalObj) {303 //304 //305 // $(GlobalObj).closest('.CurrentDateAndMonth').html(PatroLang.CurrentYear + ' ' + PatroLang.CurrentMonth);306 //}307 308 309 379 this.populateMonth(self.GlobalDate, Lang); 310 380 … … 348 418 349 419 NepaliDate = $date.split('/');//this.AdToBsDate(PatroDate.getFullYear() + '/' + (PatroDate.getMonth() + 1) + '/' + PatroDate.getDate()).split('/'); 350 351 352 //if (BS[NepaliDate[0]] === undefined) {353 //354 // alert('Date Overflow');355 //356 // return;357 //}358 420 359 421 … … 696 758 // $('body').on('click', selector + ' #NepaliPatro .Prev', function () { 697 759 $selector.on('click', '#NepaliPatro .Prev', function () { 760 761 762 698 763 //$('body').on('click', selector + ' #NepaliPatro .Prev', function () { 699 764 … … 870 935 871 936 }); 937 938 872 939 }); 873 940 }
Note: See TracChangeset
for help on using the changeset viewer.