Path: blob/main/public/games/files/asteroids/ipad.js
1036 views
var ipad = navigator.userAgent.match(/iPad/i) != null;12if (ipad) {3$(function () {4$('#left-controls, #right-controls').show();5$('body > *').hide();6$('body').css('margin', '0px').css('background', 'black').prepend($('#game-container').remove());7$('#game-container').width(1024).css('margin-top', 26).show();8$('#canvas').attr('width', 1020).attr('height', 660).css('background', 'white').css('margin', '0 1');910$('head').prepend($('<meta/>').attr('name', 'viewport').attr('content', 'width=device-width; height=device-height; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;'));1112$('#left-controls, #right-controls').bind('touchstart touchmove touchend', function (e) {13if (e.type != 'touchend') {14for (k in KEY_STATUS) {15KEY_STATUS[k] = false;16}17}18var touches = e.type == 'touchend' ? e.originalEvent.changedTouches : e.originalEvent.touches19for (var i = 0; i < touches.length; i++) {20var ele = document.elementFromPoint(touches[i].pageX, touches[i].pageY);21KEY_STATUS[ele.id] = (e.type != 'touchend');22}23});2425$(document).bind('touchstart', function (e) {26window.gameStart = true;27});2829$(document).bind('gesturestart gesturechange gestureend touchstart touchmove touchend', function (e) {30e.preventDefault();31});32});33}34353637