Add files
This commit is contained in:
122
web/embed.html
Normal file
122
web/embed.html
Normal file
@@ -0,0 +1,122 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Vortrag Matlab/Octave</title>
|
||||
<script type="text/javascript" src="jquery-3.4.1.min.js"></script>
|
||||
<script type="text/javascript" src="jquery.svg-1.5.0.min.js"></script>
|
||||
<script type="text/javascript" src="jquery.svgdom-1.5.0.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iframe src="presentation.svg" id="content" style="
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
width: 100%;
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
z-index: 0;
|
||||
height: 100%;
|
||||
"></iframe>
|
||||
|
||||
<!--
|
||||
<iframe src="http://localhost:8123/" id="console" style="
|
||||
position: fixed;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
z-index: 1;
|
||||
"></iframe>-->
|
||||
|
||||
<!-- this script takes care of displaying the consoles -->
|
||||
<script type="text/javascript">
|
||||
let consoles = {};
|
||||
|
||||
function prepareTerminalFrame() {
|
||||
let frame = document.createElement("iframe");
|
||||
frame.setAttribute("src", "http://localhost:7681/");
|
||||
frame.style.position = "fixed";
|
||||
frame.style.margin = 0;
|
||||
frame.style.padding = 0;
|
||||
frame.style.zIndex = 1;
|
||||
$(frame).on("load", function() {
|
||||
$(frame).hide();
|
||||
});
|
||||
document.body.appendChild(frame);
|
||||
return frame;
|
||||
}
|
||||
|
||||
function resizeTerminal(terminal) {
|
||||
let coordinates = terminal.placeholder.getBoundingClientRect();
|
||||
terminal.frame.style.left = coordinates.left + "px";
|
||||
terminal.frame.style.top = coordinates.top + "px";
|
||||
terminal.frame.style.width = coordinates.width + "px";
|
||||
terminal.frame.style.height = coordinates.height + "px";
|
||||
}
|
||||
|
||||
$(window).on("load", function() {
|
||||
let contentSvg = $("#content").contents().find("svg")[0];
|
||||
let placeholderTexts = $("text:contains('--console--')", contentSvg);
|
||||
|
||||
for (let text of placeholderTexts) {
|
||||
let placeholder = text.closest("g[id^='id']");
|
||||
let containerId = text.closest("g[id^='container-id']").getAttribute("id");
|
||||
let frame = prepareTerminalFrame();
|
||||
let terminal = {
|
||||
"frame": frame,
|
||||
"placeholder": placeholder
|
||||
};
|
||||
resizeTerminal(terminal);
|
||||
if (!(containerId in consoles)) {
|
||||
consoles[containerId] = [terminal];
|
||||
} else {
|
||||
consoles[containerId].push(terminal);
|
||||
}
|
||||
}
|
||||
|
||||
let observer = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
if (mutation.type == "attributes" && mutation.attributeName == "visibility") {
|
||||
let containerId = mutation.target.firstElementChild.getAttribute("id");
|
||||
let visible = mutation.target.getAttribute("visibility") != "hidden";
|
||||
if (containerId in consoles) {
|
||||
for(let terminal of consoles[containerId]) {
|
||||
if(visible) {
|
||||
$(terminal.frame).show();
|
||||
$(terminal.frame).focus();
|
||||
} else {
|
||||
$(terminal.frame).hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
for (let containerId of Object.keys(consoles)) {
|
||||
let container = $("#" + containerId, contentSvg).parent()[0]
|
||||
observer.observe(container, {
|
||||
attributes: true
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(window).on("resize", function() {
|
||||
for (let containerId of Object.keys(consoles)) {
|
||||
for (let terminal of consoles[containerId]) {
|
||||
resizeTerminal(terminal);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!--
|
||||
$("text:contains('--console--')", $("#content").contents().find("svg")[0]).closest("g[id^='id']")[0].getBoundingClientRect()
|
||||
-->
|
||||
2
web/jquery-3.4.1.min.js
vendored
Normal file
2
web/jquery-3.4.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
web/jquery.svg-1.5.0.min.js
vendored
Normal file
6
web/jquery.svg-1.5.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
web/jquery.svgdom-1.5.0.min.js
vendored
Normal file
6
web/jquery.svgdom-1.5.0.min.js
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/* http://keith-wood.name/svg.html
|
||||
jQuery DOM compatibility for jQuery SVG v1.5.0.
|
||||
Written by Keith Wood (kbwood{at}iinet.com.au) April 2009.
|
||||
Available under the MIT (http://keith-wood.name/licence.html) license.
|
||||
Please attribute the author if you use it. */
|
||||
(function($){var j=/[\t\r\n]/g,rspace=/\s+/,rwhitespace="[\\x20\\t\\r\\n\\f]";function getClassNames(a){return(!$.svg.isSVGElem(a)?a.className:(a.className?a.className.baseVal:a.getAttribute('class')))||''}function setClassNames(a,b){(a.className?a.className.baseVal=b:a.setAttribute('class',b))}$.fn.addClass=function(f){return function(d){if($.isFunction(d)){return this.each(function(i){$(this).addClass(d.call(this,i,getClassNames(this)))})}var e=arguments;d=d||'';return this.each(function(){if($.svg.isSVGElem(this)){var c=this;$.each(d.split(/\s+/),function(i,a){var b=getClassNames(c);if($.inArray(a,b.split(/\s+/))===-1){setClassNames(c,b+=(b?' ':'')+a)}})}else{f.apply($(this),e)}})}}($.fn.addClass);$.fn.removeClass=function(f){return function(d){if($.isFunction(d)){return this.each(function(i){$(this).removeClass(d.call(this,i,getClassNames(this)))})}var e=arguments;d=d||'';return this.each(function(){if($.svg.isSVGElem(this)){var c=this;$.each(d.split(/\s+/),function(i,a){var b=getClassNames(c);b=$.grep(b.split(/\s+/),function(n,i){return n!==a}).join(' ');setClassNames(c,b)})}else{f.apply($(this),e)}})}}($.fn.removeClass);$.fn.toggleClass=function(h){return function(d,e){if($.isFunction(d)){return this.each(function(i){$(this).toggleClass(d.call(this,i,getClassNames(this),e),e)})}var f=arguments;var g=(typeof e==='boolean');return this.each(function(){if($.svg.isSVGElem(this)){if(typeof d==='string'){var b=$(this);$.each(d.split(/\s+/),function(i,a){if(!g){e=!b.hasClass(a)}b[(e?'add':'remove')+'Class'](a)})}else{var c=getClassNames(this);if(c){$._data(this,'__className__',c)}setClassNames(this,c||d===false?'':$._data(this,'__className__')||'')}}else{h.apply($(this),f)}})}}($.fn.toggleClass);$.fn.hasClass=function(c){return function(a){a=a||'';var b=false;this.each(function(){if($.svg.isSVGElem(this)){b=($.inArray(a,getClassNames(this).split(/\s+/))>-1)}else{b=(c.apply($(this),[a]))}return!b});return b}}($.fn.hasClass);$.fn.attr=function(h){return function(a,b,c){if(typeof a==='string'&&b===undefined){var d=h.apply(this,arguments);if(d&&d.baseVal&&d.baseVal.numberOfItems!=null){b='';d=d.baseVal;if(a==='transform'){for(var i=0;i<d.numberOfItems;i++){var e=d.getItem(i);switch(e.type){case 1:b+=' matrix('+e.matrix.a+','+e.matrix.b+','+e.matrix.c+','+e.matrix.d+','+e.matrix.e+','+e.matrix.f+')';break;case 2:b+=' translate('+e.matrix.e+','+e.matrix.f+')';break;case 3:b+=' scale('+e.matrix.a+','+e.matrix.d+')';break;case 4:b+=' rotate('+e.angle+')';break;case 5:b+=' skewX('+e.angle+')';break;case 6:b+=' skewY('+e.angle+')';break}}d=b.substring(1)}else{d=d.getItem(0).valueAsString}}return(d&&d.baseVal?d.baseVal.valueAsString:d)}var f=a;if(typeof a==='string'){f={};f[a]=b}if($.isFunction(b)){return $(this).each(function(i){$(this).attr(a,b.call(this,i,$(this).attr(a)))})}var g=arguments;return $(this).each(function(){if($.svg.isSVGElem(this)){for(var n in f){(c?this.style[n]=f[n]:this.setAttribute(n,f[n]))}}else{h.apply($(this),g)}})}}($.fn.attr);$.fn.removeAttr=function(e){return function(c){var d=arguments;return this.each(function(){if($.svg.isSVGElem(this)){var b=this;$.each(c.split(/\s+/),function(i,a){(b[a]&&b[a].baseVal?b[a].baseVal.value=null:b.removeAttribute(a))})}else{e.apply($(this),d)}})}}($.fn.removeAttr);$.extend($.cssNumber,{'stopOpacity':true,'strokeMitrelimit':true,'strokeOpacity':true});if($.cssProps){$.css=function(f){return function(a,b,c,d){var e=(b.match(/^svg.*/)?$(a).attr($.cssProps[b]||b):'');return e||f(a,b,c,d)}}($.css)}})(jQuery);
|
||||
3
web/serve.sh
Executable file
3
web/serve.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
python2 -m SimpleHTTPServer 8000
|
||||
Reference in New Issue
Block a user