add-to-homescreen-rails 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Add to Homescreen v2.0.
|
2
|
+
* Add to Homescreen v2.0.4 ~ Copyright (c) 2012 Matteo Spinelli, http://cubiq.org
|
3
3
|
* Released under MIT license, http://cubiq.org/license
|
4
4
|
*/
|
5
5
|
var addToHome = (function (w) {
|
@@ -49,6 +49,7 @@ var addToHome = (function (w) {
|
|
49
49
|
fi_fi: 'Asenna tämä web-sovellus laitteeseesi %device: paina %icon ja sen jälkeen valitse <strong>Lisää Koti-valikkoon</strong>.',
|
50
50
|
fr_fr: 'Ajoutez cette application sur votre %device en cliquant sur %icon, puis <strong>Ajouter à l\'écran d\'accueil</strong>.',
|
51
51
|
he_il: '<span dir="rtl">התקן אפליקציה זו על ה-%device שלך: הקש %icon ואז <strong>הוסף למסך הבית</strong>.</span>',
|
52
|
+
hr_hr: 'Instaliraj ovu aplikaciju na svoj %device: klikni na %icon i odaberi <strong>Dodaj u početni zaslon</strong>.',
|
52
53
|
hu_hu: 'Telepítse ezt a web-alkalmazást az Ön %device-jára: nyomjon a %icon-ra majd a <strong>Főképernyőhöz adás</strong> gombra.',
|
53
54
|
it_it: 'Installa questa applicazione sul tuo %device: premi su %icon e poi <strong>Aggiungi a Home</strong>.',
|
54
55
|
ja_jp: 'このウェブアプリをあなたの%deviceにインストールするには%iconをタップして<strong>ホーム画面に追加</strong>を選んでください。',
|
@@ -67,14 +68,14 @@ var addToHome = (function (w) {
|
|
67
68
|
};
|
68
69
|
|
69
70
|
function init () {
|
70
|
-
// Preliminary check,
|
71
|
+
// Preliminary check, all further checks are performed on iDevices only
|
71
72
|
if ( !isIDevice ) return;
|
72
73
|
|
73
74
|
var now = Date.now(),
|
74
75
|
i;
|
75
76
|
|
76
77
|
// Merge local with global options
|
77
|
-
if (w.addToHomeConfig) {
|
78
|
+
if ( w.addToHomeConfig ) {
|
78
79
|
for ( i in w.addToHomeConfig ) {
|
79
80
|
options[i] = w.addToHomeConfig[i];
|
80
81
|
}
|
@@ -161,6 +162,8 @@ var addToHome = (function (w) {
|
|
161
162
|
closeButton = balloon.querySelector('.addToHomeClose');
|
162
163
|
if ( closeButton ) closeButton.addEventListener('click', clicked, false);
|
163
164
|
|
165
|
+
if ( !isIPad && OSVersion > 5 ) window.addEventListener('orientationchange', orientationCheck, false);
|
166
|
+
|
164
167
|
setTimeout(show, options.startDelay);
|
165
168
|
}
|
166
169
|
|
@@ -203,7 +206,7 @@ var addToHome = (function (w) {
|
|
203
206
|
balloon.style.top = startY - balloon.offsetHeight - options.bottomOffset + 'px';
|
204
207
|
} else {
|
205
208
|
balloon.style.left = '50%';
|
206
|
-
balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) + 'px';
|
209
|
+
balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) - ( w.orientation%180 && OSVersion > 5 ? 40 : 0 ) + 'px';
|
207
210
|
balloon.style.bottom = options.bottomOffset + 'px';
|
208
211
|
}
|
209
212
|
|
@@ -250,6 +253,7 @@ var addToHome = (function (w) {
|
|
250
253
|
closeButton = balloon.querySelector('.addToHomeClose');
|
251
254
|
|
252
255
|
if ( closeButton ) closeButton.removeEventListener('click', close, false);
|
256
|
+
if ( !isIPad && OSVersion > 5 ) window.removeEventListener('orientationchange', orientationCheck, false);
|
253
257
|
|
254
258
|
if ( OSVersion < 5 ) {
|
255
259
|
posY = isIPad ? w.scrollY - startY : w.scrollY + w.innerHeight - startY;
|
@@ -331,6 +335,10 @@ var addToHome = (function (w) {
|
|
331
335
|
w.sessionStorage.removeItem('addToHomeSession');
|
332
336
|
}
|
333
337
|
|
338
|
+
function orientationCheck () {
|
339
|
+
balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) - ( w.orientation%180 && OSVersion > 5 ? 40 : 0 ) + 'px';
|
340
|
+
}
|
341
|
+
|
334
342
|
// Bootstrap!
|
335
343
|
init();
|
336
344
|
|
@@ -339,4 +347,4 @@ var addToHome = (function (w) {
|
|
339
347
|
close: close,
|
340
348
|
reset: reset
|
341
349
|
};
|
342
|
-
})(
|
350
|
+
})(window);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: add-to-homescreen-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Provides the 'Add to Home screen' assets for your Rails application.
|
15
15
|
email:
|