Index: branches/new-upload/phase3/js2/mwEmbed/jquery/plugins/jquery.datePicker.js |
— | — | @@ -1054,3 +1054,472 @@ |
1055 | 1055 | |
1056 | 1056 | |
1057 | 1057 | })(jQuery); |
| 1058 | + |
| 1059 | + |
| 1060 | +/* |
| 1061 | + * Date prototype extensions. Doesn't depend on any |
| 1062 | + * other code. Doens't overwrite existing methods. |
| 1063 | + * |
| 1064 | + * Adds dayNames, abbrDayNames, monthNames and abbrMonthNames static properties and isLeapYear, |
| 1065 | + * isWeekend, isWeekDay, getDaysInMonth, getDayName, getMonthName, getDayOfYear, getWeekOfYear, |
| 1066 | + * setDayOfYear, addYears, addMonths, addDays, addHours, addMinutes, addSeconds methods |
| 1067 | + * |
| 1068 | + * Copyright (c) 2006 Jörn Zaefferer and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) |
| 1069 | + * |
| 1070 | + * Additional methods and properties added by Kelvin Luck: firstDayOfWeek, dateFormat, zeroTime, asString, fromString - |
| 1071 | + * I've added my name to these methods so you know who to blame if they are broken! |
| 1072 | + * |
| 1073 | + * Dual licensed under the MIT and GPL licenses: |
| 1074 | + * http://www.opensource.org/licenses/mit-license.php |
| 1075 | + * http://www.gnu.org/licenses/gpl.html |
| 1076 | + * |
| 1077 | + */ |
| 1078 | + |
| 1079 | +/** |
| 1080 | + * An Array of day names starting with Sunday. |
| 1081 | + * |
| 1082 | + * @example dayNames[0] |
| 1083 | + * @result 'Sunday' |
| 1084 | + * |
| 1085 | + * @name dayNames |
| 1086 | + * @type Array |
| 1087 | + * @cat Plugins/Methods/Date |
| 1088 | + */ |
| 1089 | +Date.dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; |
| 1090 | + |
| 1091 | +/** |
| 1092 | + * An Array of abbreviated day names starting with Sun. |
| 1093 | + * |
| 1094 | + * @example abbrDayNames[0] |
| 1095 | + * @result 'Sun' |
| 1096 | + * |
| 1097 | + * @name abbrDayNames |
| 1098 | + * @type Array |
| 1099 | + * @cat Plugins/Methods/Date |
| 1100 | + */ |
| 1101 | +Date.abbrDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; |
| 1102 | + |
| 1103 | +/** |
| 1104 | + * An Array of month names starting with Janurary. |
| 1105 | + * |
| 1106 | + * @example monthNames[0] |
| 1107 | + * @result 'January' |
| 1108 | + * |
| 1109 | + * @name monthNames |
| 1110 | + * @type Array |
| 1111 | + * @cat Plugins/Methods/Date |
| 1112 | + */ |
| 1113 | +Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; |
| 1114 | + |
| 1115 | +/** |
| 1116 | + * An Array of abbreviated month names starting with Jan. |
| 1117 | + * |
| 1118 | + * @example abbrMonthNames[0] |
| 1119 | + * @result 'Jan' |
| 1120 | + * |
| 1121 | + * @name monthNames |
| 1122 | + * @type Array |
| 1123 | + * @cat Plugins/Methods/Date |
| 1124 | + */ |
| 1125 | +Date.abbrMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; |
| 1126 | + |
| 1127 | +/** |
| 1128 | + * The first day of the week for this locale. |
| 1129 | + * |
| 1130 | + * @name firstDayOfWeek |
| 1131 | + * @type Number |
| 1132 | + * @cat Plugins/Methods/Date |
| 1133 | + * @author Kelvin Luck |
| 1134 | + */ |
| 1135 | +Date.firstDayOfWeek = 1; |
| 1136 | + |
| 1137 | +/** |
| 1138 | + * The format that string dates should be represented as (e.g. 'dd/mm/yyyy' for UK, 'mm/dd/yyyy' for US, 'yyyy-mm-dd' for Unicode etc). |
| 1139 | + * |
| 1140 | + * @name format |
| 1141 | + * @type String |
| 1142 | + * @cat Plugins/Methods/Date |
| 1143 | + * @author Kelvin Luck |
| 1144 | + */ |
| 1145 | +Date.format = 'dd/mm/yyyy'; |
| 1146 | +//Date.format = 'mm/dd/yyyy'; |
| 1147 | +//Date.format = 'yyyy-mm-dd'; |
| 1148 | +//Date.format = 'dd mmm yy'; |
| 1149 | + |
| 1150 | +/** |
| 1151 | + * The first two numbers in the century to be used when decoding a two digit year. Since a two digit year is ambiguous (and date.setYear |
| 1152 | + * only works with numbers < 99 and so doesn't allow you to set years after 2000) we need to use this to disambiguate the two digit year codes. |
| 1153 | + * |
| 1154 | + * @name format |
| 1155 | + * @type String |
| 1156 | + * @cat Plugins/Methods/Date |
| 1157 | + * @author Kelvin Luck |
| 1158 | + */ |
| 1159 | +Date.fullYearStart = '20'; |
| 1160 | + |
| 1161 | +(function() { |
| 1162 | + |
| 1163 | + /** |
| 1164 | + * Adds a given method under the given name |
| 1165 | + * to the Date prototype if it doesn't |
| 1166 | + * currently exist. |
| 1167 | + * |
| 1168 | + * @private |
| 1169 | + */ |
| 1170 | + function add(name, method) { |
| 1171 | + if( !Date.prototype[name] ) { |
| 1172 | + Date.prototype[name] = method; |
| 1173 | + } |
| 1174 | + }; |
| 1175 | + |
| 1176 | + /** |
| 1177 | + * Checks if the year is a leap year. |
| 1178 | + * |
| 1179 | + * @example var dtm = new Date("01/12/2008"); |
| 1180 | + * dtm.isLeapYear(); |
| 1181 | + * @result true |
| 1182 | + * |
| 1183 | + * @name isLeapYear |
| 1184 | + * @type Boolean |
| 1185 | + * @cat Plugins/Methods/Date |
| 1186 | + */ |
| 1187 | + add("isLeapYear", function() { |
| 1188 | + var y = this.getFullYear(); |
| 1189 | + return (y%4==0 && y%100!=0) || y%400==0; |
| 1190 | + }); |
| 1191 | + |
| 1192 | + /** |
| 1193 | + * Checks if the day is a weekend day (Sat or Sun). |
| 1194 | + * |
| 1195 | + * @example var dtm = new Date("01/12/2008"); |
| 1196 | + * dtm.isWeekend(); |
| 1197 | + * @result false |
| 1198 | + * |
| 1199 | + * @name isWeekend |
| 1200 | + * @type Boolean |
| 1201 | + * @cat Plugins/Methods/Date |
| 1202 | + */ |
| 1203 | + add("isWeekend", function() { |
| 1204 | + return this.getDay()==0 || this.getDay()==6; |
| 1205 | + }); |
| 1206 | + |
| 1207 | + /** |
| 1208 | + * Check if the day is a day of the week (Mon-Fri) |
| 1209 | + * |
| 1210 | + * @example var dtm = new Date("01/12/2008"); |
| 1211 | + * dtm.isWeekDay(); |
| 1212 | + * @result false |
| 1213 | + * |
| 1214 | + * @name isWeekDay |
| 1215 | + * @type Boolean |
| 1216 | + * @cat Plugins/Methods/Date |
| 1217 | + */ |
| 1218 | + add("isWeekDay", function() { |
| 1219 | + return !this.isWeekend(); |
| 1220 | + }); |
| 1221 | + |
| 1222 | + /** |
| 1223 | + * Gets the number of days in the month. |
| 1224 | + * |
| 1225 | + * @example var dtm = new Date("01/12/2008"); |
| 1226 | + * dtm.getDaysInMonth(); |
| 1227 | + * @result 31 |
| 1228 | + * |
| 1229 | + * @name getDaysInMonth |
| 1230 | + * @type Number |
| 1231 | + * @cat Plugins/Methods/Date |
| 1232 | + */ |
| 1233 | + add("getDaysInMonth", function() { |
| 1234 | + return [31,(this.isLeapYear() ? 29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()]; |
| 1235 | + }); |
| 1236 | + |
| 1237 | + /** |
| 1238 | + * Gets the name of the day. |
| 1239 | + * |
| 1240 | + * @example var dtm = new Date("01/12/2008"); |
| 1241 | + * dtm.getDayName(); |
| 1242 | + * @result 'Saturday' |
| 1243 | + * |
| 1244 | + * @example var dtm = new Date("01/12/2008"); |
| 1245 | + * dtm.getDayName(true); |
| 1246 | + * @result 'Sat' |
| 1247 | + * |
| 1248 | + * @param abbreviated Boolean When set to true the name will be abbreviated. |
| 1249 | + * @name getDayName |
| 1250 | + * @type String |
| 1251 | + * @cat Plugins/Methods/Date |
| 1252 | + */ |
| 1253 | + add("getDayName", function(abbreviated) { |
| 1254 | + return abbreviated ? Date.abbrDayNames[this.getDay()] : Date.dayNames[this.getDay()]; |
| 1255 | + }); |
| 1256 | + |
| 1257 | + /** |
| 1258 | + * Gets the name of the month. |
| 1259 | + * |
| 1260 | + * @example var dtm = new Date("01/12/2008"); |
| 1261 | + * dtm.getMonthName(); |
| 1262 | + * @result 'Janurary' |
| 1263 | + * |
| 1264 | + * @example var dtm = new Date("01/12/2008"); |
| 1265 | + * dtm.getMonthName(true); |
| 1266 | + * @result 'Jan' |
| 1267 | + * |
| 1268 | + * @param abbreviated Boolean When set to true the name will be abbreviated. |
| 1269 | + * @name getDayName |
| 1270 | + * @type String |
| 1271 | + * @cat Plugins/Methods/Date |
| 1272 | + */ |
| 1273 | + add("getMonthName", function(abbreviated) { |
| 1274 | + return abbreviated ? Date.abbrMonthNames[this.getMonth()] : Date.monthNames[this.getMonth()]; |
| 1275 | + }); |
| 1276 | + |
| 1277 | + /** |
| 1278 | + * Get the number of the day of the year. |
| 1279 | + * |
| 1280 | + * @example var dtm = new Date("01/12/2008"); |
| 1281 | + * dtm.getDayOfYear(); |
| 1282 | + * @result 11 |
| 1283 | + * |
| 1284 | + * @name getDayOfYear |
| 1285 | + * @type Number |
| 1286 | + * @cat Plugins/Methods/Date |
| 1287 | + */ |
| 1288 | + add("getDayOfYear", function() { |
| 1289 | + var tmpdtm = new Date("1/1/" + this.getFullYear()); |
| 1290 | + return Math.floor((this.getTime() - tmpdtm.getTime()) / 86400000); |
| 1291 | + }); |
| 1292 | + |
| 1293 | + /** |
| 1294 | + * Get the number of the week of the year. |
| 1295 | + * |
| 1296 | + * @example var dtm = new Date("01/12/2008"); |
| 1297 | + * dtm.getWeekOfYear(); |
| 1298 | + * @result 2 |
| 1299 | + * |
| 1300 | + * @name getWeekOfYear |
| 1301 | + * @type Number |
| 1302 | + * @cat Plugins/Methods/Date |
| 1303 | + */ |
| 1304 | + add("getWeekOfYear", function() { |
| 1305 | + return Math.ceil(this.getDayOfYear() / 7); |
| 1306 | + }); |
| 1307 | + |
| 1308 | + /** |
| 1309 | + * Set the day of the year. |
| 1310 | + * |
| 1311 | + * @example var dtm = new Date("01/12/2008"); |
| 1312 | + * dtm.setDayOfYear(1); |
| 1313 | + * dtm.toString(); |
| 1314 | + * @result 'Tue Jan 01 2008 00:00:00' |
| 1315 | + * |
| 1316 | + * @name setDayOfYear |
| 1317 | + * @type Date |
| 1318 | + * @cat Plugins/Methods/Date |
| 1319 | + */ |
| 1320 | + add("setDayOfYear", function(day) { |
| 1321 | + this.setMonth(0); |
| 1322 | + this.setDate(day); |
| 1323 | + return this; |
| 1324 | + }); |
| 1325 | + |
| 1326 | + /** |
| 1327 | + * Add a number of years to the date object. |
| 1328 | + * |
| 1329 | + * @example var dtm = new Date("01/12/2008"); |
| 1330 | + * dtm.addYears(1); |
| 1331 | + * dtm.toString(); |
| 1332 | + * @result 'Mon Jan 12 2009 00:00:00' |
| 1333 | + * |
| 1334 | + * @name addYears |
| 1335 | + * @type Date |
| 1336 | + * @cat Plugins/Methods/Date |
| 1337 | + */ |
| 1338 | + add("addYears", function(num) { |
| 1339 | + this.setFullYear(this.getFullYear() + num); |
| 1340 | + return this; |
| 1341 | + }); |
| 1342 | + |
| 1343 | + /** |
| 1344 | + * Add a number of months to the date object. |
| 1345 | + * |
| 1346 | + * @example var dtm = new Date("01/12/2008"); |
| 1347 | + * dtm.addMonths(1); |
| 1348 | + * dtm.toString(); |
| 1349 | + * @result 'Tue Feb 12 2008 00:00:00' |
| 1350 | + * |
| 1351 | + * @name addMonths |
| 1352 | + * @type Date |
| 1353 | + * @cat Plugins/Methods/Date |
| 1354 | + */ |
| 1355 | + add("addMonths", function(num) { |
| 1356 | + var tmpdtm = this.getDate(); |
| 1357 | + |
| 1358 | + this.setMonth(this.getMonth() + num); |
| 1359 | + |
| 1360 | + if (tmpdtm > this.getDate()) |
| 1361 | + this.addDays(-this.getDate()); |
| 1362 | + |
| 1363 | + return this; |
| 1364 | + }); |
| 1365 | + |
| 1366 | + /** |
| 1367 | + * Add a number of days to the date object. |
| 1368 | + * |
| 1369 | + * @example var dtm = new Date("01/12/2008"); |
| 1370 | + * dtm.addDays(1); |
| 1371 | + * dtm.toString(); |
| 1372 | + * @result 'Sun Jan 13 2008 00:00:00' |
| 1373 | + * |
| 1374 | + * @name addDays |
| 1375 | + * @type Date |
| 1376 | + * @cat Plugins/Methods/Date |
| 1377 | + */ |
| 1378 | + add("addDays", function(num) { |
| 1379 | + this.setDate(this.getDate() + num); |
| 1380 | + return this; |
| 1381 | + }); |
| 1382 | + |
| 1383 | + /** |
| 1384 | + * Add a number of hours to the date object. |
| 1385 | + * |
| 1386 | + * @example var dtm = new Date("01/12/2008"); |
| 1387 | + * dtm.addHours(24); |
| 1388 | + * dtm.toString(); |
| 1389 | + * @result 'Sun Jan 13 2008 00:00:00' |
| 1390 | + * |
| 1391 | + * @name addHours |
| 1392 | + * @type Date |
| 1393 | + * @cat Plugins/Methods/Date |
| 1394 | + */ |
| 1395 | + add("addHours", function(num) { |
| 1396 | + this.setHours(this.getHours() + num); |
| 1397 | + return this; |
| 1398 | + }); |
| 1399 | + |
| 1400 | + /** |
| 1401 | + * Add a number of minutes to the date object. |
| 1402 | + * |
| 1403 | + * @example var dtm = new Date("01/12/2008"); |
| 1404 | + * dtm.addMinutes(60); |
| 1405 | + * dtm.toString(); |
| 1406 | + * @result 'Sat Jan 12 2008 01:00:00' |
| 1407 | + * |
| 1408 | + * @name addMinutes |
| 1409 | + * @type Date |
| 1410 | + * @cat Plugins/Methods/Date |
| 1411 | + */ |
| 1412 | + add("addMinutes", function(num) { |
| 1413 | + this.setMinutes(this.getMinutes() + num); |
| 1414 | + return this; |
| 1415 | + }); |
| 1416 | + |
| 1417 | + /** |
| 1418 | + * Add a number of seconds to the date object. |
| 1419 | + * |
| 1420 | + * @example var dtm = new Date("01/12/2008"); |
| 1421 | + * dtm.addSeconds(60); |
| 1422 | + * dtm.toString(); |
| 1423 | + * @result 'Sat Jan 12 2008 00:01:00' |
| 1424 | + * |
| 1425 | + * @name addSeconds |
| 1426 | + * @type Date |
| 1427 | + * @cat Plugins/Methods/Date |
| 1428 | + */ |
| 1429 | + add("addSeconds", function(num) { |
| 1430 | + this.setSeconds(this.getSeconds() + num); |
| 1431 | + return this; |
| 1432 | + }); |
| 1433 | + |
| 1434 | + /** |
| 1435 | + * Sets the time component of this Date to zero for cleaner, easier comparison of dates where time is not relevant. |
| 1436 | + * |
| 1437 | + * @example var dtm = new Date(); |
| 1438 | + * dtm.zeroTime(); |
| 1439 | + * dtm.toString(); |
| 1440 | + * @result 'Sat Jan 12 2008 00:01:00' |
| 1441 | + * |
| 1442 | + * @name zeroTime |
| 1443 | + * @type Date |
| 1444 | + * @cat Plugins/Methods/Date |
| 1445 | + * @author Kelvin Luck |
| 1446 | + */ |
| 1447 | + add("zeroTime", function() { |
| 1448 | + this.setMilliseconds(0); |
| 1449 | + this.setSeconds(0); |
| 1450 | + this.setMinutes(0); |
| 1451 | + this.setHours(0); |
| 1452 | + return this; |
| 1453 | + }); |
| 1454 | + |
| 1455 | + /** |
| 1456 | + * Returns a string representation of the date object according to Date.format. |
| 1457 | + * (Date.toString may be used in other places so I purposefully didn't overwrite it) |
| 1458 | + * |
| 1459 | + * @example var dtm = new Date("01/12/2008"); |
| 1460 | + * dtm.asString(); |
| 1461 | + * @result '12/01/2008' // (where Date.format == 'dd/mm/yyyy' |
| 1462 | + * |
| 1463 | + * @name asString |
| 1464 | + * @type Date |
| 1465 | + * @cat Plugins/Methods/Date |
| 1466 | + * @author Kelvin Luck |
| 1467 | + */ |
| 1468 | + add("asString", function() { |
| 1469 | + var r = Date.format; |
| 1470 | + return r |
| 1471 | + .split('yyyy').join(this.getFullYear()) |
| 1472 | + .split('yy').join((this.getFullYear() + '').substring(2)) |
| 1473 | + .split('mmm').join(this.getMonthName(true)) |
| 1474 | + .split('mm').join(_zeroPad(this.getMonth()+1)) |
| 1475 | + .split('dd').join(_zeroPad(this.getDate())); |
| 1476 | + }); |
| 1477 | + |
| 1478 | + /** |
| 1479 | + * Returns a new date object created from the passed String according to Date.format or false if the attempt to do this results in an invalid date object |
| 1480 | + * (We can't simple use Date.parse as it's not aware of locale and I chose not to overwrite it incase it's functionality is being relied on elsewhere) |
| 1481 | + * |
| 1482 | + * @example var dtm = Date.fromString("12/01/2008"); |
| 1483 | + * dtm.toString(); |
| 1484 | + * @result 'Sat Jan 12 2008 00:00:00' // (where Date.format == 'dd/mm/yyyy' |
| 1485 | + * |
| 1486 | + * @name fromString |
| 1487 | + * @type Date |
| 1488 | + * @cat Plugins/Methods/Date |
| 1489 | + * @author Kelvin Luck |
| 1490 | + */ |
| 1491 | + Date.fromString = function(s) |
| 1492 | + { |
| 1493 | + var f = Date.format; |
| 1494 | + var d = new Date('01/01/1977'); |
| 1495 | + var iY = f.indexOf('yyyy'); |
| 1496 | + if (iY > -1) { |
| 1497 | + d.setFullYear(Number(s.substr(iY, 4))); |
| 1498 | + } else { |
| 1499 | + // TODO - this doesn't work very well - are there any rules for what is meant by a two digit year? |
| 1500 | + d.setFullYear(Number(Date.fullYearStart + s.substr(f.indexOf('yy'), 2))); |
| 1501 | + } |
| 1502 | + var iM = f.indexOf('mmm'); |
| 1503 | + if (iM > -1) { |
| 1504 | + var mStr = s.substr(iM, 3); |
| 1505 | + for (var i=0; i<Date.abbrMonthNames.length; i++) { |
| 1506 | + if (Date.abbrMonthNames[i] == mStr) break; |
| 1507 | + } |
| 1508 | + d.setMonth(i); |
| 1509 | + } else { |
| 1510 | + d.setMonth(Number(s.substr(f.indexOf('mm'), 2)) - 1); |
| 1511 | + } |
| 1512 | + d.setDate(Number(s.substr(f.indexOf('dd'), 2))); |
| 1513 | + if (isNaN(d.getTime())) { |
| 1514 | + return false; |
| 1515 | + } |
| 1516 | + return d; |
| 1517 | + }; |
| 1518 | + |
| 1519 | + // utility method |
| 1520 | + var _zeroPad = function(num) { |
| 1521 | + var s = '0'+num; |
| 1522 | + return s.substring(s.length-2) |
| 1523 | + //return ('0'+num).substring(-2); // doesn't work on IE :( |
| 1524 | + }; |
| 1525 | + |
| 1526 | +})(); |
Index: branches/new-upload/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js |
— | — | @@ -630,7 +630,60 @@ |
631 | 631 | if(typeof mv_lock_vid_updates == 'undefined') |
632 | 632 | mv_lock_vid_updates= false; |
633 | 633 | |
634 | | -function add_adjust_hooks( mvd_id, adj_callback ){ |
| 634 | +function add_adjust_hooks(mvd_id, adj_callback){ |
| 635 | + /*myClipEdit = new mvClipEdit({ |
| 636 | + 'control_ct': '#mvd_form_'+mvd_id |
| 637 | + }); |
| 638 | + $j('#mvd_form_'+mvd_id).html( |
| 639 | + mvClipEdit.getSetInOutHtml({ |
| 640 | + 'start_ntp' : $j('#mv_start_hr_' + mvd_id).val(), |
| 641 | + 'end_ntp' : $j('#mv_end_hr_' + mvd_id).val() |
| 642 | + }) |
| 643 | + ); |
| 644 | + mvClipEdit.setInOutBindings();*/ |
| 645 | + |
| 646 | + var start_sec = npt2seconds($j('#mv_start_hr_' + mvd_id).val() ); |
| 647 | + var end_sec = npt2seconds($j('#mv_end_hr_' + mvd_id).val() ); |
| 648 | + |
| 649 | + //if we don't have 0 as start then assume we are in a range request and give some buffer area: |
| 650 | + var min_slider = (start_sec - 60 < 0 ) ? 0 : start_sec - 60; |
| 651 | + if(min_slider!=0){ |
| 652 | + var max_slider = end_sec+60; |
| 653 | + }else{ |
| 654 | + max_slider = end_sec; |
| 655 | + } |
| 656 | + //pre-destroy just in case: |
| 657 | + $j('#mvd_form_' + mvd_id + ' .inOutSlider').slider( 'destroy' ).slider({ |
| 658 | + range: true, |
| 659 | + min: min_slider, |
| 660 | + max: max_slider, |
| 661 | + values: [start_sec, end_sec], |
| 662 | + slide: function(event, ui) { |
| 663 | + js_log(" vals:"+ seconds2npt( ui.values[0] ) + ' : ' + seconds2npt( ui.values[1]) ); |
| 664 | + $j('#mv_start_hr_' + mvd_id).val( seconds2npt( ui.values[0] ) ); |
| 665 | + $j('#mv_end_hr_' + mvd_id).val( seconds2npt( ui.values[1] ) ); |
| 666 | + }, |
| 667 | + change:function(event, ui){ |
| 668 | + do_video_time_update( seconds2npt( ui.values[0]), seconds2npt( ui.values[1] ) ); |
| 669 | + } |
| 670 | + }); |
| 671 | + $j('.mv_adj_hr').change(function(){ |
| 672 | + //preserve track duration for nav and seq: |
| 673 | + //ie seems to crash so no interface updates for IE for the time being |
| 674 | + if(!$j.browser.msie){ |
| 675 | + if(mvd_id=='nav'||mvd_id=='seq'){ |
| 676 | + add_adjust_hooks(mvd_id); // (no adj_callback) |
| 677 | + }else{ |
| 678 | + add_adjust_hooks(mvd_id) |
| 679 | + } |
| 680 | + } |
| 681 | + //update the video time for onChange |
| 682 | + do_video_time_update( $j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); |
| 683 | + }); |
| 684 | + |
| 685 | +} |
| 686 | + |
| 687 | +/*function add_adjust_hooks( mvd_id, adj_callback ){ |
635 | 688 | js_log('add_adjust_hooks: ' + mvd_id ); |
636 | 689 | //if options are unset populate functions: |
637 | 690 | //add mouse over end time frame highlight |
— | — | @@ -752,7 +805,7 @@ |
753 | 806 | $j('#container_track_'+mvd_id).width() - |
754 | 807 | $j('#resize_'+mvd_id).position().left |
755 | 808 | ); |
756 | | - }*/ |
| 809 | + } |
757 | 810 | //js_log("updated maxWidth: " + ui.options.maxWidth); |
758 | 811 | //js_log('grabbed: ' + e.explicitOriginalTarget.id); |
759 | 812 | //console.log('start ', ui); |
— | — | @@ -812,9 +865,9 @@ |
813 | 866 | $j('#mv_start_hr_'+mvd_id).val( seconds2npt(base_offset + (track_dur *($j('#resize_'+mvd_id).position().left / |
814 | 867 | $j('#container_track_'+mvd_id).width()) ) )); |
815 | 868 | } |
816 | | -} |
| 869 | +}*/ |
817 | 870 | function do_video_time_update(start_time, end_time, mvd_id) { |
818 | | - js_log('do_video_time_update: ' +start_time + end_time); |
| 871 | + js_log('do_video_time_update: ' +start_time +' '+ end_time); |
819 | 872 | |
820 | 873 | if(mv_lock_vid_updates==false){ |
821 | 874 | //update the vid title: |
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js |
— | — | @@ -588,7 +588,7 @@ |
589 | 589 | if( !npt2seconds(end_ntp) ) |
590 | 590 | end_ntp = this.end_ntp; |
591 | 591 | |
592 | | - this.src = getURLParamReplace(this.src, { 't': start_ntp + end_ntp } ); |
| 592 | + this.src = getURLParamReplace(this.src, { 't': start_ntp +'/'+ end_ntp } ); |
593 | 593 | |
594 | 594 | //update the duration |
595 | 595 | this.parseURLDuration(); |
— | — | @@ -800,7 +800,7 @@ |
801 | 801 | js_log('f:autoSelectSource:'); |
802 | 802 | //@@todo read user preference for source |
803 | 803 | // Select the default source |
804 | | - var playable_sources = this.getPlayableSources(); |
| 804 | + var playable_sources = this.getPlayableSources(); |
805 | 805 | var flash_flag=ogg_flag=false; |
806 | 806 | //debugger; |
807 | 807 | for(var source=0; source < playable_sources.length; source++){ |
— | — | @@ -817,20 +817,19 @@ |
818 | 818 | return true; |
819 | 819 | } |
820 | 820 | } |
821 | | - //set Ogg via player support |
| 821 | + //set Ogg via player support |
822 | 822 | for(var source=0; source < playable_sources.length; source++){ |
823 | 823 | js_log('f:autoSelectSource:' + playable_sources[source].mime_type); |
824 | | - var mime_type =playable_sources[source].mime_type; |
| 824 | + var mime_type =playable_sources[source].mime_type; |
825 | 825 | //set source via player |
826 | | - if(mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex' || mime_type=='application/ogg'){ |
827 | | - for(var i in embedTypes.players){ //for in loop on object oky |
828 | | - var player = embedTypes.players[i]; |
829 | | - //debugger; |
| 826 | + if(mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex' || mime_type=='application/ogg'){ |
| 827 | + for(var i=0; i < embedTypes.players.players.length; i++){ //for in loop on object oky |
| 828 | + var player = embedTypes.players.players[i]; |
830 | 829 | if(player.library=='vlc' || player.library=='native'){ |
831 | | - js_log('set via ogg via order') |
| 830 | + js_log('set via ogg via order'); |
832 | 831 | this.selected_source = playable_sources[source]; |
833 | 832 | return true; |
834 | | - } |
| 833 | + } |
835 | 834 | } |
836 | 835 | } |
837 | 836 | } |
— | — | @@ -838,7 +837,7 @@ |
839 | 838 | for(var source=0; source < playable_sources.length; source++){ |
840 | 839 | var mime_type =playable_sources[source].mime_type; |
841 | 840 | if( mime_type=='video/h264' ){ |
842 | | - js_log('set via by player preference h264 flash') |
| 841 | + js_log('set via playable_sources preference h264 flash') |
843 | 842 | this.selected_source = playable_sources[source]; |
844 | 843 | return true; |
845 | 844 | } |
— | — | @@ -851,8 +850,7 @@ |
852 | 851 | this.selected_source = playable_sources[source]; |
853 | 852 | return true; |
854 | 853 | } |
855 | | - } |
856 | | - |
| 854 | + } |
857 | 855 | //select first source |
858 | 856 | if (!this.selected_source) |
859 | 857 | { |
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/nativeEmbed.js |
— | — | @@ -30,32 +30,37 @@ |
31 | 31 | 'id="' + this.pid + '" ' + |
32 | 32 | 'style="width:' + this.width+'px;height:' + this.height + 'px;" ' + |
33 | 33 | 'width="' + this.width + '" height="'+this.height+'" '+ |
34 | | - 'src="' + this.getSrc() + '" '; |
| 34 | + 'src="' + this.getSrc() + '" >'; |
35 | 35 | |
36 | | - if(!this.onlyLoadFlag) |
37 | | - eb+='autoplay="true" '; |
| 36 | + /*if(!this.onlyLoadFlag) |
| 37 | + eb+='autoplay="true" ';*/ |
38 | 38 | |
39 | 39 | //continue with the other attr: |
40 | | - eb+= 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' + |
| 40 | + /*eb+= 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' + |
41 | 41 | 'onloadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' + |
42 | 42 | 'loadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' + |
43 | 43 | 'onprogress="$j(\'#'+this.id+'\').get(0).onprogress( event );return false;" '+ |
44 | | - 'onended="$j(\'#'+this.id+'\').get(0).onended();return false;" >' + |
45 | | - '</video>'; |
| 44 | + 'onended="$j(\'#'+this.id+'\').get(0).onended();return false;" >' +*/ |
| 45 | + eb+='</video>'; |
46 | 46 | return eb; |
47 | 47 | }, |
48 | 48 | //@@todo : loading progress |
49 | 49 | postEmbedJS:function(){ |
| 50 | + var _this = this; |
50 | 51 | js_log("f:native:postEmbedJS:"); |
51 | 52 | this.getVID(); |
| 53 | + var doActualPlay= function(){ |
| 54 | + js_log("doActualPlay "); |
| 55 | + _this.vid.play(); |
| 56 | + } |
52 | 57 | if(typeof this.vid != 'undefined'){ |
53 | 58 | //always load the media: |
54 | 59 | if( this.onlyLoadFlag ){ |
55 | 60 | this.vid.load(); |
56 | | - }else{ |
57 | | - this.vid.play(); |
58 | | - } |
59 | | - |
| 61 | + }else{ |
| 62 | + this.vid.load(); |
| 63 | + setTimeout(doActualPlay, 500); |
| 64 | + } |
60 | 65 | setTimeout('$j(\'#'+this.id+'\').get(0).monitor()',100); |
61 | 66 | }else{ |
62 | 67 | js_log('could not grab vid obj trying again:' + typeof this.vid); |
— | — | @@ -169,7 +174,7 @@ |
170 | 175 | this.getVID(); |
171 | 176 | js_log('f:onloadedmetadata metadata ready (update duration)'); |
172 | 177 | //update duration if not set (for now trust the getDuration more than this.vid.duration |
173 | | - if( this.getDuration()==0 ){ |
| 178 | + if( this.getDuration()==0 && !isNaN( this.vid.duration )){ |
174 | 179 | js_log('updaed duration via native video duration: '+ this.vid.duration) |
175 | 180 | this.duration = this.vid.duration; |
176 | 181 | } |