Skip to content

Commit 351f475

Browse files
committed
Fixes all jasny#46 and bad line breaks
1 parent 0111555 commit 351f475

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

jquery.smartbanner.js

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
this.origHtmlMargin = parseFloat($('html').css('margin-top')); // Get the original margin-top of the HTML element so we can take that into account
99
this.options = $.extend({}, $.smartbanner.defaults, options);
1010

11-
var standalone = navigator.standalone // Check if it's already a standalone web app or running within a webui view of an app (not mobile safari)
12-
, UA = navigator.userAgent;
11+
var standalone = navigator.standalone; // Check if it's already a standalone web app or running within a webui view of an app (not mobile safari)
12+
var UA = navigator.userAgent;
1313

1414
// Detect banner type (iOS or Android)
1515
if (this.options.force) {
1616
this.type = this.options.force;
17-
} else if (UA.match(/Windows Phone 8/i) != null && UA.match(/Touch/i) !== null) {
17+
} else if (UA.match(/Windows Phone 8/i) !== null && UA.match(/Touch/i) !== null) {
1818
this.type = 'windows';
19-
} else if (UA.match(/iPhone|iPod/i) != null || (UA.match(/iPad/) && this.options.iOSUniversalApp)) {
20-
if (UA.match(/Safari/i) != null &&
21-
(UA.match(/CriOS/i) != null ||
19+
} else if (UA.match(/iPhone|iPod/i) !== null || (UA.match(/iPad/) && this.options.iOSUniversalApp)) {
20+
if (UA.match(/Safari/i) !== null &&
21+
(UA.match(/CriOS/i) !== null ||
2222
window.Number(UA.substr(UA.indexOf('OS ') + 3, 3).replace('_', '.')) < 6)) this.type = 'ios'; // Check webview and native smart banner support (iOS 6+)
2323
} else if (UA.match(/\bSilk\/(.*\bMobile Safari\b)?/) || UA.match(/\bKF\w/) || UA.match('Kindle Fire')) {
2424
this.type = 'kindle';
25-
} else if (UA.match(/Android/i) != null) {
25+
} else if (UA.match(/Android/i) !== null) {
2626
this.type = 'android';
2727
}
2828

@@ -39,7 +39,7 @@
3939
var meta = $(this.type == 'android' ? 'meta[name="google-play-app"]' :
4040
this.type == 'ios' ? 'meta[name="apple-itunes-app"]' :
4141
this.type == 'kindle' ? 'meta[name="kindle-fire-app"]' : 'meta[name="msApplication-ID"]');
42-
if (meta.length == 0) return;
42+
if (meta.length === 0) return;
4343

4444
// For Windows Store apps, get the PackageFamilyName for protocol launch
4545
if (this.type == 'windows') {
@@ -68,14 +68,14 @@
6868

6969
SmartBanner.prototype = {
7070

71-
constructor: SmartBanner
71+
constructor: SmartBanner,
7272

73-
, create: function() {
74-
var iconURL
75-
, link=(this.options.url ? this.options.url : (this.type == 'windows' ? 'ms-windows-store:navigate?appid=' : (this.type == 'android' ? 'market://details?id=' : (this.type == 'kindle' ? 'amzn://apps/android?asin=' : 'https://itunes.apple.com/' + this.options.appStoreLanguage + '/app/id'))) + this.appId)
76-
, price = this.price || this.options.price
77-
, inStore=price ? price + ' - ' + (this.type == 'android' ? this.options.inGooglePlay : this.type == 'kindle' ? this.options.inAmazonAppStore : this.type == 'ios' ? this.options.inAppStore : this.options.inWindowsStore) : ''
78-
, gloss=this.options.iconGloss === null ? (this.type=='ios') : this.options.iconGloss;
73+
create: function() {
74+
var iconURL;
75+
var link=(this.options.url ? this.options.url : (this.type == 'windows' ? 'ms-windows-store:navigate?appid=' : (this.type == 'android' ? 'market://details?id=' : (this.type == 'kindle' ? 'amzn://apps/android?asin=' : 'https://itunes.apple.com/' + this.options.appStoreLanguage + '/app/id'))) + this.appId);
76+
var price = this.price || this.options.price;
77+
var inStore=price ? price + ' - ' + (this.type == 'android' ? this.options.inGooglePlay : this.type == 'kindle' ? this.options.inAmazonAppStore : this.type == 'ios' ? this.options.inAppStore : this.options.inWindowsStore) : '';
78+
var gloss=this.options.iconGloss === null ? (this.type=='ios') : this.options.iconGloss;
7979

8080
if (this.type == 'android' && this.options.GooglePlayParams) {
8181
link = link + '&referrer=' + this.options.GooglePlayParams;
@@ -120,14 +120,14 @@
120120
.css('width', $(window).width() / this.scale);
121121
}
122122
$('#smartbanner').css('position', (this.options.layer) ? 'absolute' : 'static');
123-
}
123+
},
124124

125-
, listen: function () {
125+
listen: function () {
126126
$('#smartbanner .sb-close').on('click',$.proxy(this.close, this));
127127
$('#smartbanner .sb-button').on('click',$.proxy(this.install, this));
128-
}
128+
},
129129

130-
, show: function(callback) {
130+
show: function(callback) {
131131
var banner = $('#smartbanner');
132132
banner.stop();
133133

@@ -148,9 +148,9 @@
148148
banner.slideDown(this.options.speedIn).addClass('shown');
149149
}
150150
}
151-
}
151+
},
152152

153-
, hide: function(callback) {
153+
hide: function(callback) {
154154
var banner = $('#smartbanner');
155155
banner.stop();
156156

@@ -171,29 +171,29 @@
171171
banner.slideUp(this.options.speedOut).removeClass('shown');
172172
}
173173
}
174-
}
174+
},
175175

176-
, close: function(e) {
176+
close: function(e) {
177177
e.preventDefault();
178178
this.hide();
179179
this.setCookie('sb-closed','true',this.options.daysHidden);
180-
}
180+
},
181181

182-
, install: function(e) {
182+
install: function(e) {
183183
if (this.options.hideOnInstall) {
184184
this.hide();
185185
}
186186
this.setCookie('sb-installed','true',this.options.daysReminder);
187-
}
187+
},
188188

189-
, setCookie: function(name, value, exdays) {
189+
setCookie: function(name, value, exdays) {
190190
var exdate = new Date();
191191
exdate.setDate(exdate.getDate()+exdays);
192-
value=encodeURI(value)+((exdays==null)?'':'; expires='+exdate.toUTCString());
192+
value=encodeURI(value)+((exdays===null)?'':'; expires='+exdate.toUTCString());
193193
document.cookie=name+'='+value+'; path=/;';
194-
}
194+
},
195195

196-
, getCookie: function(name) {
196+
getCookie: function(name) {
197197
var i,x,y,ARRcookies = document.cookie.split(";");
198198
for(i=0;i<ARRcookies.length;i++) {
199199
x = ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
@@ -204,10 +204,10 @@
204204
}
205205
}
206206
return null;
207-
}
207+
},
208208

209209
// Demo only
210-
, switchType: function() {
210+
switchType: function() {
211211
var that = this;
212212

213213
this.hide(function () {
@@ -223,9 +223,9 @@
223223
};
224224

225225
$.smartbanner = function (option) {
226-
var $window = $(window)
227-
, data = $window.data('smartbanner')
228-
, options = typeof option == 'object' && option;
226+
var $window = $(window);
227+
var data = $window.data('smartbanner');
228+
var options = typeof option == 'object' && option;
229229
if (!data) $window.data('smartbanner', (data = new SmartBanner(options)));
230230
if (typeof option == 'string') data[option]();
231231
};

0 commit comments

Comments
 (0)