@@ -41,9 +41,9 @@ export function createThing({
// permissions = {}
}) {
const $thing = $tmpl.cloneNode(true);
- if (!$thing instanceof window.HTMLElement) throw new Error("assertion failed: $thing must be an HTMLELement");
+ if (!($thing instanceof window.HTMLElement)) throw new Error("assertion failed: $thing must be an HTMLELement");
const $label = $thing.querySelector(".component_filename .file-details > span");
- if (!$label instanceof window.HTMLElement) throw new Error("assertion failed: $label must be an HTMLELement");
+ if (!($label instanceof window.HTMLElement)) throw new Error("assertion failed: $label must be an HTMLELement");
$label.textContent = name;
$thing.querySelector("a").setAttribute("href", link);
@@ -54,6 +54,6 @@ export function createThing({
e.preventDefault();
e.stopPropagation();
addSelection(name, type);
- }
+ };
return $thing;
}
diff --git a/public/assets/pages/viewerpage/application_3d.js b/public/assets/pages/viewerpage/application_3d.js
index 297af542..87f10842 100644
--- a/public/assets/pages/viewerpage/application_3d.js
+++ b/public/assets/pages/viewerpage/application_3d.js
@@ -6,7 +6,7 @@ import { join } from "../../lib/path.js";
import { createLoader } from "../../components/loader.js";
import { getDownloadUrl } from "./common.js";
-import * as THREE from "../../lib/vendor/three/three.module.js"
+import * as THREE from "../../lib/vendor/three/three.module.js";
import { OrbitControls } from "../../lib/vendor/three/OrbitControls.js";
import { GLTFLoader } from "../../lib/vendor/three/GLTFLoader.js";
import { OBJLoader } from "../../lib/vendor/three/OBJLoader.js";
@@ -70,15 +70,15 @@ export default function(render, { mime }) {
// resize handler
const onResize = () => {
camera.aspect = $page.clientWidth / $page.clientHeight;
- camera.updateProjectionMatrix();
+ camera.updateProjectionMatrix();
renderer.setSize($page.clientWidth, $page.clientHeight);
};
window.addEventListener("resize", onResize);
onDestroy(() => window.removeEventListener("resize", onResize));
return rxjs.animationFrames().pipe(rxjs.tap(() => {
- controls.update();
- renderer.render(scene, camera);
+ controls.update();
+ renderer.render(scene, camera);
}));
}),
rxjs.catchError(ctrlError()),
@@ -87,7 +87,7 @@ export default function(render, { mime }) {
function getLoader(mime) {
const identity = (s) => s;
- switch(mime) {
+ switch (mime) {
case "application/object":
return [new OBJLoader(), identity];
case "model/3dm":
diff --git a/public/assets/pages/viewerpage/application_audio.js b/public/assets/pages/viewerpage/application_audio.js
index ff747c04..c2793922 100644
--- a/public/assets/pages/viewerpage/application_audio.js
+++ b/public/assets/pages/viewerpage/application_audio.js
@@ -6,7 +6,6 @@ import { loadCSS, loadJS } from "../../helpers/loader.js";
import { settings_get, settings_put } from "../../lib/settings.js";
import Chromecast from "../../lib/chromecast.js";
import assert from "../../lib/assert.js";
-import { basename, extname } from "../../lib/path.js";
import ctrlError from "../ctrl_error.js";
import { render as renderMenubar } from "../../components/menubar.js";
@@ -16,14 +15,9 @@ import { ICON } from "./common_icon.js";
import { formatTimecode } from "./common_player.js";
import { transition, getDownloadUrl } from "./common.js";
-import { getSession } from "../../model/session.js";
-import { get as getConfig } from "../../model/config.js";
-
-import "../../components/menubar.js";
-
const STATUS_PLAYING = "PLAYING";
const STATUS_PAUSED = "PAUSED";
-const STATUS_BUFFERING = "BUFFERING";
+// const STATUS_BUFFERING = "BUFFERING";
export default function(render, { mime }) {
const $page = createElement(`
@@ -80,7 +74,7 @@ export default function(render, { mime }) {
const currentTime$ = new rxjs.BehaviorSubject([
0, // starting time - does change when seeking to another point
0, // offset to align the audio context currentTime. otherwise when seeking, the
- // currentTime keep growing and progress bar goes haywire
+ // currentTime keep growing and progress bar goes haywire
]);
const currentTime = (wavesurfer) => {
return currentTime$.value[0] + (wavesurfer.backend.ac.currentTime - currentTime$.value[1]);
@@ -125,7 +119,7 @@ export default function(render, { mime }) {
default:
assert.fail(status);
}
- }
+ };
const setSeek = (newTime, wavesurfer) => {
currentTime$.next([newTime, wavesurfer.backend.ac.currentTime]);
wavesurfer.backend.source.stop(0);
@@ -137,7 +131,7 @@ export default function(render, { mime }) {
// feature1: setup the dom
const setup$ = rxjs.of(qs($page, "#waveform")).pipe(
- rxjs.mergeMap(($node) => Promise.resolve(WaveSurfer.create({
+ rxjs.mergeMap(($node) => Promise.resolve(window.WaveSurfer.create({
container: $node,
interact: false,
@@ -151,13 +145,13 @@ export default function(render, { mime }) {
rxjs.tap((wavesurfer) => {
wavesurfer.load(getDownloadUrl());
wavesurfer.on("error", (err) => { // TODO: one liner to check
- throw new Error(err)
+ throw new Error(err);
});
wavesurfer.on("ready", () => {
$control.main.classList.remove("hidden");
qs($control.main, "#totalDuration").textContent = formatTimecode(wavesurfer.getDuration());
});
- onDestroy(() => wavesurfer.destroy())
+ onDestroy(() => wavesurfer.destroy());
}),
rxjs.catchError(ctrlError()),
rxjs.shareReplay(1),
@@ -188,7 +182,7 @@ export default function(render, { mime }) {
wavesurfer.on("ready", () => observer.next(wavesurfer));
})),
rxjs.share(),
- )
+ );
effect(ready$.pipe(rxjs.tap((wavesurfer) => {
wavesurfer.backend.createSource();
wavesurfer.backend.startPosition = 0;
@@ -207,7 +201,7 @@ export default function(render, { mime }) {
rxjs.mergeMap((status) => setup$.pipe(rxjs.tap((wavesurfer) => setStatus(status, wavesurfer)))),
rxjs.switchMap((wavesurfer) => rxjs.animationFrames().pipe(
rxjs.tap(() => {
- const _currentTime = currentTime(wavesurfer)
+ const _currentTime = currentTime(wavesurfer);
const percent = _currentTime / wavesurfer.getDuration();
if (percent > 1) return;
wavesurfer.drawer.progress(percent);
@@ -254,12 +248,13 @@ export default function(render, { mime }) {
rxjs.switchMap((wavesurfer) => rxjs.fromEvent(document, "keydown").pipe(
rxjs.map((e) => e.code),
rxjs.tap((code) => {
- switch(code) {
+ switch (code) {
case "Space":
case "KeyK":
setStatus(
- wavesurfer.backend.ac.state === "suspended" ?
- STATUS_PLAYING : STATUS_PAUSED,
+ wavesurfer.backend.ac.state === "suspended"
+ ? STATUS_PLAYING
+ : STATUS_PAUSED,
wavesurfer,
);
break;
@@ -276,7 +271,7 @@ export default function(render, { mime }) {
setSeek(Math.min(wavesurfer.getDuration(), currentTime(wavesurfer) + 10), wavesurfer);
break;
case "KeyF":
- chromecastLoader();
+ // chromecastLoader();
break;
case "KeyJ":
setSeek(Math.max(0, currentTime(wavesurfer) - 10), wavesurfer);
@@ -374,7 +369,7 @@ export function init() {
function setup_chromecast() {
if (!("chrome" in window)) {
return Promise.resolve();
- } else if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
+ } else if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
return Promise.resolve();
}
// if (!CONFIG.enable_chromecast) {
diff --git a/public/assets/pages/viewerpage/application_ebook.js b/public/assets/pages/viewerpage/application_ebook.js
index e9dd8536..e02843c1 100644
--- a/public/assets/pages/viewerpage/application_ebook.js
+++ b/public/assets/pages/viewerpage/application_ebook.js
@@ -23,8 +23,8 @@ export default function(render) {
// feature1: setup the dom
const setup$ = rxjs.of(qs($page, `[data-bind="epub"]`)).pipe(
- rxjs.mergeMap(async ($epub) => {
- const book = new ePub.Book({
+ rxjs.mergeMap(async($epub) => {
+ const book = new window.ePub.Book({
replacements: "blobUrl",
});
const rendition = book.renderTo($epub, {
@@ -60,7 +60,7 @@ export default function(render) {
rendition$.pipe(rxjs.mergeMap(() => rxjs.fromEvent(qs(document, "iframe").contentDocument.body, "keydown"))),
)),
rxjs.map((e) => {
- switch(e.code) {
+ switch (e.code) {
case "Space": return (r) => r.next();
case "ArrowRight": return (r) => r.next();
case "PageDown": return (r) => r.next();
@@ -69,10 +69,12 @@ export default function(render) {
}
return null;
}),
- rxjs.mergeMap((fn) => fn === null ? rxjs.EMPTY : rendition$.asObservable().pipe(
- rxjs.first(),
- rxjs.tap((rendition) => fn(rendition))
- )),
+ rxjs.mergeMap((fn) => fn === null
+ ? rxjs.EMPTY
+ : rendition$.asObservable().pipe(
+ rxjs.first(),
+ rxjs.tap((rendition) => fn(rendition))
+ )),
rxjs.catchError(ctrlError()),
));
}
diff --git a/public/assets/pages/viewerpage/application_editor.js b/public/assets/pages/viewerpage/application_editor.js
index d0135898..b5ebbd0e 100644
--- a/public/assets/pages/viewerpage/application_editor.js
+++ b/public/assets/pages/viewerpage/application_editor.js
@@ -72,7 +72,7 @@ export default async function(render) {
const editor = window.CodeMirror($editor, {
value: content,
lineNumbers: true,
- mode: CodeMirror.__mode,
+ mode: window.CodeMirror.__mode,
keyMap: ["emacs", "vim"].indexOf(config["editor"]) === -1 ? "sublime" : config["editor"],
lineWrapping: true,
readOnly: !/PUT/.test(acl),
@@ -110,20 +110,20 @@ export default async function(render) {
effect(setup$.pipe(
rxjs.switchMap((editor) => new rxjs.Observable((observer) => editor.on("change", (cm) => observer.next(cm)))),
rxjs.mergeMap((editor) => content$.pipe(rxjs.map((oldContent) => [editor, editor.getValue(), oldContent]))),
- rxjs.tap(async ([editor, newContent = "", oldContent = ""]) => {
+ rxjs.tap(async([editor, newContent = "", oldContent = ""]) => {
if ($fab.disabled) return;
const $breadcrumb = qs(document.body, `[is="component-breadcrumb"]`);
if (newContent === oldContent) {
await animate($fab, { time: 100, keyframes: opacityOut() });
$fab.classList.add("hidden");
$breadcrumb.removeAttribute("indicator");
- return
+ return;
}
$breadcrumb.setAttribute("indicator", "true");
const shouldAnimate = $fab.classList.contains("hidden");
$fab.classList.remove("hidden");
$fab.render($ICON.SAVING);
- $fab.onclick = () => CodeMirror.commands.save(editor);
+ $fab.onclick = () => window.CodeMirror.commands.save(editor);
if (shouldAnimate) await animate($fab, { time: 100, keyframes: slideXIn(40) });
}),
@@ -132,11 +132,11 @@ export default async function(render) {
// feature4: save
effect(setup$.pipe(
rxjs.mergeMap((editor) => new rxjs.Observable((observer) => {
- CodeMirror.commands.save = (cm) => observer.next(cm);
+ window.CodeMirror.commands.save = (cm) => observer.next(cm);
})),
rxjs.mergeMap((cm) => {
$fab.classList.remove("hidden");
- $fab.render($ICON.LOADING)
+ $fab.render($ICON.LOADING);
$fab.disabled = true;
return rxjs.of(cm.getValue()).pipe(
saveFile$(),
@@ -151,7 +151,7 @@ export default async function(render) {
// feature5: save on exit
effect(setup$.pipe(
- rxjs.tap((cm) => window.history.block = async (href) => {
+ rxjs.tap((cm) => window.history.block = async(href) => {
const block = qs(document.body, `[is="component-breadcrumb"]`).hasAttribute("indicator");
if (block === false) return false;
@@ -173,10 +173,10 @@ export default async function(render) {
Do you want to save the changes ?
- `, { onQuit: () => {done(false)} }));
- })
+ `, { onQuit: () => { done(false); } }));
+ });
}),
- ))
+ ));
}
function has_binary(str) {
diff --git a/public/assets/pages/viewerpage/application_editor/clike.js b/public/assets/pages/viewerpage/application_editor/clike.js
index 06ef1b6d..b9d9c5b9 100644
--- a/public/assets/pages/viewerpage/application_editor/clike.js
+++ b/public/assets/pages/viewerpage/application_editor/clike.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/clike/clike.js";
-CodeMirror.__mode = "text/x-c++src";
-export default CodeMirror;
+window.CodeMirror.__mode = "text/x-c++src";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/clojure.js b/public/assets/pages/viewerpage/application_editor/clojure.js
index 26ddf71a..f8467023 100644
--- a/public/assets/pages/viewerpage/application_editor/clojure.js
+++ b/public/assets/pages/viewerpage/application_editor/clojure.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/clojure/clojure.js";
-CodeMirror.__mode = "clojure";
-export default CodeMirror;
+window.CodeMirror.__mode = "clojure";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/cmake.js b/public/assets/pages/viewerpage/application_editor/cmake.js
index 1be7b0b1..f7221663 100644
--- a/public/assets/pages/viewerpage/application_editor/cmake.js
+++ b/public/assets/pages/viewerpage/application_editor/cmake.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/cmake/cmake.js";
-CodeMirror.__mode = "cmake";
-export default CodeMirror;
+window.CodeMirror.__mode = "cmake";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/commonlisp.js b/public/assets/pages/viewerpage/application_editor/commonlisp.js
index 7bfcdb7d..a7b25982 100644
--- a/public/assets/pages/viewerpage/application_editor/commonlisp.js
+++ b/public/assets/pages/viewerpage/application_editor/commonlisp.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/commonlisp/commonlisp.js";
-CodeMirror.__mode = "commonlisp";
-export default CodeMirror;
+window.CodeMirror.__mode = "commonlisp";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/css.js b/public/assets/pages/viewerpage/application_editor/css.js
index 0bd016cc..f063f319 100644
--- a/public/assets/pages/viewerpage/application_editor/css.js
+++ b/public/assets/pages/viewerpage/application_editor/css.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/css/css.js";
-CodeMirror.__mode = "css";
-export default CodeMirror;
+window.CodeMirror.__mode = "css";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/diff.js b/public/assets/pages/viewerpage/application_editor/diff.js
index d2f797c0..93ab930f 100644
--- a/public/assets/pages/viewerpage/application_editor/diff.js
+++ b/public/assets/pages/viewerpage/application_editor/diff.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/diff/diff.js";
-CodeMirror.__mode = "diff";
-export default CodeMirror;
+window.CodeMirror.__mode = "diff";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/dockerfile.js b/public/assets/pages/viewerpage/application_editor/dockerfile.js
index 491f9466..5507031e 100644
--- a/public/assets/pages/viewerpage/application_editor/dockerfile.js
+++ b/public/assets/pages/viewerpage/application_editor/dockerfile.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/dockerfile/dockerfile.js";
-CodeMirror.__mode = "dockerfile";
-export default CodeMirror;
+window.CodeMirror.__mode = "dockerfile";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/elm.js b/public/assets/pages/viewerpage/application_editor/elm.js
index 6e16b925..655e19ed 100644
--- a/public/assets/pages/viewerpage/application_editor/elm.js
+++ b/public/assets/pages/viewerpage/application_editor/elm.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/elm/elm.js";
-CodeMirror.__mode = "elm";
-export default CodeMirror;
+window.CodeMirror.__mode = "elm";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/emacs-org.js b/public/assets/pages/viewerpage/application_editor/emacs-org.js
index 2b9cc54d..c1c3b254 100644
--- a/public/assets/pages/viewerpage/application_editor/emacs-org.js
+++ b/public/assets/pages/viewerpage/application_editor/emacs-org.js
@@ -3,7 +3,6 @@ export const org_cycle = (cm) => {
isFold(cm, pos) ? unfold(cm, pos) : fold(cm, pos);
};
-
const state = {
stab: "CONTENT",
};
@@ -29,7 +28,6 @@ export const org_shifttab = (cm) => {
return state.stab;
};
-
function set_folding_mode(cm, mode) {
if (mode === "OVERVIEW") {
folding_mode_overview(cm);
@@ -43,7 +41,7 @@ function set_folding_mode(cm, mode) {
function folding_mode_overview(cm) {
cm.operation(function() {
for (let i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) {
- fold(cm, CodeMirror.Pos(i, 0));
+ fold(cm, window.CodeMirror.Pos(i, 0));
}
});
}
@@ -51,15 +49,15 @@ function set_folding_mode(cm, mode) {
cm.operation(function() {
let previous_header = null;
for (let i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) {
- fold(cm, CodeMirror.Pos(i, 0));
- if (/header/.test(cm.getTokenTypeAt(CodeMirror.Pos(i, 0))) === true) {
+ fold(cm, window.CodeMirror.Pos(i, 0));
+ if (/header/.test(cm.getTokenTypeAt(window.CodeMirror.Pos(i, 0))) === true) {
const level = cm.getLine(i).replace(/^(\*+).*/, "$1").length;
if (previous_header && level > previous_header.level) {
- unfold(cm, CodeMirror.Pos(previous_header.line, 0));
+ unfold(cm, window.CodeMirror.Pos(previous_header.line, 0));
}
previous_header = {
line: i,
- level: level,
+ level,
};
}
}
@@ -68,15 +66,14 @@ function set_folding_mode(cm, mode) {
function folding_mode_all(cm) {
cm.operation(function() {
for (let i = cm.firstLine(), e = cm.lastLine(); i <= e; i++) {
- if (/header/.test(cm.getTokenTypeAt(CodeMirror.Pos(i, 0))) === true) {
- unfold(cm, CodeMirror.Pos(i, 0));
+ if (/header/.test(cm.getTokenTypeAt(window.CodeMirror.Pos(i, 0))) === true) {
+ unfold(cm, window.CodeMirror.Pos(i, 0));
}
}
});
}
}
-
/*
* Promote heading or move table column to left.
*/
@@ -177,19 +174,18 @@ export const org_meta_return = (cm) => {
rearrange_list(cm, line);
} else if (p = isTitle(cm, line)) {
const tmp = previousOfType(cm, "title", line);
- const level = tmp && tmp.level || 1;
- cm.replaceRange("\n"+"*".repeat(level)+" ", { line: line, ch: content.length });
+ const level = (tmp && tmp.level) || 1;
+ cm.replaceRange("\n"+"*".repeat(level)+" ", { line, ch: content.length });
cm.setCursor({ line: line+1, ch: level+1 });
} else if (content.trim() === "") {
- cm.replaceRange("* ", { line: line, ch: 0 });
- cm.setCursor({ line: line, ch: 2 });
+ cm.replaceRange("* ", { line, ch: 0 });
+ cm.setCursor({ line, ch: 2 });
} else {
- cm.replaceRange("\n\n* ", { line: line, ch: content.length });
+ cm.replaceRange("\n\n* ", { line, ch: content.length });
cm.setCursor({ line: line + 2, ch: 2 });
}
};
-
const TODO_CYCLES = ["TODO", "DONE", ""];
/*
* Cycle the thing at point or in the current line, depending on context.
@@ -210,8 +206,8 @@ export const org_shiftleft = (cm) => {
params["status"] = cycles[cycles.indexOf(params["status"]) + 1];
cm.replaceRange(
makeTitle(params),
- { line: line, ch: 0 },
- { line: line, ch: content.length },
+ { line, ch: 0 },
+ { line, ch: content.length },
);
};
/*
@@ -234,8 +230,8 @@ export const org_shiftright = (cm) => {
params["status"] = cycles[cycles.indexOf(params["status"]) + 1];
cm.replaceRange(
makeTitle(params),
- { line: line, ch: 0 },
- { line: line, ch: content.length },
+ { line, ch: 0 },
+ { line, ch: content.length },
);
});
};
@@ -262,20 +258,19 @@ export const org_insert_todo_heading = (cm) => {
cm.setCursor({ line: p.end+1, ch: level*3+7 });
rearrange_list(cm, line);
} else if (p = isTitle(cm, line)) {
- const level = p && p.level || 1;
- cm.replaceRange("\n"+"*".repeat(level)+" TODO ", { line: line, ch: content.length });
+ const level = (p && p.level) || 1;
+ cm.replaceRange("\n"+"*".repeat(level)+" TODO ", { line, ch: content.length });
cm.setCursor({ line: line+1, ch: level+6 });
} else if (content.trim() === "") {
- cm.replaceRange("* TODO ", { line: line, ch: 0 });
- cm.setCursor({ line: line, ch: 7 });
+ cm.replaceRange("* TODO ", { line, ch: 0 });
+ cm.setCursor({ line, ch: 7 });
} else {
- cm.replaceRange("\n\n* TODO ", { line: line, ch: content.length });
+ cm.replaceRange("\n\n* TODO ", { line, ch: content.length });
cm.setCursor({ line: line + 2, ch: 7 });
}
});
};
-
/*
* Move subtree up or move table row up.
* Calls ‘org-move-subtree-up’ or ‘org-table-move-row’ or
@@ -347,7 +342,6 @@ export const org_metadown = (cm) => {
});
};
-
export const org_shiftmetaright = function(cm) {
cm.operation(() => {
const line = cm.getCursor().line;
@@ -379,7 +373,6 @@ export const org_shiftmetaleft = function(cm) {
});
};
-
function makeTitle(p) {
let content = "*".repeat(p["level"])+" ";
if (p["status"]) {
@@ -421,7 +414,7 @@ function isItemList(cm, line) {
level: padding / 2,
content: content.trimLeft().replace(/^\s*\-\s(.*)$/, "$1"),
start: line,
- end: function(_cm, _line) {
+ end: (function(_cm, _line) {
let line_candidate = _line;
let content = null;
do {
@@ -437,7 +430,7 @@ function isItemList(cm, line) {
}
} while (_line <= _cm.lineCount());
return line_candidate;
- }(cm, line),
+ }(cm, line)),
};
function findRootLine(_cm, _line) {
@@ -467,7 +460,7 @@ function isNumberedList(cm, line) {
level: padding / 3,
content: content.trimLeft().replace(/^[0-9]+[\.\)]\s(.*)$/, "$1"),
start: line,
- end: function(_cm, _line) {
+ end: (function(_cm, _line) {
let line_candidate = _line;
let content = null;
do {
@@ -483,7 +476,7 @@ function isNumberedList(cm, line) {
}
} while (_line <= _cm.lineCount());
return line_candidate;
- }(cm, line),
+ }(cm, line)),
// specific
n: parseInt(content.trimLeft().replace(/^([0-9]+).*$/, "$1")),
separator: content.trimLeft().replace(/^[0-9]+([\.\)]).*$/, "$1"),
@@ -514,7 +507,7 @@ function isTitle(cm, line, level) {
level: reference_level,
content: match[3],
start: line,
- end: function(_cm, _line) {
+ end: (function(_cm, _line) {
let line_candidate = _line;
let content = null;
do {
@@ -524,7 +517,7 @@ function isTitle(cm, line, level) {
const match = content.match(/^(\*+)\s.*/);
if (
match && match[1] &&
- ( match[1].length === reference_level || match[1].length < reference_level)
+ (match[1].length === reference_level || match[1].length < reference_level)
) {
break;
} else {
@@ -533,7 +526,7 @@ function isTitle(cm, line, level) {
}
} while (_line <= _cm.lineCount());
return line_candidate;
- }(cm, line),
+ }(cm, line)),
// specific
status: match[2].trim(),
};
@@ -566,7 +559,6 @@ function rearrange_list(cm, line) {
}
}
-
if (p = (isNumberedList(cm, i) || isItemList(cm, i))) {
// rearrange spacing levels in list
if (last_p) {
@@ -582,7 +574,6 @@ function rearrange_list(cm, line) {
}
}
-
last_p = p;
// we can process content block instead of line
if (p) {
@@ -607,13 +598,13 @@ function rearrange_list(cm, line) {
let i;
for (i=range[0]; i<=range[1]; i++) {
content = cm.getLine(i).trimLeft();
- const n_spaces = function(_level, _line, _type) {
+ const n_spaces = (function(_level, _line, _type) {
let spaces = _level * 3;
if (_line > 0) {
spaces += _type === "numbered" ? 3 : 2;
}
return spaces;
- }(level, i - range[0], type);
+ }(level, i - range[0], type));
content = " ".repeat(n_spaces) + content;
cm.replaceRange(
@@ -629,8 +620,8 @@ function rearrange_list(cm, line) {
const new_content = content.replace(/[0-9]+\./, level+".");
cm.replaceRange(
new_content,
- { line: line, ch: 0 },
- { line: line, ch: content.length },
+ { line, ch: 0 },
+ { line, ch: content.length },
);
}
@@ -720,9 +711,9 @@ export function unfold(cm, start) {
}
export function isFold(cm, start) {
const line = start.line;
- const marks = cm.findMarks(CodeMirror.Pos(line, 0), CodeMirror.Pos(line + 1, 0));
+ const marks = cm.findMarks(window.CodeMirror.Pos(line, 0), window.CodeMirror.Pos(line + 1, 0));
for (let i = 0; i < marks.length; ++i) {
- if (marks[i].__isFold && marks[i].find().from.line == line) return marks[i];
+ if (marks[i].__isFold && marks[i].find().from.line === line) return marks[i];
}
return false;
}
diff --git a/public/assets/pages/viewerpage/application_editor/erlang.js b/public/assets/pages/viewerpage/application_editor/erlang.js
index 903fb7b3..e4d56ade 100644
--- a/public/assets/pages/viewerpage/application_editor/erlang.js
+++ b/public/assets/pages/viewerpage/application_editor/erlang.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/erlang/erlang.js";
-CodeMirror.__mode = "erlang";
-export default CodeMirror;
+window.CodeMirror.__mode = "erlang";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/go.js b/public/assets/pages/viewerpage/application_editor/go.js
index 9638ff4e..9c0cfeb3 100644
--- a/public/assets/pages/viewerpage/application_editor/go.js
+++ b/public/assets/pages/viewerpage/application_editor/go.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/go/go.js";
-CodeMirror.__mode = "go";
-export default CodeMirror;
+window.CodeMirror.__mode = "go";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/htmlmixed.js b/public/assets/pages/viewerpage/application_editor/htmlmixed.js
index 63cc7f4b..7fcc8e52 100644
--- a/public/assets/pages/viewerpage/application_editor/htmlmixed.js
+++ b/public/assets/pages/viewerpage/application_editor/htmlmixed.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/htmlmixed/htmlmixed.js";
-CodeMirror.__mode = "htmlmixed";
-export default CodeMirror;
+window.CodeMirror.__mode = "htmlmixed";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/java.js b/public/assets/pages/viewerpage/application_editor/java.js
index 7babdfaf..de9b5ebf 100644
--- a/public/assets/pages/viewerpage/application_editor/java.js
+++ b/public/assets/pages/viewerpage/application_editor/java.js
@@ -1,3 +1,3 @@
import "./clike.js";
-CodeMirror.__mode = "text/x-java";
-export default CodeMirror;
+window.CodeMirror.__mode = "text/x-java";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/javascript.js b/public/assets/pages/viewerpage/application_editor/javascript.js
index 42c0908d..3cb2feb1 100644
--- a/public/assets/pages/viewerpage/application_editor/javascript.js
+++ b/public/assets/pages/viewerpage/application_editor/javascript.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/javascript/javascript.js";
-CodeMirror.__mode = "javascript";
-export default CodeMirror;
+window.CodeMirror.__mode = "javascript";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/jsx.js b/public/assets/pages/viewerpage/application_editor/jsx.js
index 838f6980..379462c7 100644
--- a/public/assets/pages/viewerpage/application_editor/jsx.js
+++ b/public/assets/pages/viewerpage/application_editor/jsx.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/jsx/jsx.js";
-CodeMirror.__mode = "jsx";
-export default CodeMirror;
+window.CodeMirror.__mode = "jsx";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/lua.js b/public/assets/pages/viewerpage/application_editor/lua.js
index 8d6eef3b..203a71d8 100644
--- a/public/assets/pages/viewerpage/application_editor/lua.js
+++ b/public/assets/pages/viewerpage/application_editor/lua.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/lua/lua.js";
-CodeMirror.__mode = "lua";
-export default CodeMirror;
+window.CodeMirror.__mode = "lua";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/orgmode.js b/public/assets/pages/viewerpage/application_editor/orgmode.js
index 697d393c..f2b8f615 100644
--- a/public/assets/pages/viewerpage/application_editor/orgmode.js
+++ b/public/assets/pages/viewerpage/application_editor/orgmode.js
@@ -1,313 +1,310 @@
-import "../../../lib/vendor/codemirror/addon/mode/simple.js";
-import {
- org_cycle, org_shifttab, org_metaleft, org_metaright, org_meta_return, org_metaup,
- org_metadown, org_insert_todo_heading, org_shiftleft, org_shiftright, fold, unfold,
- isFold, org_set_fold, org_shiftmetaleft, org_shiftmetaright,
-} from "./emacs-org.js";
+// import "../../../lib/vendor/codemirror/addon/mode/simple.js";
+// import {
+// org_cycle, org_shifttab, org_metaleft, org_metaright, org_meta_return, org_metaup,
+// org_metadown, org_insert_todo_heading, org_shiftleft, org_shiftright, fold, unfold,
+// isFold, org_set_fold, org_shiftmetaleft, org_shiftmetaright,
+// } from "./emacs-org.js";
-// TODO:
-// import { pathBuilder, dirname, currentShare } from "../../../helpers/";
+// // TODO:
+// // import { pathBuilder, dirname, currentShare } from "../../../helpers/";
-const CodeMirror = window.CodeMirror;
+// const CodeMirror = window.CodeMirror;
-CodeMirror.__mode = "orgmode";
+// CodeMirror.__mode = "orgmode";
-CodeMirror.defineSimpleMode("orgmode", {
- start: [
- { regex: /(\*\s)(TODO|DOING|WAITING|NEXT|PENDING|)(CANCELLED|CANCELED|CANCEL|DONE|REJECTED|STOP|STOPPED|)(\s+\[\#[A-C]\]\s+|)(.*?)(?:(\s{10,}|))(\:[\S]+\:|)$/, sol: true, token: ["header level1 org-level-star", "header level1 org-todo", "header level1 org-done", "header level1 org-priority", "header level1", "header level1 void", "header level1 comment"] },
- { regex: /(\*{1,}\s)(TODO|DOING|WAITING|NEXT|PENDING|)(CANCELLED|CANCELED|CANCEL|DEFERRED|DONE|REJECTED|STOP|STOPPED|)(\s+\[\#[A-C]\]\s+|)(.*?)(?:(\s{10,}|))(\:[\S]+\:|)$/, sol: true, token: ["header org-level-star", "header org-todo", "header org-done", "header org-priority", "header", "header void", "header comment"] },
- { regex: /(\+[^\+]+\+)/, token: ["strikethrough"] },
- { regex: /(\*[^\*]+\*)/, token: ["strong"] },
- { regex: /(\/[^\/]+\/)/, token: ["em"] },
- { regex: /(\_[^\_]+\_)/, token: ["link"] },
- { regex: /(\~[^\~]+\~)/, token: ["comment"] },
- { regex: /(\=[^\=]+\=)/, token: ["comment"] },
- { regex: /\[\[[^\[\]]+\]\[[^\[\]]+\]\]/, token: "org-url" }, // links
- { regex: /\[\[[^\[\]]+\]\]/, token: "org-image" }, // image
- { regex: /\[[xX\s\-\_]\]/, token: "qualifier org-toggle" }, // checkbox
- { regex: /\#\+(?:(BEGIN|begin))_[a-zA-Z]*/, token: "comment", next: "env", sol: true }, // comments
- { regex: /:?[A-Z_]+\:.*/, token: "comment", sol: true }, // property drawers
- { regex: /(\#\+[a-zA-Z_]*)(\:.*)/, token: ["keyword", "qualifier"], sol: true }, // environments
- { regex: /(CLOCK\:|SHEDULED\:|DEADLINE\:)(\s.+)/, token: ["comment", "keyword"] },
- ],
- env: [
- { regex: /\#\+(?:(END|end))_[a-zA-Z]*/, token: "comment", next: "start", sol: true },
- { regex: /.*/, token: "comment" },
- ],
-});
-CodeMirror.registerHelper("fold", "orgmode", function(cm, start) {
- // init
- const levelToMatch = headerLevel(start.line);
+// CodeMirror.defineSimpleMode("orgmode", {
+// start: [
+// { regex: /(\*\s)(TODO|DOING|WAITING|NEXT|PENDING|)(CANCELLED|CANCELED|CANCEL|DONE|REJECTED|STOP|STOPPED|)(\s+\[\#[A-C]\]\s+|)(.*?)(?:(\s{10,}|))(\:[\S]+\:|)$/, sol: true, token: ["header level1 org-level-star", "header level1 org-todo", "header level1 org-done", "header level1 org-priority", "header level1", "header level1 void", "header level1 comment"] },
+// { regex: /(\*{1,}\s)(TODO|DOING|WAITING|NEXT|PENDING|)(CANCELLED|CANCELED|CANCEL|DEFERRED|DONE|REJECTED|STOP|STOPPED|)(\s+\[\#[A-C]\]\s+|)(.*?)(?:(\s{10,}|))(\:[\S]+\:|)$/, sol: true, token: ["header org-level-star", "header org-todo", "header org-done", "header org-priority", "header", "header void", "header comment"] },
+// { regex: /(\+[^\+]+\+)/, token: ["strikethrough"] },
+// { regex: /(\*[^\*]+\*)/, token: ["strong"] },
+// { regex: /(\/[^\/]+\/)/, token: ["em"] },
+// { regex: /(\_[^\_]+\_)/, token: ["link"] },
+// { regex: /(\~[^\~]+\~)/, token: ["comment"] },
+// { regex: /(\=[^\=]+\=)/, token: ["comment"] },
+// { regex: /\[\[[^\[\]]+\]\[[^\[\]]+\]\]/, token: "org-url" }, // links
+// { regex: /\[\[[^\[\]]+\]\]/, token: "org-image" }, // image
+// { regex: /\[[xX\s\-\_]\]/, token: "qualifier org-toggle" }, // checkbox
+// { regex: /\#\+(?:(BEGIN|begin))_[a-zA-Z]*/, token: "comment", next: "env", sol: true }, // comments
+// { regex: /:?[A-Z_]+\:.*/, token: "comment", sol: true }, // property drawers
+// { regex: /(\#\+[a-zA-Z_]*)(\:.*)/, token: ["keyword", "qualifier"], sol: true }, // environments
+// { regex: /(CLOCK\:|SHEDULED\:|DEADLINE\:)(\s.+)/, token: ["comment", "keyword"] },
+// ],
+// env: [
+// { regex: /\#\+(?:(END|end))_[a-zA-Z]*/, token: "comment", next: "start", sol: true },
+// { regex: /.*/, token: "comment" },
+// ],
+// });
+// CodeMirror.registerHelper("fold", "orgmode", function(cm, start) {
+// // init
+// const levelToMatch = headerLevel(start.line);
- // no folding needed
- if (levelToMatch === null) return;
+// // no folding needed
+// if (levelToMatch === null) return;
- // find folding limits
- const lastLine = cm.lastLine();
- let end = start.line;
- while (end < lastLine) {
- end += 1;
- const level = headerLevel(end);
- if (level && level <= levelToMatch) {
- end = end - 1;
- break;
- };
- }
+// // find folding limits
+// const lastLine = cm.lastLine();
+// let end = start.line;
+// while (end < lastLine) {
+// end += 1;
+// const level = headerLevel(end);
+// if (level && level <= levelToMatch) {
+// end = end - 1;
+// break;
+// };
+// }
- return {
- from: CodeMirror.Pos(start.line, cm.getLine(start.line).length),
- to: CodeMirror.Pos(end, cm.getLine(end).length),
- };
+// return {
+// from: CodeMirror.Pos(start.line, cm.getLine(start.line).length),
+// to: CodeMirror.Pos(end, cm.getLine(end).length),
+// };
- function headerLevel(lineNo) {
- const line = cm.getLine(lineNo);
- const match = /^\*+/.exec(line);
- if (match && match.length === 1 && /header/.test(cm.getTokenTypeAt(CodeMirror.Pos(lineNo, 0)))) {
- return match[0].length;
- }
- return null;
- }
-});
-CodeMirror.registerGlobalHelper("fold", "drawer", function(mode) {
- return mode.name === "orgmode" ? true : false;
-}, function(cm, start) {
- const drawer = isBeginningOfADrawer(start.line);
- if (drawer === false) return;
+// function headerLevel(lineNo) {
+// const line = cm.getLine(lineNo);
+// const match = /^\*+/.exec(line);
+// if (match && match.length === 1 && /header/.test(cm.getTokenTypeAt(CodeMirror.Pos(lineNo, 0)))) {
+// return match[0].length;
+// }
+// return null;
+// }
+// });
+// CodeMirror.registerGlobalHelper("fold", "drawer", function(mode) {
+// return mode.name === "orgmode";
+// }, function(cm, start) {
+// const drawer = isBeginningOfADrawer(start.line);
+// if (drawer === false) return;
- // find folding limits
- const lastLine = cm.lastLine();
- let end = start.line;
- while (end < lastLine) {
- end += 1;
- if (isEndOfADrawer(end)) {
- break;
- }
- }
+// // find folding limits
+// const lastLine = cm.lastLine();
+// let end = start.line;
+// while (end < lastLine) {
+// end += 1;
+// if (isEndOfADrawer(end)) {
+// break;
+// }
+// }
- return {
- from: CodeMirror.Pos(start.line, cm.getLine(start.line).length),
- to: CodeMirror.Pos(end, cm.getLine(end).length),
- };
+// return {
+// from: CodeMirror.Pos(start.line, cm.getLine(start.line).length),
+// to: CodeMirror.Pos(end, cm.getLine(end).length),
+// };
- function isBeginningOfADrawer(lineNo) {
- const line = cm.getLine(lineNo);
- const match = /^\:.*\:$/.exec(line);
- if (match && match.length === 1 && match[0] !== ":END:") {
- return true;
- }
- return false;
- }
- function isEndOfADrawer(lineNo) {
- const line = cm.getLine(lineNo);
- return line.trim() === ":END:" ? true : false;
- }
-});
+// function isBeginningOfADrawer(lineNo) {
+// const line = cm.getLine(lineNo);
+// const match = /^\:.*\:$/.exec(line);
+// if (match && match.length === 1 && match[0] !== ":END:") {
+// return true;
+// }
+// return false;
+// }
+// function isEndOfADrawer(lineNo) {
+// const line = cm.getLine(lineNo);
+// return line.trim() === ":END:";
+// }
+// });
+// CodeMirror.registerHelper("orgmode", "init", (editor, fn) => {
+// editor.setOption("extraKeys", {
+// Tab: (cm) => org_cycle(cm),
+// "Shift-Tab": (cm) => fn("shifttab", org_shifttab(cm)),
+// "Alt-Left": (cm) => org_metaleft(cm),
+// "Alt-Right": (cm) => org_metaright(cm),
+// "Alt-Enter": (cm) => org_meta_return(cm),
+// "Alt-Up": (cm) => org_metaup(cm),
+// "Alt-Down": (cm) => org_metadown(cm),
+// "Shift-Alt-Left": (cm) => org_shiftmetaleft(cm),
+// "Shift-Alt-Right": (cm) => org_shiftmetaright(cm),
+// "Shift-Alt-Enter": (cm) => org_insert_todo_heading(cm),
+// "Shift-Left": (cm) => org_shiftleft(cm),
+// "Shift-Right": (cm) => org_shiftright(cm),
+// });
+// fn("shifttab", org_set_fold(editor));
-CodeMirror.registerHelper("orgmode", "init", (editor, fn) => {
- editor.setOption("extraKeys", {
- "Tab": (cm) => org_cycle(cm),
- "Shift-Tab": (cm) => fn("shifttab", org_shifttab(cm)),
- "Alt-Left": (cm) => org_metaleft(cm),
- "Alt-Right": (cm) => org_metaright(cm),
- "Alt-Enter": (cm) => org_meta_return(cm),
- "Alt-Up": (cm) => org_metaup(cm),
- "Alt-Down": (cm) => org_metadown(cm),
- "Shift-Alt-Left": (cm) => org_shiftmetaleft(cm),
- "Shift-Alt-Right": (cm) => org_shiftmetaright(cm),
- "Shift-Alt-Enter": (cm) => org_insert_todo_heading(cm),
- "Shift-Left": (cm) => org_shiftleft(cm),
- "Shift-Right": (cm) => org_shiftright(cm),
- });
- fn("shifttab", org_set_fold(editor));
+// editor.on("mousedown", toggleHandler);
+// editor.on("touchstart", toggleHandler);
+// editor.on("gutterClick", foldLine);
- editor.on("mousedown", toggleHandler);
- editor.on("touchstart", toggleHandler);
- editor.on("gutterClick", foldLine);
+// // fold everything except headers by default
+// editor.operation(function() {
+// for (let i = 0; i < editor.lineCount(); i++) {
+// if (/header/.test(editor.getTokenTypeAt(CodeMirror.Pos(i, 0))) === false) {
+// fold(editor, CodeMirror.Pos(i, 0));
+// }
+// }
+// });
+// return CodeMirror.orgmode.destroy.bind(this, editor);
+// });
- // fold everything except headers by default
- editor.operation(function() {
- for (let i = 0; i < editor.lineCount(); i++) {
- if (/header/.test(editor.getTokenTypeAt(CodeMirror.Pos(i, 0))) === false) {
- fold(editor, CodeMirror.Pos(i, 0));
- }
- }
- });
- return CodeMirror.orgmode.destroy.bind(this, editor);
-});
+// CodeMirror.registerHelper("orgmode", "destroy", (editor) => {
+// editor.off("mousedown", toggleHandler);
+// editor.off("touchstart", toggleHandler);
+// editor.off("gutterClick", foldLine);
+// });
-CodeMirror.registerHelper("orgmode", "destroy", (editor) => {
- editor.off("mousedown", toggleHandler);
- editor.off("touchstart", toggleHandler);
- editor.off("gutterClick", foldLine);
-});
+// function foldLine(cm, line) {
+// const cursor = { line, ch: 0 };
+// isFold(cm, cursor) ? unfold(cm, cursor) : fold(cm, cursor);
+// }
-function foldLine(cm, line) {
- const cursor = { line: line, ch: 0 };
- isFold(cm, cursor) ? unfold(cm, cursor) : fold(cm, cursor);
-}
+// let widgets = [];
+// function toggleHandler(cm, e) {
+// const position = cm.coordsChar({
+// left: e.clientX || (e.targetTouches && e.targetTouches[0].clientX),
+// top: e.clientY || (e.targetTouches && e.targetTouches[0].clientY),
+// }, "page");
+// const token = cm.getTokenAt(position);
+// _disableSelection();
+// if (/org-level-star/.test(token.type)) {
+// _preventIfShould();
+// _foldHeadline();
+// _disableSelection();
+// } else if (/org-toggle/.test(token.type)) {
+// _preventIfShould();
+// _toggleCheckbox();
+// _disableSelection();
+// } else if (/org-todo/.test(token.type)) {
+// _preventIfShould();
+// _toggleTodo();
+// _disableSelection();
+// } else if (/org-done/.test(token.type)) {
+// _preventIfShould();
+// _toggleDone();
+// _disableSelection();
+// } else if (/org-priority/.test(token.type)) {
+// _preventIfShould();
+// _togglePriority();
+// _disableSelection();
+// } else if (/org-url/.test(token.type)) {
+// _disableSelection();
+// _navigateLink();
+// } else if (/org-image/.test(token.type)) {
+// _disableSelection();
+// _toggleImageWidget();
+// }
-let widgets = [];
-function toggleHandler(cm, e) {
- const position = cm.coordsChar({
- left: e.clientX || (e.targetTouches && e.targetTouches[0].clientX),
- top: e.clientY || (e.targetTouches && e.targetTouches[0].clientY),
- }, "page");
- const token = cm.getTokenAt(position);
+// function _preventIfShould() {
+// if ("ontouchstart" in window) e.preventDefault();
+// }
+// function _disableSelection() {
+// cm.on("beforeSelectionChange", _onSelectionChangeHandler);
+// function _onSelectionChangeHandler(cm, obj) {
+// obj.update([{
+// anchor: position,
+// head: position,
+// }]);
+// cm.off("beforeSelectionChange", _onSelectionChangeHandler);
+// }
+// }
- _disableSelection();
- if (/org-level-star/.test(token.type)) {
- _preventIfShould();
- _foldHeadline();
- _disableSelection();
- } else if (/org-toggle/.test(token.type)) {
- _preventIfShould();
- _toggleCheckbox();
- _disableSelection();
- } else if (/org-todo/.test(token.type)) {
- _preventIfShould();
- _toggleTodo();
- _disableSelection();
- } else if (/org-done/.test(token.type)) {
- _preventIfShould();
- _toggleDone();
- _disableSelection();
- } else if (/org-priority/.test(token.type)) {
- _preventIfShould();
- _togglePriority();
- _disableSelection();
- } else if (/org-url/.test(token.type)) {
- _disableSelection();
- _navigateLink();
- } else if (/org-image/.test(token.type)) {
- _disableSelection();
- _toggleImageWidget();
- }
+// function _foldHeadline() {
+// const line = position.line;
+// if (line >= 0) {
+// const cursor = { line, ch: 0 };
+// isFold(cm, cursor) ? unfold(cm, cursor) : fold(cm, cursor);
+// }
+// }
- function _preventIfShould() {
- if ("ontouchstart" in window) e.preventDefault();
- }
- function _disableSelection() {
- cm.on("beforeSelectionChange", _onSelectionChangeHandler);
- function _onSelectionChangeHandler(cm, obj) {
- obj.update([{
- anchor: position,
- head: position,
- }]);
- cm.off("beforeSelectionChange", _onSelectionChangeHandler);
- }
- }
+// function _toggleCheckbox() {
+// const line = position.line;
+// const content = cm.getRange(
+// { line, ch: token.start },
+// { line, ch: token.end },
+// );
+// const new_content = content === "[X]" || content === "[x]" ? "[ ]" : "[X]";
+// cm.replaceRange(
+// new_content,
+// { line, ch: token.start },
+// { line, ch: token.end },
+// );
+// }
- function _foldHeadline() {
- const line = position.line;
- if (line >= 0) {
- const cursor = { line: line, ch: 0 };
- isFold(cm, cursor) ? unfold(cm, cursor) : fold(cm, cursor);
- }
- }
+// function _toggleTodo() {
+// const line = position.line;
+// cm.replaceRange(
+// "DONE",
+// { line, ch: token.start },
+// { line, ch: token.end },
+// );
+// }
- function _toggleCheckbox() {
- const line = position.line;
- const content = cm.getRange(
- { line: line, ch: token.start },
- { line: line, ch: token.end },
- );
- const new_content = content === "[X]" || content === "[x]" ? "[ ]" : "[X]";
- cm.replaceRange(
- new_content,
- { line: line, ch: token.start },
- { line: line, ch: token.end },
- );
- }
+// function _toggleDone() {
+// const line = position.line;
+// cm.replaceRange(
+// "TODO",
+// { line, ch: token.start },
+// { line, ch: token.end },
+// );
+// }
- function _toggleTodo() {
- const line = position.line;
- cm.replaceRange(
- "DONE",
- { line: line, ch: token.start },
- { line: line, ch: token.end },
- );
- }
+// function _togglePriority() {
+// const PRIORITIES = [" [#A] ", " [#B] ", " [#C] ", " [#A] "];
+// const line = position.line;
+// const content = cm.getRange({ line, ch: token.start }, { line, ch: token.end });
+// const new_content = PRIORITIES[PRIORITIES.indexOf(content) + 1];
+// cm.replaceRange(
+// new_content,
+// { line, ch: token.start },
+// { line, ch: token.end },
+// );
+// }
- function _toggleDone() {
- const line = position.line;
- cm.replaceRange(
- "TODO",
- { line: line, ch: token.start },
- { line: line, ch: token.end },
- );
- }
+// function _toggleImageWidget() {
+// const exist = !!widgets
+// .filter((line) => line === position.line)[0];
- function _togglePriority() {
- const PRIORITIES = [" [#A] ", " [#B] ", " [#C] ", " [#A] "];
- const line = position.line;
- const content = cm.getRange({ line: line, ch: token.start }, { line: line, ch: token.end });
- const new_content = PRIORITIES[PRIORITIES.indexOf(content) + 1];
- cm.replaceRange(
- new_content,
- { line: line, ch: token.start },
- { line: line, ch: token.end },
- );
- }
+// if (exist === false) {
+// if (!token.string.match(/\[\[(.*)\]\]/)) return null;
+// const $node = _buildImage(RegExp.$1);
+// const widget = cm.addLineWidget(position.line, $node, { coverGutter: false });
+// widgets.push(position.line);
+// $node.addEventListener("click", closeWidget);
- function _toggleImageWidget() {
- const exist = !!widgets
- .filter((line) => line === position.line)[0];
+// function closeWidget() {
+// widget.clear();
+// $node.removeEventListener("click", closeWidget);
+// widgets = widgets.filter((line) => line !== position.line);
+// }
+// }
+// function _buildImage(src) {
+// const $el = document.createElement("div");
+// const $img = document.createElement("img");
- if (exist === false) {
- if (!token.string.match(/\[\[(.*)\]\]/)) return null;
- const $node = _buildImage(RegExp.$1);
- const widget = cm.addLineWidget(position.line, $node, { coverGutter: false });
- widgets.push(position.line);
- $node.addEventListener("click", closeWidget);
+// if (/^https?\:\/\//.test(src)) {
+// $img.src = src;
+// } else {
+// const root_path = dirname(window.location.pathname.replace(/^\/view/, ""));
+// const img_path = src;
+// $img.src = "/api/files/cat?path="+encodeURIComponent(pathBuilder(root_path, img_path));
+// }
+// $el.appendChild($img);
+// return $el;
+// }
+// return null;
+// }
- function closeWidget() {
- widget.clear();
- $node.removeEventListener("click", closeWidget);
- widgets = widgets.filter((line) => line !== position.line);
- }
- }
- function _buildImage(src) {
- const $el = document.createElement("div");
- const $img = document.createElement("img");
+// function _navigateLink() {
+// token.string.match(/\[\[(.*?)\]\[/);
+// const link = RegExp.$1;
+// if (!link) return;
- if (/^https?\:\/\//.test(src)) {
- $img.src = src;
- } else {
- const root_path = dirname(window.location.pathname.replace(/^\/view/, ""));
- const img_path = src;
- $img.src = "/api/files/cat?path="+encodeURIComponent(pathBuilder(root_path, img_path));
- }
- $el.appendChild($img);
- return $el;
- }
- return null;
- }
+// let open = "_blank";
+// const isMobile = screen.availWidth < screen.availHeight;
+// if (!document.querySelector(".component_fab img.component_icon[alt=\"save\"]")) {
+// open = "_self";
+// } else if (isMobile) {
+// open = "_self";
+// }
- function _navigateLink() {
- token.string.match(/\[\[(.*?)\]\[/);
- const link = RegExp.$1;
- if (!link) return;
+// if (/^https?\:\/\//.test(link)) {
+// window.open(link, open);
+// } else {
+// const root_path = dirname(window.location.pathname.replace(/^\/view/, ""));
+// const share = currentShare();
+// const url = share ? "/view"+pathBuilder(root_path, link)+"?share="+share : "/view"+pathBuilder(root_path, link);
+// window.open(url, open);
+// }
+// }
+// }
- let open = "_blank";
- const isMobile = screen.availWidth < screen.availHeight;
- if (!document.querySelector(".component_fab img.component_icon[alt=\"save\"]")) {
- open = "_self";
- } else if (isMobile) {
- open = "_self";
- }
-
- if (/^https?\:\/\//.test(link)) {
- window.open(link, open);
- } else {
- const root_path = dirname(window.location.pathname.replace(/^\/view/, ""));
- const share = currentShare();
- const url = share ? "/view"+pathBuilder(root_path, link)+"?share="+share : "/view"+pathBuilder(root_path, link);
- window.open(url, open);
- }
- }
-}
-
-
-export default CodeMirror;
+// export default CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/perl.js b/public/assets/pages/viewerpage/application_editor/perl.js
index adcf5dc2..a3d7fe65 100644
--- a/public/assets/pages/viewerpage/application_editor/perl.js
+++ b/public/assets/pages/viewerpage/application_editor/perl.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/perl/perl.js";
-CodeMirror.__mode = "perl";
-export default CodeMirror;
+window.CodeMirror.__mode = "perl";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/php.js b/public/assets/pages/viewerpage/application_editor/php.js
index 05302d03..005bfd79 100644
--- a/public/assets/pages/viewerpage/application_editor/php.js
+++ b/public/assets/pages/viewerpage/application_editor/php.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/php/php.js";
-CodeMirror.__mode = "php";
-export default CodeMirror;
+window.CodeMirror.__mode = "php";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/properties.js b/public/assets/pages/viewerpage/application_editor/properties.js
index c308255f..ac61b413 100644
--- a/public/assets/pages/viewerpage/application_editor/properties.js
+++ b/public/assets/pages/viewerpage/application_editor/properties.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/properties/properties.js";
-CodeMirror.__mode = "properties";
-export default CodeMirror;
+window.CodeMirror.__mode = "properties";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/python.js b/public/assets/pages/viewerpage/application_editor/python.js
index a50cca82..37eda046 100644
--- a/public/assets/pages/viewerpage/application_editor/python.js
+++ b/public/assets/pages/viewerpage/application_editor/python.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/python/python.js";
-CodeMirror.__mode = "python";
-export default CodeMirror;
+window.CodeMirror.__mode = "python";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/r.js b/public/assets/pages/viewerpage/application_editor/r.js
index b1bb546e..dbc17c25 100644
--- a/public/assets/pages/viewerpage/application_editor/r.js
+++ b/public/assets/pages/viewerpage/application_editor/r.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/r/r.js";
-CodeMirror.__mode = "r";
-export default CodeMirror;
+window.CodeMirror.__mode = "r";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/ruby.js b/public/assets/pages/viewerpage/application_editor/ruby.js
index 6917a4fc..c8f79439 100644
--- a/public/assets/pages/viewerpage/application_editor/ruby.js
+++ b/public/assets/pages/viewerpage/application_editor/ruby.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/ruby/ruby.js";
-CodeMirror.__mode = "ruby";
-export default CodeMirror;
+window.CodeMirror.__mode = "ruby";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/rust.js b/public/assets/pages/viewerpage/application_editor/rust.js
index c271b8fa..947405ef 100644
--- a/public/assets/pages/viewerpage/application_editor/rust.js
+++ b/public/assets/pages/viewerpage/application_editor/rust.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/rust/rust.js";
-CodeMirror.__mode = "rust";
-export default CodeMirror;
+window.CodeMirror.__mode = "rust";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/sass.js b/public/assets/pages/viewerpage/application_editor/sass.js
index 342af3e3..fcbefe08 100644
--- a/public/assets/pages/viewerpage/application_editor/sass.js
+++ b/public/assets/pages/viewerpage/application_editor/sass.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/sass/sass.js";
-CodeMirror.__mode = "sass";
-export default CodeMirror;
+window.CodeMirror.__mode = "sass";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/shell.js b/public/assets/pages/viewerpage/application_editor/shell.js
index 5da71d5a..34ca0e18 100644
--- a/public/assets/pages/viewerpage/application_editor/shell.js
+++ b/public/assets/pages/viewerpage/application_editor/shell.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/shell/shell.js";
-CodeMirror.__mode = "shell";
-export default CodeMirror;
+window.CodeMirror.__mode = "shell";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/sparql.js b/public/assets/pages/viewerpage/application_editor/sparql.js
index c780585d..404aa75f 100644
--- a/public/assets/pages/viewerpage/application_editor/sparql.js
+++ b/public/assets/pages/viewerpage/application_editor/sparql.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/sparql/sparql.js";
-CodeMirror.__mode = "sparql";
-export default CodeMirror;
+window.CodeMirror.__mode = "sparql";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/spreadsheet.js b/public/assets/pages/viewerpage/application_editor/spreadsheet.js
index a2293c46..7f0894c5 100644
--- a/public/assets/pages/viewerpage/application_editor/spreadsheet.js
+++ b/public/assets/pages/viewerpage/application_editor/spreadsheet.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/spreadsheet/spreadsheet.js";
-CodeMirror.__mode = "spreadsheet";
-export default CodeMirror;
+window.CodeMirror.__mode = "spreadsheet";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/sql.js b/public/assets/pages/viewerpage/application_editor/sql.js
index eff773a6..0152da46 100644
--- a/public/assets/pages/viewerpage/application_editor/sql.js
+++ b/public/assets/pages/viewerpage/application_editor/sql.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/sql/sql.js";
-CodeMirror.__mode = "sql";
-export default CodeMirror;
+window.CodeMirror.__mode = "sql";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/stex.js b/public/assets/pages/viewerpage/application_editor/stex.js
index 9104d267..3b68050d 100644
--- a/public/assets/pages/viewerpage/application_editor/stex.js
+++ b/public/assets/pages/viewerpage/application_editor/stex.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/stex/stex.js";
-CodeMirror.__mode = "stex";
-export default CodeMirror;
+window.CodeMirror.__mode = "stex";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/text.js b/public/assets/pages/viewerpage/application_editor/text.js
index a4c29d3f..c8946124 100644
--- a/public/assets/pages/viewerpage/application_editor/text.js
+++ b/public/assets/pages/viewerpage/application_editor/text.js
@@ -1 +1 @@
-export default CodeMirror;
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/xml.js b/public/assets/pages/viewerpage/application_editor/xml.js
index a17cf9d1..e1cc0267 100644
--- a/public/assets/pages/viewerpage/application_editor/xml.js
+++ b/public/assets/pages/viewerpage/application_editor/xml.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/xml/xml.js";
-CodeMirror.__mode = "xml";
-export default CodeMirror;
+window.CodeMirror.__mode = "xml";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/yaml-frontmatter.js b/public/assets/pages/viewerpage/application_editor/yaml-frontmatter.js
index 414cc5ee..922bda9f 100644
--- a/public/assets/pages/viewerpage/application_editor/yaml-frontmatter.js
+++ b/public/assets/pages/viewerpage/application_editor/yaml-frontmatter.js
@@ -1,4 +1,4 @@
import "../../../lib/vendor/codemirror/mode/gfm/gfm.js";
import "../../../lib/vendor/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js";
-CodeMirror.__mode = "yaml-frontmatter";
-export default CodeMirror;
+window.CodeMirror.__mode = "yaml-frontmatter";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor/yaml.js b/public/assets/pages/viewerpage/application_editor/yaml.js
index 27031728..51ca9190 100644
--- a/public/assets/pages/viewerpage/application_editor/yaml.js
+++ b/public/assets/pages/viewerpage/application_editor/yaml.js
@@ -1,3 +1,3 @@
import "../../../lib/vendor/codemirror/mode/yaml/yaml.js";
-CodeMirror.__mode = "yaml";
-export default CodeMirror;
+window.CodeMirror.__mode = "yaml";
+export default window.CodeMirror;
diff --git a/public/assets/pages/viewerpage/application_editor_orgmode.js b/public/assets/pages/viewerpage/application_editor_orgmode.js
index 14ffe45b..6ba02887 100644
--- a/public/assets/pages/viewerpage/application_editor_orgmode.js
+++ b/public/assets/pages/viewerpage/application_editor_orgmode.js
@@ -1,5 +1,5 @@
export default function(editor) {
- CodeMirror.orgmode.init(editor, (key, value) => {
+ window.CodeMirror.orgmode.init(editor, (key, value) => {
if (key === "shifttab") {
// org_shifttab(this.state.editor)
// this.props.onFoldChange(value);
diff --git a/public/assets/pages/viewerpage/application_form.js b/public/assets/pages/viewerpage/application_form.js
index 0893f06b..c2290f05 100644
--- a/public/assets/pages/viewerpage/application_form.js
+++ b/public/assets/pages/viewerpage/application_form.js
@@ -3,7 +3,7 @@ import rxjs, { effect, applyMutation, onClick } from "../../lib/rx.js";
import { animate, slideXIn, opacityOut } from "../../lib/animate.js";
import { qs, qsa } from "../../lib/dom.js";
import { loadCSS } from "../../helpers/loader.js";
-import { createForm, mutateForm } from "../../lib/form.js";
+import { createForm } from "../../lib/form.js";
import { formTmpl } from "../../components/form.js";
import ctrlError from "../ctrl_error.js";
@@ -77,10 +77,10 @@ export default function(render) {
),
).pipe(
rxjs.map((originalState) => {
- const smod = (key, value) => value ? value : undefined;
+ const smod = (key, value) => value || undefined;
return JSON.stringify(originalState, smod) !== JSON.stringify(formState(), smod);
}),
- rxjs.mergeMap(async (isSaveButtonVisible) => {
+ rxjs.mergeMap(async(isSaveButtonVisible) => {
if (isSaveButtonVisible && $fab.classList.contains("hidden")) {
$fab.render($ICON.SAVING);
$fab.classList.remove("hidden");
@@ -96,7 +96,7 @@ export default function(render) {
// feature3: submit the form
effect(onClick($fab).pipe(
rxjs.tap(() => {
- $fab.render($ICON.LOADING)
+ $fab.render($ICON.LOADING);
$fab.disabled = true;
}),
rxjs.mergeMap(($fab) => rxjs.of(JSON.stringify(formState())).pipe(
diff --git a/public/assets/pages/viewerpage/application_iframe.js b/public/assets/pages/viewerpage/application_iframe.js
index d1ee573f..db72c8a5 100644
--- a/public/assets/pages/viewerpage/application_iframe.js
+++ b/public/assets/pages/viewerpage/application_iframe.js
@@ -17,13 +17,13 @@ export default function(render, opts = {}) {
effect(rxjs.fromEvent(window, "message").pipe(
rxjs.filter((event) => event.origin === location.origin),
rxjs.tap((event) => { // TODO: notification
- switch(event.data.type) {
+ switch (event.data.type) {
case "notify::info":
- notify.send(t(event.data.message), "info");
+ // notify.send(t(event.data.message), "info");
break;
case "notify::error":
- notify.send(t(event.data.message), "error");
- break
+ // notify.send(t(event.data.message), "error");
+ break;
}
}),
));
diff --git a/public/assets/pages/viewerpage/application_image.js b/public/assets/pages/viewerpage/application_image.js
index 0e5e2ba6..9d0018c8 100644
--- a/public/assets/pages/viewerpage/application_image.js
+++ b/public/assets/pages/viewerpage/application_image.js
@@ -9,7 +9,7 @@ import ctrlError from "../ctrl_error.js";
import { transition, getDownloadUrl } from "./common.js";
import componentMetadata from "./application_image_metadata.js";
-import componentPager, { init as initPager} from "./component_pager.js";
+import componentPager, { init as initPager } from "./component_pager.js";
import "../../components/menubar.js";
@@ -36,13 +36,14 @@ export default function(render) {
rxjs.tap(($node) => {
$node.classList.remove("hidden");
animate($node, {
- time: 300, easing: "cubic-bezier(.51,.92,.24,1.15)",
+ time: 300,
+ easing: "cubic-bezier(.51,.92,.24,1.15)",
keyframes: [
{ opacity: 0, transform: "scale(.97)" },
{ opacity: 1 },
- { opacity: 1, transform: "scale(1)" },
+ { opacity: 1, transform: "scale(1)" },
],
- })
+ });
}),
rxjs.catchError((err) => {
if (err.target instanceof window.HTMLElement && err.type === "error") {
@@ -73,5 +74,5 @@ export function init() {
return Promise.all([
loadCSS(import.meta.url, "./application_image.css"),
initPager(), // initMetadata(),
- ])
+ ]);
}
diff --git a/public/assets/pages/viewerpage/application_pdf.js b/public/assets/pages/viewerpage/application_pdf.js
index 829a60c9..122fe5be 100644
--- a/public/assets/pages/viewerpage/application_pdf.js
+++ b/public/assets/pages/viewerpage/application_pdf.js
@@ -6,7 +6,8 @@ import { loadCSS, loadJS } from "../../helpers/loader.js";
import { join } from "../../lib/path.js";
import ctrlError from "../ctrl_error.js";
-import { transition, getFilename, getDownloadUrl } from "./common.js";
+import { transition, getDownloadUrl } from "./common.js";
+import { buildMenubar, menubarDownload } from "./common_menubar.js";
import "../../components/menubar.js";
import "../../components/icon.js";
@@ -16,6 +17,7 @@ const hasNativePDF = () => "application/pdf" in window.navigator.mimeTypes;
export default async function(render) {
const ctrl = hasNativePDF() ? ctrlPDFNative : ctrlPDFJs;
ctrl(render);
+ buildMenubar(menubarDownload());
}
function ctrlPDFNative(render) {
@@ -40,8 +42,6 @@ function ctrlPDFNative(render) {
rxjs.tap(($embed) => transition($embed)),
rxjs.catchError(ctrlError()),
));
-
-
}
async function ctrlPDFJs(render) {
@@ -58,7 +58,7 @@ async function ctrlPDFJs(render) {
const removeLoader = createLoader($container);
effect(rxjs.from(window.pdfjsLib.getDocument(getDownloadUrl()).promise).pipe(
removeLoader,
- rxjs.mergeMap(async (pdf) => {
+ rxjs.mergeMap(async(pdf) => {
createBr();
for (let i=0; i
null;
- await page.render({
- canvasContext: $canvas.getContext("2d"),
- viewport: viewport,
- });
+ await page.render({
+ canvasContext: $canvas.getContext("2d"),
+ viewport,
+ });
await new Promise((done) => window.requestAnimationFrame(done));
}
createBr();
diff --git a/public/assets/pages/viewerpage/application_video.js b/public/assets/pages/viewerpage/application_video.js
index 90ae10a6..baa6ad37 100644
--- a/public/assets/pages/viewerpage/application_video.js
+++ b/public/assets/pages/viewerpage/application_video.js
@@ -13,8 +13,8 @@ import ctrlError from "../ctrl_error.js";
import { transition, getDownloadUrl } from "./common.js";
import { formatTimecode } from "./common_player.js";
import { ICON } from "./common_icon.js";
-import { menubarDownload, buildMenubar } from "./common_menubar.js";
-import { render as renderMenubar } from "../../components/menubar.js";
+// import { menubarDownload, buildMenubar } from "./common_menubar.js";
+// import { render as renderMenubar } from "../../components/menubar.js";
import "../../components/icon.js";
@@ -122,7 +122,7 @@ export default function(render, { mime }) {
}
};
const setStatus = (status) => {
- switch(status) {
+ switch (status) {
case "PLAYING":
$control.play.classList.add("hidden");
$control.pause.classList.remove("hidden");
@@ -144,9 +144,9 @@ export default function(render, { mime }) {
assert.fail(status);
}
};
- const setSeek = (newTime, shouldSet = false) => {
+ const setSeek = (newTime, shouldSet = false) => {
if (shouldSet) $video.currentTime = newTime;
- const width = 100 * (newTime / $video.duration)
+ const width = 100 * (newTime / $video.duration);
qs($page, ".progress .progress-active").style.width = `${width}%`;
if (!isNaN($video.duration)) {
qs($page, ".timecode .current").textContent = formatTimecode($video.currentTime) + " / " + formatTimecode($video.duration);
@@ -173,25 +173,28 @@ export default function(render, { mime }) {
rxjs.mergeMap(() => {
const $loader = qs($page, ".loader");
$loader.replaceChildren(createElement(`
`));
- animate($loader, { time: 150, keyframes: [
- { transform: "scale(0.7)" },
- { transform: "scale(1)" },
- ]});
+ animate($loader, {
+ time: 150,
+ keyframes: [
+ { transform: "scale(0.7)" },
+ { transform: "scale(1)" },
+ ],
+ });
setSeek(0);
return rxjs.fromEvent($loader, "click").pipe(rxjs.mapTo($loader));
}),
rxjs.tap(($loader) => {
- $loader.classList.add("hidden")
+ $loader.classList.add("hidden");
const $control = qs($page, ".videoplayer_control");
$control.classList.remove("hidden");
- animate($control, { time: 300, keyframes: slideYIn(5) })
+ animate($control, { time: 300, keyframes: slideYIn(5) });
setStatus(STATUS_PLAYING);
}),
rxjs.share(),
);
effect(setup$);
effect(setup$.pipe(rxjs.mergeMap(() => rxjs.fromEvent($video, "error").pipe(rxjs.tap(() => {
- console.error(err);
+ // console.error(err);
// notify.send(t("Not supported"), "error");
// setIsPlaying(false);
// setIsLoading(false);
@@ -235,7 +238,7 @@ export default function(render, { mime }) {
$hint.style.left = x;
$hint.textContent = formatTimecode(time);
}),
- ))
+ ));
effect(setup$.pipe(
rxjs.switchMap(() => rxjs.fromEvent(qs($page, ".progress"), "mouseleave")),
rxjs.tap(() => $hint.classList.add("hidden")),
@@ -246,7 +249,7 @@ export default function(render, { mime }) {
rxjs.switchMap(() => rxjs.fromEvent(qs($page, ".progress"), "click").pipe(
rxjs.map((e) => { // TODO: use onClick instead?
let $progress = e.target;
- if (e.target.classList.contains("progress") == false) {
+ if (e.target.classList.contains("progress") === false) {
$progress = e.target.parentElement;
}
const rec = $progress.getBoundingClientRect();
@@ -266,7 +269,7 @@ export default function(render, { mime }) {
effect(setup$.pipe(
rxjs.switchMap(() => rxjs.fromEvent(document, "keydown").pipe(rxjs.map((e) => e.code))),
rxjs.tap((code) => {
- switch(code) {
+ switch (code) {
case "Space":
case "KeyK":
setStatus($video.paused ? STATUS_PLAYING : STATUS_PAUSED);
@@ -340,7 +343,7 @@ export default function(render, { mime }) {
return $video.buffered.start(i) / $video.duration * 100;
};
const $container = qs($page, `[data-bind="progress-buffer"]`);
- if ($video.buffered.length !== $container.children.length ) {
+ if ($video.buffered.length !== $container.children.length) {
$container.innerHTML = "";
const $fragment = document.createDocumentFragment();
Array.apply(null, { length: $video.buffered.length })
@@ -349,8 +352,7 @@ export default function(render, { mime }) {
`)));
$container.appendChild($fragment);
}
-
- for (let i=0;i<$video.buffered.length;i++) {
+ for (let i=0; i<$video.buffered.length; i++) {
$container.children[i].style.left = calcLeft(i) + "%";
$container.children[i].style.width = calcWidth(i) + "%";
}
@@ -364,7 +366,7 @@ export function init() {
loadCSS(import.meta.url, "./application_video.css"),
loadCSS(import.meta.url, "./component_pager.css"),
loadJS(import.meta.url, "/overrides/video-transcoder.js"),
- ]).then(async () => {
+ ]).then(async() => {
if (typeof window.overrides["video-map-sources"] !== "function") window.overrides["video-map-sources"] = (s) => (s);
});
}
diff --git a/public/assets/pages/viewerpage/common.js b/public/assets/pages/viewerpage/common.js
index 25934586..1be2d7a1 100644
--- a/public/assets/pages/viewerpage/common.js
+++ b/public/assets/pages/viewerpage/common.js
@@ -36,6 +36,6 @@ export function getCurrentPath() {
// return encodeURIComponent(decodeURIComponent(path.replace(/%/g, "%25")));
// }
-function appendShareToUrl() {
- // TODO
-}
+// function appendShareToUrl() {
+// // TODO
+// }
diff --git a/public/assets/pages/viewerpage/common_menubar.js b/public/assets/pages/viewerpage/common_menubar.js
index 41a93d51..70dcebce 100644
--- a/public/assets/pages/viewerpage/common_menubar.js
+++ b/public/assets/pages/viewerpage/common_menubar.js
@@ -12,7 +12,7 @@ export function menubarDownload() {
`);
$fragment.querySelector(".download-button").onclick = () => {
console.log("CLICK");
- }
+ };
return $fragment;
}
diff --git a/public/assets/pages/viewerpage/common_player.js b/public/assets/pages/viewerpage/common_player.js
index cb67aefb..ce476f95 100644
--- a/public/assets/pages/viewerpage/common_player.js
+++ b/public/assets/pages/viewerpage/common_player.js
@@ -1,6 +1,6 @@
export function formatTimecode(seconds) {
return String(parseInt(seconds / 60)).padStart(2, "0") +
- ":"+
+ ":" +
String(parseInt(seconds % 60)).padStart(2, "0");
}
diff --git a/public/assets/pages/viewerpage/mimetype.js b/public/assets/pages/viewerpage/mimetype.js
index 6a5afdae..4e9dff0f 100644
--- a/public/assets/pages/viewerpage/mimetype.js
+++ b/public/assets/pages/viewerpage/mimetype.js
@@ -24,7 +24,7 @@ export function opener(file = "", mimes) {
return ["form", { mime }];
} else if (type === "video" || mime === "application/ogg") {
return ["video", { mime }];
- } else if(["application/epub+zip"].indexOf(mime) !== -1) {
+ } else if (["application/epub+zip"].indexOf(mime) !== -1) {
return ["ebook", { mime }];
} else if (type === "model" || ["application/object", "application/fbx"].indexOf(mime) !== -1) {
return ["3d", { mime }];