Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a helper method to determine if a device is JavaScript enabled …

…and one to output the XHTML Mobile 1.0 doctype
  • Loading branch information...
commit a46e0d5ff0a95407bbd8f3437a372ced53d90c9b 1 parent f4b29b2
Brendan G. Lim authored
View
2  README.rdoc
@@ -55,7 +55,7 @@ is making the request.
Supported stylesheet override device extensions at the moment are:
blackberry
- iphone
+ webkit (android,iphone,ipod)
mobileexplorer
nokia
palm
View
2  init.rb
@@ -1,5 +1,7 @@
+require File.dirname(__FILE__) + '/lib/mobile_fu_helper.rb'
require File.dirname(__FILE__) + '/lib/mobilized_styles'
require File.dirname(__FILE__) + '/lib/mobile_fu'
+ActionView::Base.send(:include, MobileFuHelper)
ActionView::Base.send(:include, MobilizedStyles)
ActionView::Base.send(:alias_method_chain, :stylesheet_link_tag, :mobilization)
View
9 lib/mobile_fu_helper.rb
@@ -0,0 +1,9 @@
+module MobileFuHelper
+ def mobile_xhtml_doctype
+ "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">"
+ end
+
+ def js_enabled_mobile_device?
+ is_device?('iphone') || is_device?('mobileexplorer') || is_device?('android')
+ end
+end
View
4 lib/mobilized_styles.rb
@@ -35,8 +35,8 @@ def user_agent_device_name
'mobileexplorer'
elsif ua.index('blackberry')
'blackberry'
- elsif ua.index('iphone') || ua.index('ipod')
- 'iphone'
+ elsif ua.index('iphone') || ua.index('ipod') || ua.index('android')
+ 'webkit'
elsif ua.index('nokia')
'nokia'
elsif ua.index('palm')

0 comments on commit a46e0d5

Please sign in to comment.
Something went wrong with that request. Please try again.