Rev 153 | Rev 159 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 153 | Rev 158 | ||
---|---|---|---|
Line 368... | Line 368... | ||
368 | <div class="analysis"> |
368 | <div class="analysis"> |
369 | <table> |
369 | <table> |
370 | <tr> |
370 | <tr> |
371 | <th><?php echo tr('Display'); ?>:</th> |
371 | <th><?php echo tr('Display'); ?>:</th> |
372 | <td><script type="text/javascript"> |
372 | <td><script type="text/javascript"> |
- | 373 | var _addEventListener = jsx.dom.addEventListener; |
|
373 | var runAsync = jsx.dom.timeout.runAsync; |
374 | var _runAsync = jsx.dom.timeout.runAsync; |
374 | var ID_SCREEN_DIM = 'screenDim'; |
375 | var ID_SCREEN_DIM = 'screenDim'; |
375 | var ID_AVAIL_DIM = 'availDim'; |
376 | var ID_AVAIL_DIM = 'availDim'; |
376 | var ID_INNER_DIM = 'innerDim'; |
377 | var ID_INNER_DIM = 'innerDim'; |
- | 378 | var TEXT_NOT_AVAILABLE = "<?php echo tr('N/A'); ?>"; |
|
377 | 379 | ||
378 | var dim = (function () { |
380 | var dim = (function () { |
379 | var screenInfo = jsx.dom.window.screenInfo; |
381 | var screenInfo = jsx.dom.window.screenInfo; |
380 | 382 | ||
381 | return { |
383 | return { |
Line 402... | Line 404... | ||
402 | } |
404 | } |
403 | }; |
405 | }; |
404 | }()); |
406 | }()); |
405 | 407 | ||
406 | (function () { |
408 | (function () { |
407 | - | ||
408 | var screenDimText = dim.getScreenText(); |
409 | var screenDimText = dim.getScreenText(); |
409 | var availDimText = dim.getAvailText(); |
410 | var availDimText = dim.getAvailText(); |
410 | var innerDimText = dim.getInnerText(); |
411 | var innerDimText = dim.getInnerText(); |
411 | var colorDepthText = dim.getColorDepthText(); |
412 | var colorDepthText = dim.getColorDepthText(); |
412 | var displayInfo = (screenDimText || availDimText || innerDimText || colorDepthText) |
413 | var displayInfo = (screenDimText || availDimText || innerDimText || colorDepthText) |
413 | ? (screenDimText ? '<span id="' + ID_SCREEN_DIM + '">' + screenDimText + '<\/span> <?php echo tr('pixels'); ?>' : "") |
414 | ? (screenDimText ? '<span id="' + ID_SCREEN_DIM + '">' + screenDimText + '<\/span> <?php echo tr('pixels'); ?>' : "") |
414 | + (availDimText ? ' (<span id="' + ID_AVAIL_DIM + '">' + availDimText + "<\/span>" : "") |
415 | + (availDimText ? ' (<span id="' + ID_AVAIL_DIM + '">' + availDimText + "<\/span>" : "") |
415 | + (innerDimText ? '<span id="' + ID_INNER_DIM + '">' + innerDimText + "<\/span>)" : "") |
416 | + (innerDimText ? '<span id="' + ID_INNER_DIM + '">' + innerDimText + "<\/span>)" : "") |
416 | + (colorDepthText ? ' × <span id="colorDepth">' + colorDepthText + "<\/span>" : "") |
417 | + (colorDepthText ? ' × <span id="colorDepth">' + colorDepthText + "<\/span>" : "") |
417 | : "<?php echo tr('N/A'); ?>"; |
418 | : TEXT_NOT_AVAILABLE; |
418 | 419 | ||
419 | /* FIXME: Convert HTML to text, update whole title text */ |
420 | /* FIXME: Convert HTML to text, update whole title text */ |
420 | document.write('<span>' + displayInfo + '<\/span>'); |
421 | document.write('<span>' + displayInfo + '<\/span>'); |
421 | 422 | ||
422 | var oColorDepth; |
423 | var oColorDepth; |
423 | runAsync(function () { |
424 | var tColor = _runAsync(function () { |
424 | if (typeof oColorDepth == "undefined") |
425 | if (typeof oColorDepth == "undefined") |
425 | { |
426 | { |
426 | oColorDepth = document.getElementById("colorDepth"); |
427 | oColorDepth = document.getElementById("colorDepth"); |
427 | } |
428 | } |
428 | 429 | ||
429 | if (oColorDepth) |
430 | if (oColorDepth) |
430 | { |
431 | { |
431 | var colorDepthText = dim.getColorDepthText(); |
432 | var colorDepthText = dim.getColorDepthText(); |
432 | /* FIXME: Also update title attribute value */ |
433 | <?php /* FIXME: Also update title attribute value */ ?> |
433 | if (oColorDepth.innerHTML != colorDepthText) |
434 | if (oColorDepth.innerHTML != colorDepthText) |
434 | { |
435 | { |
435 | oColorDepth.innerHTML = colorDepthText; |
436 | oColorDepth.innerHTML = colorDepthText; |
436 | } |
437 | } |
437 | } |
438 | } |
438 | 439 | ||
439 | this.run(); |
440 | tColor = this.run(); |
440 | }, 1000); |
441 | }, 1000); |
- | 442 | ||
- | 443 | _addEventListener(document, "unload", function () { |
|
- | 444 | tColor.unset(); |
|
- | 445 | tColor = null; |
|
- | 446 | }); |
|
441 | }()); |
447 | }()); |
442 | </script><noscript><?php echo tr('N/A'); ?></noscript></td> |
448 | </script><noscript><?php echo tr('N/A'); ?></noscript></td> |
443 | </tr> |
449 | </tr> |
444 | <tr> |
450 | <tr> |
445 | <th><?php echo tr('User Agent'); ?>:</th> |
451 | <th><?php echo tr('User Agent'); ?>:</th> |
Line 447... | Line 453... | ||
447 | (function () { |
453 | (function () { |
448 | var ua = navigator.userAgent; |
454 | var ua = navigator.userAgent; |
449 | document.write('<span id="ua" title="' + ua + '">' + ua + '<\/span>'); |
455 | document.write('<span id="ua" title="' + ua + '">' + ua + '<\/span>'); |
450 | 456 | ||
451 | var oUA; |
457 | var oUA; |
452 | runAsync(function () { |
458 | var tUA = _runAsync(function () { |
453 | if (typeof oUA == "undefined") |
459 | if (typeof oUA == "undefined") |
454 | { |
460 | { |
455 | oUA = document.getElementById("ua"); |
461 | oUA = document.getElementById("ua"); |
456 | } |
462 | } |
457 | 463 | ||
Line 462... | Line 468... | ||
462 | if (oUA.innerHTML != ua) |
468 | if (oUA.innerHTML != ua) |
463 | { |
469 | { |
464 | oUA.innerHTML = ua; |
470 | oUA.innerHTML = ua; |
465 | } |
471 | } |
466 | 472 | ||
467 | /* Converts CREs */ |
473 | <?php /* Converts CREs */ ?> |
468 | var oUAhtml = oUA.innerHTML |
474 | var oUAhtml = oUA.innerHTML |
469 | if (oUA.title != oUAhtml) |
475 | if (oUA.title != oUAhtml) |
470 | { |
476 | { |
471 | oUA.title = oUAhtml; |
477 | oUA.title = oUAhtml; |
472 | } |
478 | } |
473 | } |
479 | } |
474 | 480 | ||
475 | this.run(); |
481 | tUA = this.run(); |
476 | }, 1000); |
482 | }, 1000); |
- | 483 | ||
- | 484 | _addEventListener(document, "unload", function () { |
|
- | 485 | tUA.unset(); |
|
- | 486 | tUA = null; |
|
- | 487 | }); |
|
477 | }()); |
488 | }()); |
478 | </script><noscript><?php echo tr('N/A'); ?></noscript></td> |
489 | </script><noscript><?php echo tr('N/A'); ?></noscript></td> |
479 | </tr> |
490 | </tr> |
480 | <tr> |
491 | <tr> |
481 | <th><?php echo tr('Features'); ?>:</th> |
492 | <th><?php echo tr('Features'); ?>:</th> |
482 | <td><script type="text/javascript"> |
493 | <td><script type="text/javascript"> |
483 | var fullscreen = jsx.dom.window.fullscreen; |
494 | var fullscreen = jsx.dom.window.fullscreen; |
484 | 495 | ||
- | 496 | jsx.dom.geolocation = { |
|
- | 497 | getText: function (position) { |
|
- | 498 | var coords = position.coords; |
|
- | 499 | var latitude = coords.latitude; |
|
- | 500 | var longitude = coords.longitude; |
|
- | 501 | var altitude = coords.altitude; |
|
- | 502 | var altitudeAccuracy = coords.altitudeAccuracy; |
|
- | 503 | var speed = coords.speed; |
|
- | 504 | var heading = coords.heading; |
|
- | 505 | ||
- | 506 | return [ |
|
- | 507 | "<?php echo tr('Latitude:'); ?> " + (latitude != null ? latitude + "°" : TEXT_NOT_AVAILABLE), |
|
- | 508 | "<?php echo tr('Longitude:'); ?> " + (longitude != null ? longitude + "°" : TEXT_NOT_AVAILABLE), |
|
- | 509 | "<?php echo tr('Lat/Lng Accuracy:'); ?> " + coords.accuracy + " m", |
|
- | 510 | "<?php echo tr('Altitude:'); ?> " + (altitude != null ? altitude + " m": TEXT_NOT_AVAILABLE), |
|
- | 511 | "<?php echo tr('Alt. Accuracy:'); ?> " + (altitudeAccuracy != null ? altitudeAccuracy + " m": TEXT_NOT_AVAILABLE), |
|
- | 512 | "<?php echo tr('Speed:'); ?> " + (speed != null && !isNaN(speed) ? speed + " m∕s": TEXT_NOT_AVAILABLE), |
|
- | 513 | "<?php echo tr('Heading:'); ?> " + (heading != null && !isNaN(heading) ? heading + "°" : TEXT_NOT_AVAILABLE) |
|
- | 514 | ].join("\n"); |
|
- | 515 | }, |
|
- | 516 | ||
- | 517 | show: function (position) { |
|
- | 518 | window.alert("<?php echo tr('Your current coordinates on Terra'); ?>\n\n" + this.getText(position)); |
|
- | 519 | } |
|
- | 520 | }; |
|
- | 521 | ||
485 | (function () { |
522 | (function () { |
486 | function getFeatures () |
523 | function getFeatures () |
487 | { |
524 | { |
488 | var features = []; |
525 | var features = []; |
489 | if (typeof document.cookie != "undefined") |
526 | if (typeof document.cookie != "undefined") |
Line 491... | Line 528... | ||
491 | var cookiesText = "<?php echo tr('Cookies'); ?>" |
528 | var cookiesText = "<?php echo tr('Cookies'); ?>" |
492 | if (navigator.cookieEnabled) |
529 | if (navigator.cookieEnabled) |
493 | { |
530 | { |
494 | if (document.cookie) |
531 | if (document.cookie) |
495 | { |
532 | { |
- | 533 | var cookies = document.cookie; |
|
- | 534 | cookies = cookies.split(/\s*;\s*/); |
|
496 | features.push(cookiesText); |
535 | features.push('<a href="#" title="' |
- | 536 | + cookies.join(" ") |
|
- | 537 | + '"' |
|
- | 538 | + ' onclick="window.alert(\'<?php echo tr('Cookies for'); ?> ' + document.domain + '\\n\\n' + cookies.join("\\n") + '\'); return false">' + cookiesText + '<\/a>'); |
|
497 | } |
539 | } |
498 | else |
540 | else |
499 | { |
541 | { |
500 | features.push('<span class="unavailable"' |
542 | features.push('<span class="unavailable"' |
501 | + ' title="<?php echo tr('Cookies supported, but no data for this site'); ?>"' |
543 | + ' title="<?php echo tr('Cookies supported, but no data for this site'); ?>"' |
Line 520... | Line 562... | ||
520 | features.push("<?php echo tr('Gamepad'); ?>"); |
562 | features.push("<?php echo tr('Gamepad'); ?>"); |
521 | } |
563 | } |
522 | 564 | ||
523 | if (navigator.geolocation) |
565 | if (navigator.geolocation) |
524 | { |
566 | { |
525 | features.push("<?php echo tr('Geolocation'); ?>"); |
567 | features.push('<a href="#" title="<?php echo tr('Get location'); ?>"' |
- | 568 | + ' onclick="navigator.geolocation.getCurrentPosition(' |
|
- | 569 | + 'function (position) { jsx.dom.geolocation.show(position); }); return false"' |
|
- | 570 | + '><?php echo tr('Geolocation'); ?><\/a>'); |
|
526 | } |
571 | } |
527 | 572 | ||
528 | if (typeof navigator.javaEnabled != "undefined" && navigator.javaEnabled()) |
573 | if (typeof navigator.javaEnabled != "undefined" && navigator.javaEnabled()) |
529 | { |
574 | { |
530 | features.push("Java"); |
575 | features.push("Java"); |
Line 558... | Line 603... | ||
558 | return features.join(" • "); |
603 | return features.join(" • "); |
559 | } |
604 | } |
560 | 605 | ||
561 | function stripTags (s) |
606 | function stripTags (s) |
562 | { |
607 | { |
563 | return s.replace(/<[^>]+>/g, "") |
608 | return s.replace(/<[^>]+>/g, ""); |
564 | } |
609 | } |
565 | 610 | ||
566 | var sFeatures = getFeatures(); |
611 | var sFeatures = getFeatures(); |
567 | document.write('<span id="features" title="' |
612 | document.write('<span id="features" title="' + stripTags(sFeatures) + '">' + sFeatures + '<\/span>'); |
568 | + stripTags(sFeatures) + '">' + sFeatures |
- | |
569 | + '<\/span>'); |
- | |
570 | 613 | ||
571 | var oFeatures; |
614 | var oFeatures; |
572 | var oFeaturesHtml; |
615 | var oFeaturesHtml; |
573 | var tFeatures = runAsync(function () { |
616 | var tFeatures = _runAsync(function () { |
574 | if (typeof oFeatures == "undefined") |
617 | if (typeof oFeatures == "undefined") |
575 | { |
618 | { |
576 | oFeatures = document.getElementById("features"); |
619 | oFeatures = document.getElementById("features"); |
577 | } |
620 | } |
578 | 621 | ||
Line 606... | Line 649... | ||
606 | 649 | ||
607 | tFeatures = this.run(); |
650 | tFeatures = this.run(); |
608 | }, 1000); |
651 | }, 1000); |
609 | }()); |
652 | }()); |
610 | 653 | ||
- | 654 | _addEventListener(document, "unload", function () { |
|
- | 655 | tFeatures.unset(); |
|
- | 656 | tFeatures = null; |
|
- | 657 | }); |
|
- | 658 | ||
611 | var windowText = "<?php echo tr("Window"); ?>"; |
659 | var windowText = "<?php echo tr("Window"); ?>"; |
612 | </script><noscript><?php echo tr('N/A'); ?></noscript></td> |
660 | </script><noscript><?php echo tr('N/A'); ?></noscript></td> |
613 | </tr> |
661 | </tr> |
614 | </table> |
662 | </table> |
615 | </div> |
663 | </div> |
Line 638... | Line 686... | ||
638 | onkeyup="if (event.keyCode == 13) { this.onclick(); }" |
686 | onkeyup="if (event.keyCode == 13) { this.onclick(); }" |
639 | ><span class="text"><script type="text/javascript"> |
687 | ><span class="text"><script type="text/javascript"> |
640 | var cmd3; |
688 | var cmd3; |
641 | if (fullscreen.isSupportedBy(document.documentElement)) |
689 | if (fullscreen.isSupportedBy(document.documentElement)) |
642 | { |
690 | { |
643 | jsx.dom.addEventListener(window, "load", function () { |
691 | _addEventListener(window, "load", function () { |
644 | if (typeof cmd3 == "undefined") |
692 | if (typeof cmd3 == "undefined") |
645 | { |
693 | { |
646 | cmd3 = jsx.dom.getElementById("cmd3"); |
694 | cmd3 = jsx.dom.getElementById("cmd3"); |
647 | } |
695 | } |
648 | 696 | ||
Line 661... | Line 709... | ||
661 | var oInnerDim; |
709 | var oInnerDim; |
662 | var _gEBI = jsx.dom.getElementById; |
710 | var _gEBI = jsx.dom.getElementById; |
663 | var previousIsFullscreen; |
711 | var previousIsFullscreen; |
664 | var oldHandler; |
712 | var oldHandler; |
665 | 713 | ||
666 | jsx.dom.addEventListener(window, "resize", function () { |
714 | _addEventListener(window, "resize", function () { |
667 | /* FIXME: Also update title attribute value */ |
715 | <?php /* FIXME: Also update title attribute value */ ?> |
668 | if (typeof oScreenDim == "undefined") oScreenDim = _gEBI(ID_SCREEN_DIM); |
716 | if (typeof oScreenDim == "undefined") oScreenDim = _gEBI(ID_SCREEN_DIM); |
669 | if (oScreenDim) oScreenDim.innerHTML = dim.getScreenText(); |
717 | if (oScreenDim) oScreenDim.innerHTML = dim.getScreenText(); |
670 | 718 | ||
671 | if (typeof oAvailDim == "undefined") oAvailDim = _gEBI(ID_AVAIL_DIM); |
719 | if (typeof oAvailDim == "undefined") oAvailDim = _gEBI(ID_AVAIL_DIM); |
672 | if (oAvailDim) oAvailDim.innerHTML = dim.getAvailText(); |
720 | if (oAvailDim) oAvailDim.innerHTML = dim.getAvailText(); |
Line 734... | Line 782... | ||
734 | </div> |
782 | </div> |
735 | </div> |
783 | </div> |
736 | </div> |
784 | </div> |
737 | </div> |
785 | </div> |
738 | </body> |
786 | </body> |
739 | </html> |
787 | </html> |
740 | 788 |