import jquery (automatically), jquery-ui and jquery plugins

this allows webpack to handle our dependency tree for jquery and jquery-related modules, rather than requiring us to do it manually
This commit is contained in:
Leo McArdle 2021-10-28 13:00:42 +01:00 коммит произвёл Leo McArdle
Родитель 458e03e275
Коммит 4ecb30b8ea
44 изменённых файлов: 75 добавлений и 8901 удалений

Просмотреть файл

@ -2,7 +2,7 @@
{% from "dashboards/includes/macros.html" import localization_sidebar_nav %}
{% from "dashboards/includes/macros.html" import product_choice_list with context %}
{% set title = _('Aggregated Localization Metrics') %}
{% set scripts = ('wiki', 'jqueryui', 'rickshaw', 'wiki.dashboard') %}
{% set scripts = ('wiki', 'rickshaw', 'wiki.dashboard') %}
{% set crumbs = [(None, title)] %}
{% set classes = 'aggregated-metrics' %}

Просмотреть файл

@ -2,7 +2,7 @@
{% from "dashboards/includes/macros.html" import localization_sidebar_nav %}
{% from "dashboards/includes/macros.html" import product_choice_list with context %}
{% set title = _('[{locale}] Locale Metrics')|f(locale=current_locale) %}
{% set scripts = ('wiki', 'jqueryui', 'rickshaw', 'wiki.dashboard') %}
{% set scripts = ('wiki', 'rickshaw', 'wiki.dashboard') %}
{% set crumbs = [(None, title)] %}
{% set classes = 'locale-metrics' %}

Просмотреть файл

@ -2,7 +2,7 @@
{% from "dashboards/includes/macros.html" import print_readout, overview_section, product_choice_list, print_subscription_menu with context %}
{% from "dashboards/includes/macros.html" import localization_sidebar_nav %}
{% set title = _('[{locale}][{product}] Localization Dashboard')|fe(locale=current_locale, product=pgettext('DB: products.Product.title', product.title) if product else _('All Products')) %}
{% set scripts = ('wiki', 'jqueryui', 'wiki.dashboard') %}
{% set scripts = ('wiki', 'wiki.dashboard') %}
{% set crumbs = [(None, title)] %}
{% set classes = 'localization-dashboard' %}
{# TODO: Move required dashboard scripts out of wiki.js into their own or refactor up? #}

Просмотреть файл

@ -7,7 +7,7 @@
(url('forums.threads', forum.slug), forum.name),
(url('forums.posts', forum.slug, thread.id), thread.title),
(None, _('Edit a post'))] %}
{% set scripts = ('forums', 'jqueryui') %}
{% set scripts = ('forums',) %}
{% block content %}
<div id="edit-post" class="grid_12">

Просмотреть файл

@ -6,7 +6,7 @@
{% set crumbs = [(url('forums.forums'), _('Forums')),
(url('forums.threads', forum.slug), forum.name),
(None, _('Create a new thread'))] %}
{% set scripts = ('forums', 'jqueryui') %}
{% set scripts = ('forums',) %}
{% block content %}
<div id="new-thread" class="sumo-page-section">

Просмотреть файл

@ -11,7 +11,7 @@
{% if posts.number > 1 %}
{% set canonical_url = canonical_url|urlparams(page=posts.number) %}
{% endif %}
{% set scripts = ('forums', 'jqueryui') %}
{% set scripts = ('forums',) %}
{% block content %}

Просмотреть файл

@ -8,7 +8,7 @@
(url('wiki.discuss.threads', document.slug), _('Discuss')),
(url('wiki.discuss.posts', document.slug, thread.id), thread.title),
(None, _('Edit a post'))] %}
{% set scripts = ('forums', 'jqueryui') %}
{% set scripts = ('forums',) %}
{% block content %}
<article id="edit-post" class="sumo-page-section">

Просмотреть файл

@ -7,7 +7,7 @@
{% set crumbs = [(document.get_absolute_url(), document.title),
(url('wiki.discuss.threads', document.slug), _('Discuss')),
(None, _('Create a new thread'))] %}
{% set scripts = ('forums', 'jqueryui') %}
{% set scripts = ('forums',) %}
{% block content %}
<article id="new-thread" class="sumo-page-section">

Просмотреть файл

@ -7,7 +7,7 @@
{% set crumbs = [(document.get_absolute_url(), document.title),
(url('wiki.discuss.threads', document.slug), _('Discuss')),
(None, thread.title)] %}
{% set scripts = ('forums', 'jqueryui') %}
{% set scripts = ('forums',) %}
{% block side_top_top %}
<ul id="thread-actions" class="sidebar-nav">

Просмотреть файл

@ -3,7 +3,7 @@
{% set classes = ('kpi-dashboard ') %}
{% set title = _('KPI Dashboard') %}
{% set crumbs = [(None, title)] %}
{% set scripts = ('jqueryui', 'rickshaw', 'kpi.dashboard') %}
{% set scripts = ('rickshaw', 'kpi.dashboard') %}
{% block below_main %}
<article id="kpi-dash" class="sumo-page-section">

Просмотреть файл

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% from "messages/includes/macros.html" import message_tabs %}
{% from "includes/common_macros.html" import scam_banner %}
{% set scripts = ('messages', 'jqueryui') %}
{% set scripts = ('messages',) %}
{% block above_main %}
{{ scam_banner() }}

Просмотреть файл

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% if not scripts %}
{% set scripts = ('questions', 'jqueryui') %}
{% set scripts = ('questions',) %}
{% endif %}

Просмотреть файл

@ -14,7 +14,7 @@ we can compute the edit-title URL.
{% from "questions/includes/aaq_macros.html" import progress_bar %}
{% from "questions/includes/aaq_macros.html" import troubleshooting_instructions with context %}
{% from "upload/attachments.html" import attachments_form %}
{% set scripts = ('questions', 'jqueryui', 'questions.geo',) %}
{% set scripts = ('questions', 'questions.geo',) %}
{% set hide_aaq_link = True %}

Просмотреть файл

@ -3,7 +3,7 @@
{% set title = _('Support Forum Metrics') %}
{% set crumbs = [(url('questions.home'), _('Support Forums')),
(None, _('Metrics'))] %}
{% set scripts = ('jqueryui', 'rickshaw', 'questions.metrics') %}
{% set scripts = ('rickshaw', 'questions.metrics') %}
{% block below_main %}
<section class="sumo-page-section">

Просмотреть файл

@ -6,6 +6,6 @@
{% set crumbs = [(None, title)] %}
{% endif %}
{% if not scripts %}
{% set scripts = ('search', 'jqueryui') %}
{% set scripts = ('search',) %}
{% endif %}
{% set hide_header_search = True %}

Просмотреть файл

@ -1,3 +1,5 @@
import "sumo/js/libs/jquery.lazyload";
/*
* Wiki content previews - ajaxified.
*/

Просмотреть файл

@ -1,3 +1,6 @@
import "sumo/js/libs/jquery.ajaxupload";
import "sumo/js/kbox";
(function($) {
'use strict';

Просмотреть файл

@ -1,3 +1,5 @@
import "sumo/js/libs/jquery.cookie";
/* Please do not directly use this code or SUMO key. */
/* Contact MLS team for your own credentials. */
/* https://location.services.mozilla.com/contact */

8831
kitsune/sumo/static/sumo/js/jquery-ui-custom.js поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,3 +1,6 @@
import "sumo/js/libs/jquery.cookie";
import "sumo/js/libs/jquery.placeholder";
// Use a global k to share data accross JS files
window.k = window.k || {};

Просмотреть файл

@ -1,3 +1,5 @@
import "jquery-ui/ui/widgets/autocomplete";
/*
Marky, the markup toolbar builder

Просмотреть файл

@ -1,3 +1,5 @@
import "sumo/js/libs/jquery.autoresize";
/*
* Make textarea in replies auto expanding.
* Private messaging.

Просмотреть файл

@ -1,4 +1,6 @@
import questionmarkIcon from "sumo/img/questions/icon.questionmark.png";
import "sumo/js/libs/jquery.cookie";
/*
* questions.js
* Scripts for the questions app.

Просмотреть файл

@ -1,3 +1,5 @@
import "jquery-ui/ui/widgets/datepicker";
(function() {
function init() {

Просмотреть файл

@ -1,3 +1,6 @@
import "jquery-ui/ui/widgets/datepicker";
import "jquery-ui/ui/widgets/slider";
(function () {
'use strict';

Просмотреть файл

@ -1,3 +1,6 @@
import "jquery-ui/ui/widgets/datepicker";
import "jquery-ui/ui/widgets/tabs";
$(document).ready(function() {
// initiate tabs
var tabs = $('#search-tabs').tabs(),

Просмотреть файл

@ -1,3 +1,5 @@
import "jquery-ui/ui/widgets/autocomplete";
/*
* A tag filtering form.
*/

Просмотреть файл

@ -1,3 +1,5 @@
import "jquery-ui/ui/widgets/autocomplete";
/*
* tags.js
* Scripts to support tagging.

Просмотреть файл

@ -1,3 +1,5 @@
import "jquery-ui/ui/widgets/datepicker";
(function($) {
'use strict';

Просмотреть файл

@ -1,3 +1,5 @@
import "sumo/js/libs/jquery.ajaxupload";
function dialogSet(inner, title) {
var kbox = new KBox($('<p/>').text(inner), {
title: title,

Просмотреть файл

@ -1,3 +1,5 @@
import "sumo/js/libs/jquery.tokeninput";
/*
* users.autocomplete.js
* A username autocomplete widget.

Просмотреть файл

@ -1,3 +1,5 @@
import "jquery-ui/ui/widgets/datepicker";
/*
* kb dashboard chart
*/

Просмотреть файл

@ -1,4 +1,10 @@
import spinnerImg from "sumo/img/spinner.gif";
import "sumo/js/libs/jquery.cookie";
import "sumo/js/libs/jquery.lazyload";
import "sumo/js/kbox";
import "sumo/js/libs/django/prepopulate";
import "jquery-ui/ui/widgets/datepicker";
/*
* wiki.js
* Scripts for the wiki app.
@ -59,18 +65,6 @@ import spinnerImg from "sumo/img/spinner.gif";
$('.submit input').removeAttr('disabled');
}
if ($body.is('.edit, .new')) {
// collapse the topics listing per product and show only one topic list
// // at at a time
// $(function () {
// $('#accordion').accordion({
// collapsible: true,
// heightStyle: 'content',
// active: false
// });
// });
}
if ($body.is('.translate')) { // Translate page
initToggleDiff();
initTranslationDraft();

Просмотреть файл

@ -1,6 +1,6 @@
{% extends "base.html" %}
{% if not scripts %}
{% set scripts = ('jqueryui', 'wiki') %}
{% set scripts = ('wiki',) %}
{% endif %}
{% if product %}
{% set search_params = {'product': product.slug} %}

Просмотреть файл

@ -9,7 +9,7 @@
{% set crumbs = [(document.get_absolute_url(), document.title),
(None, _('Edit Article'))] %}
{% set classes = 'edit' %}
{% set scripts = ('wiki', 'wiki.diff', 'wiki.editor', 'jqueryui') %}
{% set scripts = ('wiki', 'wiki.diff', 'wiki.editor') %}
{% block content %}
<div class="user-messages">

Просмотреть файл

@ -1,7 +1,7 @@
{% extends "wiki/base.html" %}
{% from "wiki/includes/sidebar_modules.html" import document_tools with context %}
{% from "layout/errorlist.html" import errorlist %}
{% set scripts = ('wiki', 'jqueryui', 'rickshaw', 'wiki.history') %}
{% set scripts = ('wiki', 'rickshaw', 'wiki.history') %}
{% set meta = (('robots', 'noindex'),) %}
{% set title = _('Revision History | {document}')|fe(document=document.title) %}
{% set crumbs = [(document.get_absolute_url(), document.title),

Просмотреть файл

@ -7,7 +7,7 @@
{# TODO: Change KB url to landing page when we have one #}
{% set crumbs = [(None, _('New Article'))] %}
{% set classes = 'new' %}
{% set scripts = ('wiki', 'wiki.editor', 'jqueryui') %}
{% set scripts = ('wiki', 'wiki.editor') %}
{% block content %}
<div class="grid_9">

Просмотреть файл

@ -1,7 +1,7 @@
{% extends "wiki/base.html" %}
{% from "dashboards/includes/macros.html" import localization_sidebar_nav %}
{% set scripts = ('jqueryui', 'wiki', 'wiki.diff') %}
{% set scripts = ('wiki', 'wiki.diff') %}
{% set title = _('Recent Revisions') %}
{% set crumbs = [(None, title)] %}
{% set meta = [('robots', 'noindex, nofollow')] %}

Просмотреть файл

@ -8,7 +8,7 @@
{% set crumbs = [(parent.get_absolute_url(), parent.title),
(None, _('Translate Article'))] %}
{% set classes = 'translate' %}
{% set scripts = ('wiki', 'wiki.diff', 'wiki.editor', 'jqueryui') %}
{% set scripts = ('wiki', 'wiki.diff', 'wiki.editor') %}
{% block content %}
{% set language = settings.LANGUAGES_DICT[locale.lower()] %}

6
package-lock.json сгенерированный
Просмотреть файл

@ -10847,9 +10847,9 @@
"integrity": "sha1-3Yt0J4snEC0p32Pq4oMIqM+htYM="
},
"jquery-ui": {
"version": "1.10.5",
"resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.10.5.tgz",
"integrity": "sha1-gmrtPdH4jTKudddN9IZD3EMaWBU="
"version": "1.12.1",
"resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.12.1.tgz",
"integrity": "sha1-vLQEXI3QU5wTS8FIjN0+dop6nlE="
},
"js-tokens": {
"version": "1.0.0",

Просмотреть файл

@ -45,7 +45,7 @@
"flux": "~2.0.2",
"fontawesome": "^4.3.0",
"jquery": "1.11.3",
"jquery-ui": "~1.10.2",
"jquery-ui": "1.12.1",
"modernizr": "3.3.1",
"nunjucks": "^1.3.4",
"react": "0.13.3",

Просмотреть файл

@ -1,3 +1,4 @@
const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin");
@ -43,6 +44,11 @@ module.exports = (env, argv) => {
},
entry: entrypoints,
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
}),
new MiniCssExtractPlugin({
filename: dev ? "[name].css" : "[name].[contenthash].css",
}),

Просмотреть файл

@ -3,9 +3,6 @@ const entrypoints = {
common: [
"sumo/js/i18n.js",
"underscore/underscore.js",
"jquery",
"sumo/js/libs/jquery.cookie.js",
"sumo/js/libs/jquery.placeholder.js",
"sumo/js/templates/macros.js",
"sumo/js/templates/search-results-list.js",
"sumo/js/templates/search-results.js",
@ -48,16 +45,12 @@ const entrypoints = {
"sumo/js/show-fx-download.js",
],
community: [
"jquery",
"community/js/community.js",
"community/js/select.js",
],
"community.metrics": [
"kpi/js/kpi.browserify.js",
],
jqueryui: [
"sumo/js/jquery-ui-custom.js",
],
questions: [
"sumo/js/markup.js",
"sumo/js/ajaxvote.js",
@ -65,12 +58,10 @@ const entrypoints = {
"sumo/js/remote.js",
"sumo/js/aaq.js",
"sumo/js/questions.js",
"sumo/js/libs/jquery.tokeninput.js",
"sumo/js/tags.filter.js",
"sumo/js/tags.js",
"sumo/js/reportabuse.js",
"sumo/js/questions.metrics.js",
"sumo/js/libs/jquery.ajaxupload.js",
"sumo/js/upload.js",
],
"questions.metrics": [
@ -93,15 +84,11 @@ const entrypoints = {
"sumo/js/reportabuse.js",
],
gallery: [
"sumo/js/libs/jquery.ajaxupload.js",
"sumo/js/gallery.js",
],
wiki: [
"sumo/js/markup.js",
"sumo/js/libs/django/urlify.js",
"sumo/js/libs/django/prepopulate.js",
"sumo/js/libs/jquery.lazyload.js",
"sumo/js/libs/jquery.tokeninput.js",
"sumo/js/users.autocomplete.js",
"sumo/js/showfor.js",
"sumo/js/ajaxvote.js",
@ -118,6 +105,8 @@ const entrypoints = {
rickshaw: [
"d3/d3.js",
"sumo/js/libs/d3.layout.min.js",
"jquery-ui/ui/widgets/sortable",
"jquery-ui/ui/widgets/slider",
"sumo/js/libs/rickshaw.js",
"sumo/js/rickshaw_utils.js",
],
@ -144,14 +133,11 @@ const entrypoints = {
],
messages: [
"sumo/js/markup.js",
"sumo/js/libs/jquery.autoresize.js",
"sumo/js/libs/jquery.tokeninput.js",
"sumo/js/users.autocomplete.js",
"sumo/js/ajaxpreview.js",
"sumo/js/messages.js",
],
groups: [
"sumo/js/libs/jquery.tokeninput.js",
"sumo/js/users.autocomplete.js",
"sumo/js/markup.js",
"sumo/js/groups.js",

Просмотреть файл

@ -28,23 +28,6 @@ module.exports = [
"URLify"
),
exportAndExpose("../kitsune/sumo/static/sumo/js/upload.js", "dialogSet"),
// making jquery and jquery-ui play nice, and exposed globally is a bit difficult, but this works:
{
test: require.resolve("jquery"),
loader: "exports-loader",
options: {
type: "module",
exports: "default $",
},
},
{
test: require.resolve("../kitsune/sumo/static/sumo/js/jquery-ui-custom.js"),
loader: "exports-loader",
options: {
type: "module",
exports: "default $",
},
},
// this library attempts to expose a bunch of stuff globally by adding them to `this`, imports-loader makes that work:
{
test: require.resolve(