From b8079779b5e85dae2d259516231d863dea90d663 Mon Sep 17 00:00:00 2001 From: Mohd Zaid Date: Sat, 11 Feb 2012 19:50:01 +0800 Subject: [PATCH] merge set mobile format --- .DS_Store | Bin 0 -> 6148 bytes lib/.DS_Store | Bin 0 -> 6148 bytes lib/mobile-fu.rb | 21 ++++++++++++--------- lib/mobile-fu/.DS_Store | Bin 0 -> 6148 bytes 4 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 .DS_Store create mode 100644 lib/.DS_Store create mode 100644 lib/mobile-fu/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9524ba092aaa5b8496ea6b2442aafc3acfe03556 GIT binary patch literal 6148 zcmeHK%Wl&^6g|@fYEwXAfz%xq>rkaFs35TjAyylSmq?^82m-rK8w(41?0Qy;x+d03h$76f7637NkfjxrJ+lIG*`w5SS7QE zV;mwzf?g}hv&H>O>=HRK!b_}k$)bz-oGoBj;bb^4Gye_;Njx0YYJbE^seJ49s^hxO z-R^#T5~Y(yIzEYppW6L&(vG8E7@U4q@hBLLhmGJ=jeH13eU7NOlcovdu3_)T(Ww8W zvOb+|Zau4dTQ9a}Rd2epQ>%JUx1Y~uuH(3sU(UnF8!z`d!P)Hlk4%*b!KF^wJ%bnU zlffF^qJ<8ga2ae-R-dA_;TLaR$$6HO^8uwy5o$4+dx$YMaHJ$2Vn947UO`Emzk-90 z2=I-}s~^cZYs>Rp@_jz?ChPS%*D<2v464Szxf;v3zLGreLJf;cuYma@J8Mf{sV&ed zU=_G&1?2kR(IwUmW*XJf!A2bch-G#wV=O-yWR7RBZZOlx5t`7cM4c+k5ku&7_Irj` zH<)SE=@4pWUdPNV%n3!P+1c+YIz(NgZLI=UfuaH>{j(zXfB*XPe=*7avIAwDQTbwVO*$h1si;*OCv=I7AR4$WqfemivCSc z{hR)d`*wC6TM{c}Zk6j4HJ-!Hq2(k#NL*&0LWAyh4wuv;sl+2qbu{EF_< zWRf=;zg20k{OtJ)&-cB`aFE=_*{q#SZ{x|Q-YA>(lK3hL$Di5H!+bhvhhrZ380I64 zu;0(J6#md<50W?^eW@PI=gpHhHGOj4TGaIX?5t7Kr>(b(h3|QO^{4mxsQ&IlKm5A* z_PyXGlfo8ddFgNkKj2h0DWE!yDe9){M5tHDJzTP^$_0f1VL%wzJqFx?=$LH1uD5QyrRlXAdI2?J@(PRhC2+VEBiFRz11JmP+Bm?#VPO#wi2MjJ4Pu0WCuQId D{J~l( literal 0 HcmV?d00001 diff --git a/lib/mobile-fu.rb b/lib/mobile-fu.rb index 0849c57..6d25917 100644 --- a/lib/mobile-fu.rb +++ b/lib/mobile-fu.rb @@ -31,6 +31,15 @@ class Railtie < Rails::Railtie module ActionController module MobileFu + # These are various strings that can be found in mobile devices. Please feel free + # to add on to this list. + MOBILE_USER_AGENTS = 'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' + + 'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' + + 'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' + + 'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' + + 'webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|' + + 'mobile' + # These are various strings that can be found in tablet devices. Please feel free # to add on to this list. TABLET_USER_AGENTS = 'ipad|android 3.0|xoom|sch-i800|playbook|tablet|kindle' @@ -107,20 +116,14 @@ def force_tablet_format end # Determines the request format based on whether the device is mobile or if - # the user has opted to use either the 'Standard' view or 'Mobile' view. + # the user has opted to use either the 'Standard' view or 'Mobile' view or + # 'Tablet' view. def set_mobile_format if !mobile_exempt? && is_mobile_device? && !request.xhr? request.format = session[:mobile_view] == false ? :html : :mobile session[:mobile_view] = true if session[:mobile_view].nil? - end - end - - # Determines the request format based on whether the device is tablet or if - # the user has opted to use either the 'Standard' view or 'Tablet' view. - - def set_tablet_format - if !mobile_exempt? && is_tablet_device? && !request.xhr? + elsif !mobile_exempt? && is_tablet_device? && !request.xhr? request.format = session[:tablet_view] == false ? :html : :tablet session[:tablet_view] = true if session[:tablet_view].nil? end diff --git a/lib/mobile-fu/.DS_Store b/lib/mobile-fu/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..99e4211c90bcebd95aa9b9db3f3a423fc65e9df4 GIT binary patch literal 6148 zcmeHKyH3ME5S)b+0i-A;9rp!D{J|*-MQU0KWQYWkg`*&--SOEl`$!aHXenS<+MT<- z9iKgg_YQz8ULUT2Ie;l$5$_ttrt9h>JBo~=*fZAH;*#F1+EMlQ3FV&P5o@&AFz)%? zebaUgSM}9y=@%bn908|zv)UItp~LfT&qI#PzHp3~Ar(jkQh`(;75MiGuxG1H&m1$R z0;xbMuvb9;4~4E+1A9mNbuj4hUDqdyY8=~Lf>>f+1A9lV(8Q@kr%GHg#OchJsH=g! zqthX_GoKSXOWaVzc4xj=IixyfOa)Sbp#sM~oooNUrvGsNAChvG3Zw#mN&%THZWYq8R|9)Tqcd-GVjcukm$X#iHx&2;e+DQ8 literal 0 HcmV?d00001