diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index a8b98ac16..e64c8695d 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -2585,17 +2585,17 @@ function Ace2Inner(editorInfo, cssManagers) { const firstEditbarElement = parent.parent.$('#editbar') .children('ul').first().children().first() .children().first().children().first(); - $(this).blur(); - firstEditbarElement.focus(); + $(this).trigger('blur'); + firstEditbarElement.trigger('focus'); evt.preventDefault(); } if (!specialHandled && type === 'keydown' && altKey && keyCode === 67 && padShortcutEnabled.altC) { // Alt c focuses on the Chat window - $(this).blur(); + $(this).trigger('blur'); parent.parent.chat.show(); - parent.parent.$('#chatinput').focus(); + parent.parent.$('#chatinput').trigger('focus'); evt.preventDefault(); } if (!specialHandled && type === 'keydown' && diff --git a/src/static/js/admin/jquery.autosize.js b/src/static/js/admin/jquery.autosize.js index 8c8ab1a8f..a94ef3cde 100644 --- a/src/static/js/admin/jquery.autosize.js +++ b/src/static/js/admin/jquery.autosize.js @@ -164,7 +164,7 @@ $(window).resize(adjust); // Allow for manual triggering if needed. - $ta.bind('autosize', adjust); + $ta.on('autosize', adjust); // Call adjust in case the textarea already contains text. adjust(); diff --git a/src/static/js/admin/plugins.js b/src/static/js/admin/plugins.js index d3636dfd8..e51e1102d 100644 --- a/src/static/js/admin/plugins.js +++ b/src/static/js/admin/plugins.js @@ -112,15 +112,15 @@ $(document).ready(() => { const updateHandlers = () => { // Search - $('#search-query').unbind('keyup').keyup(() => { + $('#search-query').off('keyup').on('keyup', () => { search($('#search-query').val()); }); // Prevent form submit - $('#search-query').parent().bind('submit', () => false); + $('#search-query').parent().on('submit', () => false); // update & install - $('.do-install, .do-update').unbind('click').click(function (e) { + $('.do-install, .do-update').off('click').on('click', function (e) { const $row = $(e.target).closest('tr'); const plugin = $row.data('plugin'); if ($(this).hasClass('do-install')) { @@ -134,7 +134,7 @@ $(document).ready(() => { }); // uninstall - $('.do-uninstall').unbind('click').click((e) => { + $('.do-uninstall').off('click').on('click', (e) => { const $row = $(e.target).closest('tr'); const pluginName = $row.data('plugin'); socket.emit('uninstall', pluginName); @@ -143,14 +143,14 @@ $(document).ready(() => { }); // Sort - $('.sort.up').unbind('click').click(function () { + $('.sort.up').off('click').on('click', function () { search.sortBy = $(this).attr('data-label').toLowerCase(); search.sortDir = false; search.offset = 0; search(search.searchTerm, search.results.length); search.results = []; }); - $('.sort.down, .sort.none').unbind('click').click(function () { + $('.sort.down, .sort.none').off('click').on('click', function () { search.sortBy = $(this).attr('data-label').toLowerCase(); search.sortDir = true; search.offset = 0; @@ -164,7 +164,7 @@ $(document).ready(() => { if (data.query.offset === 0) search.results = []; search.messages.hide('nothing-found'); search.messages.hide('fetching'); - $('#search-query').removeAttr('disabled'); + $('#search-query').prop('disabled', false); console.log('got search results', data); diff --git a/src/static/js/admin/settings.js b/src/static/js/admin/settings.js index a53937471..0d9031602 100644 --- a/src/static/js/admin/settings.js +++ b/src/static/js/admin/settings.js @@ -25,7 +25,7 @@ $(document).ready(() => { /* Check to make sure the JSON is clean before proceeding */ if (isJSONClean(settings.results)) { $('.settings').append(settings.results); - $('.settings').focus(); + $('.settings').trigger('focus'); $('.settings').autosize(); } else { alert('Invalid JSON'); @@ -40,7 +40,7 @@ $(document).ready(() => { socket.emit('saveSettings', $('.settings').val()); } else { alert('Invalid JSON'); - $('.settings').focus(); + $('.settings').trigger('focus'); } }); @@ -62,7 +62,7 @@ const isJSONClean = (data) => { // this is a bit naive. In theory some key/value might contain the sequences ',]' or ',}' cleanSettings = cleanSettings.replace(',]', ']').replace(',}', '}'); try { - return typeof jQuery.parseJSON(cleanSettings) === 'object'; + return typeof JSON.parseJSON(cleanSettings) === 'object'; } catch (e) { return false; // the JSON failed to be parsed } diff --git a/src/static/js/broadcast_slider.js b/src/static/js/broadcast_slider.js index f03a22836..80afffe28 100644 --- a/src/static/js/broadcast_slider.js +++ b/src/static/js/broadcast_slider.js @@ -67,7 +67,7 @@ const loadBroadcastSliderJS = (fireWhenAllScriptsAreLoaded) => { newSavedRevision.css( 'left', (position * ($('#ui-slider-bar').width() - 2) / (sliderLength * 1.0)) - 1); $('#ui-slider-bar').append(newSavedRevision); - newSavedRevision.mouseup((evt) => { + newSavedRevision.on('mouseup', (evt) => { BroadcastSlider.setSliderPosition(position); }); savedRevisions.push(newSavedRevision); @@ -209,21 +209,21 @@ const loadBroadcastSliderJS = (fireWhenAllScriptsAreLoaded) => { // assign event handlers to html UI elements after page load fireWhenAllScriptsAreLoaded.push(() => { - $(document).keyup((e) => { + $(document).on('keyup', (e) => { if (!e) e = window.event; const code = e.keyCode || e.which; if (code === 37) { // left if (e.shiftKey) { - $('#leftstar').click(); + $('#leftstar').trigger('click'); } else { - $('#leftstep').click(); + $('#leftstep').trigger('click'); } } else if (code === 39) { // right if (e.shiftKey) { - $('#rightstar').click(); + $('#rightstar').trigger('click'); } else { - $('#rightstep').click(); + $('#rightstep').trigger('click'); } } else if (code === 32) { // spacebar $('#playpause_button_icon').trigger('click'); @@ -231,22 +231,22 @@ const loadBroadcastSliderJS = (fireWhenAllScriptsAreLoaded) => { }); // Resize - $(window).resize(() => { + $(window).on('resize', () => { updateSliderElements(); }); // Slider click - $('#ui-slider-bar').mousedown((evt) => { + $('#ui-slider-bar').on('mousedown', (evt) => { $('#ui-slider-handle').css('left', (evt.clientX - $('#ui-slider-bar').offset().left)); $('#ui-slider-handle').trigger(evt); }); // Slider dragging - $('#ui-slider-handle').mousedown(function (evt) { + $('#ui-slider-handle').on('mousedown', function (evt) { this.startLoc = evt.clientX; this.currentLoc = parseInt($(this).css('left')); sliderActive = true; - $(document).mousemove((evt2) => { + $(document).on('mousemove', (evt2) => { $(this).css('pointer', 'move'); let newloc = this.currentLoc + (evt2.clientX - this.startLoc); if (newloc < 0) newloc = 0; @@ -257,9 +257,9 @@ const loadBroadcastSliderJS = (fireWhenAllScriptsAreLoaded) => { $(this).css('left', newloc); if (getSliderPosition() !== version) _callSliderCallbacks(version); }); - $(document).mouseup((evt2) => { - $(document).unbind('mousemove'); - $(document).unbind('mouseup'); + $(document).on('mouseup', (evt2) => { + $(document).off('mousemove'); + $(document).off('mouseup'); sliderActive = false; let newloc = this.currentLoc + (evt2.clientX - this.startLoc); if (newloc < 0) newloc = 0; @@ -276,12 +276,12 @@ const loadBroadcastSliderJS = (fireWhenAllScriptsAreLoaded) => { }); // play/pause toggling - $('#playpause_button_icon').click((evt) => { + $('#playpause_button_icon').on('click', (evt) => { BroadcastSlider.playpause(); }); // next/prev saved revision and changeset - $('.stepper').click(function (evt) { + $('.stepper').on('click', function (evt) { switch ($(this).attr('id')) { case 'leftstep': setSliderPosition(getSliderPosition() - 1); diff --git a/src/static/js/chat.js b/src/static/js/chat.js index 63c17c153..9dee3be4f 100755 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -42,11 +42,14 @@ exports.chat = (() => { }, focus: () => { setTimeout(() => { - $('#chatinput').focus(); + $('#chatinput').trigger('focus'); }, 100); }, // Make chat stick to right hand side of screen stickToScreen(fromInitialCall) { + if ($('#options-stickychat').prop('checked')) { + $('#options-stickychat').prop('checked', false); + } if (pad.settings.hideChat) { return; } @@ -68,7 +71,7 @@ exports.chat = (() => { this.stickToScreen(true); $('#options-stickychat').prop('checked', true); $('#options-chatandusers').prop('checked', true); - $('#options-stickychat').prop('disabled', 'disabled'); + $('#options-stickychat').prop('disabled', true); userAndChat = true; } else { $('#options-stickychat').prop('disabled', false); @@ -223,14 +226,14 @@ exports.chat = (() => { // Send the users focus back to the pad if ((evt.altKey === true && evt.which === 67) || evt.which === 27) { // If we're in chat already.. - $(':focus').blur(); // required to do not try to remove! + $(':focus').trigger('blur'); // required to do not try to remove! padeditor.ace.focus(); // Sends focus back to pad evt.preventDefault(); return false; } }); // Clear the chat mentions when the user clicks on the chat input box - $('#chatinput').click(() => { + $('#chatinput').on('click', () => { chatMentions = 0; Tinycon.setBubble(0); }); @@ -239,14 +242,14 @@ exports.chat = (() => { $('body:not(#chatinput)').on('keypress', function (evt) { if (evt.altKey && evt.which === 67) { // Alt c focuses on the Chat window - $(this).blur(); + $(this).trigger('blur'); self.show(); - $('#chatinput').focus(); + $('#chatinput').trigger('focus'); evt.preventDefault(); } }); - $('#chatinput').keypress((evt) => { + $('#chatinput').on('keypress', (evt) => { // if the user typed enter, fire the send if (evt.key === 'Enter' && !evt.shiftKey) { evt.preventDefault(); @@ -257,7 +260,7 @@ exports.chat = (() => { // initial messages are loaded in pad.js' _afterHandshake $('#chatcounter').text(0); - $('#chatloadmessagesbutton').click(() => { + $('#chatloadmessagesbutton').on('click', () => { const start = Math.max(this.historyPointer - 20, 0); const end = this.historyPointer; diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index 74bc66f9f..11a3a3dc6 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -66,7 +66,7 @@ const getCollabClient = (ace2editor, serverVars, initialUserInfo, options, _pad) if (browser.firefox) { // Prevent "escape" from taking effect and canceling a comet connection; // doesn't work if focus is on an iframe. - $(window).bind('keydown', (evt) => { + $(window).on('keydown', (evt) => { if (evt.which === 27) { evt.preventDefault(); } diff --git a/src/static/js/index.js b/src/static/js/index.js index b0b3a1ebb..d50c14e7d 100644 --- a/src/static/js/index.js +++ b/src/static/js/index.js @@ -41,7 +41,7 @@ const randomPadName = () => { }; $(() => { - $('#go2Name').submit(() => { + $('#go2Name').on('submit', () => { const padname = $('#padname').val(); if (padname.length > 0) { window.location = `p/${encodeURIComponent(padname.trim())}`; @@ -51,7 +51,7 @@ $(() => { return false; }); - $('#button').click(() => { + $('#button').on('click', () => { window.location = `p/${randomPadName()}`; }); diff --git a/src/static/js/pad.js b/src/static/js/pad.js index c37920ead..802f1d476 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -412,10 +412,12 @@ const pad = { setTimeout(() => { padeditor.ace.focus(); }, 0); + const optionsStickyChat = $('#options-stickychat'); + optionsStickyChat.on('click', () => { chat.stickToScreen(); }); // if we have a cookie for always showing chat then show it if (padcookie.getPref('chatAlwaysVisible')) { chat.stickToScreen(true); // stick it to the screen - $('#options-stickychat').prop('checked', true); // set the checkbox to on + optionsStickyChat.prop('checked', true); // set the checkbox to on } // if we have a cookie for always showing chat then show it if (padcookie.getPref('chatAndUsers')) { @@ -437,8 +439,8 @@ const pad = { // Prevent sticky chat or chat and users to be checked for mobiles const checkChatAndUsersVisibility = (x) => { if (x.matches) { // If media query matches - $('#options-chatandusers:checked').click(); - $('#options-stickychat:checked').click(); + $('#options-chatandusers:checked').trigger('click'); + $('#options-stickychat:checked').trigger('click'); } }; const mobileMatch = window.matchMedia('(max-width: 800px)'); @@ -711,7 +713,7 @@ const pad = { $('form#reconnectform input.diagnosticInfo').val(JSON.stringify(pad.diagnosticInfo)); $('form#reconnectform input.missedChanges') .val(JSON.stringify(pad.collabClient.getMissedChanges())); - $('form#reconnectform').submit(); + $('form#reconnectform').trigger('submit'); }, callWhenNotCommitting: (f) => { pad.collabClient.callWhenNotCommitting(f); diff --git a/src/static/js/pad_automatic_reconnect.js b/src/static/js/pad_automatic_reconnect.js index 9d9ee953a..576e0d350 100644 --- a/src/static/js/pad_automatic_reconnect.js +++ b/src/static/js/pad_automatic_reconnect.js @@ -96,7 +96,7 @@ const whenConnectionIsRestablishedWithServer = (callback, pad) => { }; const forceReconnection = ($modal) => { - $modal.find('#forcereconnect').click(); + $modal.find('#forcereconnect').trigger('click'); }; const updateCountDownTimerMessage = ($modal, minutes, seconds) => { diff --git a/src/static/js/pad_connectionstatus.js b/src/static/js/pad_connectionstatus.js index 1282d488c..7b0497d96 100644 --- a/src/static/js/pad_connectionstatus.js +++ b/src/static/js/pad_connectionstatus.js @@ -31,7 +31,7 @@ const padconnectionstatus = (() => { const self = { init: () => { - $('button#forcereconnect').click(() => { + $('button#forcereconnect').on('click', () => { window.location.reload(); }); }, diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index 9d006d2c7..d7f12465d 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -65,13 +65,13 @@ class ToolbarItem { bind(callback) { if (this.isButton()) { - this.$el.click((event) => { - $(':focus').blur(); + this.$el.on('click', (event) => { + $(':focus').trigger('blur'); callback(this.getCommand(), this); event.preventDefault(); }); } else if (this.isSelect()) { - this.$el.find('select').change(() => { + this.$el.find('select').on('change', () => { callback(this.getCommand(), this); }); } @@ -134,7 +134,7 @@ exports.padeditbar = new class { $('#editbar .editbarbutton').attr('unselectable', 'on'); // for IE this.enable(); $('#editbar [data-key]').each((i, elt) => { - $(elt).unbind('click'); + $(elt).off('click'); new ToolbarItem($(elt)).bind((command, item) => { this.triggerCommand(command, item); }); @@ -144,11 +144,11 @@ exports.padeditbar = new class { this._bodyKeyEvent(evt); }); - $('.show-more-icon-btn').click(() => { + $('.show-more-icon-btn').on('click', () => { $('.toolbar').toggleClass('full-icons'); }); this.checkAllIconsAreDisplayedInToolbar(); - $(window).resize(_.debounce(() => this.checkAllIconsAreDisplayedInToolbar(), 100)); + $(window).on('resize', _.debounce(() => this.checkAllIconsAreDisplayedInToolbar(), 100)); this._registerDefaultCommands(); @@ -168,7 +168,7 @@ exports.padeditbar = new class { } // When editor is scrolled, we add a class to style the editbar differently - $('iframe[name="ace_outer"]').contents().scroll((ev) => { + $('iframe[name="ace_outer"]').contents().on('scroll', (ev) => { $('#editbar').toggleClass('editor-scrolled', $(ev.currentTarget).scrollTop() > 2); }); } @@ -305,12 +305,12 @@ exports.padeditbar = new class { // Close any dropdowns we have open.. this.toggleDropDown('none'); // Shift focus away from any drop downs - $(':focus').blur(); // required to do not try to remove! + $(':focus').trigger('blur'); // required to do not try to remove! // Check we're on a pad and not on the timeslider // Or some other window I haven't thought about! if (typeof pad === 'undefined') { // Timeslider probably.. - $('#editorcontainerbox').focus(); // Focus back onto the pad + $('#editorcontainerbox').trigger('focus'); // Focus back onto the pad } else { padeditor.ace.focus(); // Sends focus back to pad // The above focus doesn't always work in FF, you have to hit enter afterwards @@ -320,8 +320,8 @@ exports.padeditbar = new class { // Focus on the editbar :) const firstEditbarElement = parent.parent.$('#editbar button').first(); - $(evt.currentTarget).blur(); - firstEditbarElement.focus(); + $(evt.currentTarget).trigger('blur'); + firstEditbarElement.trigger('focus'); evt.preventDefault(); } } @@ -341,7 +341,7 @@ exports.padeditbar = new class { this._editbarPosition--; // Allow focus to shift back to end of row and start of row if (this._editbarPosition === -1) this._editbarPosition = focusItems.length - 1; - $(focusItems[this._editbarPosition]).focus(); + $(focusItems[this._editbarPosition]).trigger('focus'); } // On right arrow move to next button in editbar @@ -352,7 +352,7 @@ exports.padeditbar = new class { this._editbarPosition++; // Allow focus to shift back to end of row and start of row if (this._editbarPosition >= focusItems.length) this._editbarPosition = 0; - $(focusItems[this._editbarPosition]).focus(); + $(focusItems[this._editbarPosition]).trigger('focus'); } } } @@ -366,7 +366,7 @@ exports.padeditbar = new class { this.registerCommand('settings', () => { this.toggleDropDown('settings'); - $('#options-stickychat').focus(); + $('#options-stickychat').trigger('focus'); }); this.registerCommand('import_export', () => { @@ -374,22 +374,22 @@ exports.padeditbar = new class { // If Import file input exists then focus on it.. if ($('#importfileinput').length !== 0) { setTimeout(() => { - $('#importfileinput').focus(); + $('#importfileinput').trigger('focus'); }, 100); } else { - $('.exportlink').first().focus(); + $('.exportlink').first().trigger('focus'); } }); this.registerCommand('showusers', () => { this.toggleDropDown('users'); - $('#myusernameedit').focus(); + $('#myusernameedit').trigger('focus'); }); this.registerCommand('embed', () => { this.setEmbedLinks(); this.toggleDropDown('embed'); - $('#linkinput').focus().select(); + $('#linkinput').trigger('focus').trigger('select'); }); this.registerCommand('savedRevision', () => { diff --git a/src/static/js/pad_editor.js b/src/static/js/pad_editor.js index e39f73fee..585cccbb5 100644 --- a/src/static/js/pad_editor.js +++ b/src/static/js/pad_editor.js @@ -76,7 +76,7 @@ const padeditor = (() => { }); // font family change - $('#viewfontmenu').change(() => { + $('#viewfontmenu').on('change', () => { pad.changeViewOption('padFontFamily', $('#viewfontmenu').val()); }); @@ -97,7 +97,7 @@ const padeditor = (() => { }); }); $('#languagemenu').val(html10n.getLanguage()); - $('#languagemenu').change(() => { + $('#languagemenu').on('change', () => { Cookies.set('language', $('#languagemenu').val()); window.html10n.localize([$('#languagemenu').val(), 'en']); if ($('select').niceSelect) { diff --git a/src/static/js/pad_impexp.js b/src/static/js/pad_impexp.js index c85a791eb..4d607ff83 100644 --- a/src/static/js/pad_impexp.js +++ b/src/static/js/pad_impexp.js @@ -38,7 +38,7 @@ const padimpexp = (() => { const fileInputUpdated = () => { $('#importsubmitinput').addClass('throbbold'); $('#importformfilediv').addClass('importformenabled'); - $('#importsubmitinput').removeAttr('disabled'); + $('#importsubmitinput').prop('disabled', false); $('#importmessagefail').fadeOut('fast'); }; @@ -69,8 +69,8 @@ const padimpexp = (() => { $('#import_export').removeClass('popup-show'); if (directDatabaseAccess) window.location.reload(); } - $('#importsubmitinput').removeAttr('disabled').val(html10n.get('pad.impexp.importbutton')); - window.setTimeout(() => $('#importfileinput').removeAttr('disabled'), 0); + $('#importsubmitinput').prop('disabled', false).val(html10n.get('pad.impexp.importbutton')); + window.setTimeout(() => $('#importfileinput').prop('disabled', false), 0); $('#importstatusball').hide(); addImportFrames(); })(); @@ -162,9 +162,9 @@ const padimpexp = (() => { } addImportFrames(); - $('#importfileinput').change(fileInputUpdated); - $('#importform').unbind('submit').submit(fileInputSubmit); - $('.disabledexport').click(cantExport); + $('#importfileinput').on('change', fileInputUpdated); + $('#importform').off('submit').on('submit', fileInputSubmit); + $('.disabledexport').on('click', cantExport); }, disable: () => { $('#impexp-disabled-clickcatcher').show(); diff --git a/src/static/js/pad_userlist.js b/src/static/js/pad_userlist.js index 07c223341..b689ae1ad 100644 --- a/src/static/js/pad_userlist.js +++ b/src/static/js/pad_userlist.js @@ -325,23 +325,23 @@ const paduserlist = (() => { }; const setUpEditable = (jqueryNode, valueGetter, valueSetter) => { - jqueryNode.bind('focus', (evt) => { + jqueryNode.on('focus', (evt) => { const oldValue = valueGetter(); if (jqueryNode.val() !== oldValue) { jqueryNode.val(oldValue); } jqueryNode.addClass('editactive').removeClass('editempty'); }); - jqueryNode.bind('blur', (evt) => { + jqueryNode.on('blur', (evt) => { const newValue = jqueryNode.removeClass('editactive').val(); valueSetter(newValue); }); padutils.bindEnterAndEscape(jqueryNode, () => { - jqueryNode.blur(); + jqueryNode.trigger('blur'); }, () => { - jqueryNode.val(valueGetter()).blur(); + jqueryNode.val(valueGetter()).trigger('blur'); }); - jqueryNode.removeAttr('disabled').addClass('editable'); + jqueryNode.prop('disabled', false).addClass('editable'); }; let pad = undefined; @@ -369,15 +369,15 @@ const paduserlist = (() => { }); // color picker - $('#myswatchbox').click(showColorPicker); - $('#mycolorpicker .pickerswatchouter').click(function () { + $('#myswatchbox').on('click', showColorPicker); + $('#mycolorpicker .pickerswatchouter').on('click', function () { $('#mycolorpicker .pickerswatchouter').removeClass('picked'); $(this).addClass('picked'); }); - $('#mycolorpickersave').click(() => { + $('#mycolorpickersave').on('click', () => { closeColorPicker(true); }); - $('#mycolorpickercancel').click(() => { + $('#mycolorpickercancel').on('click', () => { closeColorPicker(false); }); // @@ -587,7 +587,7 @@ const showColorPicker = () => { li.appendTo(colorsList); - li.bind('click', (event) => { + li.on('click', (event) => { $('#colorpickerswatches li').removeClass('picked'); $(event.target).addClass('picked'); diff --git a/src/static/js/pad_utils.js b/src/static/js/pad_utils.js index e10841f50..58105d23c 100644 --- a/src/static/js/pad_utils.js +++ b/src/static/js/pad_utils.js @@ -224,7 +224,7 @@ const padutils = { // It is work on Windows (IE8, Chrome 6.0.472), CentOs (Firefox 3.0) and Mac OSX (Firefox // 3.6.10, Chrome 6.0.472, Safari 5.0). if (onEnter) { - node.keypress((evt) => { + node.on('keypress', (evt) => { if (evt.which === 13) { onEnter(evt); } @@ -232,7 +232,7 @@ const padutils = { } if (onEscape) { - node.keydown((evt) => { + node.on('keydown', (evt) => { if (evt.which === 27) { onEscape(evt); } @@ -299,7 +299,7 @@ const padutils = { } field.removeClass('editempty'); }); - field.blur(() => { + field.on('blur', () => { if (!field.val()) { clear(); } @@ -313,11 +313,11 @@ const padutils = { if (value) { $(node).attr('checked', 'checked'); } else { - $(node).removeAttr('checked'); + $(node).prop('checked', false); } }, bindCheckboxChange: (node, func) => { - $(node).change(func); + $(node).on('change', func); }, encodeUserId: (userId) => userId.replace(/[^a-y0-9]/g, (c) => { if (c === '.') return '-'; diff --git a/src/static/js/skin_variants.js b/src/static/js/skin_variants.js index a7902545e..9a0427ac9 100644 --- a/src/static/js/skin_variants.js +++ b/src/static/js/skin_variants.js @@ -46,7 +46,7 @@ if (window.location.hash.toLowerCase() === '#skinvariantsbuilder') { $('#skin-variant-full-width').prop('checked', $('html').hasClass('full-width-editor')); }; - $('.skin-variant').change(() => { + $('.skin-variant').on('change', () => { updateSkinVariantsClasses(); }); diff --git a/src/static/js/timeslider.js b/src/static/js/timeslider.js index 246872061..8c5993145 100644 --- a/src/static/js/timeslider.js +++ b/src/static/js/timeslider.js @@ -82,7 +82,7 @@ const init = () => { // get all the export links exportLinks = $('#export > .exportlink'); - $('button#forcereconnect').click(() => { + $('button#forcereconnect').on('click', () => { window.location.reload(); }); @@ -159,7 +159,7 @@ const handleClientVars = (message) => { $('#rightstep').attr('title', html10n.get('timeslider.forwardRevision')); // font family change - $('#viewfontmenu').change(function () { + $('#viewfontmenu').on('change', function () { $('#innerdocbody').css('font-family', $(this).val() || ''); }); }; diff --git a/src/static/js/vendors/farbtastic.js b/src/static/js/vendors/farbtastic.js index cc0c2c1bf..9e167d6bb 100644 --- a/src/static/js/vendors/farbtastic.js +++ b/src/static/js/vendors/farbtastic.js @@ -33,7 +33,7 @@ $._farbtastic = function (container, options) { fb.linkTo = function (callback) { // Unbind previous nodes if (typeof fb.callback == 'object') { - $(fb.callback).unbind('keyup', fb.updateValue); + $(fb.callback).off('keyup').on('keyup').on('keyup', fb.updateValue); } // Reset color @@ -45,7 +45,7 @@ $._farbtastic = function (container, options) { } else if (typeof callback == 'object' || typeof callback == 'string') { fb.callback = $(callback); - fb.callback.bind('keyup', fb.updateValue); + fb.callback.on('keyup', fb.updateValue); if (fb.callback[0].value) { fb.setColor(fb.callback[0].value); } @@ -388,7 +388,7 @@ $._farbtastic = function (container, options) { fb.mousedown = function (event) { // Capture mouse if (!$._farbtastic.dragging) { - $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup); + $(document).on('mousemove', fb.mousemove).on('mouseup', fb.mouseup); $._farbtastic.dragging = true; } @@ -429,8 +429,8 @@ $._farbtastic = function (container, options) { */ fb.mouseup = function () { // Uncapture mouse - $(document).unbind('mousemove', fb.mousemove); - $(document).unbind('mouseup', fb.mouseup); + $(document).off('mousemove').on('mousemove',fb.mousemove); + $(document).off('mouseup').on('mouseup', fb.mouseup); $._farbtastic.dragging = false; } @@ -519,7 +519,7 @@ $._farbtastic = function (container, options) { fb.initWidget(); // Install mousedown handler (the others are set on the document on-demand) - $('canvas.farbtastic-overlay', container).mousedown(fb.mousedown); + $('canvas.farbtastic-overlay', container).on('mousedown',fb.mousedown); // Set linked elements/callback if (options.callback) { diff --git a/src/static/js/vendors/jquery.js b/src/static/js/vendors/jquery.js index aad916a31..26f1a6735 100644 --- a/src/static/js/vendors/jquery.js +++ b/src/static/js/vendors/jquery.js @@ -1,15 +1,12 @@ /*! - * jQuery JavaScript Library v3.0.0 + * jQuery JavaScript Library v3.7.0 * https://jquery.com/ * - * Includes Sizzle.js - * https://sizzlejs.com/ - * - * Copyright jQuery Foundation and other contributors + * Copyright OpenJS Foundation and other contributors * Released under the MIT license * https://jquery.org/license * - * Date: 2016-06-09T18:02Z + * Date: 2023-05-11T18:29Z */ ( function( global, factory ) { @@ -23,7 +20,7 @@ // (such as Node.js), expose a factory as module.exports. // This accentuates the need for the creation of a real `window`. // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info. + // See ticket trac-14549 for more info. module.exports = global.document ? factory( global, true ) : function( w ) { @@ -37,293 +34,104 @@ } // Pass this if window is not defined yet -}( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common // enough that all such attempts are guarded in a try block. -"use strict"; + "use strict"; -var arr = []; + var arr = []; -var document = window.document; + var getProto = Object.getPrototypeOf; -var getProto = Object.getPrototypeOf; + var slice = arr.slice; -var slice = arr.slice; + var flat = arr.flat ? function( array ) { + return arr.flat.call( array ); + } : function( array ) { + return arr.concat.apply( [], array ); + }; -var concat = arr.concat; -var push = arr.push; + var push = arr.push; -var indexOf = arr.indexOf; + var indexOf = arr.indexOf; -var class2type = {}; + var class2type = {}; -var toString = class2type.toString; + var toString = class2type.toString; -var hasOwn = class2type.hasOwnProperty; + var hasOwn = class2type.hasOwnProperty; -var fnToString = hasOwn.toString; + var fnToString = hasOwn.toString; -var ObjectFunctionString = fnToString.call( Object ); + var ObjectFunctionString = fnToString.call( Object ); -var support = {}; + var support = {}; + + var isFunction = function isFunction( obj ) { + + // Support: Chrome <=57, Firefox <=52 + // In some browsers, typeof returns "function" for HTML elements + // (i.e., `typeof document.createElement( "object" ) === "function"`). + // We don't want to classify *any* DOM node as a function. + // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 + // Plus for old WebKit, typeof returns "function" for HTML collections + // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) + return typeof obj === "function" && typeof obj.nodeType !== "number" && + typeof obj.item !== "function"; + }; + + + var isWindow = function isWindow( obj ) { + return obj != null && obj === obj.window; + }; + + + var document = window.document; - function DOMEval( code, doc ) { + var preservedScriptAttributes = { + type: true, + src: true, + nonce: true, + noModule: true + }; + + function DOMEval( code, node, doc ) { doc = doc || document; - var script = doc.createElement( "script" ); + var i, val, + script = doc.createElement( "script" ); script.text = code; + if ( node ) { + for ( i in preservedScriptAttributes ) { + + // Support: Firefox 64+, Edge 18+ + // Some browsers don't support the "nonce" property on scripts. + // On the other hand, just using `getAttribute` is not enough as + // the `nonce` attribute is reset to an empty string whenever it + // becomes browsing-context connected. + // See https://github.com/whatwg/html/issues/2369 + // See https://html.spec.whatwg.org/#nonce-attributes + // The `node.getAttribute` check was added for the sake of + // `jQuery.globalEval` so that it can fake a nonce-containing node + // via an object. + val = node[ i ] || node.getAttribute && node.getAttribute( i ); + if ( val ) { + script.setAttribute( i, val ); + } + } + } doc.head.appendChild( script ).parentNode.removeChild( script ); } -var - version = "3.0.0", - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }, - - // Support: Android <=4.0 only - // Make sure we trim BOM and NBSP - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }; - -jQuery.fn = jQuery.prototype = { - - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num != null ? - - // Return just the one element from the set - ( num < 0 ? this[ num + this.length ] : this[ num ] ) : - - // Return all the elements in a clean array - slice.call( this ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - each: function( callback ) { - return jQuery.each( this, callback ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map( this, function( elem, i ) { - return callback.call( elem, i, elem ); - } ) ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: arr.sort, - splice: arr.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[ 0 ] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // Skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { - target = {}; - } - - // Extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - - // Only deal with non-null/undefined values - if ( ( options = arguments[ i ] ) != null ) { - - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = jQuery.isArray( copy ) ) ) ) { - - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray( src ) ? src : []; - - } else { - clone = src && jQuery.isPlainObject( src ) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend( { - - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - isFunction: function( obj ) { - return jQuery.type( obj ) === "function"; - }, - - isArray: Array.isArray, - - isWindow: function( obj ) { - return obj != null && obj === obj.window; - }, - - isNumeric: function( obj ) { - - // As of jQuery 3.0, isNumeric is limited to - // strings and numbers (primitives or objects) - // that can be coerced to finite numbers (gh-2662) - var type = jQuery.type( obj ); - return ( type === "number" || type === "string" ) && - - // parseFloat NaNs numeric-cast false positives ("") - // ...but misinterprets leading-number strings, particularly hex literals ("0x...") - // subtraction forces infinities to NaN - !isNaN( obj - parseFloat( obj ) ); - }, - - isPlainObject: function( obj ) { - var proto, Ctor; - - // Detect obvious negatives - // Use toString instead of jQuery.type to catch host objects - if ( !obj || toString.call( obj ) !== "[object Object]" ) { - return false; - } - - proto = getProto( obj ); - - // Objects with no prototype (e.g., `Object.create( null )`) are plain - if ( !proto ) { - return true; - } - - // Objects with prototype are plain iff they were constructed by a global Object function - Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; - return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - type: function( obj ) { + function toType( obj ) { if ( obj == null ) { return obj + ""; } @@ -332,369 +140,469 @@ jQuery.extend( { return typeof obj === "object" || typeof obj === "function" ? class2type[ toString.call( obj ) ] || "object" : typeof obj; - }, + } + /* global Symbol */ +// Defining this global in .eslintrc.json would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module - // Evaluates a script in a global context - globalEval: function( code ) { - DOMEval( code ); - }, - // Convert dashed to camelCase; used by the css and data modules - // Support: IE <=9 - 11, Edge 12 - 13 - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, + var version = "3.7.0", - each: function( obj, callback ) { - var length, i = 0; + rhtmlSuffix = /HTML$/i, - if ( isArrayLike( obj ) ) { - length = obj.length; - for ( ; i < length; i++ ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } else { - for ( i in obj ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } + // Define a local copy of jQuery + jQuery = function( selector, context ) { - return obj; - }, - - // Support: Android <=4.0 only - trim: function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArrayLike( Object( arr ) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : indexOf.call( arr, elem, i ); - }, - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - for ( ; j < len; j++ ) { - first[ i++ ] = second[ j ]; - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var length, value, - i = 0, - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArrayLike( elems ) ) { - length = elems.length; - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var tmp, args, proxy; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); }; - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; + jQuery.fn = jQuery.prototype = { - return proxy; - }, + // The current version of jQuery being used + jquery: version, - now: Date.now, + constructor: jQuery, - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); + // The default length of a jQuery object is 0 + length: 0, -// JSHint would error on this code due to the Symbol not being defined in ES5. -// Defining this global in .jshintrc would create a danger of using the global -// unguarded in another place, it seems safer to just disable JSHint for these -// three lines. -/* jshint ignore: start */ -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} -/* jshint ignore: end */ + toArray: function() { + return slice.call( this ); + }, -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), -function( i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -} ); + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { -function isArrayLike( obj ) { + // Return all the elements in a clean array + if ( num == null ) { + return slice.call( this ); + } - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = jQuery.type( obj ); + // Return just the one element from the set + return num < 0 ? this[ num + this.length ] : this[ num ]; + }, - if ( type === "function" || jQuery.isWindow( obj ) ) { - return false; - } + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.3.0 - * https://sizzlejs.com/ - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2016-01-04 - */ -(function( window ) { + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, + // Add the old object onto the stack (as a reference) + ret.prevObject = this; - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, + // Return the newly-formed element set + return ret; + }, - // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + even: function() { + return this.pushStack( jQuery.grep( this, function( _elem, i ) { + return ( i + 1 ) % 2; + } ) ); + }, + + odd: function() { + return this.pushStack( jQuery.grep( this, function( _elem, i ) { + return i % 2; + } ) ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice + }; + + jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; } - return 0; - }, - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[i] === elem ) { - return i; + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + copy = options[ name ]; + + // Prevent Object.prototype pollution + // Prevent never-ending loop + if ( name === "__proto__" || target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = Array.isArray( copy ) ) ) ) { + src = target[ name ]; + + // Ensure proper type for the source value + if ( copyIsArray && !Array.isArray( src ) ) { + clone = []; + } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { + clone = {}; + } else { + clone = src; + } + copyIsArray = false; + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } } } - return -1; - }, - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + // Return the modified object + return target; + }; - // Regular expressions + jQuery.extend( { - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", + // Assume jQuery is ready without the ready module + isReady: true, - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + - "*\\]", + error: function( msg ) { + throw new Error( msg ); + }, - pseudos = ":(" + identifier + ")(?:\\((" + - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - // 3. anything else (capture 2) - ".*" + - ")\\)|)", + noop: function() {}, - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + isPlainObject: function( obj ) { + var proto, Ctor; - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + proto = getProto( obj ); - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } - matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, + isEmptyObject: function( obj ) { + var name; - rnative = /^[^{]+\{\s*\[native \w/, + for ( name in obj ) { + return false; + } + return true; + }, - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + // Evaluates a script in a provided context; falls back to the global one + // if not specified. + globalEval: function( code, options, doc ) { + DOMEval( code, { nonce: options && options.nonce }, doc ); + }, - rsibling = /[+~]/, + each: function( obj, callback ) { + var length, i = 0; - // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox<24 - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - high < 0 ? - // BMP codepoint - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { + return obj; + }, + + + // Retrieve the text value of an array of DOM nodes + text: function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + + // If no nodeType, this is expected to be an array + while ( ( node = elem[ i++ ] ) ) { + + // Do not traverse comment nodes + ret += jQuery.text( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + return elem.textContent; + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + + // Do not include comment or processing instruction nodes + + return ret; + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + isXMLDoc: function( elem ) { + var namespace = elem && elem.namespaceURI, + docElem = elem && ( elem.ownerDocument || elem ).documentElement; + + // Assume HTML when documentElement doesn't yet exist, such as inside + // document fragments. + return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return flat( ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support + } ); + + if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; + } + +// Populate the class2type map + jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), + function( _i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); + } ); + + function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = toType( obj ); + + if ( isFunction( obj ) || isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; + } + + + function nodeName( elem, name ) { + + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + + } + var pop = arr.pop; + + + var sort = arr.sort; + + + var splice = arr.splice; + + + var whitespace = "[\\x20\\t\\r\\n\\f]"; + + + var rtrimCSS = new RegExp( + "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", + "g" + ); + + + + +// Note: an element does not contain itself + jQuery.contains = function( a, b ) { + var bup = b && b.parentNode; + + return a === bup || !!( bup && bup.nodeType === 1 && ( + + // Support: IE 9 - 11+ + // IE doesn't have `contains` on SVG. + a.contains ? + a.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + ) ); + }; + + + + +// CSS string/identifier serialization +// https://drafts.csswg.org/cssom/#common-serializing-idioms + var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; + + function fcssescape( ch, asCodePoint ) { if ( asCodePoint ) { // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER @@ -708,931 +616,946 @@ var i, // Other potentially-special ASCII characters get backslash-escaped return "\\" + ch; - }, + } - // Used for iframes - // See setDocument() - // Removing the function wrapper causes a "Permission Denied" - // error in IE - unloadHandler = function() { - setDocument(); - }, + jQuery.escapeSelector = function( sel ) { + return ( sel + "" ).replace( rcssescape, fcssescape ); + }; - disabledAncestor = addCombinator( - function( elem ) { - return elem.disabled === true; - }, - { dir: "parentNode", next: "legend" } - ); + + + + var preferredDoc = document, + pushNative = push; + + ( function() { + + var i, + Expr, + outermostContext, + sortInput, + hasDuplicate, + push = pushNative, + + // Local document vars + document, + documentElement, + documentIsHTML, + rbuggyQSA, + matches, + + // Instance-specific data + expando = jQuery.expando, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + nonnativeSelectorCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + + "loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram + identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", + + // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + + whitespace + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + + whitespace + "*" ), + rdescend = new RegExp( whitespace + "|>" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + ID: new RegExp( "^#(" + identifier + ")" ), + CLASS: new RegExp( "^\\.(" + identifier + ")" ), + TAG: new RegExp( "^(" + identifier + "|[*])" ), + ATTR: new RegExp( "^" + attributes ), + PSEUDO: new RegExp( "^" + pseudos ), + CHILD: new RegExp( + "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + bool: new RegExp( "^(?:" + booleans + ")$", "i" ), + + // For use in libraries implementing .is() + // We use this for POS matching in `select` + needsContext: new RegExp( "^" + whitespace + + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + + // CSS escapes + // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + + "?|\\\\([^\\r\\n\\f])", "g" ), + funescape = function( escape, nonHex ) { + var high = "0x" + escape.slice( 1 ) - 0x10000; + + if ( nonHex ) { + + // Strip the backslash prefix from a non-hex escape sequence + return nonHex; + } + + // Replace a hexadecimal escape sequence with the encoded Unicode code point + // Support: IE <=11+ + // For values outside the Basic Multilingual Plane (BMP), manually construct a + // surrogate pair + return high < 0 ? + String.fromCharCode( high + 0x10000 ) : + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // Used for iframes; see `setDocument`. + // Support: IE 9 - 11+, Edge 12 - 18+ + // Removing the function wrapper causes a "Permission Denied" + // error in IE/Edge. + unloadHandler = function() { + setDocument(); + }, + + inDisabledFieldset = addCombinator( + function( elem ) { + return elem.disabled === true && nodeName( elem, "fieldset" ); + }, + { dir: "parentNode", next: "legend" } + ); + +// Support: IE <=9 only +// Accessing document.activeElement can throw unexpectedly +// https://bugs.jquery.com/ticket/13393 + function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } + } // Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, match, groups, newSelector, - newContext = context && context.ownerDocument, - - // nodeType defaults to 9, since context defaults to document - nodeType = context ? context.nodeType : 9; - - results = results || []; - - // Return early from calls with invalid selector or context - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - // Try to shortcut find operations (as opposed to filters) in HTML documents - if ( !seed ) { - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - context = context || document; - - if ( documentIsHTML ) { - - // If the selector is sufficiently simple, try using a "get*By*" DOM method - // (excepting DocumentFragment context, where the methods don't exist) - if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { - - // ID selector - if ( (m = match[1]) ) { - - // Document context - if ( nodeType === 9 ) { - if ( (elem = context.getElementById( m )) ) { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - - // Element context - } else { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( newContext && (elem = newContext.getElementById( m )) && - contains( context, elem ) && - elem.id === m ) { - - results.push( elem ); - return results; - } - } - - // Type selector - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Class selector - } else if ( (m = match[3]) && support.getElementsByClassName && - context.getElementsByClassName ) { - - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // Take advantage of querySelectorAll - if ( support.qsa && - !compilerCache[ selector + " " ] && - (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - - if ( nodeType !== 1 ) { - newContext = context; - newSelector = selector; - - // qSA looks outside Element context, which is not what we want - // Thanks to Andrew Dupont for this workaround technique - // Support: IE <=8 - // Exclude object elements - } else if ( context.nodeName.toLowerCase() !== "object" ) { - - // Capture the context ID, setting it first if necessary - if ( (nid = context.getAttribute( "id" )) ) { - nid = nid.replace( rcssescape, fcssescape ); - } else { - context.setAttribute( "id", (nid = expando) ); - } - - // Prefix every selector in the list - groups = tokenize( selector ); - i = groups.length; - while ( i-- ) { - groups[i] = "#" + nid + " " + toSelector( groups[i] ); - } - newSelector = groups.join( "," ); - - // Expand context for sibling selectors - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || - context; - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key + " " ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created element and returns a boolean result - */ -function assert( fn ) { - var el = document.createElement("fieldset"); - - try { - return !!fn( el ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( el.parentNode ) { - el.parentNode.removeChild( el ); - } - // release memory in IE - el = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for :enabled/:disabled - * @param {Boolean} disabled true for :disabled; false for :enabled - */ -function createDisabledPseudo( disabled ) { - // Known :disabled false positives: - // IE: *[disabled]:not(button, input, select, textarea, optgroup, option, menuitem, fieldset) - // not IE: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable - return function( elem ) { - - // Check form elements and option elements for explicit disabling - return "label" in elem && elem.disabled === disabled || - "form" in elem && elem.disabled === disabled || - - // Check non-disabled form elements for fieldset[disabled] ancestors - "form" in elem && elem.disabled === false && ( - // Support: IE6-11+ - // Ancestry is covered for us - elem.isDisabled === disabled || - - // Otherwise, assume any non-