OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset=utf-8> |
| 5 <title>Calendar Picker test</title> |
| 6 <style> |
| 7 body { |
| 8 background-color: #eeffff; |
| 9 } |
| 10 iframe { |
| 11 z-index: 2147483647; |
| 12 width: 100px; |
| 13 height: 100px; |
| 14 border: 0; |
| 15 overflow: hidden; |
| 16 } |
| 17 </style> |
| 18 </head> |
| 19 <body> |
| 20 |
| 21 <p>This is a testbed for date suggestion picker.</p> |
| 22 |
| 23 <div><input type="text" id="date"></div> |
| 24 <iframe></iframe> |
| 25 |
| 26 <ol id="console" style="font-family:monospace;"> |
| 27 </ol> |
| 28 |
| 29 <script> |
| 30 var arguments = { |
| 31 selectedIndex: 0, |
| 32 children: [ |
| 33 { |
| 34 type: "option", |
| 35 label: "foo", |
| 36 title: "", |
| 37 value: 0, |
| 38 ariaLabel: "", |
| 39 disabled: false, |
| 40 }, |
| 41 { |
| 42 type: "option", |
| 43 label: "bar", |
| 44 title: "", |
| 45 value: 1, |
| 46 ariaLabel: "", |
| 47 disabled: false, |
| 48 }, |
| 49 { |
| 50 type: "option", |
| 51 label: "bar", |
| 52 title: "", |
| 53 value: 2, |
| 54 ariaLabel: "", |
| 55 disabled: false, |
| 56 }, |
| 57 { |
| 58 type: "optgroup", |
| 59 label: "foo", |
| 60 title: "", |
| 61 ariaLabel: "", |
| 62 disabled: false, |
| 63 children: [{ |
| 64 type: "option", |
| 65 label: "bar", |
| 66 title: "", |
| 67 value: 3, |
| 68 ariaLabel: "", |
| 69 disabled: false, |
| 70 }, |
| 71 { |
| 72 type: "option", |
| 73 label: "bar", |
| 74 title: "", |
| 75 value: 4, |
| 76 ariaLabel: "", |
| 77 disabled: false, |
| 78 }, |
| 79 ], |
| 80 }, |
| 81 { |
| 82 type: "option", |
| 83 label: "bar", |
| 84 title: "", |
| 85 value: 5, |
| 86 ariaLabel: "", |
| 87 disabled: false, |
| 88 }, |
| 89 ], |
| 90 anchorRectInScreen: {x: 1332, |
| 91 y: 356, |
| 92 width: 64, |
| 93 height: 18, |
| 94 }, |
| 95 }; |
| 96 |
| 97 function openCalendar(args) { |
| 98 var frame = document.getElementsByTagName('iframe')[0]; |
| 99 var doc = frame.contentDocument; |
| 100 doc.documentElement.innerHTML = '<head></head><body><div id=main>Loading...<
/div></body>'; |
| 101 var commonCssLink = doc.createElement('link'); |
| 102 commonCssLink.rel = 'stylesheet'; |
| 103 commonCssLink.href = '../../Source/web/resources/pickerCommon.css?' + (new D
ate()).getTime(); |
| 104 doc.head.appendChild(commonCssLink); |
| 105 var commonChromiumCssLink = doc.createElement('link'); |
| 106 commonChromiumCssLink.rel = 'stylesheet'; |
| 107 commonChromiumCssLink.href = '../../Source/web/resources/pickerCommon.css?'
+ (new Date()).getTime(); |
| 108 doc.head.appendChild(commonChromiumCssLink); |
| 109 var listPickerCssLink = doc.createElement('link'); |
| 110 listPickerCssLink.rel = 'stylesheet'; |
| 111 listPickerCssLink.href = '../../Source/web/resources/listPicker.css?' + (new
Date()).getTime(); |
| 112 doc.head.appendChild(listPickerCssLink); |
| 113 var calendarPickerChromiumCssLink = doc.createElement('link'); |
| 114 calendarPickerChromiumCssLink.rel = 'stylesheet'; |
| 115 calendarPickerChromiumCssLink.href = '../../Source/web/resources/calendarPic
ker.css?' + (new Date()).getTime(); |
| 116 doc.head.appendChild(calendarPickerChromiumCssLink); |
| 117 var commonJsScript = doc.createElement('script'); |
| 118 commonJsScript.src = '../../Source/web/resources/pickerCommon.js?' + (new Da
te()).getTime(); |
| 119 doc.body.appendChild(commonJsScript); |
| 120 var listPickerJsScript = doc.createElement('script'); |
| 121 listPickerJsScript.src = '../../Source/web/resources/listPicker.js?' + (new
Date()).getTime(); |
| 122 doc.body.appendChild(listPickerJsScript); |
| 123 |
| 124 var pagePopupController = { |
| 125 setValueAndClosePopup: function(numValue, stringValue) { |
| 126 window.log('number=' + numValue + ', string="' + stringValue + '"'); |
| 127 if (numValue == 0) |
| 128 window.document.getElementById('date').value = stringValue; |
| 129 }, |
| 130 } |
| 131 |
| 132 setTimeout(function() { |
| 133 frame.contentWindow.postMessage(JSON.stringify(args), "*"); |
| 134 frame.contentWindow.pagePopupController = pagePopupController; |
| 135 }, 100); |
| 136 } |
| 137 |
| 138 function log(str) { |
| 139 var entry = document.createElement('li'); |
| 140 entry.innerText = str; |
| 141 document.getElementById('console').appendChild(entry); |
| 142 } |
| 143 |
| 144 openCalendar(arguments); |
| 145 </script> |
| 146 </body> |
| 147 </html> |
OLD | NEW |