2020-02-09 23:02:19 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Elements;
|
|
|
|
|
2020-04-03 15:56:04 +02:00
|
|
|
class Script extends \View {
|
2020-02-09 23:02:19 +01:00
|
|
|
|
|
|
|
const MIME_TEXT_JAVASCRIPT = "text/javascript";
|
|
|
|
|
|
|
|
const CORE = "/js/script.js";
|
|
|
|
// const HOME = "/js/home.js";
|
2020-02-10 00:52:25 +01:00
|
|
|
const ADMIN = "/js/admin.js";
|
2020-02-09 23:02:19 +01:00
|
|
|
// const SORTTABLE = "/js/sorttable.js";
|
|
|
|
const JQUERY = "/js/jquery.min.js";
|
|
|
|
// const JQUERY_UI = "/js/jquery-ui.js";
|
|
|
|
// const JQUERY_MASKED_INPUT = "/js/jquery.maskedinput.min.js";
|
|
|
|
// const JQUERY_CONTEXT_MENU = "/js/jquery.contextmenu.min.js";
|
|
|
|
// const JQUERY_TERMINAL = "/js/jquery.terminal.min.js";
|
|
|
|
// const JQUERY_TERMINAL_UNIX = "/js/unix_formatting.js";
|
|
|
|
// const JSCOLOR = "/js/jscolor.min.js";
|
|
|
|
// const SYNTAX_HIGHLIGHTER = "/js/syntaxhighlighter.js";
|
|
|
|
// const HIGHLIGHT = "/js/highlight.pack.js";
|
|
|
|
// const GOOGLE_CHARTS = "/js/loader.js";
|
|
|
|
const BOOTSTRAP = "/js/bootstrap.min.js";
|
|
|
|
// const BOOTSTRAP_DATEPICKER_JS = "/js/bootstrap-datepicker.min.js";
|
|
|
|
// const POPPER = "/js/popper.min.js";
|
|
|
|
// const JSMPEG = "/js/jsmpeg.min.js";
|
|
|
|
// const MOMENT = "/js/moment.min.js";
|
|
|
|
// const CHART = "/js/chart.js";
|
|
|
|
// const REVEALJS = "/js/reveal.js";
|
|
|
|
// const REVEALJS_PLUGIN_NOTES = "/js/reveal_notes.js";
|
|
|
|
const INSTALL = "/js/install.js";
|
|
|
|
|
|
|
|
const HIGHLIGHT_JS_LOADER = "\$(document).ready(function(){\$('code').each(function(i, block) { hljs.highlightBlock(block); }); })";
|
|
|
|
|
2020-04-03 15:56:04 +02:00
|
|
|
private string $type;
|
|
|
|
private string $content;
|
|
|
|
private string $url;
|
2020-02-09 23:02:19 +01:00
|
|
|
|
|
|
|
function __construct($type, $src, $content = "") {
|
|
|
|
$this->type = $type;
|
|
|
|
$this->content = $content;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getCode() {
|
|
|
|
$src = (empty($this->url) ? "" : " src=\"$this->url\"");
|
|
|
|
$script = "<script type=\"$this->type\"$src>";
|
|
|
|
$script .= $this->content;
|
|
|
|
$script .= '</script>';
|
|
|
|
return $script;
|
|
|
|
}
|
2020-04-03 15:56:04 +02:00
|
|
|
}
|