Page Index Toggle Pages: 1 ReplyAdd Poll Send Topic
Normal Topic Automatic switching to mobile css (Read 551 times)
 
Paste Member Name in Quick Reply Box Vitaly Smirnov
New Member
*
Offline


I Love YaBB!

Posts: 6
Joined: Jan 10th, 2021
Automatic switching to mobile css
Dec 14th, 2022 at 9:24pm
Mark & QuoteQuote  
Hi!
I found a site with a mobile browser detection code, please have a look codes:
Code (Perl)
Select All
if ($ENV{'HTTP_USER_AGENT'} =~ m/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|f
ennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser
|link)|vodafone|wap|windows ce|xda|xiino/i || substr($ENV{'HTTP_USER_AGENT'}, 0, 4) =~ m/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as
(te|us)|attw|au(di|\-m|r |s |do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|t
a)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|kej
i|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w]ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|60|\-[2-7]l|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v |5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i) {
 	print "defaultmobile.css";
 	exit;
 }
  


Code (Javascript)
Select All
(function(a,b){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|black
berry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser
|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as
(te|us)|attw|au(di|\-m|r |s |do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|t
a)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|kej
i|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w]ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|60|\-[2-7]l|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v |5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g  


Another site suggested using this code to automatically switch from:
Code (HTML)
Select All
<link rel="stylesheet" href="...../yabbfiles/Templates/Forum/default.css" type="text/css" /> 


to:
Code (HTML)
Select All
<link rel="stylesheet" href="...../yabbfiles/Templates/Forum/defaultmobile.css" type="text/css" /> 



Unfortunately, I did not find where you can insert and use this code. As I understand, <yabb style> is connected with the user's choice of theme.

Maybe there is an easy way to apply style switching from default.css to defaultmobile.css  in automatic mode?
  
Back to top
 
IP Logged
 
Paste Member Name in Quick Reply Box Vitaly Smirnov
New Member
*
Offline


I Love YaBB!

Posts: 6
Joined: Jan 10th, 2021
Re: Automatic switching to mobile css
Reply #1 - Jan 26th, 2023 at 1:47pm
Mark & QuoteQuote  
I am making a mobile theme.
Now the main page, the list of sections and the page with posts are ready.
Question. If I add modified files from the Templates/default folder to the Templates/mobile folder, how does the mobile version of the forum open?
  
Back to top
 
IP Logged
 
Paste Member Name in Quick Reply Box Vitaly Smirnov
New Member
*
Offline


I Love YaBB!

Posts: 6
Joined: Jan 10th, 2021
Re: Automatic switching to mobile css
Reply #2 - Jan 26th, 2023 at 2:03pm
Mark & QuoteQuote  
As I see it, the most difficult thing in the mobile version of the forum is typing. The current way of writing a post is not very convenient. You need to tap in the topic field, then in the text field, tap on tags. At the same time, the virtual keyboard constantly pops up.
It would be ideal if, when creating a post, a virtual keyboard with an input field will immediately open as in instant messengers, and a preview will immediately open above. Sending a message on clicking the submit button next to a single-line input field
Dream... Smiley
  
Back to top
 
IP Logged
 
Paste Member Name in Quick Reply Box Vitaly Smirnov
New Member
*
Offline


I Love YaBB!

Posts: 6
Joined: Jan 10th, 2021
Re: Automatic switching to mobile css
Reply #3 - Jan 26th, 2023 at 2:13pm
Mark & QuoteQuote  
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
ReplyAdd Poll Send Topic
Bookmarks: del.icio.us Digg Facebook Google LinkedIn reddit Twitter Yahoo
Automatic switching to mobile css

Please type the characters exactly as they appear in the image,
without the first 2 and last 2 characters.
The characters must be typed in the same order,
and they are case-sensitive.
Open Preview Preview

You can resize the textbox by dragging the right or bottom border.
Off Topic Comment Insert Spoiler
Insert Hyperlink Insert FTP Link Insert Image Insert E-mail Insert Media Insert Table Insert Table Row Insert Table Column Insert Horizontal Rule Insert Teletype Insert Code Insert Quote Edited Superscript Subscript Insert List /me - my name Insert Marquee Insert Timestamp No Parse
Bold Italicized Underline Insert Strikethrough Highlight
                       
Change Text Color
Insert Preformatted Text Left Align Centered Right Align
resize_wb
resize_hb







Max 5000 characters. Remaining characters:
Text size: %
More Smilies
View All Smilies
Collapse additional features Collapse/Expand additional features Smiley Wink Cheesy Grin Angry Sad Shocked Cool Huh Roll Eyes Tongue Embarrassed Lips Sealed Undecided Kiss Cry