修訂 | 1527 (tree) |
---|---|
時間 | 2017-12-20 08:43:30 |
作者 | takahashi_m |
(empty log message)
@@ -1,4 +1,10 @@ | ||
1 | -5.9.27.2 (2017/12/15) | |
1 | +5.9.27.3 (2017/12/22) | |
2 | + [時間ピッカー改修] | |
3 | + 24時以降の表示に対応します。 | |
4 | + ブレイクを12時単位にした上で、間を空けることで選択しやすくします。 | |
5 | + jsp/common/eventScript.js#ogClockpicker | |
6 | + | |
7 | +5.9.27.2 (2017/12/15) | |
2 | 8 | [日本語ファイル名のEdge対応] |
3 | 9 | Edgeで日本語ファイル名をfileDownloadServlet経由で落とす場合に文字化けしていたため、IEと同様の処理としておきます。 |
4 | 10 | 判定はUserAgentの「Edge」の文字列有無としています。 |
@@ -763,6 +763,7 @@ | ||
763 | 763 | @og.rev 5.9.12.3 (2015/09/23) 返す値に秒(00固定)を追加出来るようにする(useSecond) |
764 | 764 | @og.rev 5.9.15.1 (2016/12/09) 数値変換不具合対応 |
765 | 765 | @og.rev 5.9.17.2 (2017/02/15) layout指定追加 |
766 | +@og.rev 5.9.**.* (2017/12/19) 選択時間を幅広く取れるように変更、及び方向キー対応 | |
766 | 767 | ********************************************************************************************/ |
767 | 768 | |
768 | 769 | jQuery.fn.ogClockpicker = function(options, callback) { |
@@ -854,10 +855,13 @@ | ||
854 | 855 | var $hourcont = jQuery("<div id='CP_hourcont' class='CP' />").appendTo( $body ); |
855 | 856 | !settings.useBgiframe ? $hourcont.css("opacity",settings.hoursopacity) : null; |
856 | 857 | binder( $hourcont ); |
857 | - | |
858 | - var $hourcol1 = jQuery("<div class='CP_hourcol' id='hourcol1' />").appendTo( $body ); | |
859 | - var $hourcol2 = jQuery("<div class='CP_hourcol' id='hourcol2' />").appendTo( $body ); | |
860 | 858 | |
859 | + //多数に対応させるため配列に代入 5.9.27.3 (2017/12/22) | |
860 | + var $hourcol = []; | |
861 | + for(var i=0;i<Math.floor(settings.endhour/12)-Math.floor(settings.starthour/12)+1;i++){ | |
862 | + $hourcol.push(jQuery("<div class='CP_hourcol' id='hourcol"+i+"' />").appendTo( $body )); | |
863 | + } | |
864 | + | |
861 | 865 | // if showminutes, append minutes cont to body |
862 | 866 | |
863 | 867 | if (settings.showminutes == "true") { |
@@ -872,8 +876,9 @@ | ||
872 | 876 | } |
873 | 877 | } |
874 | 878 | else { |
875 | - $hourcol1.addClass('floatleft'); | |
876 | - $hourcol2.addClass('floatleft'); | |
879 | + for (i=0;i<$hourcol.length;i++){ | |
880 | + $hourcol[i].addClass('floatleft'); | |
881 | + } | |
877 | 882 | } |
878 | 883 | |
879 | 884 | // all the action right here |
@@ -887,11 +892,12 @@ | ||
887 | 892 | function renderhours() { |
888 | 893 | // fill in the $hourcont div |
889 | 894 | var c = 1; |
895 | + var numberC = 0; | |
890 | 896 | // counter as index 2 of hr id, gives us index |
891 | 897 | // in group of hourdivs for calculating where to put minutecont on keydown |
892 | 898 | for (var h=settings.starthour; h<=settings.endhour; h++) { |
893 | 899 | |
894 | - if(h==12) { c = 1; } // reset counter for col 2 | |
900 | + if(h%12==0) { c = 1; } // reset counter for col 2 | |
895 | 901 | |
896 | 902 | var displayhours = ((!settings.military && h > 12) ? h - 12 : h); |
897 | 903 | var valuehouers = h; // opengion |
@@ -916,12 +922,29 @@ | ||
916 | 922 | if (!v) { |
917 | 923 | $hd.css("float","left"); |
918 | 924 | } |
919 | - (h<12) ? $hourcol1.append($hd) : $hourcol2.append($hd); | |
925 | + $hourcol[numberC].append($hd); | |
926 | + if((h+1)%12==0){ | |
927 | + numberC++; | |
928 | + } | |
920 | 929 | c++; |
921 | 930 | } |
922 | - $hourcont.append($hourcol1); | |
923 | - !v ? $hourcont.append("<div style='clear:left' />") : ''; | |
924 | - $hourcont.append($hourcol2); | |
931 | + | |
932 | + // 5.9.27.3 (2017/12/22) | |
933 | + for(var j=0; j<$hourcol.length;j++){ | |
934 | + if(v){ | |
935 | + if(j!=0&&j%2==0){ | |
936 | + $hourcol[j].css("margin-left",$mc.width()+4 + 'px'); | |
937 | + } | |
938 | + }else{ | |
939 | + $hourcont.append("<div style='clear:left' />"); | |
940 | + if(j!=0&&j%2==0){ | |
941 | + //$mc.height()が0になってまう?? | |
942 | + $hourcol[j].css("margin-top","19px"); | |
943 | + } | |
944 | + } | |
945 | + $hourcont.append($hourcol[j]); | |
946 | + } | |
947 | + | |
925 | 948 | } |
926 | 949 | |
927 | 950 | function renderminutes( h ) { |
@@ -1089,33 +1112,29 @@ | ||
1089 | 1112 | var h = $obj.attr("id").split('_')[1], |
1090 | 1113 | i = $obj.attr("id").split('_')[2], |
1091 | 1114 | l, |
1092 | - t; | |
1115 | + t, | |
1116 | + nn; | |
1093 | 1117 | $obj.addClass("CP_over"); |
1094 | - | |
1118 | + | |
1119 | + //何個目の要素を見ているか計算して、分表示を配置するための独立変数nnを算出 5.9.27.3 (2017/12/22) | |
1120 | + nn = Math.ceil((Math.floor(h/12)-Math.floor(settings.starthour/12))/2); | |
1121 | + | |
1095 | 1122 | if ( settings.showminutes == "true") { |
1096 | 1123 | $mc.hide(); |
1097 | 1124 | renderminutes(h); |
1098 | - | |
1099 | 1125 | // set position & show minutes container |
1100 | 1126 | if (v) { |
1101 | 1127 | t = e.type == 'mouseover' |
1102 | 1128 | ? e.pageY - 15 |
1103 | 1129 | : $hourcont.offset().top + 2 + ($obj.height() * i); |
1104 | - if ( h < 12 ) | |
1105 | - l = $hourcont.offset().left - $mc.width() - 2; | |
1106 | - else | |
1107 | - l = $hourcont.offset().left + $hourcont.width() + 2; | |
1130 | + l = $hourcont.offset().left + $hourcol[0].width()*2*nn + $mc.width()*(nn-1) + 4*nn-2; // 5.9.27.3 (2017/12/22) | |
1108 | 1131 | } |
1109 | 1132 | else { |
1110 | 1133 | l = (e.type == 'mouseover') |
1111 | 1134 | ? e.pageX - 10 |
1112 | 1135 | : $hourcont.offset().left + ($obj.width()-5) * i; |
1113 | - if(h<12) { | |
1114 | - t = $hourcont.offset().top - $mc.height() - 2; | |
1115 | - } | |
1116 | - else { | |
1117 | - t = $hourcont.offset().top + $hourcont.height(); | |
1118 | - } | |
1136 | + //$hourcol[0].height()は出ないため全体から各要素を引いて導出 | |
1137 | + t = $hourcont.offset().top + ($hourcont.height()-($mc.height()+2)*(Math.ceil($hourcol.length/2)-1))/$hourcol.length*2*nn + $mc.height()*(nn-1) + 2*nn-1; // (2017/12/19) | |
1119 | 1138 | } |
1120 | 1139 | $mc.css("left",l+'px').css("top",t+'px'); |
1121 | 1140 | rectify( $mc ); |
@@ -1201,11 +1220,22 @@ | ||
1201 | 1220 | divtype = $obj.is(".CP_hour") ? 'hour' : 'minute', |
1202 | 1221 | hi = (divtype == 'hour') ? $obj[0].id.split('_')[2] : 0, // hour index |
1203 | 1222 | h = (divtype == 'minute') ? $obj[0].id.split('_')[0] : $obj[0].id.split('_')[1]; // real hour |
1204 | - if (divtype == 'minute') | |
1205 | - { var curloc = h<12 ? 'm1' : 'm2' } | |
1206 | - else | |
1207 | - { var curloc = h<12 ? 'h1' : 'h2' } | |
1208 | - | |
1223 | + // 5.9.27.3 (2017/12/22) | |
1224 | + if (divtype == 'minute') { | |
1225 | + if((Math.floor(h/12)-Math.floor(settings.starthour/12))==0){ | |
1226 | + var curloc = 'm1'; | |
1227 | + }else if((Math.floor(h/12)-Math.floor(settings.endhour/12))==0&&(Math.floor(h/12)-Math.floor(settings.starthour/12))%2!=0){ | |
1228 | + var curloc = 'm2'; | |
1229 | + }else{ | |
1230 | + var curloc = 'm3'; | |
1231 | + } | |
1232 | + }else{ | |
1233 | + if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1234 | + var curloc = 'h1'; | |
1235 | + }else{ | |
1236 | + var curloc = 'h2'; | |
1237 | + } | |
1238 | + } | |
1209 | 1239 | function divprev($obj) { |
1210 | 1240 | if ($obj.prev().size()) { |
1211 | 1241 | eval(divtype + 'div_out($obj)'); |
@@ -1223,7 +1253,13 @@ | ||
1223 | 1253 | } |
1224 | 1254 | |
1225 | 1255 | function hourtohour($obj) { |
1226 | - var ctx = h>=12 ? '#hourcol1' : '#hourcol2'; | |
1256 | + // 5.9.27.3 (2017/12/22) | |
1257 | + if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1258 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))+1); | |
1259 | + }else{ | |
1260 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))-1); | |
1261 | + } | |
1262 | + var ctx = '#hourcol'+next; | |
1227 | 1263 | $newobj = jQuery(".CP_hour[id$=_" + hi + "]", ctx ); |
1228 | 1264 | if ($newobj.size()) { |
1229 | 1265 | hourdiv_out($obj); |
@@ -1237,11 +1273,27 @@ | ||
1237 | 1273 | minutediv_over($(".CP_minute:first")); |
1238 | 1274 | } |
1239 | 1275 | |
1240 | - function minutetohour($obj) { | |
1276 | + function minutetohour($obj,where) { | |
1241 | 1277 | minutediv_out($obj); |
1242 | - var ctx = h>=12 ? '#hourcol2' : '#hourcol1'; | |
1278 | + // 5.9.27.3 (2017/12/22) | |
1279 | + if(where<0){ | |
1280 | + if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1281 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where); | |
1282 | + h = String(Number(h)-12); | |
1283 | + }else{ | |
1284 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))); | |
1285 | + } | |
1286 | + }else{ | |
1287 | + if((Math.floor(h/12)-Math.floor(settings.starthour/12))%2==0){ | |
1288 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))); | |
1289 | + }else{ | |
1290 | + var next = String((Math.floor(h/12)-Math.floor(settings.starthour/12))+where); | |
1291 | + h = String(Number(h)+12); | |
1292 | + } | |
1293 | + } | |
1294 | + var ctx = '#hourcol'+next; | |
1295 | + var $newobj = jQuery(".CP_hour[id^=hr_" + h + "]", ctx); | |
1243 | 1296 | // extract hour from minutediv, then find hourdiv with that hour |
1244 | - var $newobj = jQuery(".CP_hour[id^=hr_" + h + "]", ctx); | |
1245 | 1297 | hourdiv_over($newobj, e); |
1246 | 1298 | } |
1247 | 1299 |
@@ -1253,8 +1305,11 @@ | ||
1253 | 1305 | return false; |
1254 | 1306 | break; |
1255 | 1307 | case 'm2': |
1256 | - minutetohour($obj); | |
1308 | + minutetohour($obj,-1); | |
1257 | 1309 | break; |
1310 | + case 'm3': | |
1311 | + minutetohour($obj,-1); // 5.9.27.3 (2017/12/22) | |
1312 | + break; | |
1258 | 1313 | case 'h1': |
1259 | 1314 | hourtominute($obj); |
1260 | 1315 | break; |
@@ -1278,8 +1333,11 @@ | ||
1278 | 1333 | return false; |
1279 | 1334 | break; |
1280 | 1335 | case 'm2': |
1281 | - minutetohour($obj); | |
1336 | + minutetohour($obj,-1); | |
1282 | 1337 | break; |
1338 | + case 'm3': | |
1339 | + minutetohour($obj,-1); // 5.9.27.3 (2017/12/22) | |
1340 | + break; | |
1283 | 1341 | case 'h1': |
1284 | 1342 | hourtominute($obj); |
1285 | 1343 | break; |
@@ -1293,11 +1351,14 @@ | ||
1293 | 1351 | if (v) { |
1294 | 1352 | switch (curloc) { |
1295 | 1353 | case 'm1': |
1296 | - minutetohour($obj); | |
1354 | + minutetohour($obj,1); | |
1297 | 1355 | break; |
1298 | 1356 | case 'm2': |
1299 | 1357 | return false; |
1300 | 1358 | break; |
1359 | + case 'm3': | |
1360 | + minutetohour($obj,1); // 5.9.27.3 (2017/12/22) | |
1361 | + break; | |
1301 | 1362 | case 'h1': |
1302 | 1363 | hourtohour($obj); |
1303 | 1364 | break; |
@@ -1318,11 +1379,14 @@ | ||
1318 | 1379 | else { |
1319 | 1380 | switch (curloc) { |
1320 | 1381 | case 'm1': |
1321 | - minutetohour($obj); | |
1382 | + minutetohour($obj,1); | |
1322 | 1383 | break; |
1323 | 1384 | case 'm2': |
1324 | 1385 | return false; |
1325 | 1386 | break; |
1387 | + case 'm3': | |
1388 | + minutetohour($obj,1); // 5.9.27.3 (2017/12/22) | |
1389 | + break; | |
1326 | 1390 | case 'h1': |
1327 | 1391 | hourtohour($obj); |
1328 | 1392 | break; |