Pull jquery using require.js rather than as a script tag and fix require to pass jquery as a parameter

This commit is contained in:
Caleb James DeLisle
2017-04-18 12:14:32 +02:00
parent 107e75b287
commit c341fa8e94
48 changed files with 121 additions and 183 deletions

View File

@@ -1,7 +1,14 @@
// This is stage 1, it can be changed but you must bump the version of the project.
define([], function () {
// fix up locations so that relative urls work.
require.config({ baseUrl: window.location.pathname });
require.config({
baseUrl: window.location.pathname,
paths: {
// jquery declares itself as literally "jquery" so it cannot be pulled by path :(
"jquery": "/bower_components/jquery/dist/jquery.min",
// json.sortify same
"json.sortify": "/bower_components/json.sortify/dist/JSON.sortify"
}
});
require([document.querySelector('script[data-bootload]').getAttribute('data-bootload')]);
});

View File

@@ -1,7 +1,4 @@
define([
'/bower_components/jquery/dist/jquery.min.js',
], function () {
var $ = window.jQuery;
define(['jquery'], function ($) {
var Clipboard = {};
// copy arbitrary text to the clipboard
@@ -13,7 +10,7 @@ define([
$('body').append($ta);
if (!($ta.length && $ta[0].select)) {
if (!($ta.length && $ta[0].select)) {
// console.log("oops");
return;
}

View File

@@ -1,11 +1,10 @@
define([
'jquery',
'/customize/messages.js',
'/common/common-util.js',
'/customize/application_config.js',
'/bower_components/alertifyjs/dist/js/alertify.js',
'/bower_components/jquery/dist/jquery.min.js',
], function (Messages, Util, AppConfig, Alertify) {
var $ = window.jQuery;
'/bower_components/alertifyjs/dist/js/alertify.js'
], function ($, Messages, Util, AppConfig, Alertify) {
var UI = {};

View File

@@ -1,10 +1,10 @@
define([
'jquery',
'/bower_components/chainpad-crypto/crypto.js',
'/bower_components/chainpad-netflux/chainpad-netflux.js',
'/common/cryptpad-common.js',
'/bower_components/textpatcher/TextPatcher.js',
'/bower_components/jquery/dist/jquery.min.js',
], function (Crypto, Realtime, Cryptpad, TextPatcher) {
'/bower_components/textpatcher/TextPatcher.js'
], function ($, Crypto, Realtime, Cryptpad, TextPatcher) {
var Messages = Cryptpad.Messages;
var noop = function () {};
var finish = function (S, err, doc) {

View File

@@ -1,4 +1,5 @@
define([
'jquery',
'/api/config',
'/customize/messages.js',
'/common/fsStore.js',
@@ -8,17 +9,15 @@ define([
'/common/clipboard.js',
'/common/pinpad.js',
'/customize/application_config.js',
'/customize/application_config.js'
], function ($, Config, Messages, Store, Util, Hash, UI, Clipboard, Pinpad, AppConfig) {
'/bower_components/jquery/dist/jquery.min.js',
], function (Config, Messages, Store, Util, Hash, UI, Clipboard, Pinpad, AppConfig) {
/* This file exposes functionality which is specific to Cryptpad, but not to
any particular pad type. This includes functions for committing metadata
about pads to your local storage for future use and improved usability.
Additionally, there is some basic functionality for import/export.
*/
var $ = window.jQuery;
var common = window.Cryptpad = {
Messages: Messages,

View File

@@ -1,7 +1,6 @@
define([
'/bower_components/jquery/dist/jquery.min.js',
], function () {
var $ = window.jQuery;
'jquery',
], function ($) {
var module = {};
var Messages = {};

View File

@@ -1,10 +1,10 @@
define([
'jquery',
'/bower_components/chainpad-listmap/chainpad-listmap.js',
'/bower_components/chainpad-crypto/crypto.js?v=0.1.5',
'/bower_components/textpatcher/TextPatcher.amd.js',
'/common/userObject.js',
'/bower_components/jquery/dist/jquery.min.js',
], function (Listmap, Crypto, TextPatcher, FO) {
], function ($, Listmap, Crypto, TextPatcher, FO) {
/*
This module uses localStorage, which is synchronous, but exposes an
asyncronous API. This is so that we can substitute other storage
@@ -13,7 +13,6 @@ define([
To override these methods, create another file at:
/customize/storage.js
*/
var $ = window.jQuery;
var Store = {};
var store;

View File

@@ -1,12 +1,12 @@
define([
'jquery',
'/bower_components/chainpad-listmap/chainpad-listmap.js',
'/bower_components/chainpad-crypto/crypto.js',
'/common/cryptpad-common.js',
'/common/credential.js',
'/bower_components/tweetnacl/nacl-fast.min.js',
'/bower_components/scrypt-async/scrypt-async.min.js', // better load speed
'/bower_components/jquery/dist/jquery.min.js',
], function (Listmap, Crypto, Cryptpad, Cred) {
], function ($, Listmap, Crypto, Cryptpad, Cred) {
var Exports = {
Cred: Cred,
};

View File

@@ -1,4 +1,3 @@
require.config({ paths: { 'json.sortify': '/bower_components/json.sortify/dist/JSON.sortify' } });
define([
'/common/cryptpad-common.js',
'/common/cryptget.js',

View File

@@ -1,9 +1,8 @@
define([
'jquery',
'/customize/application_config.js',
'/api/config',
'/bower_components/jquery/dist/jquery.min.js'
], function (Config, ApiConfig) {
var $ = window.jQuery;
'/api/config'
], function ($, Config, ApiConfig) {
var Messages = {};

View File

@@ -1,7 +1,6 @@
define([
'/bower_components/jquery/dist/jquery.min.js',
], function () {
var $ = window.jQuery;
'jquery',
], function ($) {
var module = {};
var ROOT = module.ROOT = "root";
@@ -897,4 +896,3 @@ define([
return module;
});