SlideShare a Scribd company logo
1 of 13
Welcome to OS mobile JavaScript 
Tuesday September 8th 2014
What is JavaScript? 
 Client-side scripting that allows manipulation of 
the Document Object Model 
 DOM includes 
 CSS includes <link href="style.css/> 
 JS includes <script src="file.js"/> 
 All elements <div><h1>Title</h1></div> 
 All current browsers support it 
 If not disabled
What Mobile Needs 
 1 column layout 
 New navigation 
 Marketing tweaks 
 Fewer lines of JavaScript 
 No Flash media 
 No Mouse events 
 No Modals
Why JavaScript? 
 Fastest way for us to get mobile done 
 Good split of designer & developer time 
 No server configuration 
 No duplicate code or URLs 
 JavaScript already necessary 
 Tools already exist
Broad Overview 
 Check if they need mobile 
 White out the page 
 Reorganize things 
 Remove Desktop JavaScript 
 Alter HTML elements (add/delete/move) 
 Add Mobile CSS and JS 
 Render page
Who is Mobile? 
function useMobileView() { 
var d = document, c = d.cookie; 
if (d.documentElement.classList == undefined) return 0; 
if (c.indexOf("MobileView=") > -1) return (c.indexOf("MobileView=1") > -1); 
return screen.width <= 760; 
} 
 Browsers that support classList 
 Safari 5.1, Android 3, IE10, FF3.6, Chrome 8 
 Users with explicit cookies 
 Screen width of 760px or smaller
Mobify 
 Mobify is a paid service for turning Desktop 
websites mobile with Open Sourced JS 
 We modified the capture.js bit from their /src 
 https://github.com/mobify/mobifyjs 
 Process 
 Hides live DOM (w/ <plaintext 
style=”display:none”>) 
 Creates shadow DOM (w/ callback) 
 Replaces live DOM with shadow DOM (w/ callback)
Why Does it Work? 
 JavaScript is loaded/run as it happens 
 JavaScript doesn't care about the future, only 
the past 
 You can tell JavaScript to run after events 
happen, but that's outside the scope
Our JS Files 
 capture.js from 
Mobify 
 rebuild.js modifies the 
shadow DOM 
 loaded.js registers 
onload of the shadow 
DOM onload event 
 onload/*.js files do 
normal JS things
rebuild.js I 
 Activates Mobile CSS 
<link href="/css/everything.css?eba5c95" rel="mobile-style" 
type="text/css" id="jx_mobileStyles" /> 
Transmutes to 
<link href="/css/everything.css?eba5c95" rel="stylesheet" 
type="text/css" id="jx_mobileStyles" /> 
 Is put at the bottom of the HEAD 
 Overrides previous styles
rebuild.js I Code 
var head = doc.getElementsByTagName("head")[0]; 
// Activate mobile style sheet and place it 
at the bottom of the head 
var style = doc.querySelector("#jx_mobileStyles"); 
style.setAttribute("rel", "stylesheet"); 
head.appendChild(style);
rebuild.js II 
 Removes JavaScript that the Desktop uses 
 Including MooTools and CeraBox 
 Any elements using the class 
“jx_desktopScripting” are removed 
Ex: 
<script type="text/javascript" 
src="/assets/js/mootools.js" 
class="jx_desktopScripting"></script>
rebuild.js II Code 
// Remove our desktop JavaScript 
var 
scripts=doc.getElementsByClassName("jx_desktopScript 
ing"); 
while(scripts.length > 0){ 
destroy(scripts[0]); 
} 
function destroy(node) { 
var parent = node.parentNode; 
if (node && parent) { 
parent.removeChild(node); 
}

More Related Content

What's hot

The 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityThe 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityDirk Ginader
 
[D2 오픈세미나]2.모바일웹디버깅
[D2 오픈세미나]2.모바일웹디버깅[D2 오픈세미나]2.모바일웹디버깅
[D2 오픈세미나]2.모바일웹디버깅NAVER D2
 
Implementation of GUI Framework part3
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3masahiroookubo
 
Vuejs for Angular developers
Vuejs for Angular developersVuejs for Angular developers
Vuejs for Angular developersMikhail Kuznetcov
 
AngularJS - GrapeCity Echo Tokyo
AngularJS - GrapeCity Echo TokyoAngularJS - GrapeCity Echo Tokyo
AngularJS - GrapeCity Echo TokyoChris Bannon
 
A New Vue for Web Development
A New Vue for Web DevelopmentA New Vue for Web Development
A New Vue for Web DevelopmentChad Campbell
 
ARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversGilbert Guerrero
 
Geekspeak: Javascript
Geekspeak: JavascriptGeekspeak: Javascript
Geekspeak: Javascriptlisakennelly
 
jQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisjQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisPablo Garrido
 
JavaScript development methodology
JavaScript development methodologyJavaScript development methodology
JavaScript development methodologyAleksander Fabijan
 
Javascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsJavascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsSoós Gábor
 

What's hot (20)

VueJS: The Simple Revolution
VueJS: The Simple RevolutionVueJS: The Simple Revolution
VueJS: The Simple Revolution
 
Web Workers
Web WorkersWeb Workers
Web Workers
 
Vue js for beginner
Vue js for beginner Vue js for beginner
Vue js for beginner
 
Jquery
JqueryJquery
Jquery
 
Html5 & less css
Html5 & less cssHtml5 & less css
Html5 & less css
 
The 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityThe 5 Layers of Web Accessibility
The 5 Layers of Web Accessibility
 
Jquery
JqueryJquery
Jquery
 
BBUI
BBUIBBUI
BBUI
 
[D2 오픈세미나]2.모바일웹디버깅
[D2 오픈세미나]2.모바일웹디버깅[D2 오픈세미나]2.모바일웹디버깅
[D2 오픈세미나]2.모바일웹디버깅
 
Implementation of GUI Framework part3
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3
 
Vuejs for Angular developers
Vuejs for Angular developersVuejs for Angular developers
Vuejs for Angular developers
 
AngularJS - GrapeCity Echo Tokyo
AngularJS - GrapeCity Echo TokyoAngularJS - GrapeCity Echo Tokyo
AngularJS - GrapeCity Echo Tokyo
 
A New Vue for Web Development
A New Vue for Web DevelopmentA New Vue for Web Development
A New Vue for Web Development
 
Single Page Applications
Single Page ApplicationsSingle Page Applications
Single Page Applications
 
ARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: Rollovers
 
Geekspeak: Javascript
Geekspeak: JavascriptGeekspeak: Javascript
Geekspeak: Javascript
 
jQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveisjQuery Mobile - Desenvolvimento para dispositivos móveis
jQuery Mobile - Desenvolvimento para dispositivos móveis
 
JavaScript development methodology
JavaScript development methodologyJavaScript development methodology
JavaScript development methodology
 
Web design services
Web design servicesWeb design services
Web design services
 
Javascript frameworks: Backbone.js
Javascript frameworks: Backbone.jsJavascript frameworks: Backbone.js
Javascript frameworks: Backbone.js
 

Viewers also liked

Grammatica de pronomine demonstrativo
Grammatica de pronomine demonstrativoGrammatica de pronomine demonstrativo
Grammatica de pronomine demonstrativoÓscar Ramos
 
Dan lehr
Dan lehrDan lehr
Dan lehrdlehr87
 
Resenha espirita on line 107
Resenha espirita on line 107Resenha espirita on line 107
Resenha espirita on line 107MRS
 
Baptista mollie visual resume
Baptista mollie visual resumeBaptista mollie visual resume
Baptista mollie visual resumeMollie Baptista
 
Hongos Micorricico Arbusculares inducen la resistencia contra oomicetes en pa...
Hongos Micorricico Arbusculares inducen la resistencia contra oomicetes en pa...Hongos Micorricico Arbusculares inducen la resistencia contra oomicetes en pa...
Hongos Micorricico Arbusculares inducen la resistencia contra oomicetes en pa...Hernán Patricio Lucero Mosquera
 
Authentic learning presentation1
Authentic learning presentation1Authentic learning presentation1
Authentic learning presentation1missykayt
 
Beautiful Photos 1
Beautiful Photos 1Beautiful Photos 1
Beautiful Photos 1verka 123
 
テスト駆動開発を文化として定着させるために
テスト駆動開発を文化として定着させるためにテスト駆動開発を文化として定着させるために
テスト駆動開発を文化として定着させるためにYudai Tsuyuzaki
 
Zenpowerpoint Welter
Zenpowerpoint WelterZenpowerpoint Welter
Zenpowerpoint Welterdana28
 
2014年11月23日福島勉強会 たまあじさいの会
2014年11月23日福島勉強会 たまあじさいの会2014年11月23日福島勉強会 たまあじさいの会
2014年11月23日福島勉強会 たまあじさいの会コーヒー プリン
 
Presentation1
Presentation1Presentation1
Presentation1thetarnnn
 
Workshop TodoMedia CLIL Mobile
Workshop TodoMedia CLIL MobileWorkshop TodoMedia CLIL Mobile
Workshop TodoMedia CLIL Mobileandycrunch
 

Viewers also liked (20)

Grammatica de pronomine demonstrativo
Grammatica de pronomine demonstrativoGrammatica de pronomine demonstrativo
Grammatica de pronomine demonstrativo
 
Institutions to close
Institutions to closeInstitutions to close
Institutions to close
 
MóDulo 7 2 Parte
MóDulo 7 2 ParteMóDulo 7 2 Parte
MóDulo 7 2 Parte
 
All about Bees
All about BeesAll about Bees
All about Bees
 
Dan lehr
Dan lehrDan lehr
Dan lehr
 
Resenha espirita on line 107
Resenha espirita on line 107Resenha espirita on line 107
Resenha espirita on line 107
 
Baptista mollie visual resume
Baptista mollie visual resumeBaptista mollie visual resume
Baptista mollie visual resume
 
Hongos Micorricico Arbusculares inducen la resistencia contra oomicetes en pa...
Hongos Micorricico Arbusculares inducen la resistencia contra oomicetes en pa...Hongos Micorricico Arbusculares inducen la resistencia contra oomicetes en pa...
Hongos Micorricico Arbusculares inducen la resistencia contra oomicetes en pa...
 
Authentic learning presentation1
Authentic learning presentation1Authentic learning presentation1
Authentic learning presentation1
 
Beautiful Photos 1
Beautiful Photos 1Beautiful Photos 1
Beautiful Photos 1
 
テスト駆動開発を文化として定着させるために
テスト駆動開発を文化として定着させるためにテスト駆動開発を文化として定着させるために
テスト駆動開発を文化として定着させるために
 
Brochure
BrochureBrochure
Brochure
 
Andrea y esther
Andrea y estherAndrea y esther
Andrea y esther
 
Autoexamen 2012
Autoexamen 2012Autoexamen 2012
Autoexamen 2012
 
Zenpowerpoint Welter
Zenpowerpoint WelterZenpowerpoint Welter
Zenpowerpoint Welter
 
2014年11月23日福島勉強会 たまあじさいの会
2014年11月23日福島勉強会 たまあじさいの会2014年11月23日福島勉強会 たまあじさいの会
2014年11月23日福島勉強会 たまあじさいの会
 
Presentation1
Presentation1Presentation1
Presentation1
 
Mi ar
Mi arMi ar
Mi ar
 
Workshop TodoMedia CLIL Mobile
Workshop TodoMedia CLIL MobileWorkshop TodoMedia CLIL Mobile
Workshop TodoMedia CLIL Mobile
 
Das leben
Das lebenDas leben
Das leben
 

Similar to Os mobile

JavaScript Perfomance
JavaScript PerfomanceJavaScript Perfomance
JavaScript PerfomanceAnatol Alizar
 
JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)Steve Souders
 
RESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side ComponentsRESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side ComponentsSven Wolfermann
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...tdc-globalcode
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest servicesIoan Eugen Stan
 
Modern Web Technologies
Modern Web TechnologiesModern Web Technologies
Modern Web TechnologiesPerttu Myry
 
Using RequireJS with CakePHP
Using RequireJS with CakePHPUsing RequireJS with CakePHP
Using RequireJS with CakePHPStephen Young
 
Testable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascriptTestable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascriptTimothy Oxley
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers dssprakash
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX DesignersAshlimarie
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012ghnash
 
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...Chartbeat
 
Yeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsYeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsclimboid
 
HTML5 and Mobile
HTML5 and MobileHTML5 and Mobile
HTML5 and Mobiledoodoofish
 
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfHTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfJAX London
 
Introduction to jQuery Mobile
Introduction to jQuery MobileIntroduction to jQuery Mobile
Introduction to jQuery Mobileejlp12
 

Similar to Os mobile (20)

JavaScript Perfomance
JavaScript PerfomanceJavaScript Perfomance
JavaScript Perfomance
 
JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)JavaScript Performance (at SFJS)
JavaScript Performance (at SFJS)
 
Webpack
Webpack Webpack
Webpack
 
RESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side ComponentsRESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side Components
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
Modern Web Technologies
Modern Web TechnologiesModern Web Technologies
Modern Web Technologies
 
Using RequireJS with CakePHP
Using RequireJS with CakePHPUsing RequireJS with CakePHP
Using RequireJS with CakePHP
 
Testable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascriptTestable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascript
 
Taking your Web App for a walk
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walk
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers
 
JavaScript Basics
JavaScript BasicsJavaScript Basics
JavaScript Basics
 
Fundaments of Knockout js
Fundaments of Knockout jsFundaments of Knockout js
Fundaments of Knockout js
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012
 
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...
Tom Germeau: Mobile Apps: Finding the balance between performance and flexibi...
 
Yeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web appsYeoman AngularJS and D3 - A solid stack for web apps
Yeoman AngularJS and D3 - A solid stack for web apps
 
HTML5 and Mobile
HTML5 and MobileHTML5 and Mobile
HTML5 and Mobile
 
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias WessendorfHTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
 
Introduction to jQuery Mobile
Introduction to jQuery MobileIntroduction to jQuery Mobile
Introduction to jQuery Mobile
 

Os mobile

  • 1. Welcome to OS mobile JavaScript Tuesday September 8th 2014
  • 2. What is JavaScript?  Client-side scripting that allows manipulation of the Document Object Model  DOM includes  CSS includes <link href="style.css/>  JS includes <script src="file.js"/>  All elements <div><h1>Title</h1></div>  All current browsers support it  If not disabled
  • 3. What Mobile Needs  1 column layout  New navigation  Marketing tweaks  Fewer lines of JavaScript  No Flash media  No Mouse events  No Modals
  • 4. Why JavaScript?  Fastest way for us to get mobile done  Good split of designer & developer time  No server configuration  No duplicate code or URLs  JavaScript already necessary  Tools already exist
  • 5. Broad Overview  Check if they need mobile  White out the page  Reorganize things  Remove Desktop JavaScript  Alter HTML elements (add/delete/move)  Add Mobile CSS and JS  Render page
  • 6. Who is Mobile? function useMobileView() { var d = document, c = d.cookie; if (d.documentElement.classList == undefined) return 0; if (c.indexOf("MobileView=") > -1) return (c.indexOf("MobileView=1") > -1); return screen.width <= 760; }  Browsers that support classList  Safari 5.1, Android 3, IE10, FF3.6, Chrome 8  Users with explicit cookies  Screen width of 760px or smaller
  • 7. Mobify  Mobify is a paid service for turning Desktop websites mobile with Open Sourced JS  We modified the capture.js bit from their /src  https://github.com/mobify/mobifyjs  Process  Hides live DOM (w/ <plaintext style=”display:none”>)  Creates shadow DOM (w/ callback)  Replaces live DOM with shadow DOM (w/ callback)
  • 8. Why Does it Work?  JavaScript is loaded/run as it happens  JavaScript doesn't care about the future, only the past  You can tell JavaScript to run after events happen, but that's outside the scope
  • 9. Our JS Files  capture.js from Mobify  rebuild.js modifies the shadow DOM  loaded.js registers onload of the shadow DOM onload event  onload/*.js files do normal JS things
  • 10. rebuild.js I  Activates Mobile CSS <link href="/css/everything.css?eba5c95" rel="mobile-style" type="text/css" id="jx_mobileStyles" /> Transmutes to <link href="/css/everything.css?eba5c95" rel="stylesheet" type="text/css" id="jx_mobileStyles" />  Is put at the bottom of the HEAD  Overrides previous styles
  • 11. rebuild.js I Code var head = doc.getElementsByTagName("head")[0]; // Activate mobile style sheet and place it at the bottom of the head var style = doc.querySelector("#jx_mobileStyles"); style.setAttribute("rel", "stylesheet"); head.appendChild(style);
  • 12. rebuild.js II  Removes JavaScript that the Desktop uses  Including MooTools and CeraBox  Any elements using the class “jx_desktopScripting” are removed Ex: <script type="text/javascript" src="/assets/js/mootools.js" class="jx_desktopScripting"></script>
  • 13. rebuild.js II Code // Remove our desktop JavaScript var scripts=doc.getElementsByClassName("jx_desktopScript ing"); while(scripts.length > 0){ destroy(scripts[0]); } function destroy(node) { var parent = node.parentNode; if (node && parent) { parent.removeChild(node); }