diff options
author | Olivier Paroz <github@oparoz.com> | 2015-04-17 03:29:51 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-04-17 03:29:51 +0300 |
commit | 9fcd30c159e0a7bf4278b75331ef47c38dd45872 (patch) | |
tree | 26bbad3598be2943f521a8fdd162477e9a813b0c | |
parent | 634295f254879c3eb1d89ebcf3662ff089951039 (diff) |
Move compatibility notifications to utility class
-rw-r--r-- | js/app.js | 4 | ||||
-rw-r--r-- | js/gallery.js | 27 | ||||
-rw-r--r-- | js/galleryutility.js | 28 | ||||
-rw-r--r-- | js/galleryview.js | 2 |
4 files changed, 30 insertions, 31 deletions
@@ -10,11 +10,11 @@ $(document).ready(function () { Gallery.ie10AndBelow = navigator.userAgent.indexOf('MSIE') != -1; if (Gallery.ie10AndBelow) { - Gallery.showOldIeWarning(); + Gallery.utility.showIeWarning('old'); Gallery.showEmpty(); } else { if (Gallery.ie11AndAbove) { - Gallery.showModernIeWarning(); + Gallery.utility.showIeWarning('modern'); } // Needed to centre the spinner in some browsers diff --git a/js/gallery.js b/js/gallery.js index b94a01b1..37a928d1 100644 --- a/js/gallery.js +++ b/js/gallery.js @@ -281,33 +281,6 @@ Gallery.showNormal = function () { $('#content').removeClass('icon-loading'); }; -Gallery.recommendedBrowsers = '</br>' + -'<a href="http://www.getfirefox.com"><strong>Mozilla Firefox</strong></a> or ' + -'<a href="https://www.google.com/chrome/"><strong>Google Chrome</strong></a>' + -'</br>'; - -/** - * Shows a warning to users of old, unsupported version of Internet Explorer - */ -Gallery.showOldIeWarning = function () { - var text = '<strong>' + t('gallery', 'Your browser is not supported!') + '</strong></br>' + - t('gallery', 'please install one of the following alternatives') + - Gallery.recommendedBrowsers; - Gallery.utility.showHtmlNotification(text, 60); -}; - -/** - * Shows a warning to users of the latest version of Internet Explorer - */ -Gallery.showModernIeWarning = function () { - var text = '<strong>' + - t('gallery', 'This application may not work properly on your browser.') + '</strong></br>' + - t('gallery', - 'For an improved experience, please install one of the following alternatives') + - Gallery.recommendedBrowsers; - Gallery.utility.showHtmlNotification(text, 15); -}; - /** * Resets the height of the content div so that the spinner can be centred */ diff --git a/js/galleryutility.js b/js/galleryutility.js index 21d2a162..5c391f6e 100644 --- a/js/galleryutility.js +++ b/js/galleryutility.js @@ -1,4 +1,4 @@ -/* global OC, $, Gallery, oc_requesttoken */ +/* global OC, $, t, Gallery, oc_requesttoken */ (function () { /** * Contains utility methods @@ -12,6 +12,32 @@ Utility.prototype = { /** + * Shows a notification to IE users, letting them know that they should use another browser + * in order to get the best experience + * + * @param {string} age + */ + showIeWarning: function (age) { + var line1 = t('gallery', 'This application may not work properly on your browser.'); + var line2 = t('gallery', + 'For an improved experience, please install one of the following alternatives'); + var timeout = 15; + if (age === 'old') { + line1 = t('gallery', 'Your browser is not supported!'); + line2 = t('gallery', 'please install one of the following alternatives') + timeout = 60; + } + + var recommendedBrowsers = '</br>' + + '<a href="http://www.getfirefox.com"><strong>Mozilla Firefox</strong></a> or ' + + '<a href="https://www.google.com/chrome/"><strong>Google Chrome</strong></a>' + + '</br>'; + + var text = '<strong>' + line1 + '</strong></br>' + line2 + recommendedBrowsers; + this.showHtmlNotification(text, timeout); + }, + + /** * Shows a notification at the top of the screen * * @param {string} text diff --git a/js/galleryview.js b/js/galleryview.js index 789b6c6d..0bb61acc 100644 --- a/js/galleryview.js +++ b/js/galleryview.js @@ -1,4 +1,4 @@ -/* global OC, t, oc_requesttoken, $, _, Gallery */ +/* global OC, t, $, _, Gallery */ (function () { /** |