aboutsummaryrefslogtreecommitdiff
path: root/mod/lightpics/vendors/jquery-file-upload/cors/postmessage.html
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-12-29 20:45:58 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-12-29 20:45:58 -0200
commit97e689213ff4e829f251af526ed4e796a3cc2b71 (patch)
treeb04d03ec56305041216b72328fc9b5afde27bc76 /mod/lightpics/vendors/jquery-file-upload/cors/postmessage.html
parent0ab6351abb7a602d96c62b0ad35413c88113a6cf (diff)
parent69e2d8c5d8732042c9319aef1fdea45a82b63e42 (diff)
downloadelgg-97e689213ff4e829f251af526ed4e796a3cc2b71.tar.gz
elgg-97e689213ff4e829f251af526ed4e796a3cc2b71.tar.bz2
Merge branch 'master' into saravea
Conflicts: .gitmodules mod/admins mod/assemblies mod/audio_html5 mod/beechat mod/crud mod/elgg-activitystreams mod/elggman mod/elggpg mod/favorites mod/federated-objects mod/friendly_time mod/group_alias mod/group_operators mod/languages mod/lightpics mod/openid_client mod/spotlight mod/suicide mod/tasks mod/videolist
Diffstat (limited to 'mod/lightpics/vendors/jquery-file-upload/cors/postmessage.html')
-rw-r--r--mod/lightpics/vendors/jquery-file-upload/cors/postmessage.html75
1 files changed, 75 insertions, 0 deletions
diff --git a/mod/lightpics/vendors/jquery-file-upload/cors/postmessage.html b/mod/lightpics/vendors/jquery-file-upload/cors/postmessage.html
new file mode 100644
index 000000000..4a93bb867
--- /dev/null
+++ b/mod/lightpics/vendors/jquery-file-upload/cors/postmessage.html
@@ -0,0 +1,75 @@
+<!DOCTYPE HTML>
+<!--
+/*
+ * jQuery File Upload Plugin postMessage API 1.1.1
+ * https://github.com/blueimp/jQuery-File-Upload
+ *
+ * Copyright 2011, Sebastian Tschan
+ * https://blueimp.net
+ *
+ * Licensed under the MIT license:
+ * http://www.opensource.org/licenses/MIT
+ */
+-->
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<title>jQuery File Upload Plugin postMessage API</title>
+<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
+</head>
+<body>
+<script>
+/*jslint unparam: true, regexp: true */
+/*global $, Blob, FormData, location */
+'use strict';
+var origin = /^http:\/\/example.org/,
+ target = new RegExp('^(http(s)?:)?\\/\\/' + location.host + '\\/');
+$(window).on('message', function (e) {
+ e = e.originalEvent;
+ var s = e.data,
+ xhr = $.ajaxSettings.xhr(),
+ f;
+ if (!origin.test(e.origin)) {
+ throw new Error('Origin "' + e.origin + '" does not match ' + origin);
+ }
+ if (!target.test(e.data.url)) {
+ throw new Error('Target "' + e.data.url + '" does not match ' + target);
+ }
+ $(xhr.upload).on('progress', function (ev) {
+ ev = ev.originalEvent;
+ e.source.postMessage({
+ id: s.id,
+ type: ev.type,
+ timeStamp: ev.timeStamp,
+ lengthComputable: ev.lengthComputable,
+ loaded: ev.loaded,
+ total: ev.total
+ }, e.origin);
+ });
+ s.xhr = function () {
+ return xhr;
+ };
+ if (!(s.data instanceof Blob)) {
+ f = new FormData();
+ $.each(s.data, function (i, v) {
+ f.append(v.name, v.value);
+ });
+ s.data = f;
+ }
+ $.ajax(s).always(function (result, statusText, jqXHR) {
+ if (!jqXHR.done) {
+ jqXHR = result;
+ result = null;
+ }
+ e.source.postMessage({
+ id: s.id,
+ status: jqXHR.status,
+ statusText: statusText,
+ result: result,
+ headers: jqXHR.getAllResponseHeaders()
+ }, e.origin);
+ });
+});
+</script>
+</body>
+</html> \ No newline at end of file