Ticket #1088 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

Installer page should detect Android...

Reported by: justinc Owned by: gpress
Priority: minor Milestone:
Component: seattle clearinghouse Version: 0.1t
Severity: Low Keywords:
Cc: justinc Blocking:
Blocked By:

Description

The installer page should detect android and put this at the top of the screen. In theory, this should be as simple as changing trunk/seattlegeni/website/html/media/scripts to look like this:

$(document).ready(function() {
	detectOs();
});

function detectOs() {
	var os = $.browser.OS();
	switch (os) {
		case "Windows":
			$("#downloads").prepend($("#win"));
			break;
		case "Mac":
			$("#downloads").prepend($("#mac"));
			break;
		case "Linux":
			$("#downloads").prepend($("#linux"));
			break;
		case "Android":
			$("#downloads").prepend($("#android"));
			break;
		default:
			break;
	}
}

However, this doesn't work because jquery doesn't detect Android correctly. When I looked at this by googling around, it seems to detect it as Linux running Safari...

Change History

Changed 7 years ago by justinc

  • cc justinc added

I'll move this to the top of the (unordered) list to help to prevent this from being a problem.

Changed 7 years ago by gpress

Well I use:

if (!(navigator.userAgent.match(/(iphone|ipod|ipad|android|blackberry|windows ce|palm|symbian)/i))) { do stuff}

to disable a function if its a mobile device In the edit_profile.js file and it seems to detect Android fine (I tested it on my phone).

I'll come up with something similar for the installer page.

Changed 7 years ago by gpress

This fixes the problem

$(document).ready(function() {
	detectOs();
});

function detectOs() {
  var os;
  if ((navigator.userAgent.match(/(android)/i))) {
    os = "Android";
  } else {
      os = $.browser.OS();
    }
  switch (os) {
	case "Windows":
		$("#downloads").prepend($("#win"));
		break;
	case "Mac":
		$("#downloads").prepend($("#mac"));
		break;
	case "Linux":
		$("#downloads").prepend($("#linux"));
		break;
        case "Android":
                $("#downloads").prepend($("#android"));
                break;
	default:
		break;
	}
}

Changed 7 years ago by gpress

  • status changed from new to closed
  • resolution set to fixed

fixed in r5696

Note: See TracTickets for help on using tickets.