[LON-CAPA-cvs] cvs: loncom / loncapa_apache.conf mime.types /homework daxeopen.pm daxepage.pm daxesave.pm structuretags.pm /html/adm/daxe VERSION daxe.tar.gz /html/adm/split.js LICENSE.txt split.css split.js split.min.js /html/adm/split.js/grips horizontal.png vertical.png /lonnet/perl lonnet.pm /publisher lonpubdir.pm doc/loncapafiles loncapafiles.lpml
damieng
damieng at source.lon-capa.org
Thu Dec 10 11:27:00 EST 2015
damieng Thu Dec 10 16:27:00 2015 EDT
Added files:
/loncom/homework daxepage.pm
/loncom/html/adm/split.js LICENSE.txt split.css split.js
split.min.js
/loncom/html/adm/split.js/grips horizontal.png vertical.png
Modified files:
/doc/loncapafiles loncapafiles.lpml
/loncom loncapa_apache.conf mime.types
/loncom/homework daxeopen.pm daxesave.pm structuretags.pm
/loncom/html/adm/daxe VERSION daxe.tar.gz
/loncom/lonnet/perl lonnet.pm
/loncom/publisher lonpubdir.pm
Log:
added a preview for Daxe, updated automatically when the document is saved
-------------- next part --------------
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.924 doc/loncapafiles/loncapafiles.lpml:1.925
--- doc/loncapafiles/loncapafiles.lpml:1.924 Thu Dec 3 20:40:10 2015
+++ doc/loncapafiles/loncapafiles.lpml Thu Dec 10 16:26:36 2015
@@ -2,7 +2,7 @@
"http://lpml.sourceforge.net/DTD/lpml.dtd">
<!-- loncapafiles.lpml -->
-<!-- $Id: loncapafiles.lpml,v 1.924 2015/12/03 20:40:10 damieng Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.925 2015/12/10 16:26:36 damieng Exp $ -->
<!--
@@ -643,6 +643,18 @@
</directory>
<directory dist='default'>
<protectionlevel>modest_delete</protectionlevel>
+ <targetdir dist='default'>home/httpd/html/adm/split.js</targetdir>
+ <categoryname>server readonly</categoryname>
+ <description>Split.js</description>
+</directory>
+<directory dist='default'>
+ <protectionlevel>modest_delete</protectionlevel>
+ <targetdir dist='default'>home/httpd/html/adm/split.js/grips</targetdir>
+ <categoryname>server readonly</categoryname>
+ <description>Split.js grip icons</description>
+</directory>
+<directory dist='default'>
+ <protectionlevel>modest_delete</protectionlevel>
<targetdir dist='default'>home/httpd/html/ckeditor</targetdir>
<categoryname>server readonly</categoryname>
<description>Rich Text Editor</description>
@@ -4755,6 +4767,42 @@
</file>
<file>
+ <source>loncom/html/adm/split.js/split.min.js</source>
+ <target dist='default'>home/httpd/html/adm/split.js/split.min.js</target>
+ <categoryname>interface file</categoryname>
+ <description>
+ Split.js minimized
+ </description>
+</file>
+
+<file>
+ <source>loncom/html/adm/split.js/split.css</source>
+ <target dist='default'>home/httpd/html/adm/split.js/split.css</target>
+ <categoryname>interface file</categoryname>
+ <description>
+ Split.js CSS
+ </description>
+</file>
+
+<file>
+ <source>loncom/html/adm/split.js/grips/horizontal.png</source>
+ <target dist='default'>home/httpd/html/adm/split.js/grips/horizontal.png</target>
+ <categoryname>interface file</categoryname>
+ <description>
+ Split.js horizontal grip icon
+ </description>
+</file>
+
+<file>
+ <source>loncom/html/adm/split.js/grips/vertical.png</source>
+ <target dist='default'>home/httpd/html/adm/split.js/grips/vertical.png</target>
+ <categoryname>interface file</categoryname>
+ <description>
+ Split.js vertical grip icon
+ </description>
+</file>
+
+<file>
<source>loncom/javascriptlib/file_upload.js</source>
<target dist='default'>home/httpd/html/res/adm/includes/file_upload.js</target>
<categoryname>interface file</categoryname>
@@ -6353,6 +6401,15 @@
<status>works/unverified</status>
</file>
<file>
+ <source>loncom/homework/daxepage.pm</source>
+ <target dist='default'>home/httpd/lib/perl/Apache/daxepage.pm</target>
+ <categoryname>handler</categoryname>
+ <description>
+ Handler displaying Daxe and the problem preview
+ </description>
+ <status>works/unverified</status>
+</file>
+<file>
<source>loncom/homework/daxeopen.pm</source>
<target dist='default'>home/httpd/lib/perl/Apache/daxeopen.pm</target>
<categoryname>handler</categoryname>
Index: loncom/loncapa_apache.conf
diff -u loncom/loncapa_apache.conf:1.236 loncom/loncapa_apache.conf:1.237
--- loncom/loncapa_apache.conf:1.236 Thu Dec 3 20:40:16 2015
+++ loncom/loncapa_apache.conf Thu Dec 10 16:26:40 2015
@@ -2,7 +2,7 @@
## loncapa_apache.conf -- Apache HTTP LON-CAPA configuration file
##
-# $Id: loncapa_apache.conf,v 1.236 2015/12/03 20:40:16 damieng Exp $
+# $Id: loncapa_apache.conf,v 1.237 2015/12/10 16:26:40 damieng Exp $
#
# LON-CAPA Section (extensions to httpd.conf daemon configuration)
@@ -445,7 +445,7 @@
PerlHandler Apache::lonxml
</LocationMatch>
-<LocationMatch "^/daxeopen/priv/.*$">
+<LocationMatch "^/daxe(page|open)/priv/.*$">
AuthType LONCAPA
Require valid-user
PerlAuthzHandler Apache::loncacc
@@ -456,6 +456,11 @@
ErrorDocument 500 /adm/errorhandler
</LocationMatch>
+<LocationMatch "^/daxepage/priv/.*\.(task|problem|exam|quiz|assess|survey|library)$">
+SetHandler perl-script
+PerlHandler Apache::daxepage
+</LocationMatch>
+
<LocationMatch "^/daxeopen/priv/.*\.(task|problem|exam|quiz|assess|survey|library)$">
SetHandler perl-script
PerlHandler Apache::daxeopen
@@ -477,10 +482,6 @@
PerlAuthzHandler Apache::lonacc
SetHandler perl-script
PerlHandler Apache::daxesave
-ErrorDocument 403 /adm/login
-ErrorDocument 404 /adm/notfound.html
-ErrorDocument 406 /adm/unauthorized
-ErrorDocument 500 /adm/errorhandler
</LocationMatch>
<LocationMatch "^/adm/wrapper/">
Index: loncom/mime.types
diff -u loncom/mime.types:1.7 loncom/mime.types:1.8
--- loncom/mime.types:1.7 Tue Jul 29 13:22:25 2014
+++ loncom/mime.types Thu Dec 10 16:26:40 2015
@@ -467,7 +467,7 @@
text/enriched
text/html html htm
text/parityfec
-text/plain asc txt
+text/plain asc txt properties
text/prs.lines.tag
text/rfc822-headers
text/richtext rtx
Index: loncom/homework/daxeopen.pm
diff -u loncom/homework/daxeopen.pm:1.1 loncom/homework/daxeopen.pm:1.2
--- loncom/homework/daxeopen.pm:1.1 Thu Dec 3 20:40:27 2015
+++ loncom/homework/daxeopen.pm Thu Dec 10 16:26:43 2015
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Opening converted problems and directory listings for Daxe
#
-# $Id: daxeopen.pm,v 1.1 2015/12/03 20:40:27 damieng Exp $
+# $Id: daxeopen.pm,v 1.2 2015/12/10 16:26:43 damieng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -53,7 +53,8 @@
return convert_problem($uri, $request);
} else {
# Apache should send other files directly
- return HTTP_NOT_ACCEPTABLE;
+ $request->status(406);
+ return OK;
}
}
@@ -63,7 +64,8 @@
my $file = &Apache::lonnet::filelocation('', $uri);
&Apache::lonnet::repcopy($file);
if (! -e $file) {
- return HTTP_NOT_FOUND;
+ $request->status(404);
+ return OK;
}
try {
my $warnings = 0; # no warning printed
@@ -74,12 +76,10 @@
$request->print($text);
return OK;
} catch {
- die "convert failed for $file: $_";
- #$request->print('<?xml version="1.0" encoding="UTF-8"?>'."\n");
- #$request->print("<problem>\n");
- #$request->print("convert failed for $file: $_");
- #$request->print("</problem>\n");
- #return OK;
+ $request->content_type('text/plain');
+ $request->print("convert failed for $file: $_");
+ $request->status(406);
+ return OK;
};
}
@@ -87,7 +87,8 @@
my ($uri, $request) = @_;
my $dirpath = &Apache::lonnet::filelocation('', $uri);
if (! -e $dirpath) {
- return HTTP_NOT_FOUND;
+ $request->status(404);
+ return OK;
}
$dirpath =~ s/\/$//;
opendir my $dir, $dirpath or die "Cannot open directory: $dirpath";
@@ -125,26 +126,5 @@
return OK;
}
-# NOTE: binaries should be sent directly be Apache
-# sub send_binary {
-# my ($request, $filepath) = @_;
-#
-# $buffer = '';
-# if (!open(FILE, "<", $filepath)) {
-# return HTTP_NOT_FOUND;
-# }
-# binmode(FILE);
-#
-# # Read file in 32K blocks
-# while ((read(FILE, $buffer, 32768)) != 0) {
-# $request->print($buffer);
-# }
-#
-# if (!close(FILE)) {
-# &Apache::lonnet::logthis("Error closing the file $filepath");
-# }
-# return OK;
-# }
-
1;
__END__
Index: loncom/homework/daxesave.pm
diff -u loncom/homework/daxesave.pm:1.1 loncom/homework/daxesave.pm:1.2
--- loncom/homework/daxesave.pm:1.1 Thu Dec 3 20:40:27 2015
+++ loncom/homework/daxesave.pm Thu Dec 10 16:26:43 2015
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Convert and save a problem from Daxe.
#
-# $Id: daxesave.pm,v 1.1 2015/12/03 20:40:27 damieng Exp $
+# $Id: daxesave.pm,v 1.2 2015/12/10 16:26:43 damieng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -41,6 +41,8 @@
sub handler {
my $request = shift;
+ $request->content_type('text/plain');
+
my $path = $env{'form.path'}; # should be in the form "/daxeopen/priv/..."
$path =~ s/^\/daxeopen//;
@@ -56,8 +58,10 @@
}
}
unless ($allowed) {
- $request->log_reason("Unauthorized path: $path", $path);
- return HTTP_NOT_ACCEPTABLE;
+ $request->log_reason("Unauthorized path: $path", $path);
+ $request->print("error\nUnauthorized path: $path");
+ $request->status(403);
+ return OK;
}
my $newpath = &Apache::lonnet::filelocation('', $path);
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.542 loncom/homework/structuretags.pm:1.543
--- loncom/homework/structuretags.pm:1.542 Mon Dec 7 08:11:55 2015
+++ loncom/homework/structuretags.pm Thu Dec 10 16:26:43 2015
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.542 2015/12/07 08:11:55 raeburn Exp $
+# $Id: structuretags.pm,v 1.543 2015/12/10 16:26:43 damieng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -980,8 +980,7 @@
'onclick="javascript:setmode(this.form,'."'editxml'".')" />';
if ($env{'browser.type'} ne 'explorer' || $env{'browser.version'} > 9) {
my $uri = $env{'request.uri'};
- my $daxeurl = '/adm/daxe/daxe.html?config=config/loncapa_config.xml&file=/daxeopen'.$uri.
- '&save=/daxesave';
+ my $daxeurl = '/daxepage'.$uri;
$result .= '<input type="button" value="'.&mt('Edit with Daxe').'" '.
'onclick="window.open(\''.$daxeurl.'\',\'_blank\');" />';
}
Index: loncom/html/adm/daxe/VERSION
diff -u loncom/html/adm/daxe/VERSION:1.1 loncom/html/adm/daxe/VERSION:1.2
--- loncom/html/adm/daxe/VERSION:1.1 Thu Dec 3 20:40:36 2015
+++ loncom/html/adm/daxe/VERSION Thu Dec 10 16:26:47 2015
@@ -1 +1 @@
-20151203
+20151210
Index: loncom/html/adm/daxe/daxe.tar.gz
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1296 loncom/lonnet/perl/lonnet.pm:1.1297
--- loncom/lonnet/perl/lonnet.pm:1.1296 Thu Dec 3 20:40:42 2015
+++ loncom/lonnet/perl/lonnet.pm Thu Dec 10 16:26:56 2015
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.1296 2015/12/03 20:40:42 damieng Exp $
+# $Id: lonnet.pm,v 1.1297 2015/12/10 16:26:56 damieng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -7213,7 +7213,7 @@
my ($ownername,$ownerdomain,$ownerhome);
($ownerdomain,$ownername) =
- ($url=~ m{^(?:\Q$perlvar{'lonDocRoot'}\E|)(?:/daxeopen)?/priv/($match_domain)/($match_username)/});
+ ($url=~ m{^(?:\Q$perlvar{'lonDocRoot'}\E|)(?:/daxepage|/daxeopen)?/priv/($match_domain)/($match_username)/});
# The URL does not really point to any authorspace, forget it
unless (($ownername) && ($ownerdomain)) { return ''; }
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.165 loncom/publisher/lonpubdir.pm:1.166
--- loncom/publisher/lonpubdir.pm:1.165 Thu Dec 3 20:40:46 2015
+++ loncom/publisher/lonpubdir.pm Thu Dec 10 16:26:59 2015
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Authoring Space Directory Lister
#
-# $Id: lonpubdir.pm,v 1.165 2015/12/03 20:40:46 damieng Exp $
+# $Id: lonpubdir.pm,v 1.166 2015/12/10 16:26:59 damieng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -915,7 +915,7 @@
$editlink=' (<a href="'.$linkdir.'/'.$filename.'?editmode=Edit&problemmode=editxml">'.&mt('EditXML').'</a>)';
$editlink2=' <br />(<a href="'.$linkdir.'/'.$filename.'?editmode=Edit&problemmode=edit">'.&mt('Edit').'</a>)';
if ($env{'browser.type'} ne 'explorer' || $env{'browser.version'} > 9) {
- my $daxeurl = '/adm/daxe/daxe.html?config=config/loncapa_config.xml&file=/daxeopen'.$linkdir.'/'.$filename.'&save=/daxesave';
+ my $daxeurl = '/daxepage'.$linkdir.'/'.$filename;
$editlink .= ' (<a href="'.$daxeurl.'" target="_blank">Daxe</a>)';
}
}
Index: loncom/homework/daxepage.pm
+++ loncom/homework/daxepage.pm
# The LearningOnline Network
# Page with Daxe on the left side and the preview on the right side
#
# $Id: daxepage.pm,v 1.1 2015/12/10 16:26:43 damieng Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
###
package Apache::daxepage;
use Apache::Constants;
sub handler {
my $request = shift;
my $uri = $request->uri;
$uri =~ s/^\/daxepage//;
&Apache::loncommon::no_cache($request);
if ($uri !~ /\.(task|problem|exam|quiz|assess|survey|library)$/) {
$request->status(406);
return OK;
}
my $result = '';
$result .= "<!DOCTYPE html>\n";
$result .= "<html>\n";
$result .= "<head>\n";
my $name = $uri;
$name =~ s/^.*\/([^\/]+)$/$1/;
$result .= " <title>LON-CAPA Daxe: $name</title>\n";
$result .= ' <script src="/adm/split.js/split.min.js"></script>'."\n";
$result .= ' <link rel="stylesheet" href="/adm/split.js/split.css">'."\n";
$result .= " <style>\n";
$result .= " #daxe, #preview { border: none; }\n";
$result .= " </style>\n";
$result .= "</head>\n";
$result .= "<body>\n";
$result .= ' <div class="split-parent">'."\n";;
my $daxeurl = '/adm/daxe/daxe.html?config=config/loncapa_config.xml&file=/daxeopen'.$uri.
'&save=/daxesave';
$result .= ' <iframe id="daxe" src="'.$daxeurl.'" class="split split-horizontal"></iframe>'."\n";
my $previewurl = $uri.'?inhibitmenu=yes';
$result .= ' <iframe id="preview" src="'.$previewurl.'" class="split split-horizontal"></iframe>'."\n";
$result .= " </div>\n";
$result .= ' <script>Split(["#daxe", "#preview"], {sizes: [75, 25], minSize: [400, 20]});</script>'."\n";
$result .= "</body>\n";
$result .= "</html>\n";
$request->print($result);
return OK;
}
1;
__END__
Index: loncom/html/adm/split.js/LICENSE.txt
+++ loncom/html/adm/split.js/LICENSE.txt
Copyright (c) 2015 Nathan Cahill
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Index: loncom/html/adm/split.js/split.css
+++ loncom/html/adm/split.js/split.css
gutter {
background-color: #eee;
background-repeat: no-repeat;
background-position: 50%;
}
gutter.gutter-horizontal {
background-image: url('grips/vertical.png');
cursor: ew-resize;
}
gutter.gutter-vertical {
background-image: url('grips/horizontal.png');
cursor: ns-resize;
}
split {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
gutter:active {
cursor: grabbing;
cursor: -moz-grabbing;
cursor: -webkit-grabbing;
}
split.split-horizontal, .gutter.gutter-horizontal {
height: 100%;
float: left;
}
split-parent {
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
}
Index: loncom/html/adm/split.js/split.js
+++ loncom/html/adm/split.js/split.js
'use strict';
(function() {
var global = this
, querySelector = 'querySelector'
, addEventListener = 'addEventListener'
, removeEventListener = 'removeEventListener'
, getBoundingClientRect = 'getBoundingClientRect'
, isIE8 = global.attachEvent && !global[addEventListener]
, calc = (function () {
var el
, prefixes = ["", "-webkit-", "-moz-", "-o-"]
for (var i = 0; i < prefixes.length; i++) {
el = global.document.createElement('div')
el.style.cssText = "width:" + prefixes[i] + "calc(9px)"
if (el.style.length) {
return prefixes[i] + "calc"
}
}
})()
, Split = function (ids, options) {
var dimension
, i
, clientDimension
, clientAxis
, position
, gutterClass
, paddingA
, paddingB
, pairs = []
// Set defaults
options = typeof options !== 'undefined' ? options : {}
if (!options.gutterSize) options.gutterSize = 10
if (!options.minSize) options.minSize = 100
if (!options.snapOffset) options.snapOffset = 30
if (!options.direction) options.direction = 'horizontal'
if (!options.cursor) options.cursor = 'grabbing'
if (options.direction == 'horizontal') {
dimension = 'width'
clientDimension = 'clientWidth'
clientAxis = 'clientX'
position = 'left'
gutterClass = 'gutter gutter-horizontal'
paddingA = 'paddingLeft'
paddingB = 'paddingRight'
} else if (options.direction == 'vertical') {
dimension = 'height'
clientDimension = 'clientHeight'
clientAxis = 'clientY'
position = 'top'
gutterClass = 'gutter gutter-vertical'
paddingA = 'paddingTop'
paddingB = 'paddingBottom'
}
// Event listeners for drag events, bound to a pair object.
// Calculate the pair's position and size when dragging starts.
// Prevent selection on start and re-enable it when done.
var startDragging = function (e) {
if (!this.dragging && options.onDragStart) {
options.onDragStart()
}
e.preventDefault()
this.dragging = true
this.move = drag.bind(this)
this.stop = stopDragging.bind(this)
global[addEventListener]('mouseup', this.stop)
global[addEventListener]('touchend', this.stop)
global[addEventListener]('touchcancel', this.stop)
this.parent[addEventListener]('mousemove', this.move)
this.parent[addEventListener]('touchmove', this.move)
this.a[addEventListener]('selectstart', preventSelection)
this.a[addEventListener]('dragstart', preventSelection)
this.b[addEventListener]('selectstart', preventSelection)
this.b[addEventListener]('dragstart', preventSelection)
this.a.style.userSelect = 'none'
this.a.style.webkitUserSelect = 'none'
this.a.style.MozUserSelect = 'none'
this.a.style.pointerEvents = 'none'
this.a.style.cursor = options.cursor
this.b.style.userSelect = 'none'
this.b.style.webkitUserSelect = 'none'
this.b.style.MozUserSelect = 'none'
this.b.style.pointerEvents = 'none'
this.b.style.cursor = options.cursor
this.gutter.style.cursor = options.cursor
calculateSizes.call(this)
}
, stopDragging = function () {
if (this.dragging && options.onDragEnd) {
options.onDragEnd()
}
this.dragging = false
global[removeEventListener]('mouseup', this.stop)
global[removeEventListener]('touchend', this.stop)
global[removeEventListener]('touchcancel', this.stop)
this.parent[removeEventListener]('mousemove', this.move)
this.parent[removeEventListener]('touchmove', this.move)
delete this.stop
delete this.move
this.a[removeEventListener]('selectstart', preventSelection)
this.a[removeEventListener]('dragstart', preventSelection)
this.b[removeEventListener]('selectstart', preventSelection)
this.b[removeEventListener]('dragstart', preventSelection)
this.a.style.userSelect = ''
this.a.style.webkitUserSelect = ''
this.a.style.MozUserSelect = ''
this.a.style.pointerEvents = ''
this.a.style.cursor = ''
this.b.style.userSelect = ''
this.b.style.webkitUserSelect = ''
this.b.style.MozUserSelect = ''
this.b.style.pointerEvents = ''
this.b.style.cursor = ''
this.gutter.style.cursor = ''
}
, drag = function (e) {
var offset
if (!this.dragging) return
// Get the relative position of the event from the first side of the
// pair.
if ('touches' in e) {
offset = e.touches[0][clientAxis] - this.start
} else {
offset = e[clientAxis] - this.start
}
// If within snapOffset of min or max, set offset to min or max
if (offset <= this.aMin + options.snapOffset) {
offset = this.aMin
} else if (offset >= this.size - this.bMin - options.snapOffset) {
offset = this.size - this.bMin
}
adjust.call(this, offset)
if (options.onDrag) {
options.onDrag()
}
}
, calculateSizes = function () {
// Calculate the pairs size, and percentage of the parent size
var computedStyle = global.getComputedStyle(this.parent)
, parentSize = this.parent[clientDimension] - parseFloat(computedStyle[paddingA]) - parseFloat(computedStyle[paddingB])
this.size = this.a[getBoundingClientRect]()[dimension] + this.b[getBoundingClientRect]()[dimension] + this.aGutterSize + this.bGutterSize
this.percentage = Math.min(this.size / parentSize * 100, 100)
this.start = this.a[getBoundingClientRect]()[position]
}
, adjust = function (offset) {
// A size is the same as offset. B size is total size - A size.
// Both sizes are calculated from the initial parent percentage.
this.a.style[dimension] = calc + '(' + (offset / this.size * this.percentage) + '% - ' + this.aGutterSize + 'px)'
this.b.style[dimension] = calc + '(' + (this.percentage - (offset / this.size * this.percentage)) + '% - ' + this.bGutterSize + 'px)'
}
, fitMin = function () {
if (this.a[getBoundingClientRect]()[dimension] < this.aMin) {
this.a.style[dimension] = (this.aMin - this.aGutterSize) + 'px'
this.b.style[dimension] = (this.size - this.aMin - this.aGutterSize) + 'px'
} else if (this.b[getBoundingClientRect]()[dimension] < this.bMin) {
this.a.style[dimension] = (this.size - this.bMin - this.bGutterSize) + 'px'
this.b.style[dimension] = (this.bMin - this.bGutterSize) + 'px'
}
}
, fitMinReverse = function () {
if (this.b[getBoundingClientRect]()[dimension] < this.bMin) {
this.a.style[dimension] = (this.size - this.bMin - this.bGutterSize) + 'px'
this.b.style[dimension] = (this.bMin - this.bGutterSize) + 'px'
} else if (this.a[getBoundingClientRect]()[dimension] < this.aMin) {
this.a.style[dimension] = (this.aMin - this.aGutterSize) + 'px'
this.b.style[dimension] = (this.size - this.aMin - this.aGutterSize) + 'px'
}
}
, balancePairs = function (pairs) {
for (var i = 0; i < pairs.length; i++) {
calculateSizes.call(pairs[i])
fitMin.call(pairs[i])
}
for (i = pairs.length - 1; i >= 0; i--) {
calculateSizes.call(pairs[i])
fitMinReverse.call(pairs[i])
}
}
, preventSelection = function () { return false }
, parent = global.document[querySelector](ids[0]).parentNode
if (!options.sizes) {
var percent = 100 / ids.length
options.sizes = []
for (i = 0; i < ids.length; i++) {
options.sizes.push(percent)
}
}
if (!Array.isArray(options.minSize)) {
var minSizes = []
for (i = 0; i < ids.length; i++) {
minSizes.push(options.minSize)
}
options.minSize = minSizes
}
for (i = 0; i < ids.length; i++) {
var el = global.document[querySelector](ids[i])
, isFirst = (i == 1)
, isLast = (i == ids.length - 1)
, size
, gutterSize = options.gutterSize
, pair
if (i > 0) {
pair = {
a: global.document[querySelector](ids[i - 1]),
b: el,
aMin: options.minSize[i - 1],
bMin: options.minSize[i],
dragging: false,
parent: parent,
isFirst: isFirst,
isLast: isLast,
direction: options.direction
}
// For first and last pairs, first and last gutter width is half.
pair.aGutterSize = options.gutterSize
pair.bGutterSize = options.gutterSize
if (isFirst) {
pair.aGutterSize = options.gutterSize / 2
}
if (isLast) {
pair.bGutterSize = options.gutterSize / 2
}
}
// IE9 and above
if (!isIE8) {
if (i > 0) {
var gutter = global.document.createElement('div')
gutter.className = gutterClass
gutter.style[dimension] = options.gutterSize + 'px'
gutter[addEventListener]('mousedown', startDragging.bind(pair))
gutter[addEventListener]('touchstart', startDragging.bind(pair))
parent.insertBefore(gutter, el)
pair.gutter = gutter
}
if (i === 0 || i == ids.length - 1) {
gutterSize = options.gutterSize / 2
}
if (typeof options.sizes[i] === 'string' || options.sizes[i] instanceof String) {
size = options.sizes[i]
} else {
size = calc + '(' + options.sizes[i] + '% - ' + gutterSize + 'px)'
}
// IE8 and below
} else {
if (typeof options.sizes[i] === 'string' || options.sizes[i] instanceof String) {
size = options.sizes[i]
} else {
size = options.sizes[i] + '%'
}
}
el.style[dimension] = size
if (i > 0) {
pairs.push(pair)
}
}
balancePairs(pairs)
}
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = Split
}
exports.Split = Split
} else {
global.Split = Split
}
}).call(window)
Index: loncom/html/adm/split.js/split.min.js
+++ loncom/html/adm/split.js/split.min.js
"use strict";(function(){var t=this,e="querySelector",i="addEventListener",s="removeEventListener",n="getBoundingClientRect",r=t.attachEvent&&!t[i],h=function(){var e,i=["","-webkit-","-moz-","-o-"];for(var s=0;s<i.length;s++){e=t.document.createElement("div");e.style.cssText="width:"+i[s]+"calc(9px)";if(e.style.length){return i[s]+"calc"}}}(),a=function(a,o){var l,u,c,f,g,p,z,d,S=[];o=typeof o!=="undefined"?o:{};if(!o.gutterSize)o.gutterSize=10;if(!o.minSize)o.minSize=100;if(!o.snapOffset)o.snapOffset=30;if(!o.direction)o.direction="horizontal";if(!o.cursor)o.cursor="grabbing";if(o.direction=="horizontal"){l="width";c="clientWidth";f="clientX";g="left";p="gutter gutter-horizontal";z="paddingLeft";d="paddingRight"}else if(o.direction=="vertical"){l="height";c="clientHeight";f="clientY";g="top";p="gutter gutter-vertical";z="paddingTop";d="paddingBottom"}var b=function(e){if(!this.dragging&&o.onDragStart){o.onDragStart()}e.preventDefault();this.dragging=true;this.move=m.bind(t!
his);this.stop=y.bind(this);t[i]("mouseup",this.stop);t[i]("touchend",this.stop);t[i]("touchcancel",this.stop);this.parent[i]("mousemove",this.move);this.parent[i]("touchmove",this.move);this.a[i]("selectstart",w);this.a[i]("dragstart",w);this.b[i]("selectstart",w);this.b[i]("dragstart",w);this.a.style.userSelect="none";this.a.style.webkitUserSelect="none";this.a.style.MozUserSelect="none";this.a.style.pointerEvents="none";this.a.style.cursor=o.cursor;this.b.style.userSelect="none";this.b.style.webkitUserSelect="none";this.b.style.MozUserSelect="none";this.b.style.pointerEvents="none";this.b.style.cursor=o.cursor;this.gutter.style.cursor=o.cursor;v.call(this)},y=function(){if(this.dragging&&o.onDragEnd){o.onDragEnd()}this.dragging=false;t[s]("mouseup",this.stop);t[s]("touchend",this.stop);t[s]("touchcancel",this.stop);this.parent[s]("mousemove",this.move);this.parent[s]("touchmove",this.move);delete this.stop;delete this.move;this.a[s]("selectstart",w);this.a[s]("dragstart"!
,w);this.b[s]("selectstart",w);this.b[s]("dragstart",w);this.a.style.u
serSelect="";this.a.style.webkitUserSelect="";this.a.style.MozUserSelect="";this.a.style.pointerEvents="";this.a.style.cursor="";this.b.style.userSelect="";this.b.style.webkitUserSelect="";this.b.style.MozUserSelect="";this.b.style.pointerEvents="";this.b.style.cursor="";this.gutter.style.cursor=""},m=function(t){var e;if(!this.dragging)return;if("touches"in t){e=t.touches[0][f]-this.start}else{e=t[f]-this.start}if(e<=this.aMin+o.snapOffset){e=this.aMin}else if(e>=this.size-this.bMin-o.snapOffset){e=this.size-this.bMin}M.call(this,e);if(o.onDrag){o.onDrag()}},v=function(){var e=t.getComputedStyle(this.parent),i=this.parent[c]-parseFloat(e[z])-parseFloat(e[d]);this.size=this.a[n]()[l]+this.b[n]()[l]+this.aGutterSize+this.bGutterSize;this.percentage=Math.min(this.size/i*100,100);this.start=this.a[n]()[g]},M=function(t){this.a.style[l]=h+"("+t/this.size*this.percentage+"% - "+this.aGutterSize+"px)";this.b.style[l]=h+"("+(this.percentage-t/this.size*this.percentage)+"% - "+this.!
bGutterSize+"px)"},x=function(){if(this.a[n]()[l]<this.aMin){this.a.style[l]=this.aMin-this.aGutterSize+"px";this.b.style[l]=this.size-this.aMin-this.aGutterSize+"px"}else if(this.b[n]()[l]<this.bMin){this.a.style[l]=this.size-this.bMin-this.bGutterSize+"px";this.b.style[l]=this.bMin-this.bGutterSize+"px"}},G=function(){if(this.b[n]()[l]<this.bMin){this.a.style[l]=this.size-this.bMin-this.bGutterSize+"px";this.b.style[l]=this.bMin-this.bGutterSize+"px"}else if(this.a[n]()[l]<this.aMin){this.a.style[l]=this.aMin-this.aGutterSize+"px";this.b.style[l]=this.size-this.aMin-this.aGutterSize+"px"}},E=function(t){for(var e=0;e<t.length;e++){v.call(t[e]);x.call(t[e])}for(e=t.length-1;e>=0;e--){v.call(t[e]);G.call(t[e])}},w=function(){return false},U=t.document[e](a[0]).parentNode;if(!o.sizes){var D=100/a.length;o.sizes=[];for(u=0;u<a.length;u++){o.sizes.push(D)}}if(!Array.isArray(o.minSize)){var k=[];for(u=0;u<a.length;u++){k.push(o.minSize)}o.minSize=k}for(u=0;u<a.length;u++){var L!
=t.document[e](a[u]),O=u==1,B=u==a.length-1,F,A=o.gutterSize,C;if(u>0)
{C={a:t.document[e](a[u-1]),b:L,aMin:o.minSize[u-1],bMin:o.minSize[u],dragging:false,parent:U,isFirst:O,isLast:B,direction:o.direction};C.aGutterSize=o.gutterSize;C.bGutterSize=o.gutterSize;if(O){C.aGutterSize=o.gutterSize/2}if(B){C.bGutterSize=o.gutterSize/2}}if(!r){if(u>0){var N=t.document.createElement("div");N.className=p;N.style[l]=o.gutterSize+"px";N[i]("mousedown",b.bind(C));N[i]("touchstart",b.bind(C));U.insertBefore(N,L);C.gutter=N}if(u===0||u==a.length-1){A=o.gutterSize/2}if(typeof o.sizes[u]==="string"||o.sizes[u]instanceof String){F=o.sizes[u]}else{F=h+"("+o.sizes[u]+"% - "+A+"px)"}}else{if(typeof o.sizes[u]==="string"||o.sizes[u]instanceof String){F=o.sizes[u]}else{F=o.sizes[u]+"%"}}L.style[l]=F;if(u>0){S.push(C)}}E(S)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){exports=module.exports=a}exports.Split=a}else{t.Split=a}}).call(window);
More information about the LON-CAPA-cvs
mailing list