Use require() instead of import in client code

Closes #895
This commit is contained in:
Pavel Djundik 2017-03-18 11:21:18 +02:00
parent 52cc3ee909
commit dcefcd19cb
15 changed files with 44 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"),