Merge pull request #973 from thelounge/xpaw/use-require

Use require() instead of import in client code
This commit is contained in:
Jérémie Astori 2017-03-31 01:41:29 -04:00 committed by GitHub
commit 4363ef4abe
16 changed files with 45 additions and 19 deletions

View File

@ -1,3 +0,0 @@
---
parserOptions:
sourceType: module

View File

@ -1,3 +1,5 @@
"use strict";
// Generates a string from "color-1" to "color-32" based on an input string // Generates a string from "color-1" to "color-32" based on an input string
module.exports = function(str) { module.exports = function(str) {
var hash = 0; var hash = 0;

View File

@ -1,3 +1,5 @@
"use strict";
var diff; var diff;
module.exports = function(a, opt) { module.exports = function(a, opt) {

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = function(a, b, opt) { module.exports = function(a, b, opt) {
a = a.toString(); a = a.toString();
b = b.toString(); b = b.toString();

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = function(time) { module.exports = function(time) {
return new Date(time).toLocaleDateString(); return new Date(time).toLocaleDateString();
}; };

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = function(time) { module.exports = function(time) {
return new Date(time).toLocaleString(); return new Date(time).toLocaleString();
}; };

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = function(mode) { module.exports = function(mode) {
var modes = { var modes = {
"~": "owner", "~": "owner",

View File

@ -1,5 +1,7 @@
import Handlebars from "handlebars/runtime"; "use strict";
import URI from "urijs";
const Handlebars = require("handlebars/runtime");
const URI = require("urijs");
module.exports = function(text) { module.exports = function(text) {
text = Handlebars.Utils.escapeExpression(text); text = Handlebars.Utils.escapeExpression(text);

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = function(count) { module.exports = function(count) {
if (count < 1000) { if (count < 1000) {
return count; return count;

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = function(context) { module.exports = function(context) {
return window.JSON.stringify(context); return window.JSON.stringify(context);
}; };

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = function(time) { module.exports = function(time) {
time = new Date(time); time = new Date(time);
var h = time.getHours(); var h = time.getHours();

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = function(count) { module.exports = function(count) {
return count + " " + (count === 1 ? "user" : "users"); return count + " " + (count === 1 ? "user" : "users");
}; };

View File

@ -1,7 +1,9 @@
"use strict";
/** /**
* Simple slideout menu implementation. * Simple slideout menu implementation.
*/ */
export default function slideoutMenu(viewport, menu) { module.exports = function slideoutMenu(viewport, menu) {
var touchStartPos = null; var touchStartPos = null;
var touchCurPos = null; var touchCurPos = null;
var touchStartTime = 0; var touchStartTime = 0;
@ -98,4 +100,4 @@ export default function slideoutMenu(viewport, menu) {
return menuIsOpen; return menuIsOpen;
} }
}; };
} };

View File

@ -1,18 +1,20 @@
"use strict";
// vendor libraries // vendor libraries
import "jquery-ui/ui/widgets/sortable"; require("jquery-ui/ui/widgets/sortable");
import $ from "jquery"; const $ = require("jquery");
import io from "socket.io-client"; const io = require("socket.io-client");
import Mousetrap from "mousetrap"; const Mousetrap = require("mousetrap");
import URI from "urijs"; const URI = require("urijs");
// our libraries // our libraries
import "./libs/jquery/inputhistory"; require("./libs/jquery/inputhistory");
import "./libs/jquery/stickyscroll"; require("./libs/jquery/stickyscroll");
import "./libs/jquery/tabcomplete"; require("./libs/jquery/tabcomplete");
import helpers_parse from "./libs/handlebars/parse"; const helpers_parse = require("./libs/handlebars/parse");
import helpers_roundBadgeNumber from "./libs/handlebars/roundBadgeNumber"; const helpers_roundBadgeNumber = require("./libs/handlebars/roundBadgeNumber");
import slideoutMenu from "./libs/slideout"; const slideoutMenu = require("./libs/slideout");
import templates from "../views"; const templates = require("../views");
$(function() { $(function() {
var path = window.location.pathname + "socket.io/"; var path = window.location.pathname + "socket.io/";

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = { module.exports = {
actions: { actions: {
action: require("./actions/action.tpl"), action: require("./actions/action.tpl"),

View File

@ -74,6 +74,7 @@ let config = {
if (process.env.NODE_ENV === "production") { if (process.env.NODE_ENV === "production") {
config.plugins.push(new webpack.optimize.UglifyJsPlugin({ config.plugins.push(new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
comments: false comments: false
})); }));
} else { } else {