diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2012-11-09 17:13:28 +0100 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-01-18 15:10:36 +0100 |
commit | 8f8e790d9468245c031320d6a506a420f486638f (patch) | |
tree | fb425e7cbd456843976cc268d7d985ec5600fdb1 /install/ui/src/libs/browser.js | |
parent | 65301fe3f3118e5f76a47cf3d1cbeb9b8e4af858 (diff) | |
download | freeipa.git-8f8e790d9468245c031320d6a506a420f486638f.tar.gz freeipa.git-8f8e790d9468245c031320d6a506a420f486638f.tar.xz freeipa.git-8f8e790d9468245c031320d6a506a420f486638f.zip |
Move of Web UI non AMD dep. libs to libs subdirectory
Third party JS libraries which are not AMD modules were moved to src/libs/
directory. Links in html files were changed accordingly.
https://fedorahosted.org/freeipa/ticket/112
Diffstat (limited to 'install/ui/src/libs/browser.js')
-rw-r--r-- | install/ui/src/libs/browser.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/install/ui/src/libs/browser.js b/install/ui/src/libs/browser.js new file mode 100644 index 00000000..9268d9dc --- /dev/null +++ b/install/ui/src/libs/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; + }; +} |