td/tp semaines 1-2
This commit is contained in:
+10872
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,56 @@
|
||||
/*!
|
||||
|
||||
JSZipUtils - A collection of cross-browser utilities to go along with JSZip.
|
||||
<http://stuk.github.io/jszip-utils>
|
||||
|
||||
(c) 2014 Stuart Knightley, David Duponchel
|
||||
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown.
|
||||
|
||||
*/
|
||||
;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};/* jshint evil: true, newcap: false */
|
||||
/* global IEBinaryToArray_ByteStr, IEBinaryToArray_ByteStr_Last */
|
||||
"use strict";
|
||||
|
||||
// Adapted from http://stackoverflow.com/questions/1095102/how-do-i-load-binary-image-data-using-javascript-and-xmlhttprequest
|
||||
var IEBinaryToArray_ByteStr_Script =
|
||||
"<!-- IEBinaryToArray_ByteStr -->\r\n"+
|
||||
"<script type='text/vbscript'>\r\n"+
|
||||
"Function IEBinaryToArray_ByteStr(Binary)\r\n"+
|
||||
" IEBinaryToArray_ByteStr = CStr(Binary)\r\n"+
|
||||
"End Function\r\n"+
|
||||
"Function IEBinaryToArray_ByteStr_Last(Binary)\r\n"+
|
||||
" Dim lastIndex\r\n"+
|
||||
" lastIndex = LenB(Binary)\r\n"+
|
||||
" if lastIndex mod 2 Then\r\n"+
|
||||
" IEBinaryToArray_ByteStr_Last = Chr( AscB( MidB( Binary, lastIndex, 1 ) ) )\r\n"+
|
||||
" Else\r\n"+
|
||||
" IEBinaryToArray_ByteStr_Last = "+'""'+"\r\n"+
|
||||
" End If\r\n"+
|
||||
"End Function\r\n"+
|
||||
"</script>\r\n";
|
||||
|
||||
// inject VBScript
|
||||
document.write(IEBinaryToArray_ByteStr_Script);
|
||||
|
||||
global.JSZipUtils._getBinaryFromXHR = function (xhr) {
|
||||
var binary = xhr.responseBody;
|
||||
var byteMapping = {};
|
||||
for ( var i = 0; i < 256; i++ ) {
|
||||
for ( var j = 0; j < 256; j++ ) {
|
||||
byteMapping[ String.fromCharCode( i + (j << 8) ) ] =
|
||||
String.fromCharCode(i) + String.fromCharCode(j);
|
||||
}
|
||||
}
|
||||
var rawBytes = IEBinaryToArray_ByteStr(binary);
|
||||
var lastChr = IEBinaryToArray_ByteStr_Last(binary);
|
||||
return rawBytes.replace(/[\s\S]/g, function( match ) {
|
||||
return byteMapping[match];
|
||||
}) + lastChr;
|
||||
};
|
||||
|
||||
// enforcing Stuk's coding style
|
||||
// vim: set shiftwidth=4 softtabstop=4:
|
||||
|
||||
},{}]},{},[1])
|
||||
;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,118 @@
|
||||
/*!
|
||||
|
||||
JSZipUtils - A collection of cross-browser utilities to go along with JSZip.
|
||||
<http://stuk.github.io/jszip-utils>
|
||||
|
||||
(c) 2014 Stuart Knightley, David Duponchel
|
||||
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown.
|
||||
|
||||
*/
|
||||
!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.JSZipUtils=e():"undefined"!=typeof global?global.JSZipUtils=e():"undefined"!=typeof self&&(self.JSZipUtils=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var JSZipUtils = {};
|
||||
// just use the responseText with xhr1, response with xhr2.
|
||||
// The transformation doesn't throw away high-order byte (with responseText)
|
||||
// because JSZip handles that case. If not used with JSZip, you may need to
|
||||
// do it, see https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data
|
||||
JSZipUtils._getBinaryFromXHR = function (xhr) {
|
||||
// for xhr.responseText, the 0xFF mask is applied by JSZip
|
||||
return xhr.response || xhr.responseText;
|
||||
};
|
||||
|
||||
// taken from jQuery
|
||||
function createStandardXHR() {
|
||||
try {
|
||||
return new window.XMLHttpRequest();
|
||||
} catch( e ) {}
|
||||
}
|
||||
|
||||
function createActiveXHR() {
|
||||
try {
|
||||
return new window.ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch( e ) {}
|
||||
}
|
||||
|
||||
// Create the request object
|
||||
var createXHR = window.ActiveXObject ?
|
||||
/* Microsoft failed to properly
|
||||
* implement the XMLHttpRequest in IE7 (can't request local files),
|
||||
* so we use the ActiveXObject when it is available
|
||||
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
|
||||
* we need a fallback.
|
||||
*/
|
||||
function() {
|
||||
return createStandardXHR() || createActiveXHR();
|
||||
} :
|
||||
// For all other browsers, use the standard XMLHttpRequest object
|
||||
createStandardXHR;
|
||||
|
||||
|
||||
|
||||
JSZipUtils.getBinaryContent = function(path, callback) {
|
||||
/*
|
||||
* Here is the tricky part : getting the data.
|
||||
* In firefox/chrome/opera/... setting the mimeType to 'text/plain; charset=x-user-defined'
|
||||
* is enough, the result is in the standard xhr.responseText.
|
||||
* cf https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Receiving_binary_data_in_older_browsers
|
||||
* In IE <= 9, we must use (the IE only) attribute responseBody
|
||||
* (for binary data, its content is different from responseText).
|
||||
* In IE 10, the 'charset=x-user-defined' trick doesn't work, only the
|
||||
* responseType will work :
|
||||
* http://msdn.microsoft.com/en-us/library/ie/hh673569%28v=vs.85%29.aspx#Binary_Object_upload_and_download
|
||||
*
|
||||
* I'd like to use jQuery to avoid this XHR madness, but it doesn't support
|
||||
* the responseType attribute : http://bugs.jquery.com/ticket/11461
|
||||
*/
|
||||
try {
|
||||
|
||||
var xhr = createXHR();
|
||||
|
||||
xhr.open('GET', path, true);
|
||||
|
||||
// recent browsers
|
||||
if ("responseType" in xhr) {
|
||||
xhr.responseType = "arraybuffer";
|
||||
}
|
||||
|
||||
// older browser
|
||||
if(xhr.overrideMimeType) {
|
||||
xhr.overrideMimeType("text/plain; charset=x-user-defined");
|
||||
}
|
||||
|
||||
xhr.onreadystatechange = function(evt) {
|
||||
var file, err;
|
||||
// use `xhr` and not `this`... thanks IE
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 200 || xhr.status === 0) {
|
||||
file = null;
|
||||
err = null;
|
||||
try {
|
||||
file = JSZipUtils._getBinaryFromXHR(xhr);
|
||||
} catch(e) {
|
||||
err = new Error(e);
|
||||
}
|
||||
callback(err, file);
|
||||
} else {
|
||||
callback(new Error("Ajax error for " + path + " : " + this.status + " " + this.statusText), null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
|
||||
} catch (e) {
|
||||
callback(new Error(e), null);
|
||||
}
|
||||
};
|
||||
|
||||
// export
|
||||
module.exports = JSZipUtils;
|
||||
|
||||
// enforcing Stuk's coding style
|
||||
// vim: set shiftwidth=4 softtabstop=4:
|
||||
|
||||
},{}]},{},[1])
|
||||
(1)
|
||||
});
|
||||
;
|
||||
File diff suppressed because one or more lines are too long
+11370
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user