Показать сообщение отдельно
  #1 (permalink)  
Старый 28.07.2016, 05:43
Новичок на форуме
Отправить личное сообщение для Svyatik95 Посмотреть профиль Найти все сообщения от Svyatik95
 
Регистрация: 18.03.2016
Сообщений: 8

Здравствуйте парни) такой вопрос, можно ли както упростить эту конструкцию?)
if(device.ios() == true){
		document.write("device.ios() === ", "<span class=\"" + device.ios() + "\">" + device.ios() + "</span>", "<br />");
	}else	{
		if(device.portrait() == true){
			document.write("device.portrait() === ", "<span class=\"" + device.portrait() + "\">" + device.portrait() + "</span>", "<br />");
		} else{
			if(device.windows() == true){
				document.write("device.windows() === ", "<span class=\"" + device.windows() + "\">" + device.windows() + "</span>", "<br />");
			}else {
				if(device.blackberry() == true){
					document.write("device.blackberry() === ", "<span class=\"" + device.blackberry() + "\">" + device.blackberry() + "</span>", "<br />");
				}else {
					if(device.iphone() == true){
						  document.write("device.iphone() === ", "<span class=\"" + device.iphone() + "\">" + device.iphone() + "</span>", "<br />");

					}else {
						if(device.ipod() == true){
							  document.write("device.ipod() === ", "<span class=\"" + device.ipod() + "\">" + device.ipod() + "</span>", "<br />");

						}else {
							if(device.ipad() == true){
								  document.write("device.ipad() === ", "<span class=\"" + device.ipad() + "\">" + device.ipad() + "</span>", "<br />");

							}else {
								if(device.android() == true){
									  document.write("device.android() === ", "<span class=\"" + device.android() + "\">" + device.android() + "</span>", "<br />");

								}else {
									if(device.androidPhone() == true){
										  document.write("device.androidPhone() === ", "<span class=\"" + device.androidPhone() + "\">" + device.androidPhone() + "</span>", "<br />");

									}else {
										if(device.androidTablet() == true){
											  document.write("device.androidTablet() === ", "<span class=\"" + device.androidTablet() + "\">" + device.androidTablet() + "</span>", "<br />");

										}else{
											if(device.blackberryPhone() == true){
												  document.write("device.blackberryPhone() === ", "<span class=\"" + device.blackberryPhone() + "\">" + device.blackberryPhone() + "</span>", "<br />");

											}else{
												if(blackberryTablet() == true){
													  document.write("device.blackberryTablet() === ", "<span class=\"" + device.blackberryTablet() + "\">" + device.blackberryTablet() + "</span>", "<br />");

												}else{
													if(device.windowsPhone() == true){
														  document.write("device.windowsPhone() === ", "<span class=\"" + device.windowsPhone() + "\">" + device.windowsPhone() + "</span>", "<br />");

													}else{
														if(device.windowsTablet() == true){
															  document.write("device.windowsTablet() === ", "<span class=\"" + device.windowsTablet() + "\">" + device.windowsTablet() + "</span>", "<br />");

														}else{
															if(device.fxos() == true){
																  document.write("device.fxos() === ", "<span class=\"" + device.fxos() + "\">" + device.fxos() + "</span>", "<br />");

															}else{
																if(device.fxosPhone() == true){
																	  document.write("device.fxosPhone() === ", "<span class=\"" + device.fxosPhone() + "\">" + device.fxosPhone() + "</span>", "<br />");

																}else{
																	if(device.fxosTablet() == true){
																		  document.write("device.fxosTablet() === ", "<span class=\"" + device.fxosTablet() + "\">" + device.fxosTablet() + "</span>", "<br />");

																	}else{
																		if(device.mobile() == true){
																			  document.write("device.mobile() === ", "<span class=\"" + device.mobile() + "\">" + device.mobile() + "</span>", "<br />");

																		}else{
																			if(device.tablet() == true){
																				  document.write("device.tablet() === ", "<span class=\"" + device.tablet() + "\">" + device.tablet() + "</span>", "<br />");

																			}else{
																				if(device.landscape() == true){
																					  document.write("device.landscape() === ", "<span class=\"" + device.landscape() + "\">" + device.landscape() + "</span>", "<br />");

																				}
																			}
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}

если да то то подскажите более красивую конструкцию, пытался через свич но походу что то не то делаю, не работает(
Ответить с цитированием