web-base/core/Elements/Script.class.php

54 lines
2.0 KiB
PHP
Raw Normal View History

2020-02-09 23:02:19 +01:00
<?php
namespace Elements;
class Script extends Source {
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); }); })";
private $type;
private $content;
function __construct($type, $src, $content = "") {
parent::__construct('script', $src);
$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;
}
}
?>