diff --git a/public/src/admin/appearance/customise.js b/public/src/admin/appearance/customise.js index 25ed9430ec..5e9a943e79 100644 --- a/public/src/admin/appearance/customise.js +++ b/public/src/admin/appearance/customise.js @@ -22,7 +22,7 @@ define('admin/appearance/customise', ['admin/settings', 'ace/ace'], function (Se }; function initACE(aceElementId, mode, holder) { - var editorEl = ace.edit(aceElementId, { + const editorEl = ace.edit(aceElementId, { mode: 'ace/mode/' + mode, theme: 'ace/theme/twilight', maxLines: 30, diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 1c20521640..01fa8dc1cb 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -1,6 +1,6 @@ 'use strict'; -const hooks = require('./modules/hooks'); +const hooks = require('hooks'); const { render } = require('./widgets'); window.ajaxify = window.ajaxify || {}; @@ -326,6 +326,7 @@ ajaxify.widgets = { render: render }; ajaxify.loadScript = function (tpl_url, callback) { let location = !app.inAdmin ? 'forum/' : ''; + if (tpl_url.startsWith('admin')) { location = ''; } diff --git a/public/src/app.js b/public/src/app.js index 5406a225d8..f67f8355e3 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -25,7 +25,6 @@ app.currentRoom = null; app.widgets = {}; app.flags = {}; - (function () { let appLoaded = false; const isTouchDevice = utils.isTouchDevice(); diff --git a/public/src/client/test.js b/public/src/client/test.js deleted file mode 100644 index 4d7a9e39eb..0000000000 --- a/public/src/client/test.js +++ /dev/null @@ -1,103 +0,0 @@ -import 'jquery-ui/ui/widgets/datepicker'; -import Sortable from 'sortablejs'; -import semver from 'semver'; -import * as autocomplete from 'autocomplete'; -// we are using browser colorpicker -// import { enable as colorpickerEnable } from '../admin/modules/colorpicker'; -import * as api from 'api'; -import * as alerts from 'alerts'; - -export function init() { - console.log('should be true semver.gt("1.1.1", "1.0.0")', semver.gt('1.1.1', '1.0.0')); - $('#change-skin').val(config.bootswatchSkin); - - $('#inputTags').tagsinput({ - confirmKeys: [13, 44], - trimValue: true, - }); - - $('#inputBirthday').datepicker({ - changeMonth: true, - changeYear: true, - yearRange: '1900:-5y', - defaultDate: '-13y', - }); - - $('#change-language').on('click', function () { - config.userLang = 'tr'; - var languageCode = utils.userLangToTimeagoCode(config.userLang); - import(/* webpackChunkName: "timeago/[request]" */ 'timeago/locales/jquery.timeago.' + languageCode).then(function () { - overrides.overrideTimeago(); - ajaxify.refresh(); - }); - }); - - // colorpickerEnable($('#colorpicker')); - - autocomplete.user($('#autocomplete')); - - Sortable.create($('#sortable-list')[0], {}); - - var data = $('#form-serialize').serializeObject(); - $('#json-form-data').text(JSON.stringify(data, null, 2)); - - $('#form-deserialize').deserialize({ - foo: [1, 2], - moo: 'it works', - }); - - $('#change-skin').change(async function () { - var newSkin = $(this).val(); - api.put(`/users/${app.user.uid}/settings`, { - settings: { - postsPerPage: 20, - topicsPerPage: 20, - bootswatchSkin: newSkin, - } - }).then((newSettings) => { - config.bootswatchSkin = newSkin; - reskin(newSkin); - }).catch(alerts.error); - }); - - // copied from account/settings - async function reskin(skinName) { - const clientEl = Array.prototype.filter.call(document.querySelectorAll('link[rel="stylesheet"]'), function (el) { - return el.href.indexOf(config.relative_path + '/assets/client') !== -1; - })[0] || null; - if (!clientEl) { - return; - } - - const currentSkinClassName = $('body').attr('class').split(/\s+/).filter(function (className) { - return className.startsWith('skin-'); - }); - if (!currentSkinClassName[0]) { - return; - } - let currentSkin = currentSkinClassName[0].slice(5); - currentSkin = currentSkin !== 'noskin' ? currentSkin : ''; - - // Stop execution if skin didn't change - if (skinName === currentSkin) { - return; - } - - const linkEl = document.createElement('link'); - linkEl.rel = 'stylesheet'; - linkEl.type = 'text/css'; - linkEl.href = config.relative_path + '/assets/client' + (skinName ? '-' + skinName : '') + '.css'; - linkEl.onload = function () { - clientEl.parentNode.removeChild(clientEl); - - // Update body class with proper skin name - $('body').removeClass(currentSkinClassName.join(' ')); - $('body').addClass('skin-' + (skinName || 'noskin')); - }; - - document.head.appendChild(linkEl); - } -} - -const testPage = { init }; -export default testPage; \ No newline at end of file diff --git a/public/src/utils.common.js b/public/src/utils.common.js index 926ec0804d..6a462ee3b5 100644 --- a/public/src/utils.common.js +++ b/public/src/utils.common.js @@ -448,14 +448,6 @@ const utils = { return !utils.isAbsoluteUrl(url); }, - makeNumbersHumanReadable: function (elements) { - elements.each(function () { - $(this) - .html(utils.makeNumberHumanReadable($(this).attr('title'))) - .removeClass('hidden'); - }); - }, - makeNumberHumanReadable: function (num) { const n = parseInt(num, 10); if (!n) { @@ -469,14 +461,6 @@ const utils = { return n; }, - addCommasToNumbers: function (elements) { - elements.each(function (index, element) { - $(element) - .html(utils.addCommas($(element).html())) - .removeClass('hidden'); - }); - }, - // takes a string like 1000 and returns 1,000 addCommas: function (text) { return String(text).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,'); diff --git a/src/meta/js.js b/src/meta/js.js index c1f540d4d5..69ab76f369 100644 --- a/src/meta/js.js +++ b/src/meta/js.js @@ -14,7 +14,6 @@ const minifier = require('./minifier'); const JS = module.exports; - JS.scripts = { base: [ 'node_modules/@adactive/bootstrap-tagsinput/src/bootstrap-tagsinput.js', diff --git a/src/routes/debug.js b/src/routes/debug.js index 508c349961..b4ad76721f 100644 --- a/src/routes/debug.js +++ b/src/routes/debug.js @@ -13,16 +13,6 @@ module.exports = function (app) { res.redirect(404); }); - // const { setupPageRoute } = require('./helpers'); - // setupPageRoute(app, '/debug/test', middleware, [], async (req, res) => { - // // res.redirect(404); - // const meta = require('../meta'); - // res.render('test', { - // now: new Date().toISOString(), - // skins: [{ name: 'no-skin', value: '' }].concat(meta.css.supportedSkins.map(s => ({ name: s, value: s }))), - // }); - // }); - // Redoc router.get('/spec/:type', async (req, res, next) => { const types = ['read', 'write']; diff --git a/src/views/test.tpl b/src/views/test.tpl deleted file mode 100644 index 9282e39028..0000000000 --- a/src/views/test.tpl +++ /dev/null @@ -1,59 +0,0 @@ - - -
- - - -
- - - -
- - - -
- - -
- -
- - -
-
- - - -
- - -
- -
-
- - -
- - - -
-

-
- - -
- - - -
-
\ No newline at end of file