diff options
Diffstat (limited to 'core/src/globals.js')
-rw-r--r-- | core/src/globals.js | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/core/src/globals.js b/core/src/globals.js index 8f0fe6dbf86..eb72a9fef30 100644 --- a/core/src/globals.js +++ b/core/src/globals.js @@ -1,3 +1,4 @@ +/* eslint-disable nextcloud/no-deprecations */ /** * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at> * @@ -19,7 +20,46 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -import {initCore} from './init' +import { initCore } from './init' + +import _ from 'underscore' +import $ from 'jquery' +import 'jquery-migrate/dist/jquery-migrate.min' +// TODO: switch to `jquery-ui` package and import widgets and effects individually +// `jquery-ui-dist` is used as a workaround for the issue of missing effects +import 'jquery-ui-dist/jquery-ui' +import 'jquery-ui-dist/jquery-ui.css' +import 'jquery-ui-dist/jquery-ui.theme.css' +// END TODO +import autosize from 'autosize' +import Backbone from 'backbone' +import 'bootstrap/js/dist/tooltip' +import './Polyfill/tooltip' +import ClipboardJS from 'clipboard' +import dav from 'davclient.js' +import DOMPurify from 'dompurify' +import Handlebars from 'handlebars' +import 'jcrop/js/jquery.Jcrop' +import 'jcrop/css/jquery.Jcrop.css' +import jstimezonedetect from 'jstimezonedetect' +import marked from 'marked' +import md5 from 'blueimp-md5' +import moment from 'moment' +import 'select2' +import 'select2/select2.css' +import 'snap.js/dist/snap' +import 'strengthify' +import 'strengthify/strengthify.css' + +import OC from './OC/index' +import OCP from './OCP/index' +import OCA from './OCA/index' +import escapeHTML from './Util/escapeHTML' +import formatDate from './Util/format-date' +import { getToken as getRequestToken } from './OC/requesttoken' +import getURLParameter from './Util/get-url-parameter' +import humanFileSize from './Util/human-file-size' +import relativeModifiedDate from './Util/relative-modified-date' const warnIfNotTesting = function() { if (window.TESTING === undefined) { @@ -28,9 +68,12 @@ const warnIfNotTesting = function() { } /** + * Mark a function as deprecated and automatically + * warn if used! * * @param {Function} func the library to deprecate * @param {String} funcName the name of the library + * @returns {function} */ const deprecate = (func, funcName) => { const oldFunc = func @@ -59,53 +102,12 @@ const setDeprecatedProp = (global, cb, msg) => { }) } -import _ from 'underscore' -import $ from 'jquery' -import 'jquery-migrate/dist/jquery-migrate.min' -// TODO: switch to `jquery-ui` package and import widgets and effects individually -// `jquery-ui-dist` is used as a workaround for the issue of missing effects -import 'jquery-ui-dist/jquery-ui' -import 'jquery-ui-dist/jquery-ui.css' -import 'jquery-ui-dist/jquery-ui.theme.css' -// END TODO -import autosize from 'autosize' -import Backbone from 'backbone' -import 'bootstrap/js/dist/tooltip' -import './Polyfill/tooltip' -import ClipboardJS from 'clipboard' -import cssVars from 'css-vars-ponyfill' -import dav from 'davclient.js' -import DOMPurify from 'dompurify' -import Handlebars from 'handlebars' -import 'jcrop/js/jquery.Jcrop' -import 'jcrop/css/jquery.Jcrop.css' -import jstimezonedetect from 'jstimezonedetect' -import marked from 'marked' -import md5 from 'blueimp-md5' -import moment from 'moment' -import 'select2' -import 'select2/select2.css' -import 'snap.js/dist/snap' -import 'strengthify' -import 'strengthify/strengthify.css' - -import OC from './OC/index' -import OCP from './OCP/index' -import OCA from './OCA/index' -import escapeHTML from './Util/escapeHTML' -import formatDate from './Util/format-date' -import {getToken as getRequestToken} from './OC/requesttoken' -import getURLParameter from './Util/get-url-parameter' -import humanFileSize from './Util/human-file-size' -import relative_modified_date from './Util/relative-modified-date' - window['_'] = _ window['$'] = $ window['autosize'] = autosize window['Backbone'] = Backbone window['Clipboard'] = ClipboardJS window['ClipboardJS'] = ClipboardJS -window['cssVars'] = cssVars window['dav'] = dav setDeprecatedProp('DOMPurify', () => DOMPurify, 'The global DOMPurify is deprecated, ship your own') window['Handlebars'] = Handlebars @@ -118,7 +120,7 @@ window['moment'] = moment window['OC'] = OC setDeprecatedProp('initCore', () => initCore, 'this is an internal function') -setDeprecatedProp('oc_appswebroots', () => OC.appswebroots, 'use OC.appswebroots instead') +setDeprecatedProp('oc_appswebroots', () => OC.appswebroots, 'use OC.appswebroots instead') setDeprecatedProp('oc_capabilities', OC.getCapabilities, 'use OC.getCapabilities instead') setDeprecatedProp('oc_config', () => OC.config, 'use OC.config instead') setDeprecatedProp('oc_current_user', () => OC.getCurrentUser().uid, 'use OC.getCurrentUser().uid instead') @@ -134,7 +136,7 @@ window['escapeHTML'] = deprecate(escapeHTML, 'escapeHTML') window['formatDate'] = deprecate(formatDate, 'formatDate') window['getURLParameter'] = deprecate(getURLParameter, 'getURLParameter') window['humanFileSize'] = deprecate(humanFileSize, 'humanFileSize') -window['relative_modified_date'] = deprecate(relative_modified_date, 'relative_modified_date') +window['relative_modified_date'] = deprecate(relativeModifiedDate, 'relative_modified_date') $.fn.select2 = deprecate($.fn.select2, 'select2') /** @@ -145,7 +147,7 @@ $.fn.select2 = deprecate($.fn.select2, 'select2') * @param {number} [count] number to replace %n with * @return {string} */ -window.t = _.bind(OC.L10N.translate, OC.L10N); +window.t = _.bind(OC.L10N.translate, OC.L10N) /** * translate a string @@ -156,4 +158,4 @@ window.t = _.bind(OC.L10N.translate, OC.L10N); * @param [vars] map of placeholder key to value * @return {string} Translated string */ -window.n = _.bind(OC.L10N.translatePlural, OC.L10N); +window.n = _.bind(OC.L10N.translatePlural, OC.L10N) |