Commit fd8bbe5a authored by Sven Franck's avatar Sven Franck

removed IE8 shims to separate file

parent b265c991
......@@ -29,22 +29,23 @@
<!-- global popup -->
<!-- JQM -->
<script src="js/libs/jquery/jquery.js"></script>
<script src="js/libs/jquery-mobile/jquery-mobile.js"></script>
<script src="js/extensions.js"></script>
<script type="text/javascript" src="js/libs/jquery/jquery.js"></script>
<script type="text/javascript" src="js/libs/jquery-mobile/jquery-mobile.js"></script>
<script type="text/javascript" src="js/extensions.js"></script>
<!-- JIO -->
<script src="js/libs/jio/sha256.amd.js"></script>
<script src="js/libs/jio/rsvp-custom.js"></script>
<script src="js/libs/jio/jio.js"></script>
<script src="js/libs/jio/complex_queries.js"></script>
<script src="js/libs/jio/localstorage.js"></script>
<script type="text/javascript" src="js/libs/jio/sha256.amd.js"></script>
<script type="text/javascript" src="js/libs/jio/rsvp-custom.js"></script>
<script type="text/javascript" src="js/libs/jio/jio.js"></script>
<script type="text/javascript" src="js/libs/jio/complex_queries.js"></script>
<script type="text/javascript" src="js/libs/jio/localstorage.js"></script>
<!-- plugins -->
<script src="js/plugins/validval/jquery.validVal.js"></script>
<script src="js/plugins/i18next/i18next.js"></script>
<script type="text/javascript" src="js/plugins/validval/jquery.validVal.js"></script>
<script type="text/javascript" src="js/plugins/i18next/i18next.js"></script>
<!-- stuff happens here -->
<script src="js/erp5_loader.js"></script>
<script type="text/javascript" src="js/erp5_loader.js"></script>
<script type="text/javascript" src="js/shims.js"></script>
</body>
</html>
......@@ -13,89 +13,11 @@
erp5 = {},
// JQM content erateerator
factory = {},
// Shims
shim_dict = {},
// renderJS
javascript_registration_dict = {},
renderJS = {};
/* ====================================================================== */
/* SHIMS */
/* ====================================================================== */
// NOTE: to support IE8+/Windows Mobile where possible, test via modernizr
// 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;
}
};
/* ====================================================================== */
/* MAPPING ERP5 */
/* ====================================================================== */
......@@ -1579,7 +1501,7 @@
// secure
if (i === 0 && secure === "default") {
stamp = new Date().getTime();
encode = window.btoa || shim_dict.Base64.encode;
encode = window.btoa || window.shim.Base64.encode;
// TODO: include client IP in hash to block submission serverside
sauce = encode(stamp.toString() + spec.property_dict.secret_hash);
......@@ -4907,6 +4829,8 @@
/* ====================================================================== */
init.contentLoaded(window, function () {
// TODO: modernizr check and shim test here
// HACK: don't!
window.localStorage.clear();
......
/*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: to support IE8+/Windows Mobile where possible, test via modernizr
// 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment