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
module.exports = function(str) {
var hash = 0;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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