Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ecommerce-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
ecommerce-ui
Commits
84d42a68
Commit
84d42a68
authored
Dec 13, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added selectivr and shim to prepare old browser support
parent
c5761099
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
693 additions
and
0 deletions
+693
-0
js/plugins/selectivzr/selectivzr.js
js/plugins/selectivzr/selectivzr.js
+561
-0
js/shims.js
js/shims.js
+132
-0
No files found.
js/plugins/selectivzr/selectivzr.js
0 → 100644
View file @
84d42a68
This diff is collapsed.
Click to expand it.
js/shims.js
0 → 100644
View file @
84d42a68
/*jslint indent: 2, maxlen: 80, nomen: true, sloppy: true, todo: true */
/*global console, window, document */
(
function
(
window
,
document
)
{
"
use strict
"
;
// NOTE: old browsers need all of these
var
shim_dict
=
{};
/* ====================================================================== */
/* SHIMS */
/* ====================================================================== */
// NOTE: add more: https://github.com/kriskowal/es5-shim
// NOTE: to support IE8+/Windows Mobile where possible, test via modernizr
// =============================== indexOf ================================
if
(
!
Array
.
prototype
.
indexOf
)
{
Array
.
prototype
.
indexOf
=
function
(
searchElement
/*, fromIndex */
)
{
"
use strict
"
;
if
(
this
===
void
0
||
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
)
n
=
0
;
else
if
(
n
!==
0
&&
n
!==
(
1
/
0
)
&&
n
!==
-
(
1
/
0
))
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
;
};
}
// =============================== BASE64 encoding ========================
// https://gist.github.com/yahiko/229984
shim_dict
.
Base64
=
{
characters
:
"
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
"
,
/**
* Shim for atob (not available on IE8+9+Windows Mobile?)
* @method Base64.encode
* @param {string} string String to be hashed
* @return {string} encoded string
*/
encode
:
function
(
string
)
{
var
characters
=
shim_dict
.
Base64
.
characters
;
var
result
=
''
;
var
i
=
0
;
do
{
var
a
=
string
.
charCodeAt
(
i
++
);
var
b
=
string
.
charCodeAt
(
i
++
);
var
c
=
string
.
charCodeAt
(
i
++
);
a
=
a
?
a
:
0
;
b
=
b
?
b
:
0
;
c
=
c
?
c
:
0
;
var
b1
=
(
a
>>
2
)
&
0x3F
;
var
b2
=
(
(
a
&
0x3
)
<<
4
)
|
(
(
b
>>
4
)
&
0xF
);
var
b3
=
(
(
b
&
0xF
)
<<
2
)
|
(
(
c
>>
6
)
&
0x3
);
var
b4
=
c
&
0x3F
;
if
(
!
b
)
{
b3
=
b4
=
64
;
}
else
if
(
!
c
)
{
b4
=
64
;
}
result
+=
characters
.
charAt
(
b1
)
+
characters
.
charAt
(
b2
)
+
characters
.
charAt
(
b3
)
+
characters
.
charAt
(
b4
);
}
while
(
i
<
string
.
length
);
return
result
;
},
/**
* Shim for btoa (not available on IE8+9+Windows Mobile?)
* @method Base64.decode
* @param {string} string String to be hashed
* @return {string} encoded string
*/
decode
:
function
(
string
)
{
var
characters
=
shim_dict
.
Base64
.
characters
;
var
result
=
''
;
var
i
=
0
;
do
{
var
b1
=
characters
.
indexOf
(
string
.
charAt
(
i
++
)
);
var
b2
=
characters
.
indexOf
(
string
.
charAt
(
i
++
)
);
var
b3
=
characters
.
indexOf
(
string
.
charAt
(
i
++
)
);
var
b4
=
characters
.
indexOf
(
string
.
charAt
(
i
++
)
);
var
a
=
(
(
b1
&
0x3F
)
<<
2
)
|
(
(
b2
>>
4
)
&
0x3
);
var
b
=
(
(
b2
&
0xF
)
<<
4
)
|
(
(
b3
>>
2
)
&
0xF
);
var
c
=
(
(
b3
&
0x3
)
<<
6
)
|
(
b4
&
0x3F
);
result
+=
String
.
fromCharCode
(
a
)
+
(
b
?
String
.
fromCharCode
(
b
):
''
)
+
(
c
?
String
.
fromCharCode
(
c
):
''
);
}
while
(
i
<
string
.
length
);
return
result
;
}
};
window
.
shim
=
shim_dict
;
}(
window
,
document
));
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment