mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-07 16:09:57 +08:00
Fix the default parameters in JS
This was causing major issues in IE.
This commit is contained in:
parent
bd414c8b4f
commit
5cb79f6282
3 changed files with 9 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
function initCommentOptions(scrollableContainer, useParentOffset = true) {
|
function initCommentOptions(scrollableContainer, useParentOffset) {
|
||||||
|
useParentOffset = (typeof useParentOffset !== 'undefined') ? useParentOffset : true;
|
||||||
scrollCommentOptions($(".dropdown-comment"), useParentOffset);
|
scrollCommentOptions($(".dropdown-comment"), useParentOffset);
|
||||||
|
|
||||||
// Reposition dropdown to the left
|
// Reposition dropdown to the left
|
||||||
|
@ -25,7 +26,8 @@ function initCommentOptions(scrollableContainer, useParentOffset = true) {
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollCommentOptions(selector, useParentOffset = true) {
|
function scrollCommentOptions(selector, useParentOffset) {
|
||||||
|
useParentOffset = (typeof useParentOffset !== 'undefined') ? useParentOffset : true;
|
||||||
_.each(selector, function(el) {
|
_.each(selector, function(el) {
|
||||||
var $el = $(el);
|
var $el = $(el);
|
||||||
var offset = useParentOffset ? $el.offset().top : $el.position().top;
|
var offset = useParentOffset ? $el.offset().top : $el.position().top;
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
/*
|
/*
|
||||||
* Render errors specified in JSON format for many form elements.
|
* Render errors specified in JSON format for many form elements.
|
||||||
*/
|
*/
|
||||||
$.fn.renderFormErrors = function (modelName, errors, clear = true, ev) {
|
$.fn.renderFormErrors = function (modelName, errors, clear, ev) {
|
||||||
|
clear = (typeof clear !== 'undefined') ? clear : true;
|
||||||
if (clear || _.isUndefined(clear)) {
|
if (clear || _.isUndefined(clear)) {
|
||||||
this.clearFormErrors();
|
this.clearFormErrors();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,9 @@ $.fn.onSubmitValidator = function(validatorCb) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function textValidator(ev, textInput, canBeBlank = false, limitLength = true) {
|
function textValidator(ev, textInput, canBeBlank) {
|
||||||
|
canBeBlank = (typeof canBeBlank !== 'undefined') ? canBeBlank : false;
|
||||||
|
limitLength = (typeof limitLength !== 'undefined') ? limitLength : true;
|
||||||
var nameTooShort = $(textInput).val().length === 0;
|
var nameTooShort = $(textInput).val().length === 0;
|
||||||
var nameTooLong = $(textInput).val().length > 50;
|
var nameTooLong = $(textInput).val().length > 50;
|
||||||
var errMsg;
|
var errMsg;
|
||||||
|
|
Loading…
Reference in a new issue