aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@owncloud.com>2016-04-19 15:06:42 +0200
committerChristoph Wurst <christoph@owncloud.com>2016-04-19 15:06:42 +0200
commit05d203a989721f3e456ba516ef07be3fd72f460b (patch)
tree58073f16f936f8ce3b26ad3db377ecf1e5da085a
parent37530f27f00a1b284c339d8b8a11563d79ca5757 (diff)
downloadnextcloud-server-05d203a989721f3e456ba516ef07be3fd72f460b.tar.gz
nextcloud-server-05d203a989721f3e456ba516ef07be3fd72f460b.zip
replace $.parseJSON() by JSON.parse()
-rw-r--r--apps/files/controller/viewcontroller.php1
-rw-r--r--apps/files/js/file-upload.js2
-rw-r--r--apps/files/js/filelist.js2
-rw-r--r--apps/files/js/jquery.iframe-transport.js205
-rw-r--r--apps/files_sharing/templates/public.php1
-rw-r--r--core/js/core.json2
-rw-r--r--core/js/js.js3
-rw-r--r--settings/admin.php1
-rw-r--r--settings/js/certificates.js4
-rw-r--r--settings/js/personal.js6
-rw-r--r--settings/personal.php1
11 files changed, 8 insertions, 220 deletions
diff --git a/apps/files/controller/viewcontroller.php b/apps/files/controller/viewcontroller.php
index 6c5f4c6d2a0..d3ff9e2ab1a 100644
--- a/apps/files/controller/viewcontroller.php
+++ b/apps/files/controller/viewcontroller.php
@@ -136,7 +136,6 @@ class ViewController extends Controller {
\OCP\Util::addscript('files', 'app');
\OCP\Util::addscript('files', 'file-upload');
\OCP\Util::addscript('files', 'newfilemenu');
- \OCP\Util::addscript('files', 'jquery.iframe-transport');
\OCP\Util::addscript('files', 'jquery.fileupload');
\OCP\Util::addscript('files', 'jquery-visibility');
\OCP\Util::addscript('files', 'fileinfomodel');
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index fca69064cde..b88a7031dba 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -504,7 +504,7 @@ OC.Upload = {
//fetch response from iframe
response = data.result[0].body.innerText;
}
- var result = $.parseJSON(response);
+ var result = JSON.parse(response);
delete data.jqXHR;
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 3eebd4ff1b7..004048dd99e 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -2549,7 +2549,7 @@
// fetch response from iframe
response = data.result[0].body.innerText;
}
- var result=$.parseJSON(response);
+ var result = JSON.parse(response);
if (typeof result[0] !== 'undefined' && result[0].status === 'success') {
var file = result[0];
diff --git a/apps/files/js/jquery.iframe-transport.js b/apps/files/js/jquery.iframe-transport.js
deleted file mode 100644
index 5c9df77976b..00000000000
--- a/apps/files/js/jquery.iframe-transport.js
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * jQuery Iframe Transport Plugin 1.7
- * 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
- */
-
-/*jslint unparam: true, nomen: true */
-/*global define, window, document */
-
-(function (factory) {
- 'use strict';
- if (typeof define === 'function' && define.amd) {
- // Register as an anonymous AMD module:
- define(['jquery'], factory);
- } else {
- // Browser globals:
- factory(window.jQuery);
- }
-}(function ($) {
- 'use strict';
-
- // Helper variable to create unique names for the transport iframes:
- var counter = 0;
-
- // The iframe transport accepts three additional options:
- // options.fileInput: a jQuery collection of file input fields
- // options.paramName: the parameter name for the file form data,
- // overrides the name property of the file input field(s),
- // can be a string or an array of strings.
- // options.formData: an array of objects with name and value properties,
- // equivalent to the return data of .serializeArray(), e.g.:
- // [{name: 'a', value: 1}, {name: 'b', value: 2}]
- $.ajaxTransport('iframe', function (options) {
- if (options.async) {
- var form,
- iframe,
- addParamChar;
- return {
- send: function (_, completeCallback) {
- form = $('<form style="display:none;"></form>');
- form.attr('accept-charset', options.formAcceptCharset);
- addParamChar = /\?/.test(options.url) ? '&' : '?';
- // XDomainRequest only supports GET and POST:
- if (options.type === 'DELETE') {
- options.url = options.url + addParamChar + '_method=DELETE';
- options.type = 'POST';
- } else if (options.type === 'PUT') {
- options.url = options.url + addParamChar + '_method=PUT';
- options.type = 'POST';
- } else if (options.type === 'PATCH') {
- options.url = options.url + addParamChar + '_method=PATCH';
- options.type = 'POST';
- }
- // javascript:false as initial iframe src
- // prevents warning popups on HTTPS in IE6.
- // IE versions below IE8 cannot set the name property of
- // elements that have already been added to the DOM,
- // so we set the name along with the iframe HTML markup:
- counter += 1;
- iframe = $(
- '<iframe src="javascript:false;" name="iframe-transport-' +
- counter + '"></iframe>'
- ).bind('load', function () {
- var fileInputClones,
- paramNames = $.isArray(options.paramName) ?
- options.paramName : [options.paramName];
- iframe
- .unbind('load')
- .bind('load', function () {
- var response;
- // Wrap in a try/catch block to catch exceptions thrown
- // when trying to access cross-domain iframe contents:
- try {
- response = iframe.contents();
- // Google Chrome and Firefox do not throw an
- // exception when calling iframe.contents() on
- // cross-domain requests, so we unify the response:
- if (!response.length || !response[0].firstChild) {
- throw new Error();
- }
- } catch (e) {
- response = undefined;
- }
- // The complete callback returns the
- // iframe content document as response object:
- completeCallback(
- 200,
- 'success',
- {'iframe': response}
- );
- // Fix for IE endless progress bar activity bug
- // (happens on form submits to iframe targets):
- $('<iframe src="javascript:false;"></iframe>')
- .appendTo(form);
- window.setTimeout(function () {
- // Removing the form in a setTimeout call
- // allows Chrome's developer tools to display
- // the response result
- form.remove();
- }, 0);
- });
- form
- .prop('target', iframe.prop('name'))
- .prop('action', options.url)
- .prop('method', options.type);
- if (options.formData) {
- $.each(options.formData, function (index, field) {
- $('<input type="hidden"/>')
- .prop('name', field.name)
- .val(field.value)
- .appendTo(form);
- });
- }
- if (options.fileInput && options.fileInput.length &&
- options.type === 'POST') {
- fileInputClones = options.fileInput.clone();
- // Insert a clone for each file input field:
- options.fileInput.after(function (index) {
- return fileInputClones[index];
- });
- if (options.paramName) {
- options.fileInput.each(function (index) {
- $(this).prop(
- 'name',
- paramNames[index] || options.paramName
- );
- });
- }
- // Appending the file input fields to the hidden form
- // removes them from their original location:
- form
- .append(options.fileInput)
- .prop('enctype', 'multipart/form-data')
- // enctype must be set as encoding for IE:
- .prop('encoding', 'multipart/form-data');
- }
- form.submit();
- // Insert the file input fields at their original location
- // by replacing the clones with the originals:
- if (fileInputClones && fileInputClones.length) {
- options.fileInput.each(function (index, input) {
- var clone = $(fileInputClones[index]);
- $(input).prop('name', clone.prop('name'));
- clone.replaceWith(input);
- });
- }
- });
- form.append(iframe).appendTo(document.body);
- },
- abort: function () {
- if (iframe) {
- // javascript:false as iframe src aborts the request
- // and prevents warning popups on HTTPS in IE6.
- // concat is used to avoid the "Script URL" JSLint error:
- iframe
- .unbind('load')
- .prop('src', 'javascript'.concat(':false;'));
- }
- if (form) {
- form.remove();
- }
- }
- };
- }
- });
-
- // The iframe transport returns the iframe content document as response.
- // The following adds converters from iframe to text, json, html, xml
- // and script.
- // Please note that the Content-Type for JSON responses has to be text/plain
- // or text/html, if the browser doesn't include application/json in the
- // Accept header, else IE will show a download dialog.
- // The Content-Type for XML responses on the other hand has to be always
- // application/xml or text/xml, so IE properly parses the XML response.
- // See also
- // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
- $.ajaxSetup({
- converters: {
- 'iframe text': function (iframe) {
- return iframe && $(iframe[0].body).text();
- },
- 'iframe json': function (iframe) {
- return iframe && $.parseJSON($(iframe[0].body).text());
- },
- 'iframe html': function (iframe) {
- return iframe && $(iframe[0].body).html();
- },
- 'iframe xml': function (iframe) {
- var xmlDoc = iframe && iframe[0];
- return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
- $.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
- $(xmlDoc.body).html());
- },
- 'iframe script': function (iframe) {
- return iframe && $.globalEval($(iframe[0].body).text());
- }
- }
- });
-
-})); \ No newline at end of file
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index ae00b01dca2..cb7fe1103b5 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -8,7 +8,6 @@ OCP\Util::addStyle('files_sharing', 'mobile');
OCP\Util::addScript('files_sharing', 'public');
OCP\Util::addScript('files', 'fileactions');
OCP\Util::addScript('files', 'fileactionsmenu');
-OCP\Util::addScript('files', 'jquery.iframe-transport');
OCP\Util::addScript('files', 'jquery.fileupload');
// JS required for folders
diff --git a/core/js/core.json b/core/js/core.json
index 555c683f6f7..670051a4ca4 100644
--- a/core/js/core.json
+++ b/core/js/core.json
@@ -1,7 +1,7 @@
{
"vendor": [
"jquery/dist/jquery.min.js",
- "jquery-migrate/jquery-migrate.min.js",
+ "jquery-migrate/jquery-migrate.js",
"jquery-ui/ui/jquery-ui.custom.js",
"underscore/underscore.js",
"moment/min/moment-with-locales.js",
diff --git a/core/js/js.js b/core/js/js.js
index ce4bf3ee5e9..ac1d582a9f8 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1337,9 +1337,6 @@ if(typeof localStorage !=='undefined' && localStorage !== null){
var item = localStorage.getItem(OC.localStorage.namespace+name);
if(item === null) {
return null;
- } else if (typeof JSON === 'undefined') {
- //fallback to jquery for IE6/7/8
- return $.parseJSON(item);
} else {
return JSON.parse(item);
}
diff --git a/settings/admin.php b/settings/admin.php
index e0d3a907f47..bc78fdfa030 100644
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -38,7 +38,6 @@ $template = new OC_Template('settings', 'admin', 'user');
$l = \OC::$server->getL10N('settings');
OC_Util::addScript('settings', 'certificates');
-OC_Util::addScript('files', 'jquery.iframe-transport');
OC_Util::addScript('files', 'jquery.fileupload');
$showLog = (\OC::$server->getConfig()->getSystemValue('log_type', 'owncloud') === 'owncloud');
diff --git a/settings/js/certificates.js b/settings/js/certificates.js
index f2a8e6b0afb..7e62a4f5157 100644
--- a/settings/js/certificates.js
+++ b/settings/js/certificates.js
@@ -24,10 +24,10 @@ $(document).ready(function () {
},
success: function (data) {
if (typeof data === 'string') {
- data = $.parseJSON(data);
+ data = JSON.parse(data);
} else if (data && data.length) {
// fetch response from iframe
- data = $.parseJSON(data[0].body.innerText);
+ data = JSON.parse(data[0].body.innerText);
}
if (!data || typeof(data) === 'string') {
// IE8 iframe workaround comes here instead of fail()
diff --git a/settings/js/personal.js b/settings/js/personal.js
index bd13b7fd251..b6e8e2ff508 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -166,7 +166,7 @@ function cleanCropper () {
function avatarResponseHandler (data) {
if (typeof data === 'string') {
- data = $.parseJSON(data);
+ data = JSON.parse(data);
}
var $warning = $('#avatar .warning');
$warning.hide();
@@ -248,10 +248,10 @@ $(document).ready(function () {
done: function (e, data) {
var response = data;
if (typeof data.result === 'string') {
- response = $.parseJSON(data.result);
+ response = JSON.parse(data.result);
} else if (data.result && data.result.length) {
// fetch response from iframe
- response = $.parseJSON(data.result[0].body.innerText);
+ response = JSON.parse(data.result[0].body.innerText);
} else {
response = data.result;
}
diff --git a/settings/personal.php b/settings/personal.php
index 62a718985f8..f27b40770f5 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -47,7 +47,6 @@ OC_Util::addScript('settings', 'certificates');
OC_Util::addStyle( 'settings', 'settings' );
\OC_Util::addVendorScript('strengthify/jquery.strengthify');
\OC_Util::addVendorStyle('strengthify/strengthify');
-\OC_Util::addScript('files', 'jquery.iframe-transport');
\OC_Util::addScript('files', 'jquery.fileupload');
if ($config->getSystemValue('enable_avatars', true) === true) {
\OC_Util::addVendorScript('jcrop/js/jquery.Jcrop');