diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2011-12-01 10:31:05 +0100 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2011-12-02 18:35:59 +0000 |
commit | fd43a625a212f5d76902cb98f75ead79281a4f5b (patch) | |
tree | d100188ae608bea39acf5d9bdb69552a39f24b5f /install | |
parent | 8956fdbf40fab0259f65144678d1ffcc759771d9 (diff) | |
download | freeipa-fd43a625a212f5d76902cb98f75ead79281a4f5b.tar.gz freeipa-fd43a625a212f5d76902cb98f75ead79281a4f5b.tar.xz freeipa-fd43a625a212f5d76902cb98f75ead79281a4f5b.zip |
Added cross browser support of Array.indexOf method
https://fedorahosted.org/freeipa/ticket/2151
Diffstat (limited to 'install')
-rw-r--r-- | install/ui/Makefile.am | 1 | ||||
-rw-r--r-- | install/ui/browser.js | 61 | ||||
-rw-r--r-- | install/ui/index.html | 1 |
3 files changed, 63 insertions, 0 deletions
diff --git a/install/ui/Makefile.am b/install/ui/Makefile.am index 2ec047c34..2e5b3998e 100644 --- a/install/ui/Makefile.am +++ b/install/ui/Makefile.am @@ -12,6 +12,7 @@ app_DATA = \ add.js \ association.js \ automount.js \ + browser.js \ certificate.js \ details.js \ dialog.js \ diff --git a/install/ui/browser.js b/install/ui/browser.js new file mode 100644 index 000000000..9268d9dc8 --- /dev/null +++ b/install/ui/browser.js @@ -0,0 +1,61 @@ +/* Authors: + * Petr Vobornik <pvoborni@redhat.com> + * + * Copyright (C) 2010 Red Hat + * see file 'COPYING' for use and warranty information + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * This file should contain functionality to support UI accross all major + * browsers. +*/ + +/* + * Add support of Array.indexOf method if missing. + * Source: + * https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf + */ + +if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { + "use strict"; + if (this === undefined || this === null) { + throw new TypeError(); + } + var t = Object(this); + var len = t.length >>> 0; + if (len === 0) { + return -1; + } + var n = 0; + if (arguments.length > 0) { + n = Number(arguments[1]); + if (n !== n) { // shortcut for verifying if it's NaN + n = 0; + } else if (n !== 0 && n !== Infinity && n !== -Infinity) { + n = (n > 0 || -1) * Math.floor(Math.abs(n)); + } + } + if (n >= len) { + return -1; + } + var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); + for (; k < len; k++) { + if (k in t && t[k] === searchElement) { + return k; + } + } + return -1; + }; +} diff --git a/install/ui/index.html b/install/ui/index.html index 25e910ed0..4b21bf38c 100644 --- a/install/ui/index.html +++ b/install/ui/index.html @@ -9,6 +9,7 @@ <script type="text/javascript" src="jquery-ui.js"></script> <script type="text/javascript" src="jquery.ba-bbq.js"></script> <script type="text/javascript" src="jquery.ordered-map.js"></script> + <script type="text/javascript" src="browser.js"></script> <script type="text/javascript" src="ipa.js"></script> <script type="text/javascript" src="widget.js"></script> |