From 4aaf32d5b9a6d68f15f055358e02de96842c967f Mon Sep 17 00:00:00 2001 From: Jefferson Souza Date: Sat, 23 Aug 2014 10:18:54 -0300 Subject: [PATCH 1/2] Added new devices for emulation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Renamed the default device to ‘iPhone 5’ - added the Moto X device for emulation --- lib/ionic.coffee | 15 +++++++++++---- stylesheets/ionic.css | 10 +++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/ionic.coffee b/lib/ionic.coffee index 0a663d0..f6121a7 100644 --- a/lib/ionic.coffee +++ b/lib/ionic.coffee @@ -5,12 +5,13 @@ http = require("http") class WebBrowserPreviewView extends ScrollView @content: (params) -> - @iframe outlet: "frame", class: "iphone", src: params.url, sandbox: "none" + @iframe outlet: "frame", class: params.platform, src: params.url, sandbox: "none" getTitle: -> - "Ionic: Preview" + "Ionic: Preview" + @platform initialize: (params) -> me = $(@) @url = params.url + @platform = params.platform @.on 'load', -> $(window).on 'resize', -> height = me[0].parentNode?.scrollHeight @@ -34,7 +35,13 @@ class WebBrowserPreviewView extends ScrollView module.exports = activate: -> - atom.workspaceView.command "ionic:preview", => + me = $(@) + me.platform = 'iphone-5' + atom.workspaceView.command "ionic:preview-iPhone-5", => + me.platform = 'iphone-5' + atom.workspace.open "ionic://localhost:8100", split: "right" + atom.workspaceView.command "ionic:preview-moto-x", => + me.platform = 'moto-x' atom.workspace.open "ionic://localhost:8100", split: "right" atom.workspace.registerOpener (uri) -> @@ -48,7 +55,7 @@ module.exports = uri = url.parse(uri) uri.protocol = "http:" - preview = new WebBrowserPreviewView(url: uri.format()) + preview = new WebBrowserPreviewView(url: uri.format(), platform: me.platform) http.get(uri.format(), -> preview.go() diff --git a/stylesheets/ionic.css b/stylesheets/ionic.css index 33576b9..049cc9a 100644 --- a/stylesheets/ionic.css +++ b/stylesheets/ionic.css @@ -1,7 +1,15 @@ -.iphone { +.iphone-5 { width: 320px; height: 568px; margin: auto; border: none; display: none; } + +.moto-x { + width: 360px; + height: 640px; + margin: auto; + border: none; + display: none; +} From 30edaa8ff5a7445ced063cda72bbe5a6054e52c2 Mon Sep 17 00:00:00 2001 From: Jefferson Souza Date: Sat, 23 Aug 2014 10:25:43 -0300 Subject: [PATCH 2/2] Added iPhone 4 device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added a space caracter on text ‘Ionic: Preview ‘ - Added the iPhone 4 device --- lib/ionic.coffee | 5 ++++- stylesheets/ionic.css | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/ionic.coffee b/lib/ionic.coffee index f6121a7..e76a70e 100644 --- a/lib/ionic.coffee +++ b/lib/ionic.coffee @@ -7,7 +7,7 @@ class WebBrowserPreviewView extends ScrollView @content: (params) -> @iframe outlet: "frame", class: params.platform, src: params.url, sandbox: "none" getTitle: -> - "Ionic: Preview" + @platform + "Ionic: Preview " + @platform initialize: (params) -> me = $(@) @url = params.url @@ -37,6 +37,9 @@ module.exports = activate: -> me = $(@) me.platform = 'iphone-5' + atom.workspaceView.command "ionic:preview-iPhone-4", => + me.platform = 'iphone-4' + atom.workspace.open "ionic://localhost:8100", split: "right" atom.workspaceView.command "ionic:preview-iPhone-5", => me.platform = 'iphone-5' atom.workspace.open "ionic://localhost:8100", split: "right" diff --git a/stylesheets/ionic.css b/stylesheets/ionic.css index 049cc9a..00b8ee0 100644 --- a/stylesheets/ionic.css +++ b/stylesheets/ionic.css @@ -1,3 +1,11 @@ +.iphone-4 { + width: 320px; + height: 480px; + margin: auto; + border: none; + display: none; +} + .iphone-5 { width: 320px; height: 568px;