MCPcopy Create free account
hub / github.com/TruthHun/BookStack / factory

Function factory

static/editor.md/plugins/video-dialog/video-dialog.js:3–182  ·  view source on GitHub ↗
(exports)

Source from the content-addressed store, hash-verified

1(function() {
2
3 var factory = function (exports) {
4
5 var pluginName = "video-dialog";
6
7 exports.fn.videoDialog = function() {
8
9 var _this = this;
10 var cm = this.cm;
11 var lang = this.lang;
12 var editor = this.editor;
13 var settings = this.settings;
14 var cursor = cm.getCursor();
15 var selection = cm.getSelection();
16 var videoLang = lang.dialog.video;
17 var classPrefix = this.classPrefix;
18 var iframeName = classPrefix + "video-iframe";
19 var dialogName = classPrefix + pluginName, dialog;
20
21 cm.focus();
22
23 var loading = function(show) {
24 var _loading = dialog.find("." + classPrefix + "dialog-mask");
25 _loading[(show) ? "show" : "hide"]();
26 };
27
28 if (editor.find("." + dialogName).length < 1)
29 {
30 var guid = (new Date).getTime();
31 var action = settings.videoUploadURL + (settings.videoUploadURL.indexOf("?") >= 0 ? "&" : "?") + "guid=" + guid+"&type=video";
32
33 if (settings.crossDomainUpload)
34 {
35 action += "&callback=" + settings.uploadCallbackURL + "&dialog_id=editormd-video-dialog-" + guid;
36 }
37
38 var dialogContent = ( (settings.videoUpload) ? "<form action=\"" + action +"\" target=\"" + iframeName + "\" method=\"post\" enctype=\"multipart/form-data\" class=\"" + classPrefix + "form\">" : "<div class=\"" + classPrefix + "form\">" ) +
39 ( (settings.videoUpload) ? "<iframe name=\"" + iframeName + "\" id=\"" + iframeName + "\" guid=\"" + guid + "\"></iframe>" : "" ) +
40 "<label>" + videoLang.url + "</label>" +
41 "<input type=\"text\" data-url />" + (function(){
42 return (settings.videoUpload) ? "<div class=\"" + classPrefix + "file-input\">" +
43 "<input type=\"file\" name=\"" + classPrefix + "video-file\" accept=\"video/*\" />" +
44 "<input type=\"submit\" value=\"" + videoLang.uploadButton + "\" />" +
45 "</div>" : "";
46 })() +
47 "<br/>" +
48 "<label>" + videoLang.alt + "</label>" +
49 "<input type=\"text\" value=\"" + selection + "\" data-alt />" +
50 "<br/>" +
51 "<label>" + videoLang.link + "</label>" +
52 "<input type=\"text\" value=\"\" data-link />" +
53 "<br/>" +
54 ( (settings.videoUpload) ? "</form>" : "</div>");
55
56 //var videoFooterHTML = "<button class=\"" + classPrefix + "btn " + classPrefix + "video-manager-btn\" style=\"float:left;\">" + videoLang.managerButton + "</button>";
57
58 dialog = this.createDialog({
59 title : videoLang.title,
60 width : (settings.videoUpload) ? 465 : 380,

Callers 1

video-dialog.jsFile · 0.70

Calls 1

loadingFunction · 0.70

Tested by

no test coverage detected