Added jquery files
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@129095 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
cfe72fe3e1
commit
9279a3c19f
|
@ -4,6 +4,15 @@
|
|||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="ckan-metadata-publisher-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-metadata-publisher-widget/ckan-metadata-publisher-widget">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="ckan-util-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-util-library/ckan-util-library">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="gcubedatacatalogue-metadata-discovery-0.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcubedatacatalogue-metadata-discovery/gcubedatacatalogue-metadata-discovery">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="context-root" value="gcube-ckan-datacatalog"/>
|
||||
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</wb-module>
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMeta
|
|||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.CreateDatasetForm;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
|
|
@ -9,4 +9,6 @@
|
|||
--%>
|
||||
<link rel="stylesheet" href="<%=request.getContextPath()%>/GCubeCkanDataCatalog.css" type="text/css">
|
||||
<script type="text/javascript" src="<%=request.getContextPath()%>/gCubeCkanDataCatalog/gCubeCkanDataCatalog.nocache.js"></script>
|
||||
<script type="text/javascript" src='<%=request.getContextPath()%>/js/jquery.min.js'></script>
|
||||
<script type="text/javascript" src='<%=request.getContextPath()%>/js/jquery.autosize.js'></script>
|
||||
<div id="gCubeCkanDataCatalog"></div>
|
|
@ -0,0 +1,187 @@
|
|||
/*!
|
||||
jQuery Autosize v1.16.12
|
||||
(c) 2013 Jack Moore - jacklmoore.com
|
||||
updated: 2013-05-31
|
||||
license: http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
var
|
||||
defaults = {
|
||||
className: 'autosizejs',
|
||||
append: '',
|
||||
callback: false
|
||||
},
|
||||
hidden = 'hidden',
|
||||
borderBox = 'border-box',
|
||||
lineHeight = 'lineHeight',
|
||||
|
||||
// border:0 is unnecessary, but avoids a bug in FireFox on OSX
|
||||
copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden;"/>',
|
||||
|
||||
// line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
|
||||
copyStyle = [
|
||||
'fontFamily',
|
||||
'fontSize',
|
||||
'fontWeight',
|
||||
'fontStyle',
|
||||
'letterSpacing',
|
||||
'textTransform',
|
||||
'wordSpacing',
|
||||
'textIndent'
|
||||
],
|
||||
oninput = 'oninput',
|
||||
onpropertychange = 'onpropertychange',
|
||||
|
||||
// to keep track which textarea is being mirrored when adjust() is called.
|
||||
mirrored,
|
||||
|
||||
// the mirror element, which is used to calculate what size the mirrored element should be.
|
||||
mirror = $(copy).data('autosize', true)[0];
|
||||
|
||||
// test that line-height can be accurately copied.
|
||||
mirror.style.lineHeight = '99px';
|
||||
if ($(mirror).css(lineHeight) === '99px') {
|
||||
copyStyle.push(lineHeight);
|
||||
}
|
||||
mirror.style.lineHeight = '';
|
||||
|
||||
$.fn.autosize = function (options) {
|
||||
options = $.extend({}, defaults, options || {});
|
||||
|
||||
if (mirror.parentNode !== document.body) {
|
||||
$(document.body).append(mirror);
|
||||
}
|
||||
|
||||
return this.each(function () {
|
||||
var
|
||||
ta = this,
|
||||
$ta = $(ta),
|
||||
minHeight,
|
||||
maxHeight,
|
||||
resize,
|
||||
boxOffset = 0,
|
||||
callback = $.isFunction(options.callback);
|
||||
|
||||
if ($ta.data('autosize')) {
|
||||
// exit if autosize has already been applied, or if the textarea is the mirror element.
|
||||
return;
|
||||
}
|
||||
|
||||
if ($ta.css('box-sizing') === borderBox || $ta.css('-moz-box-sizing') === borderBox || $ta.css('-webkit-box-sizing') === borderBox){
|
||||
boxOffset = $ta.outerHeight() - $ta.height();
|
||||
}
|
||||
|
||||
// IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
|
||||
minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
|
||||
|
||||
resize = ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal';
|
||||
|
||||
$ta.css({
|
||||
overflow: hidden,
|
||||
overflowY: hidden,
|
||||
wordWrap: 'break-word',
|
||||
resize: resize
|
||||
}).data('autosize', true);
|
||||
|
||||
function initMirror() {
|
||||
mirrored = ta;
|
||||
mirror.className = options.className;
|
||||
maxHeight = parseInt($ta.css('maxHeight'), 10);
|
||||
|
||||
// mirror is a duplicate textarea located off-screen that
|
||||
// is automatically updated to contain the same text as the
|
||||
// original textarea. mirror always has a height of 0.
|
||||
// This gives a cross-browser supported way getting the actual
|
||||
// height of the text, through the scrollTop property.
|
||||
$.each(copyStyle, function(i, val){
|
||||
mirror.style[val] = $ta.css(val);
|
||||
});
|
||||
|
||||
// The textarea overflow is probably now hidden, but Chrome doesn't reflow the text to account for the
|
||||
// new space made available by removing the scrollbars. This workaround causes Chrome to reflow the text.
|
||||
if (oninput in ta) {
|
||||
var value = ta.value;
|
||||
ta.value = '';
|
||||
ta.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Using mainly bare JS in this function because it is going
|
||||
// to fire very often while typing, and needs to very efficient.
|
||||
function adjust() {
|
||||
var height, overflow, original;
|
||||
|
||||
if (mirrored !== ta) {
|
||||
initMirror();
|
||||
}
|
||||
|
||||
mirror.value = ta.value + options.append;
|
||||
mirror.style.overflowY = ta.style.overflowY;
|
||||
original = parseInt(ta.style.height,10);
|
||||
|
||||
// Update the width in case the original textarea width has changed
|
||||
// A floor of 0 is needed because IE8 returns a negative value for hidden textareas, raising an error.
|
||||
mirror.style.width = Math.max($ta.width(), 0) + 'px';
|
||||
|
||||
// Needed for IE8 and lower to reliably return the correct scrollTop
|
||||
mirror.scrollTop = 0;
|
||||
|
||||
mirror.scrollTop = 9e4;
|
||||
|
||||
// Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
|
||||
height = mirror.scrollTop;
|
||||
|
||||
if (maxHeight && height > maxHeight) {
|
||||
height = maxHeight;
|
||||
overflow = 'scroll';
|
||||
} else if (height < minHeight) {
|
||||
height = minHeight;
|
||||
}
|
||||
|
||||
height += boxOffset;
|
||||
ta.style.overflowY = overflow || hidden;
|
||||
|
||||
if (original !== height) {
|
||||
ta.style.height = height + 'px';
|
||||
if (callback) {
|
||||
options.callback.call(ta,ta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (onpropertychange in ta) {
|
||||
if (oninput in ta) {
|
||||
// Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
|
||||
// so binding to onkeyup to catch most of those occassions. There is no way that I
|
||||
// know of to detect something like 'cut' in IE9.
|
||||
ta[oninput] = ta.onkeyup = adjust;
|
||||
} else {
|
||||
// IE7 / IE8
|
||||
ta[onpropertychange] = function(){
|
||||
if(event.propertyName === 'value'){
|
||||
adjust();
|
||||
}
|
||||
};
|
||||
}
|
||||
} else {
|
||||
// Modern Browsers
|
||||
ta[oninput] = adjust;
|
||||
}
|
||||
|
||||
$(window).on('resize', function(){
|
||||
active = false;
|
||||
adjust();
|
||||
});
|
||||
|
||||
// Allow for manual triggering if needed.
|
||||
$ta.on('autosize', function(){
|
||||
active = false;
|
||||
adjust();
|
||||
});
|
||||
|
||||
// Call adjust in case the textarea already contains text.
|
||||
adjust();
|
||||
});
|
||||
};
|
||||
}(window.jQuery || window.Zepto));
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue