2021-05-23 10:14:08 +02:00
[# def? means define a variable if such a variable does not exist yet]
[# true and false are ezc functions defined by winix]
2021-01-21 17:10:04 +01:00
2021-05-23 10:14:08 +02:00
[def? winix_has_uikit false]
[def? winix_has_jquery false]
2021-05-27 13:41:29 +02:00
[def? winix_has_htmx false]
2021-02-16 12:55:35 +01:00
2021-05-23 10:14:08 +02:00
[def? winix_set_charset true]
[def? winix_set_viewport true]
2021-02-16 12:55:35 +01:00
2021-05-27 13:41:29 +02:00
[def? winix_load_uikit true]
2022-04-05 16:59:57 +02:00
[def? winix_uikit_version "3.13.7"] [# "3.13.7-scope" ]
2021-10-13 23:48:30 +02:00
2021-05-27 13:41:29 +02:00
[def? winix_load_htmx true]
2021-01-21 17:10:04 +01:00
2021-10-07 04:42:46 +02:00
[def? winix_load_clocklet false]
[def? winix_clocklet_uikit_theme true]
[def? winix_load_flatpickr false]
[def? winix_load_litepicker false]
2021-01-21 17:10:04 +01:00
2021-05-23 10:14:08 +02:00
[if winix_set_charset]
< meta charset = "UTF-8" >
[end]
[if winix_set_viewport]
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
[end]
[if winix_load_uikit]
[def winix_has_uikit true]
[# UIkit CSS]
2021-10-13 23:48:30 +02:00
< link rel = "stylesheet" href = "[doc_base_url_common]/uikit/uikit-[winix_uikit_version]/css/uikit.min.css" >
2021-05-23 10:14:08 +02:00
[# UIkit JS]
2021-10-13 23:48:30 +02:00
< script src = "[doc_base_url_common]/uikit/uikit-[winix_uikit_version]/js/uikit.min.js" > < / script >
< script src = "[doc_base_url_common]/uikit/uikit-[winix_uikit_version]/js/uikit-icons.min.js" > < / script >
2021-05-23 10:14:08 +02:00
[end]
2012-10-17 08:00:00 +02:00
2021-05-27 13:41:29 +02:00
[if winix_load_htmx]
[def winix_has_htmx true]
2021-05-27 19:36:04 +02:00
2022-04-05 16:53:46 +02:00
< script src = "[doc_base_url_common]/htmx/1.7.0/dist/htmx.min.js" > < / script >
2021-05-27 13:41:29 +02:00
[end]
2021-05-27 19:36:04 +02:00
[if winix_has_htmx]
< script > h t m x . o n ( " h t m x : a f t e r O n L o a d " , f u n c t i o n ( e v t ) \ {
[# we can optimize it by searching first the < head > tag]
var winix_elements = htmx.findAll(".winix-auto-delete");
for(var i=0 ; i< winix_elements.length ; + + i )
\{
console.log("removing:");
console.log(winix_elements\[i\]);
htmx.remove(winix_elements\[i\]);
\}
\});
< / script >
[end]
2021-05-27 13:41:29 +02:00
2012-10-17 08:00:00 +02:00
2021-06-29 23:42:57 +02:00
[if or [winix_function_is "emacs"] [winix_function_is "env"] [winix_function_is "meta"]]
2021-11-26 21:49:21 +01:00
< script type = "text/javascript" src = "[doc_base_url_common]/codemirror/5.64.0/lib/codemirror.js" > < / script >
< link rel = "stylesheet" href = "[doc_base_url_common]/codemirror/5.64.0/lib/codemirror.css" type = "text/css" >
2015-04-18 20:50:39 +02:00
2021-11-26 21:49:21 +01:00
< script src = "[doc_base_url_common]/codemirror/5.64.0/mode/css/css.js" > < / script >
< script src = "[doc_base_url_common]/codemirror/5.64.0/mode/javascript/javascript.js" > < / script >
< script src = "[doc_base_url_common]/codemirror/5.64.0/mode/xml/xml.js" > < / script >
< script src = "[doc_base_url_common]/codemirror/5.64.0/mode/htmlmixed/htmlmixed.js" > < / script >
< script src = "[doc_base_url_common]/codemirror/5.64.0/mode/markdown/markdown.js" > < / script >
2015-04-18 20:50:39 +02:00
2021-11-26 21:49:21 +01:00
<!-- <link rel="stylesheet" href="[doc_base_url_common]/codemirror/5.64.0/theme/base16 - light.css" type="text/css"> -->
2015-04-18 20:50:39 +02:00
2021-11-26 21:49:21 +01:00
< script src = "[doc_base_url_common]/codemirror/5.64.0/addon/display/fullscreen.js" > < / script >
< link rel = "stylesheet" href = "[doc_base_url_common]/codemirror/5.64.0/addon/display/fullscreen.css" type = "text/css" >
2015-04-18 20:50:39 +02:00
[if false]
2021-11-26 21:49:21 +01:00
< script src = "[doc_base_url_common]/codemirror/5.64.0/addon/search/search.js" > < / script >
< link rel = "stylesheet" href = "[doc_base_url_common]/codemirror/5.64.0/addon/search/matchesonscrollbar.css" type = "text/css" >
2015-04-18 20:50:39 +02:00
[end]
2021-11-26 21:49:21 +01:00
< script src = "[doc_base_url_common]/codemirror/5.64.0/addon/fold/xml-fold.js" > < / script >
< script src = "[doc_base_url_common]/codemirror/5.64.0/addon/edit/matchtags.js" > < / script >
< script src = "[doc_base_url_common]/codemirror/5.64.0/addon/selection/active-line.js" > < / script >
[# markdown to html converter]
[# https://github.com/showdownjs/showdown ]
< script src = "[doc_base_url_common]/showdown/1.9.1/dist/showdown.min.js" > < / script >
2015-04-18 20:50:39 +02:00
< style >
.CodeMirror-matchingtag \{
font-weight: bold;
background: none;
\}
.CodeMirror-activeline-background \{
background: #f3f3f3;
\}
.CodeMirror \{
border: 1px solid #dedede;
\}
< / style >
< script type = "text/javascript" >
2021-11-26 21:49:21 +01:00
var winix_code_mirror_editor = null;
var winix_showdown_converter = null;
var winix_converter_output = null;
var winix_content_parsed = null;
var winix_emacs_mode = 0;
2015-04-18 20:50:39 +02:00
function winix_initialize_editor()
\{
var text_area = document.getElementById("winix_content_id");
2021-11-26 21:49:21 +01:00
var winix_contenttype = document.getElementById("winix_contenttype_id");
var onchange_delay = null;
winix_content_parsed = document.getElementById("winix_content_parsed_id");
2015-04-18 20:50:39 +02:00
if( text_area )
\{
2021-11-26 21:49:21 +01:00
winix_showdown_converter = new showdown.Converter();
winix_converter_output = document.getElementById("winix_output_preview");
2015-04-18 20:50:39 +02:00
winix_code_mirror_editor = CodeMirror.fromTextArea(text_area, \{
2021-11-26 21:49:21 +01:00
mode: winix_get_codemirror_mode(winix_emacs_mode),
2015-04-18 20:50:39 +02:00
theme: "default",
indentUnit: 4,
smartIndent: true,
tabSize: 4,
indentWithTabs: true,
extraKeys: \{
"F11": function(cm) \{ cm.setOption("fullScreen", !cm.getOption("fullScreen")); \},
"Esc": function(cm) \{ if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false); \}
\},
lineNumbers: true,
lineWiseCopyCut: false,
dragDrop: false,
matchTags: true,
styleActiveLine: true
\});
2021-11-26 21:49:21 +01:00
winix_codemirror_preview();
winix_code_mirror_editor.on("change", function(instance) \{
if( onchange_delay !== null )
clearTimeout(onchange_delay);
onchange_delay = setTimeout(winix_codemirror_preview, 300);
\});
\}
if( winix_contenttype )
\{
winix_emacs_mode = parseInt(winix_contenttype.value);
winix_set_codemirror_mode();
winix_contenttype.addEventListener("change", function(e) \{
winix_emacs_mode = parseInt(this.value);
winix_set_codemirror_mode();
\});
\}
\}
function winix_codemirror_preview()
\{
if( winix_code_mirror_editor !== null )
\{
if( winix_emacs_mode == 2 )
\{
let sourceMarkup = winix_code_mirror_editor.getValue();
winix_converter_output.innerHTML = sourceMarkup;
if( winix_content_parsed !== null )
winix_content_parsed.value = "";
\}
else
if( winix_emacs_mode == 5 )
\{
let sourceMarkup = winix_code_mirror_editor.getValue();
let htmlMarkup = winix_showdown_converter.makeHtml(sourceMarkup);
if( winix_converter_output !== null )
winix_converter_output.innerHTML = htmlMarkup;
if( winix_content_parsed !== null )
winix_content_parsed.value = htmlMarkup;
\}
else
\{
[# IMPROVEME add support for text and formated text ]
winix_converter_output.innerHTML = "";
if( winix_content_parsed !== null )
winix_content_parsed.value = "";
\}
2015-04-18 20:50:39 +02:00
\}
\}
2021-11-26 21:49:21 +01:00
function winix_get_codemirror_mode(mode)
\{
switch(mode)
\{
case 5:
return "markdown";
case 2: // html
return "htmlmixed";
case 0: // text
case 1: // formatted text
case 3: // bbcode
case 4: // other
default:
return "text/plain";
\}
\}
function winix_set_codemirror_mode()
\{
if( winix_code_mirror_editor !== null )
\{
let codeMirrorMode = winix_get_codemirror_mode(winix_emacs_mode);
console.log("changing mode to: " + codeMirrorMode);
winix_code_mirror_editor.setOption("mode", codeMirrorMode);
winix_codemirror_preview();
\}
\}
2015-04-18 20:50:39 +02:00
[if false]
this will probably be used to change the mode in the fly
winix_code_mirror_editor.setOption("mode", "");
before saving (update button by ajax) this method should be used:
cm.save()
Copy the content of the editor into the textarea.
[end]
2021-11-26 21:49:21 +01:00
window.addEventListener("load", winix_initialize_editor, false);
2015-04-18 20:50:39 +02:00
< / script >
[end]
2012-10-17 08:00:00 +02:00
2010-11-04 17:46:19 +01:00
[if winix_function_is "ckeditor"]
2021-05-23 10:14:08 +02:00
[def winix_has_jquery true]
2018-05-10 00:48:14 +02:00
< script type = "text/javascript" src = "[doc_base_url_common]/ckeditor_4.9.2/ckeditor.js" > < / script >
2021-01-22 16:56:51 +01:00
< script type = "text/javascript" src = "[doc_base_url_common]/jquery/1.12.4/jquery.min.js" > < / script >
2018-05-10 19:21:39 +02:00
< script type = "text/javascript" src = "[doc_base_url_common]/winix/update_button.js" > < / script >
2010-11-04 17:46:19 +01:00
[end]
[if winix_function_is "tinymce"]
2021-01-22 16:56:51 +01:00
< script type = "text/javascript" src = "[doc_base_url]/common/tiny_mce/5.6.2/tinymce.min.js" > < / script >
[# tinymce can use a special theme called 'mobile' - it is used when /mobile param is provided]
< script type = "text/javascript" src = "[doc_base_url]/var/tinymce.js[if winix_function_param_is " mobile " ] / - / mobile [ end ] " > < / script >
2021-05-23 10:14:08 +02:00
[def winix_has_jquery true]
2021-01-22 16:56:51 +01:00
< script type = "text/javascript" src = "[doc_base_url_common]/jquery/1.12.4/jquery.min.js" > < / script >
< script type = "text/javascript" src = "[doc_base_url_common]/winix/update_button.js" > < / script >
2010-11-04 17:46:19 +01:00
[end]
2011-06-13 03:06:10 +02:00
[if winix_function_is "nicedit"]
2021-01-26 17:24:48 +01:00
< script type = "text/javascript" src = "[doc_base_url_common]/nicedit/0.9_r25/nicEdit.js" > < / script >
2011-06-13 03:06:10 +02:00
[end]
2010-11-04 17:46:19 +01:00
[if winix_function_is "vim"]
2021-01-25 14:34:35 +01:00
[# info from version 0.5-rc1: this editor doesn't work on different domains by default, solution: http://forum.wymeditor.org/forum/viewtopic.php?f=2& t=731& p=2507#p2504 ]
[# you should add one file to winix: wymiframe.html ]
2010-11-04 17:46:19 +01:00
2021-05-23 10:14:08 +02:00
[def winix_has_jquery true]
2021-01-25 14:34:35 +01:00
< script type = "text/javascript" src = "[doc_base_url_common]/jquery/1.12.4/jquery.min.js" > < / script >
< script type = "text/javascript" src = "[doc_base_url_common]/wymeditor/1.1.1/wymeditor/jquery.wymeditor.min.js" > < / script >
< link rel = "stylesheet" type = "text/css" href = "[doc_base_url_common]/wymeditor/1.1.1/wymeditor/skins/default/skin.css" >
2010-11-04 17:46:19 +01:00
< script type = "text/javascript" > jQuery ( function ( ) \ { jQuery ( "textarea" ) . wymeditor ( \ { basePath : "[doc_base_url_common]/wymeditor/" , iframeBasePath : "[doc_base_url]/var/" , updateSelector : "form" , updateEvent : 'submit' \ } ) ; \ } ) ; < / script >
[end]
2011-01-31 16:51:53 +01:00
2011-04-01 18:30:14 +02:00
[if winix_function_is "gallery"]
2021-02-16 16:31:52 +01:00
[if gallery_mount_type_arg_is "lightbox"]
[# https://lokeshdhakar.com/projects/lightbox2/ ]
2011-04-01 18:30:14 +02:00
2021-05-23 10:14:08 +02:00
[def winix_has_jquery true]
2021-02-16 16:31:52 +01:00
< script type = "text/javascript" src = "[doc_base_url_common]/jquery/1.12.4/jquery.min.js" > < / script >
< link rel = "stylesheet" href = "[doc_base_url_common]/lightbox/2.11.3/dist/css/lightbox.min.css" type = "text/css" >
< script src = "[doc_base_url_common]/lightbox/2.11.3/dist/js/lightbox.min.js" type = "text/javascript" > < / script >
2011-04-01 18:30:14 +02:00
[end]
2013-02-26 12:49:22 +01:00
2021-02-16 16:31:52 +01:00
[if gallery_mount_type_arg_is "galleriajs"]
[# https://galleriajs.github.io/ ]
[# formerly called aino-gallery ]
2021-05-23 10:14:08 +02:00
[def winix_has_jquery true]
2021-02-16 16:31:52 +01:00
< script type = "text/javascript" src = "[doc_base_url_common]/jquery/1.12.4/jquery.min.js" > < / script >
< script src = "[doc_base_url_common]/galleriajs/1.6.1/dist/galleria.min.js" type = "text/javascript" > < / script >
2013-02-26 12:49:22 +01:00
[end]
2011-04-01 18:30:14 +02:00
[end]
2011-06-24 22:53:21 +02:00
2012-07-15 17:49:48 +02:00
2013-07-02 09:14:19 +02:00
[if winix_function_is "upload"]
2021-01-22 11:50:28 +01:00
[# https://blueimp.github.io/jQuery-File-Upload/]
2014-08-06 22:14:10 +02:00
[# https://github.com/blueimp/jQuery-File-Upload]
2012-07-15 17:49:48 +02:00
2014-08-06 22:14:10 +02:00
[# Force latest IE rendering engine or ChromeFrame if installed]
<!-- \[if IE\]>
< meta http-equiv = "X-UA-Compatible" content = "IE=edge,chrome=1" >
<!\[endif\]-->
2012-07-15 17:49:48 +02:00
2021-01-22 11:50:28 +01:00
< link rel = "stylesheet" href = "[doc_base_url_common]/bootstrap/3.3.7/css/bootstrap.min.css" >
2021-01-21 17:10:04 +01:00
2021-01-22 11:50:28 +01:00
[# in doc_base_url_common/jquery-file-upload/10.31.0_extra/blueimp-gallery/ is download_all_files.sh script in order to download all necessary files]
<!-- blueimp Gallery styles -->
< link rel = "stylesheet" href = "[doc_base_url_common]/jquery-file-upload/10.31.0_extra/blueimp-gallery/blueimp-gallery.min.css" >
2012-07-15 17:49:48 +02:00
2021-01-22 11:50:28 +01:00
[# CSS to style the file input field as button and adjust the Bootstrap progress bars]
< link rel = "stylesheet" href = "[doc_base_url_common]/jquery-file-upload/10.31.0/css/jquery.fileupload.css" >
< link rel = "stylesheet" href = "[doc_base_url_common]/jquery-file-upload/10.31.0/css/jquery.fileupload-ui.css" >
2012-07-15 17:49:48 +02:00
2021-01-22 11:50:28 +01:00
[# CSS adjustments for browsers with JavaScript disabled]
< noscript >
< link rel = "stylesheet" href = "[doc_base_url_common]/jquery-file-upload/10.31.0/css/jquery.fileupload-noscript.css" >
< link rel = "stylesheet" href = "[doc_base_url_common]/jquery-file-upload/10.31.0/css/jquery.fileupload-ui-noscript.css" >
< / noscript >
2012-07-15 17:49:48 +02:00
2021-05-23 10:14:08 +02:00
[def winix_has_jquery true]
2021-01-22 11:50:28 +01:00
< script src = "[doc_base_url_common]/jquery/1.12.4/jquery.min.js" > < / script >
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0/js/vendor/jquery.ui.widget.js" > < / script >
<!-- The Templates plugin is included to render the upload/download listings -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0_extra/tmpl.min.js" > < / script >
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0_extra/load-image.all.min.js" > < / script >
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0_extra/canvas-to-blob.min.js" > < / script >
<!-- blueimp Gallery script -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0_extra/jquery.blueimp-gallery.min.js" > < / script >
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0/js/jquery.iframe-transport.js" > < / script >
<!-- The basic File Upload plugin -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0/js/jquery.fileupload.js" > < / script >
<!-- The File Upload processing plugin -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0/js/jquery.fileupload-process.js" > < / script >
<!-- The File Upload image preview & resize plugin -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0/js/jquery.fileupload-image.js" > < / script >
<!-- The File Upload audio preview plugin -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0/js/jquery.fileupload-audio.js" > < / script >
<!-- The File Upload video preview plugin -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0/js/jquery.fileupload-video.js" > < / script >
<!-- The File Upload validation plugin -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0/js/jquery.fileupload-validate.js" > < / script >
<!-- The File Upload user interface plugin -->
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0/js/jquery.fileupload-ui.js" > < / script >
[if false]
[# the code to run the plugin we have in fun_upload.html]
<!-- The main application script -->
2018-11-15 18:01:40 +01:00
<!--
2021-01-22 11:50:28 +01:00
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0/js/demo.js" > < / script >
2018-11-15 18:01:40 +01:00
-->
2021-01-22 11:50:28 +01:00
[end]
2012-07-15 17:49:48 +02:00
2021-01-22 11:50:28 +01:00
<!-- The XDomainRequest Transport is included for cross - domain file deletion for IE 8 and IE 9 -->
<!-- \[if (gte IE 8)&(lt IE 10)\]>
< script src = "[doc_base_url_common]/jquery-file-upload/10.31.0/js/cors/jquery.xdr-transport.js" > < / script >
<!\[endif\]-->
2011-06-24 22:53:21 +02:00
[end]
2012-07-15 17:49:48 +02:00
2011-08-02 02:10:45 +02:00
[if winix_function_is "sort"]
2021-06-20 18:12:43 +02:00
[if not request.is_item]
2021-01-28 20:16:44 +01:00
< script type = "text/javascript" src = "[doc_base_url_common]/winix/winix_sort.js" > < / script >
2011-08-02 02:10:45 +02:00
[end]
[end]
2011-06-24 22:53:21 +02:00
2013-03-29 23:03:28 +01:00
[if winix_function_is "imgcrop"]
2021-05-23 10:14:08 +02:00
[def winix_has_jquery true]
2021-02-16 18:35:55 +01:00
< script type = "text/javascript" src = "[doc_base_url_common]/jquery/1.12.4/jquery.min.js" > < / script >
< script type = "text/javascript" src = "[doc_base_url_common]/jcrop/0.9.15/js/jquery.Jcrop.min.js" > < / script >
< link type = "text/css" rel = "stylesheet" href = "[doc_base_url_common]/jcrop/0.9.15/css/jquery.Jcrop.min.css" >
2013-03-29 23:03:28 +01:00
[end]
2021-10-07 04:42:46 +02:00
[if winix_load_clocklet]
[# https://github.com/luncheon/clocklet ]
[# https://luncheon.github.io/clocklet/demo.html - color samples here too]
< link rel = "stylesheet" href = "[doc_base_url_common]/clocklet/0.3.0/clocklet.min.css" >
< script src = "[doc_base_url_common]/clocklet/0.3.0/clocklet.js" > < / script >
[if winix_clocklet_uikit_theme]
< link rel = "stylesheet" href = "[doc_base_url_common]/clocklet/0.3.0/uikit-theme.css" >
[end]
[end]
[if winix_load_flatpickr]
[# date picker, time picker, date and time picker, date range picker (selecting time works only for the first day), available different themes ]
[# the datepicker on mobile devices is a native datepicker (this functionality can be disabled via disableMobile option) ]
[# https://flatpickr.js.org ]
[# https://github.com/flatpickr/flatpickr ]
[# options: https://flatpickr.js.org/options/ ]
2022-04-05 17:37:24 +02:00
< link rel = "stylesheet" href = "[doc_base_url_common]/flatpickr/4.6.11/flatpickr.min.css" >
< script src = "[doc_base_url_common]/flatpickr/4.6.11/flatpickr.js" > < / script >
2021-10-07 04:42:46 +02:00
[if is_not [lang "flatpickr_locale_url"] "none"]
2022-04-05 17:37:24 +02:00
< script src = "[doc_base_url_common]/flatpickr/4.6.11/l10n/[lang " flatpickr_locale_url " ] " > < / script >
2021-10-07 04:42:46 +02:00
< script >
flatpickr.localize(flatpickr.l10ns.{flatpickr_locale_config_prefix});
< / script >
[end]
[if false]
[# can be inserted in this way: ]
< script >
flatpickr("#my-input-id", \{
\});
< / script >
[end]
[end]
[if winix_load_litepicker]
[# date picker and date range picker ]
[# can show a dialog with more than one month, config parameters: numberOfColumns and numberOfMonths]
[# https://litepicker.com ]
[# https://github.com/wakirin/litepicker/ ]
[# options: https://litepicker.com/docs/options ]
[# in bundle.js there are all plugins, you can use litepicker.js to load the datepicker without plugins]
< script src = "[doc_base_url_common]/litepicker/2.0.11/bundle.js" > < / script >
[if false]
[# can be inserted in this way: ]
< script >
const picker = new Litepicker(\{
element: document.getElementById('my-input-id'),
plugins: \['mobilefriendly'\],
lang: "{winix_html_lang_attr}"
\});
< / script >
[end]
[end]
2015-03-09 00:22:05 +01:00
[if false]
[# temporarily blocked]
2011-06-24 22:53:21 +02:00
[if winix_has_plugin "stats"]
[include "stats_info.html"]
[end]
2015-03-09 00:22:05 +01:00
[end]
2011-06-24 22:53:21 +02:00