0 ) {
if ( isAsync ) {
rc = submitAsyncForm( markForm, null, handleErrorMessageDataPopUp);
} else
markForm.submit();
} else {
if(!isAsync) {
var errorMessage =
getMessageById('quickOutputSelectAtLeastOneCheckbox');
alert(errorMessage);
} else
rc = true;
}
}
return rc;
}
function setSelected(target, candidateForm, checkboxName, delimiter) {
if ( ! delimiter || delimiter.length < 1 )
delimiter = ";";
if ( ! checkboxName || checkboxName.length < 1 )
checkboxName = "marked_list_candidates";
var result = -1;
var targetForm = ( target != null ) ? target.form : null;
if ( targetForm == null )
return result;
var formName = targetForm.getAttribute('records_form_name');
if ( candidateForm == null ) {
candidateForm = getRecordsForm( formName );
if ( ! candidateForm )
candidateForm = targetForm;
}
var selectedValues = getCheckedFormValues( candidateForm, checkboxName );
if ( selectedValues.length > 0 )
target.value = selectedValues.join( delimiter );
return selectedValues.length;
}
// Created to fix WOKVX-19936 for search_mode = CitedRefList
// To get the marked_list_candidates in a different way
function setSelectedForCitedRefList(target) {
var selectedValues = "";
var selectedValuesLength = 0;
$("#records_chunks :input[name='marked_list_candidates']:checked").each(function() {
selectedValues += $(this).val() + ";";
selectedValuesLength++;
});
if ( selectedValuesLength > 0 ) {
target.value = selectedValues;
}
return selectedValuesLength;
}
// If there are multiple inputs with the specified name, this returns all of them. (in which case "type" will be "undefined")
// If there is only one, it puts it into the first/only element of the array.
function getNamedFormInputs( form, inputName ) {
var results = new Array();
if (form != null && (typeof form.elements !='undefined') && form.elements[inputName] != null ) {
var type = form.elements[inputName].type;
switch ( type ) {
case "hidden":
case "checkbox":
case "radio":
results[0] = form.elements[inputName];
break;
default:
results = form.elements[inputName];
}
}
return results;
}
function getCheckedFormInputsOrValues( form, inputName, valuesOnly ) {
if ( valuesOnly == null )
valuesOnly = false;
var selected = new Array();
var candidates = getNamedFormInputs( form, inputName );
//alert("candidates: "+candidates);
if ( candidates.length > 0 ) {
for ( var i = 0; i < candidates.length; ++i ) {
if ( candidates[i].checked == true ) {
var input = candidates[i];
selected.push( valuesOnly ? input.value : input );
}
}
}
return selected;
}
function getCheckedFormInputs( form, inputName ) {
return getCheckedFormInputsOrValues( form, inputName, false );
}
function getCheckedFormValues( form, inputName ) {
return getCheckedFormInputsOrValues( form, inputName, true );
}
/*** not needed yet
MARK_TYPE {
SELECTED : 0,
PAGE : 1,
RANGE : 2,
ALL : 3
}
***/
var RECORDS_MAX = 500000;
function getRecordsForm( formName ) {
var candidateForm = null;
var candidateFormJQ = null;
if ( formName && formName.length > 0 ) {
candidateForm = document.forms[formName];
}
if ( ! candidateForm ) {
if ( typeof(jQuery) == 'function' ) {
candidateFormJQ = $('form[name="records_form"]');
if ( !candidateFormJQ.size() ) {
candidateFormJQ = $('form[name="summary_records_form"]');
if ( !candidateFormJQ.size() ) {
candidateFormJQ = $('form[name="full_record_form"]');
if ( !candidateFormJQ.size() ) {
return null;
}
}
}
candidateForm = candidateFormJQ.get(0);
} else {
candidateForm = document.getElementsByName("records_form");
if ( candidateForm.length === 0 ) {
candidateForm = document.getElementsByName("summary_records_form");
if ( candidateForm.length === 0 ) {
candidateForm = document.getElementsByName("full_record_form");
if ( candidateForm.length === 0 ) {
return null;
}
}
}
}
}
return candidateForm;
}
function fullRecordMarkedlistCountCheck() {
var full_record_form = document.forms["full_record_form"];
var maxRecordLimit = MARKED_LIST_MAX_RECORDS;
var $MLCount = $('#MLCount');
if (!$MLCount.length) {
return true;
}
var totalCurrentCount = parseInt($MLCount.first().text()
.replace(new RegExp('[^0-9]', 'g'), ''));
var totalProjectedCount
= totalCurrentCount + 1;
if (totalProjectedCount > maxRecordLimit) {
var fullRecord_error_message = getMessageById('ml_total_morethan_maxrec_error');
show_client_error("errorMessageDiv", fullRecord_error_message);
return false;
}
return true;
}
function mark_records( inputForm, markType ) {
if ( inputForm != null ) {
var recordsForm = getRecordsForm();
if ( recordsForm == null )
recordsForm = inputForm;
// var markType = MARK_TYPE.SELECTED;
var option = markType;
if (option == null) {
var checked = getCheckedFormValues( inputForm, "value(record_select_type)" );
if ( checked.length > 0 ) {
// we expect only 1, so take first one
option = checked[0];
}
}
switch ( option ) {
case 'allrecord':
case 'pagerecords':
var inputs = getNamedFormInputs( inputForm, "marked_list_candidates" );
var length = inputs.length;
if ( length < 1 ) {
inputs = getNamedFormInputs( recordsForm, "marked_list_candidates" );
length = inputs.length;
}
if ( length > 0 ) {
var start = inputs[0].value;
var end = inputs[length - 1].value;
mark_records_by_range( start, end, false );
}
if ( length == 0) {
var errorMessage = getMessageById('quickOutputSelectAtLeastOneCheckbox');
alert(errorMessage);
}
break;
case 'range':
var from = inputForm.elements["markFrom"];
var to = inputForm.elements["markTo"];
if ( from && to ) {
var fromValue = trimString( from.value );
var toValue = trimString( to.value );
mark_records_by_range( fromValue, toValue, true );
}
break;
case 'allrecords':
mark_records_by_range( 1, RECORDS_MAX, false );
break;
case 'pagerecordsByValue':
var checked = checkAllByName();
if ( checked < 1 )
break;
// else fall through
case 'selrecord':
case 'selrecords':
if(!fullRecordMarkedlistCountCheck())
break;
default:
mark_selected_records( recordsForm );
}
}
return false;
}
function trimString( string ) {
if ( string.length ) {
string = string.replace( /^\s\s*/, '' );
var whiteSpace = /\s/;
var i = string.length;
while ( whiteSpace.test(string.charAt(--i)) ) ;
return string.slice(0, i + 1);
}
return "";
}
function fillTodayDateById() {
//populate and format the date value to be written to the field.
var today = new Date();
var month = new String(today.getMonth() + 1);
var day = new String(today.getDate());
var year = today.getFullYear();
if (month.length == 1) {
month = "0"+month;
}
if (day.length == 1) {
day = "0"+day;
}
var formattedDate = year+"-"+month+"-"+day;
//get the field passed to us to populate
var since = document.getElementById("since");
if (!since || since.value.length < 1 )
since.value = formattedDate;
}
function getMessageById( id ) {
var message;
var element = document.getElementById( id );
if (!element) {
return "No message found for " + id;
}
if ( element.tagName == "input" )
message = element.value;
else
message = element.innerHTML;
return trimString( message );
}
function resetOptionsToDefaults( inputForm, checkboxName ) {
if ( ! checkboxName || checkboxName.length < 1 ) {
checkboxName = "fields";
}
var checkboxes = getNamedFormInputs( inputForm, checkboxName );
for ( var i = 0; i < checkboxes.length; ++i ) {
if (checkboxes[i].getAttribute("default") == "default") {
checkboxes[i].checked = true;
} else {
checkboxes[i].checked = false;
}
}
inputForm.elements["value(select_All)"].checked = false;
saveForm(inputForm.id);
return false;
}
function checkAllByName( inputForm, checkboxName ) {
if ( ! inputForm )
inputForm = getRecordsForm();
if ( ! checkboxName || checkboxName.length < 1 ) {
checkboxName = "marked_list_candidates";
}
var checked = 0;
var checkboxes = getNamedFormInputs( inputForm, checkboxName );
for ( var i = 0; i < checkboxes.length; ++i ) {
++checked;
checkboxes[i].checked = true;
}
return checked;
}
function checkOrUncheckAllByName( inputForm, checkboxName ) {
if ( ! inputForm )
inputForm = getRecordsForm();
if ( ! checkboxName || checkboxName.length < 1 ) {
checkboxName = "marked_list_candidates";
}
var checked = 0;
var isChecked = inputForm.elements["select_All"].checked;
var checkboxes = getNamedFormInputs( inputForm, checkboxName );
for ( var i = 0; i < checkboxes.length; ++i ) {
++checked;
checkboxes[i].checked = isChecked;
}
return checked;
}
function toggleCheckBoxesByName( formName, checkboxName, toggler ) {
var inputForm = document.forms[ formName ];
if ( ! inputForm )
inputForm = getRecordsForm();
if ( ! checkboxName || checkboxName.length < 1 ) {
checkboxName = "marked_list_candidates";
}
var checked = 0;
var isChecked = inputForm.elements[toggler].checked;
//alert("checked=" + isChecked);
var checkboxes = getNamedFormInputs( inputForm, checkboxName );
for ( var i = 0; i < checkboxes.length; ++i ) {
++checked;
checkboxes[i].checked = isChecked;
}
saveForm( formName );
return checked;
}
function toggleCheckBoxesByKeypress( formName, checkboxName, toggler ) {
var inputForm = document.forms[ formName ];
if ( ! inputForm )
inputForm = getRecordsForm();
if ( ! checkboxName || checkboxName.length < 1 ) {
checkboxName = "marked_list_candidates";
}
var checked = 0;
var isChecked = inputForm.elements[toggler].checked;
if(isChecked) {
isChecked = false;
}
else {
isChecked = true;
}
inputForm.elements[toggler].checked = isChecked;
//alert("checked=" + isChecked);
var checkboxes = getNamedFormInputs( inputForm, checkboxName );
for ( var i = 0; i < checkboxes.length; ++i ) {
++checked;
checkboxes[i].checked = isChecked;
}
saveForm( formName );
return checked;
}
// With a given id, this function will return the associated string.
function confirmationMessage( id ) {
var msg = null;
if ( id ) {
msg = getMessageById(id);
}
if ( msg && msg.length > 0 )
return confirm( msg );
return false;
}
//Changes the action of the current output form with the specified URL
//Fixed WOKVX-11287 by addind the rurl parameter to the outputform action
function changeFormActionForSaveToRID(input, url, rurl) {
var outputForm = getOutputForm();
if ( input && outputForm ) {
var inputForm = input.form;
if ( inputForm ) {
var formName = inputForm.getAttribute('input_form_name');
var form = document.forms[ formName ];
if ( form )
inputForm = form;
}
var foundFilters = setFilters( inputForm, outputForm );
outputForm.elements[ "format" ].value = input.name;
var recordsForm = getRecordsForm();
if ( recordsForm == null )
recordsForm = inputForm;
var option = "";
var checked = getCheckedFormValues( inputForm, "value(record_select_type)" );
if ( checked.length > 0 ) {
// we expect only 1, so take first one
option = checked[0];
}
if( option =='range') {
var valid = true;
valid = check_qo_input();
if(!valid) { return false; }
}
}
if (outputForm && url) {
outputForm.action = url + "&rurl=" + encodeURIComponent(rurl);
}
return true;
}
// Asks the user to certify that the records that he/she would like to add to his/her RID
// publication list are his/her own.
function certifyPublicationsForRID() {
var accept = confirmationMessage('quickOutputCertifyPublicationsForRID');
return accept;
}
// Called when clicking on the "Save to ResearcherID" button
// Fixed WOKVX-11287 by adding the rurl parameter to the url
function outputRIDRecords(form, url, rurl) {
var outputForm = getOutputForm();
if (outputForm && outputForm.colName.value == "DIIDW") {
outputForm.mode.value = "outputServiceForSaveToRID";
}
if (url && rurl) {
url = url + "&rurl=" + encodeURIComponent(rurl);
}
output_records(form, outputForm, url, null, certifyPublicationsForRID);
return false;
}
function output_records_by_range( rangeStart, rangeEnd, validate, url, presubmitFunction ) {
var outputForm = document.forms["output_form"];
if(!outputForm) { return false; }
var from = outputForm.elements["mark_from"];
var to = outputForm.elements["mark_to"];
if ( !(from && to) ) { return false; }
//we only need to validate user input. If the user selects
//"all records on page", we don't want to validate.
var valid = true;
if(validate) {
valid = check_qo_input();
}
if(!valid) { return false; }
var submit = true;
if ( presubmitFunction ) {
submit = presubmitFunction( outputForm );
}
if ( submit == true ) {
if (outputForm && url) {
outputForm.action = url;
}
from.value = rangeStart;
to.value = rangeEnd;
if ( invokeAutoSubmit() )
outputForm.submit();
}
return false;
}
function output_selected_records( checkboxForm, outputForm, url, presubmitFunction ) {
if ( outputForm == null )
outputForm = document.forms[ "output_form" ];
var checkedRecs = 0;
if ( outputForm ) {
var selectedIds = outputForm.elements["selectedIds"];
checkedRecs = setSelected( selectedIds, checkboxForm );
if ( checkedRecs > 0 ) {
var submit = true;
if ( presubmitFunction ) {
submit = presubmitFunction( outputForm );
$("select[name='emailStyle']").select2({dropdownAutoWidth: false, minimumResultsForSearch: 99});
}
if ( submit == true ) {
if (outputForm && url) {
outputForm.action = url;
}
disable_auto_submit();
outputForm.submit();
}
} else {
var errorMessage = getMessageById('quickOutputSelectAtLeastOneCheckbox');
alert(errorMessage);
}
}
return false;
}
function FIELDS() { return "fields"; };
function setFilters( inputForm, outputForm, defaultToAll ) {
var found = false;
if ( inputForm == null )
return found;
if ( defaultToAll == null )
defaultToAll = true;
if ( outputForm == null )
outputForm = getOutputForm();
var filters = outputForm.elements[ "filters" ];
if ( filters == null )
return found;
// look for checked checkboxes
var numFilters = setSelected( filters, inputForm, "fields", " " );
if ( numFilters == 0 && defaultToAll ) {
var fields = getNamedFormInputs( inputForm, "fields" );
if ( fields.length == 0 ) {
// try for selection
fields = getCheckedFormInputs( inputForm, "fields_selection" );
if ( fields != null && fields.length != 0) {
found = true;
var values = fields[0].value;
var optName = fields[0].id + "_option";
var options = getCheckedFormInputs( inputForm, optName );
if ( options ) {
for ( var i = 0; i < options.length; ++i )
values += " " + options[i].value;
}
filters.value = values;
}
}
} else
found = true;
return found;
}
function getOutputForm( formName ) {
var candidateForm = null;
if ( formName && formName.length > 0 ) {
candidateForm = document.forms[formName];
}
if ( ! candidateForm ) {
candidateForm = document.forms["output_form"];
if ( ! candidateForm ) {
candidateForm = getRecordsForm();
}
}
return candidateForm;
}
var MAX_OUTPUT_RECORDS = 500;
function prepareAllRecordsOnPageForOutput( inputs ) {
var i;
var allIds = new Array();
for ( i = 0; i < inputs.length; i++ ) {
allIds.push(inputs[i].value);
}
if(document.forms["output_form"].elements["product"].value != "DIIDW") {
document.forms["output_form"].elements["selectedIds"].value = allIds.join(";");
}
if(document.forms["output_form"].elements["totalMarked"]) {
document.forms["output_form"].elements["totalMarked"].value = inputs.length;
}
if(document.forms["summary_records_form"].elements["product"].value != "DIIDW") {
document.forms["summary_records_form"].elements["selectedIds"].value = allIds.join(";");
}
if(document.forms["summary_records_form"].elements["totalMarked"]) {
document.forms["summary_records_form"].elements["totalMarked"].value = inputs.length;
}
}
function output_records( input, outputForm, url, orderType, presubmitFunction ) {
if ( outputForm == null ) {
outputForm = getOutputForm();
}
if ( input && outputForm ) {
var inputForm = input.form;
if ( inputForm ) {
var formName = inputForm.getAttribute('input_form_name');
var form = document.forms[ formName ];
if ( form )
inputForm = form;
}
var foundFilters = setFilters( inputForm, outputForm );
outputForm.elements[ "format" ].value = input.name;
var recordsForm = getRecordsForm();
if ( recordsForm == null )
recordsForm = inputForm;
var option = "";
var checked = getCheckedFormValues( inputForm, "value(record_select_type)" );
if ( checked.length > 0 ) {
// we expect only 1, so take first one
option = checked[0];
}
//Once tests are validated for ranges and other options, disable autosubmit
switch ( option ) {
case 'allrecord':
case 'pagerecords':
var checkboxName = "marked_list_candidates";
var inputs = getNamedFormInputs( inputForm, checkboxName );
var length = inputs.length;
if ( length < 1 ) {
inputs = getNamedFormInputs( recordsForm, checkboxName );
length = inputs.length;
prepareAllRecordsOnPageForOutput(inputs);
}
if ( length > 0 ) {
var start = inputs[0].value;
var end = inputs[length - 1].value;
prepareAllRecordsOnPageForOutput(inputs);
output_records_by_range( start, end, false, url, presubmitFunction );
}
if ( length == 0) {
var errorMessage = getMessageById('quickOutputSelectAtLeastOneCheckbox');
alert(errorMessage);
do_output = false;
}
break;
case 'range':
var from = inputForm.elements["markFrom"];
var to = inputForm.elements["markTo"];
var fromValueString;
var toValueString;
var eids_max_recs_limit = EIDS_MAX_RECORDS;
if ( from && to ) {
fromValueString = trimString( from.value );
toValueString = trimString( to.value );
var numRecs = parseInt(toValueString) - parseInt(fromValueString) + 1;
if ( (numRecs > eids_max_recs_limit ) && (orderType == 'EIDS') ) {
allrecs_morethan_maxrec_eids_notice = getMessageById("ml_eids_morethan_maxrec_output_notice");
alert(allrecs_morethan_maxrec_eids_notice);
}
else {
output_records_by_range( fromValueString, toValueString, true, url, presubmitFunction );
}
}
break;
case 'allrecords':
var current_num_ml_recs = CURRENT_NUM_MARKED_LIST_RECORDS;
var qo_max_record_limit = QUICK_OUTPUT_MAX_RECORDS;
var eids_max_recs_limit = EIDS_MAX_RECORDS;
var do_output = true;
if ( current_num_ml_recs > qo_max_record_limit) {
allrecs_morethan_maxrec_output_notice = getMessageById("ml_allrecs_morethan_maxrec_output_notice");
//do_output = confirm(allrecs_morethan_maxrec_output_notice);
alert(allrecs_morethan_maxrec_output_notice);
do_output = true;
}
if ( (current_num_ml_recs > eids_max_recs_limit ) && (orderType == 'EIDS') ) {
allrecs_morethan_maxrec_eids_notice = getMessageById("ml_eids_morethan_maxrec_output_notice");
alert(allrecs_morethan_maxrec_eids_notice);
do_output = false;
}
if (do_output) {
if (current_num_ml_recs > MAX_OUTPUT_RECORDS) {
output_records_by_range( 1, MAX_OUTPUT_RECORDS, false, url, presubmitFunction );
}
else {
output_records_by_range( 1, current_num_ml_recs, false, url, presubmitFunction );
}
}
break;
case 'pagerecordsByValue':
var checked = checkAllByName();
if ( checked < 1 )
break;
// else fall through
case 'selrecord':
case 'selrecords':
default:
output_selected_records( recordsForm, outputForm, url, presubmitFunction );
}
}
return false;
}
//Added below two functions for bug fix: 1010.
function quick_summary_output(output_form)
{
if (document.output_form.fields_selection[0].checked == true) {
document.output_form.fullrec_fields_option.checked = false;
} else if (document.output_form.fields_selection[1].checked == true) {
document.output_form.bib_fields_option.checked = false;
}
}
function quick_fullrecord_output(records_form)
{
if (document.records_form.fields_selection[0].checked == true) {
document.records_form.fullrec_fields_option.checked = false;
} else if (document.records_form.fields_selection[1].checked == true) {
document.records_form.bib_fields_option.checked = false;
}
}
function isEnterEvent( objevent ) {
if (! objevent)
objevent = event;
var charcode = objevent.which;
if (! charcode)
charcode = objevent.keyCode;
var is_safari = navigator.userAgent.indexOf('Safari')>0;
if (is_safari && charcode == 3)
charcode = 13;
return (charcode == 13);
}
function setSelectedForForm( form ) {
var rc = true;
if ( form ) {
var selectedIds = form.elements['selectedIds'];
var target = 'isickref';
var numSet = setSelected( selectedIds, form, target );
}
return true;
}
function saveFormPreferences( form ) {
if ( form ) {
return submitAsyncForm( form, "savePreferencesUrl" );
}
return false;
}
function saveMarkedListPreferences( form ) {
var rc = false;
if ( ! form )
form = getOutputForm();
if ( setFilters( form, null, false ) ) {
rc = saveFormPreferences( form );
if (rc = 'true') {
var input = document.getElementById('savedMLPreferences').style.display = "inline";
}
}
return rc;
}
function saveOneSettingPreference(formName, fieldName, doAsync) {
var form = getRecordsForm( formName );
var url = form.getAttribute("savePreferencesUrl");
var saveField = document.getElementById(fieldName);
var newSaveField = document.getElementById(fieldName).cloneNode(true);
newSaveField.value = saveField.value;
var newForm = form.cloneNode(false);
newForm.setAttribute("savePreferencesUrl", url);
newForm.appendChild(newSaveField);
var sid = form.elements["SID"].cloneNode(true);
newForm.appendChild(sid);
var product = form.elements['product'].cloneNode(true);
newForm.appendChild(product);
var sdhaHandler = function(data) { document.write( data ); };
var rc = true;
try {
dojo.io.bind({
url: url,
encoding: "utf8",
sync: !(doAsync && doAsync === true),
formNode: newForm,
mimetype: "text/plain",
load: function(type, data, evt) { },
mimetype: "text/plain"
});
} catch (e) {
return false;
}
return true;
}
function setOtherPageSelectedRecCount( totalSelected, checkboxName, formName ) {
var count;
var input = document.getElementById( "selectedRecs" );
if ( input ) {
if ( totalSelected == null )
count = 0;
else {
if ( ! checkboxName )
checkboxName = "isickref";
var form = getRecordsForm( formName );
var checked = getCheckedFormValues( form, checkboxName );
count = totalSelected - checked.length;
}
input.value = count;
}
return count;
}
function getSearchInputForm( formName ) {
var candidateForm = null;
if ( formName && formName.length > 0 ) {
candidateForm = document.forms[formName];
}
if ( ! candidateForm ) {
if ( jQuery ) {
var formSelector = $('.searchInputForm');
if ( formSelector )
candidateForm = formSelector[0];
}
if ( ! candidateForm )
candidateForm = document.forms[0];
}
return candidateForm;
}
function numberMatch() {
var re = new RegExp("\\w-\\d{4}-\\d{4}");
var textValue = document.getElementById('value(input3)').value;
/*check entered value is Empty if not then check for expression match
if expression match fails display expression match error message
*/
document.getElementById('errorMessage').style.display = 'none';
document.getElementById('author.search.error.fullName').style.display = 'none';
document.getElementById('author.search.invalidQuery').style.display = 'none';
if (textValue == null || textValue.length == 0) {
if (document.getElementById('errorMessage').style.display == 'none') {
document.getElementById('errorMessage').style.display = 'block';
document.getElementById('author.search.reasearchId.validation').style.display = 'block';
}
} else if (textValue.match(re)) {
document.getElementById('RID').value = textValue;
document.getElementById('WOS_AuthorSearch_input_form').submit();
} else {
if (document.getElementById('errorMessage').style.display == 'none') {
document.getElementById('errorMessage').style.display = 'block';
document.getElementById('author.search.reasearchIdFormat').style.display = 'block';
}
}
}
function validateAuthorName() {
var authorName = null;
var firstInitialRegEx = new RegExp("[@%&*#!$\\d]");
var lastNameRegEx1 = new RegExp("[@%!\\d]");
var lastNameRegEx2 = new RegExp("\\*[a-zA-Z]?");
var lastNameRegEx3 = new RegExp("\\$[a-zA-Z]?");
var lastName = document.getElementById('value(input1)').value;
var firstInitial = document.getElementById('value(input2)').value;
var exactMatch = document.getElementById('exactMatch').checked;
document.getElementById('errorMessage').style.display = 'none';
document.getElementById('author.search.reasearchIdFormat').style.display = 'none';
document.getElementById('author.search.reasearchId.validation').style.display = 'none';
if (lastName == null || lastName.length == 0) {
document.getElementById('author.search.invalidQuery').style.display = 'none';
document.getElementById('errorMessage').style.display = 'block';
document.getElementById('author.search.error.fullName').style.display = 'block';
checkForErrorSpans();
} else if ( firstInitial == null || firstInitial.length == 0 || firstInitial == ' ') {
document.getElementById('author.search.invalidQuery').style.display = 'none';
document.getElementById('errorMessage').style.display = 'block';
document.getElementById('author.search.error.fullName').style.display = 'block';
checkForErrorSpans();
} else if ( firstInitial.match(firstInitialRegEx) ) {
document.getElementById('author.search.error.fullName').style.display = 'none';
document.getElementById('errorMessage').style.display = 'block';
document.getElementById('author.search.invalidQuery').style.display = 'block';
checkForErrorSpans();
} else if ( lastName.match(lastNameRegEx1)) {
document.getElementById('author.search.error.fullName').style.display = 'none';
document.getElementById('errorMessage').style.display = 'block';
document.getElementById('author.search.invalidQuery').style.display = 'block';
checkForErrorSpans();
} else if ( lastName.match(lastNameRegEx2) && exactMatch == true) {
document.getElementById('author.search.error.fullName').style.display = 'none';
document.getElementById('errorMessage').style.display = 'block';
document.getElementById('author.search.invalidQuery').style.display = 'block';
checkForErrorSpans();
} else if ( lastName.match(lastNameRegEx3) && exactMatch == true) {
document.getElementById('author.search.error.fullName').style.display = 'none';
document.getElementById('errorMessage').style.display = 'block';
document.getElementById('author.search.invalidQuery').style.display = 'block';
checkForErrorSpans();
} else {
authorName = lastName+" "+firstInitial;
// Surround term with single quotes if term == boolean operators 'and' or 'or'.
if (lastName.toUpperCase() == 'OR' || lastName.toUpperCase() == 'AND' || lastName.toUpperCase() == 'NOT' || lastName.toUpperCase() == 'SAME' ) {
authorName = "\""+authorName+"\"";
}
document.getElementById('authorName').value = authorName;
document.getElementById('WOS_AuthorSearch_input_form').submit();
checkForErrorSpans();
}
}
function clearAuthorSearchFields(pType) {
document.getElementById('value(input1)').value="";
document.getElementById('value(input2)').value="";
checkForErrorSpans();
saveForm('WOS_AuthorSearch_input_form');
}
function checkForErrorSpans() {
if (document.getElementById('searchErrorMessage')!= null && document.getElementById('searchErrorMessage').style.display == "") {
document.getElementById('searchErrorMessage').style.display = 'none';
} else if (document.getElementById('searchErrorMessageDiv')!= null && document.getElementById('searchErrorMessageDiv').style.display == "") {
document.getElementById('searchErrorMessageDiv').style.display = 'none';
} else if (document.getElementById('noRecordsDiv')!= null && document.getElementById('noRecordsDiv').style.display == "") {
document.getElementById('noRecordsDiv').style.display = 'none';
} else {
}
}
function check_author_variant_inputs(form) {
var i;
var hasInput = false;
var authorVariantSelectionElements = document.getElementsByName('radiobutton');
if (authorVariantSelectionElements != null) {
for (i = 0; i < authorVariantSelectionElements.length; i++) {
var authorVariantSelectionElement = authorVariantSelectionElements[i];
if (authorVariantSelectionElement.checked) {
hasInput = true;
break;
}
}
}
if (!hasInput) {
var errorMessage = document.getElementById('refineSelectAtLeastOneRadioButton').value;
alert(errorMessage);
}
return hasInput;
}
function setAuthorVariantName(radioObj){
var radioLength = radioObj.length;
if (typeof radioLength == 'undefined') {
document.forms['author_variant_more_form'].authorName.value = radioObj.value;
return radioObj.value;
}
for(var i = 0; i < radioLength; i++) {
if(radioObj[i].checked) {
document.forms['author_variant_more_form'].authorName.value = radioObj[i].value;
return radioObj[i].value;
}
}
return "";
}
function authorEnterFunction(event) {
if (event && event.keyCode == 13) {
validateAuthorName();
} else {
return false;
}
}
/*--------------- For wos-chem numerical fields ---------------*/
function toggleInputDisplay(item1, item2, operatorInput) {
var obj1 = document.getElementById(item1);
var obj2 = document.getElementById(item2);
if(operatorInput == "between"){
obj1.style.display = 'inline';
obj2.style.display = 'inline';
}
else{
obj1.value = '';
obj1.style.display = 'none';
obj2.style.display = 'none';
}
}
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 58 && charCode > 44 && charCode != 47))
return true;
else if (charCode == 8)return true;
return false;
}
/*--------------- For wos-chem numerical fields ---------------*/
function check_email(form) {
var email_to = $('#' + form.id + ' input[name="emailAddress"]').val();
var re = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+$/;
var emailTos = new String(email_to);
var emailTo = emailTos.split(';');
if(emailTo.length == 1 ) {
emailTo = emailTos.split(',');
}
var toEbox = document.getElementById('emailAddress_error');
toEbox.style.display = 'none';
for(i=0; i < emailTo.length; i++) {
emailTo[i] = emailTo[i].replace(/\s/g, "");
if (!emailTo[i].match(re) ||(emailTo[i].length ==0 && i ==0)) {
toEbox.style.display = 'block';
return false;
}
}
var str = emailTo.join(",");
form.emailAddress.value = str;
return true;
}
function swapCheckboxLabel(checkboxvar, labelId, uncheckedText, checkedText) {
//Swaps the text on a label associated with a checkbox
//Used to make dynamic labels for JAWS
//To call this include the following in the checkbox:
//onclick="swapCheckboxLabel(this, 'labelId', 'uncheckedText', 'checkedText');"
var labelvar = document.getElementById(labelId);
if(!checkboxvar.checked) {
labelvar.innerHTML = uncheckedText;
}
else {
labelvar.innerHTML = checkedText;
}
}
function exportFunctionality(owner){
var exportText = $('.saveToMenu ' + owner.saveAction).first().attr('name');
var titleText = $('.saveToMenu ' + owner.saveAction).first().attr('title');
var quickOptionSelectedClass = owner.saveAction.substring(1);
$('#saveToMenu').attr('value', owner.idPrefix.substring(2).toLowerCase());
saveOutputForm('UA_output_input_form');
$('.exportIconButton').parent().html(
'') ;
$('.exportIconButton').click(owner.showOptions);
$('.exportMoreOption').show();
}
function updateResultOptions( name, value ) {
var id = 'value(' + name + ')';
var form = $('.autoSaveForm');
var selector = $(form).find('input[name="' + id + '"]');
if ( selector ) {
selector[0].value = value;
saveForm(form.attr('name'));
}
return true;
}
function updateResultContentOption( selectObj ) {
if ( selectObj ) {
var index = selectObj.selectedIndex;
var opt = selectObj.options[index];
var value = opt.getAttribute("id");
if ( ! value ) {
value = opt.value;
}
updateResultOptions('contentType', value);
}
}
function prepareSQCDropDownMenu() {
var width = $("#sqcDropDownMenuTitleLink" ).width();
$("#sqcDropDownMenuTitleLink")
.hover(function() {
$(this).addClass("sqcDropDownMenuLink");
$("#sqcDropDownMenuTitleLink #sqcMenuArrow").hide();
$("#sqcDropDownMenuTitleLink #sqcMenuArrowHover").show();
var menu = $("#sqcDropDownMenuItems")
.show()
.position({my: "left top", at: "left bottom", of: this});
$(document).one("click", function() {
menu.hide();
});
return false;
},function(e) {
$(this).removeClass("sqcDropDownMenuLink");
$("#sqcDropDownMenuTitleLink #sqcMenuArrowHover").hide();
$("#sqcDropDownMenuTitleLink #sqcMenuArrow").show();
if(e.pageX < $("#sqcDropDownMenuItems").position().left
|| e.pageX > $("#sqcDropDownMenuItems").position().left + $("#sqcDropDownMenuItems").width()
|| e.pageY < $("#sqcDropDownMenuTitleLink").position().top
|| e.pageY > $("#sqcDropDownMenuItems").position().top + $("#sqcDropDownMenuItems").height() ) {
$("#sqcDropDownMenuItems").hide();
}
return false;
});
$("#sqcDropDownMenuTitleLink")
.focus(function() {
$(this).addClass("sqcDropDownMenuLink");
$("#sqcDropDownMenuTitleLink #sqcMenuArrow").hide();
$("#sqcDropDownMenuTitleLink #sqcMenuArrowHover").show();
var menu = $("#sqcDropDownMenuItems")
.show()
.position({my: "left top", at: "left bottom", of: this});
$(document).one("click", function() {
menu.hide();
});
return false;
}).focusout(function(e) {
$(this).removeClass("sqcDropDownMenuLink");
$("#sqcDropDownMenuTitleLink #sqcMenuArrowHover").hide();
$("#sqcDropDownMenuTitleLink #sqcMenuArrow").show();
$(".sqcDropDownMenuItem").first().find("a").focus();
return false;
});
$(".sqcDropDownMenuItem")
.focus(function() {
$(this).find("a").addClass("sqcDropDownMenuItemHover");
}).focusout(function(e) {
$(this).find("a").removeClass("sqcDropDownMenuItemHover");
var next = $(this).next();
if(next.attr("class") == $(this).attr("class")) {
next.find("a").focus();
} else {
$("#sqcDropDownMenuItems").hide();
}
});
$("#sqcDropDownMenuItems")
.menu()
.width(width)
.mouseleave(function() {
$("#sqcDropDownMenuItems").hide();
});
$("#sqcDropDownMenuItems li a").click(function() {
var href = $(this).attr('href');
$(location).attr('href', href);
});
}
function hideLinksDropdown( event ) {
var $target = $(event.target);
if (!event.target) {
$target = event.srcElement;
}
$('.popup-full-text').hide();
if ( $target.is('.button-ft') ) {
if ( $target.is('.button-active') ) {
$target.removeClass('button-active');
} else {
$target.addClass('button-active');
var name = $target.attr('name');
var $menu = $('#'+name+'_menu');
$menu.show();
}
} else {
$('.button-ft').removeClass('button-active');
}
}
function initHideShow( id, isActivated ) {
if ( id ) {
var prefix = '.' + id;
var showClass = ( isActivated ) ? ( prefix + 'On' ) : ( prefix + 'Off' );
var hideClass = ( isActivated ) ? ( prefix + 'Off' ) : ( prefix + 'On' );
$(hideClass).hide();
$(showClass).show();
}
}
function toggleOnOff( id ) {
if ( id ) {
var prefix = '.' + id;
$(prefix + 'On').toggle();
$(prefix + 'Off').toggle();
}
}
//this global variable will be used for journal overlay and ESI badge overlay
var globalDialog = null;
function open_journal_overlay( overlaySpan, linkSpan ) {
if ( overlaySpan && linkSpan ) {
var opt = {
autoOpen: false,
closeOnEscape: true,
modal: false,
closeText: 'close',
resizable: false,
close: function() {
$(this).dialog('destroy');
globalDialog = null;
},
dialogClass: 'ui-dialog-quickoutput journal-overlay',
position: {of: $( '#' + linkSpan), my: 'left top', at: 'left bottom'}
};
if(globalDialog!=null){
//if there is overlay is opened at this moment, we will close that one at first
$(globalDialog).dialog('close');
globalDialog = null;
}
var theDialog = $('#' + overlaySpan).dialog(opt);
theDialog.dialog("open");
globalDialog = theDialog;
return true;
}
else {
return false;
}
}
function open_esi_badge_overlay( overlaySpan, linkSpan ) {
if ( overlaySpan && linkSpan ) {
var opt = {
autoOpen: false,
closeOnEscape: true,
modal: false,
resizable: false,
draggable: false,
closeText: 'close',
close: function() {
$(this).dialog('destroy');
globalDialog = null;
},
dialogClass: 'ui-dialog-quickoutput journal-overlay esi-badge-overlay',
position: {of: $( '#' + linkSpan), my: 'right top', at: 'left bottom'}
};
if(globalDialog!=null){
//if there is overlay is opened at this moment, we will close that one at first
$(globalDialog).dialog('close');
globalDialog = null;
}
var theDialog = $('#' + overlaySpan).dialog(opt);
theDialog.dialog("open");
globalDialog = theDialog;
return true;
}
else {
return false;
}
}
function open_ra_entery_overlay(overlaySpan, linkSpan, optionalClass) {
var dialogClasses = 'ui-dialog-quickoutput journal-overlay esi-badge-overlay';
if(optionalClass){
dialogClasses += ' ' + optionalClass;
console.log('Specified.')
}
if ( overlaySpan && linkSpan ) {
var opt = {
autoOpen: false,
closeOnEscape: true,
modal: false,
resizable: false,
draggable: false,
closeText: 'close',
close: function() {
$(this).dialog('destroy');
globalDialog = null;
},
dialogClass: dialogClasses,
position: {of: $( '#' + linkSpan), my: 'left top', at: 'right bottom'}
};
if(globalDialog!=null){
//if there is overlay is opened at this moment, we will close that one at first
$(globalDialog).dialog('close');
globalDialog = null;
}
var theDialog = $('#' + overlaySpan).dialog(opt);
theDialog.dialog("open");
globalDialog = theDialog;
return true;
}
else {
return false;
}
}
function toggle_unified_funding() {
$('.uni_fund_toggle span').toggle();
$('.uni_fund').toggleClass('hide');
}
function open_early_access_overlay( overlaySpan, linkSpan ) {
console.log(overlaySpan);
if ( overlaySpan && linkSpan ) {
var opt = {
autoOpen: false,
closeOnEscape: true,
modal: false,
resizable: false,
draggable: false,
closeText: 'close',
close: function() {
$(this).dialog('destroy');
globalDialog = null;
},
dialogClass: 'ui-dialog-quickoutput journal-overlay esi-badge-overlay',
position: {of: $( '#' + linkSpan), my: 'left bottom', at: 'right top'}
};
if(globalDialog!=null){
//if there is overlay is opened at this moment, we will close that one at first
$(globalDialog).dialog('close');
globalDialog = null;
}
var theDialog = $('#' + overlaySpan).dialog(opt);
theDialog.dialog("open");
globalDialog = theDialog;
return true;
}
else {
return false;
}
}
function close_journal_overlay(thiscontext, overlaySpan) {
try {
$('#' + overlaySpan).dialog('close');
return true;
} catch (e) {
//alert("in catch");
$(thiscontext).parents('#' + overlaySpan).dialog('close');
return false;
}
}
function close_SML_overlay(thiscontext, overlaySpan) {
try {
$(thiscontext).closest('.ui-dialog-content').dialog('close');
return true;
} catch (e) {
//alert("in catch");
$(thiscontext).parents('#' + overlaySpan).dialog('close');
return false;
}
}
function close_SML_error_overlay(thiscontext, overlaySpan) {
try {
$(thiscontext).dialog('close');
return true;
} catch (e) {
//alert("in catch");
$(thiscontext).parents('#' + overlaySpan).dialog('close');
return false;
}
}
function save_markedlist(smlurl){
if(isMLFormValid() == true) {
reload = false;
if(!isMLReachLimit()) {
if(isListNameDuplicate(smlurl)) {
$("#saveToMLDialog").dialog("close");
var msg = $("#smlDuplicateMessage").val();
$("#smlDuplicateDialogText").text("'" + $('#MarkedListName').val() + "' " + msg);
$("#saveToMLDuplicateDialog").dialog( "open" );
}
else {
savedLists(smlurl);
}
}
else {
$("#saveToMLDialog").dialog("close");
$("#saveToMLLimitDialog").dialog("open");
}
}
}
function isMLReachLimit() {
var maxMarkedList = $("#maxMarkedList").val();
var currentMLCount = $("#currentMLCount").val();
if(maxMarkedList == currentMLCount) {
return true;
}
return false;
}
function isListNameDuplicate(smlurl) {
smlurl = smlurl + "&action=saveUniqueList&product=UA";
var duplicate = false;
$.ajax({type:'POST',
url: smlurl,
data: { listName: $('#MarkedListName').val() },
async:false,
success: function(data) {
if(data == 'DUPLICATE') {
duplicate = true;
}
},
error: function(data){
$("#saveToMLDialog").dialog( "close" );
$("#saveToMLErrorDialog").dialog( "open" );
}
});
return duplicate;
}
function savedLists(smlurl) {
smlurl = smlurl + "&action=saveList&product=UA";
var args = { listName: $('#MarkedListName').val() };
if($("#listDescription").val().length != 0) {
args['desc'] = $('#listDescription').val();
}
$.ajax({type:'POST',
url: smlurl,
data: args,
async:false,
success: function(data) {
$("#saveToMLDialog").dialog( "close" );
$("#saveToMLDuplicateDialog").dialog("close");
if(data == 'OK') {
$("#saveToMLDoneDialog").dialog( "open" );
}
else {
$("#saveToMLErrorDialog").dialog( "open" );
}
},
error: function(data){
$("#saveToMLDialog").dialog( "close" );
$("#saveToMLErrorDialog").dialog( "open" );
}
});
}
function isMLFormValid() {
var regex = /[<>]/;
if($('#MarkedListName').val().length == 0) {
$('#SMLnameEmpty').css("visibility", "visible");
return false;
}
if (regex.test($('#MarkedListName').val())) {
alert("greater than sign or less than sign cannot be used in list name");
return false;
}
return true;
}
function MLDetection() {
$("#mlFirstUse").dialog( "open" );
$('#hasMLPopUpShown').val(true);
saveForm('UA_options_input_form');
};
function openMarkedListOverlay(listName, possibleCount, index) {
$("#replaceButton").click(function(){
submitAndRetrieveSml(index, "&replace=true");
});
if (possibleCount > MARKED_LIST_MAX_RECORDS) {
$(".replaceAddSpan").css("display", "none");
$("#replaceAddButton").html("");
$(".replaceRecordsOrAdd").html("");
}
else {
$("#replaceAddButton").click(function(){
submitAndRetrieveSml(index, "&replace=false");
});
$(".replaceRecords").html("");
}
$("#mlOpen").dialog( "open" );
};
function browserDetection() {
var popupStatus = $('#hasBrowserPopUpShown').val();
if (navigator.appName.indexOf("Internet Explorer") > -1) {
if (navigator.appVersion.indexOf("MSIE 9") > -1 || navigator.appVersion.indexOf("MSIE 8") > -1 ) {
if (location.protocol !== "https:") {
var protocol = "https://";
var host = $('#applicationHostString').html();
if ( host.length == 0 )
host = location.host;
var path = location.pathname;
var query = location.search;
var destination = protocol + host + path + query;
location.replace(destination);
}
}
}
if (popupStatus != 'true') {
var nVer = navigator.appVersion;
var nAgt = navigator.userAgent;
var browserName = navigator.appName;
var fullVersion = ''+parseFloat(navigator.appVersion);
var majorVersion = parseInt(navigator.appVersion,10);
var nameOffset,verOffset,ix;
var operatingSystem, winVersion;
var popUpMessage;
/* In Opera, the true version is after "Opera" or after "Version" */
if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
browserName = "Opera";
fullVersion = nAgt.substring(verOffset+6);
if ((verOffset=nAgt.indexOf("Version"))!=-1)
fullVersion = nAgt.substring(verOffset+8);
}
/* In MSIE, the true version is after "MSIE" in userAgent */
else if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
browserName = "Internet Explorer";
fullVersion = nAgt.substring(verOffset+5);
}
/* In Chrome, the true version is after "Chrome" */
else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) {
browserName = "Chrome";
fullVersion = nAgt.substring(verOffset+7);
}
/* In Safari, the true version is after "Safari" or after "Version" */
else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
browserName = "Safari";
fullVersion = nAgt.substring(verOffset+7);
if ((verOffset=nAgt.indexOf("Version"))!=-1)
fullVersion = nAgt.substring(verOffset+8);
}
/* In Firefox, the true version is after "Firefox" */
else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
browserName = "Firefox";
fullVersion = nAgt.substring(verOffset+8);
}
/* In most other browsers, "name/version" is at the end of userAgent -*/
else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) )
{
browserName = nAgt.substring(nameOffset,verOffset);
fullVersion = nAgt.substring(verOffset+1);
if (browserName.toLowerCase()==browserName.toUpperCase()) {
browserName = navigator.appName;
}
}
majorVersion = parseInt(''+fullVersion,10);
if (isNaN(majorVersion)) {
fullVersion = ''+parseFloat(navigator.appVersion);
majorVersion = parseInt(navigator.appVersion,10);
}
if (/Windows/.test(nAgt)) {
operatingSystem = "Windows";
if (/Windows NT 5.1|Windows XP/.test(nAgt)) {
winVersion = "XP";
} else if (/Windows NT 5.2/.test(nAgt)) {
winVersion = "Server 2003";
} else if (/Windows NT 6.0/.test(nAgt)) {
winVersion = "Vista";
} else if (/Windows NT 6.1/.test(nAgt)) {
winVersion = "7";
} else if (/Windows NT 6.2/.test(nAgt)) {
winVersion = "8";
}
} else if (/Mac_PowerPC|Macintosh/.test(nAgt)) {
operatingSystem = "Mac";
} else if (/Linux|X11/.test(nAgt)) {
operatingSystem = "Linux";
} else if (/SunOS/.test(nAgt)) {
operatingSystem = "SunOS";
} else {
operatingSystem = "other";
}
//browserName = "Internet Explorer";
//majorVersion = 8;
//winVersion = "XP";
//alert ("operatingSystem: "+operatingSystem+" winVersion: "+winVersion);
//alert ("browserName: "+browserName+" majorVersion: "+majorVersion+" fullVersion: "+fullVersion);
if (browserName === "Firefox") {
if (majorVersion <= 19) {
popUpMessage = $('#browserMessage').val();
}
} else if (browserName === "Internet Explorer") {
if (majorVersion <= 7) {
popUpMessage = $('#browserMessageIE').val();
}
} else if (browserName === "Chrome") {
if (majorVersion <= 24) {
popUpMessage = $('#browserMessage').val();
}
} else if (browserName === "Safari") {
if (majorVersion <= 5) {
popUpMessage = $('#browserMessage').val();
}
}
if (popUpMessage != null && !(/\?\?\?/.test(popUpMessage))) {
popUpMessage = popUpMessage.replace("BROWSERNAME", browserName);
popUpMessage = popUpMessage.replace("MAJORVERSION", majorVersion);
popUpMessage = popUpMessage.replace("OSVERSION", operatingSystem);
popUpMessage = popUpMessage.replace("WINVERSION", winVersion);
popUpMessage = popUpMessage.replace("+", "\n");
alert(popUpMessage);
}
popupStatus = 'true';
$('#hasBrowserPopUpShown').val(popupStatus);
saveForm('UA_options_input_form');
}
};
var Email = {
isValid: function (address) {
var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(address);
}
};
/* Addition for Full Record Show/Hide (WOSVX-10735) */
function expandCollapseRecord(buttonMessageId, buttonMessageToExpand, buttonMessageToCollapse, divToShowHideId, formToPersistId, formFieldId) {
var divToShowHideId = '#' + divToShowHideId;
var buttonMessageId = '#' + buttonMessageId;
var persistanceName = '#' + formToPersistId + ' #' + formFieldId;
if($(divToShowHideId).is(':visible')) {
$(buttonMessageId).text(buttonMessageToExpand);
$(divToShowHideId).hide(500);
trackSnowplowEventSE('see-fewer-data-fields-click');
if(formToPersistId && formFieldId && formToPersistId != '' && formFieldId != '') {
$(persistanceName).val('false');
saveForm(formToPersistId);
}
}
else {
$(buttonMessageId).text(buttonMessageToCollapse);
$(divToShowHideId).show(500);
trackSnowplowEventSE('see-more-data-fields-click');
if(formToPersistId && formFieldId && formToPersistId != '' && formFieldId != '') {
$(persistanceName).val('true');
saveForm(formToPersistId);
}
}
}
/* End Addition. */
function updateSiloInformation(silo){
if($(".silo-information").length == 0){
$(".select2-container--dbselect .select2-dropdown.select2-dropdown--below").after("")
}
let show = '#editions_' + silo + '_show';
let hide = '#editions_' + silo + '_hide';
let cont = '#editions_' + silo;
let db = $('').html($("#databaseDesc").html());
db.find(show).hide();
db.find(hide).hide();
db.find(cont).show();
$(".silo-information").html(db.find('#' + silo));
}
function startsWith(str, word) {
return str.lastIndexOf(word, 0) === 0;
}
function updateFieldInformation(field){
if(startsWith(field, "UA") || startsWith(field, "WOS")){
if($(".field-information").length == 0){
$(".select2-container--open .select2-dropdown ").after("")
}
let db = $('').html($("#fieldDesc").html());
$(".field-information").html(db.find('#' + field));
}
}
/*--------------- this should always be last in the script ---------------*/
addEvent(window, "load", function(){
processPageLinks();
// processPageInputButtons();
});
function proxyAddToPubList_submit(){
var form = document.forms["ProxyClaimForm"];
var error_msg = document.getElementById('no.radio.button.selected');
var Radios = getNamedFormInputs(form, 'rid_steamID');
var len = Radios.length;
if (typeof len == 'undefined') {
len = 1;
}
var atleastOneRadioChecked = false;
for(i = 0; i < len; i++) {
if(Radios[i].checked == true) {
atleastOneRadioChecked = true;
}
}
if (atleastOneRadioChecked) {
form.submit;
}
else {
alert(error_msg.value);
return false;
}
return true;
}
function paintGenericESILinkInOverlay(id){
var currentESILink = $('#HS_ESILink').attr("onclick");
var esilink = "";
if($( '#'+id ).length != 0){
if(id.indexOf("esi_hp_overlay_generic_") != -1){
esilink = currentESILink.replace("OutboundService.do?", "OutboundService.do?esitype=esi_hot&");
$( '#'+id ).attr("onclick",esilink );
}
else {
esilink = currentESILink.replace("OutboundService.do?", "OutboundService.do?esitype=esi_highlycited&");
$( '#'+id ).attr("onclick",esilink );
}
}
}
function formatESIBadgeLink(id){
if($( '#'+id ).length != 0){
$('#'+id).hover(function(){
$('#'+id).css("cursor","pointer");
$('#'+id).css("text-decoration","underline");
},function(){
$('#'+id).css("text-decoration","none");
});
}
}
function toggleSearchTypes(moreText, moreTextAlt, lessText, lessTextAlt) {
$(".hidable").toggleClass('searchtype-sub-nav__list-item-hidden');
$("#searchToggle").toggleClass('fa-minus');
$("#searchToggle").toggleClass('fa-plus');
$("#searchToggleText").toggleText(moreText, moreTextAlt, lessText, lessTextAlt);
}
jQuery.fn.extend({
toggleText: function (moreText, moreTextAlt, lessText, lessTextAlt){
var that = this;
if (that.text() != lessText && that.text() != moreText){
that.text(lessText);
$('#searchtype-toggle-btn').prop('title', lessTextAlt);
trackSnowplowEventSE('more-search-types-click');
}
else
if (that.text() == lessText){
that.text(moreText);
$('#searchtype-toggle-btn').prop('title', moreTextAlt);
trackSnowplowEventSE('less-search-types-click');
}
else
if (that.text() == moreText){
that.text(lessText);
$('#searchtype-toggle-btn').prop('title', lessTextAlt);
trackSnowplowEventSE('more-search-types-click');
}
return this;
}
});
function getFileName() {
var fi = document.getElementById('ssslocalFile'); // GET THE FILE INPUT AS VARIABLE.
var totalFileSize = 0;
// VALIDATE OR CHECK IF ANY FILE IS SELECTED.
if (fi.files.length > 0)
{
// RUN A LOOP TO CHECK EACH SELECTED FILE.
for (var i = 0; i <= fi.files.length - 1; i++)
{
//ACCESS THE SIZE PROPERTY OF THE ITEM OBJECT IN FILES COLLECTION. IN THIS WAY ALSO GET OTHER PROPERTIES LIKE FILENAME AND FILETYPE
var fsize = fi.files.item(i).size;
$("#ssslocalfilelabel").text(fi.files.item(i).name);
var ssslocalFileproduct = fi.files.item(i).name.split('.');
$("#sssProductId").val(ssslocalFileproduct.pop().toLocaleUpperCase());
var reader = new FileReader();
reader.readAsText(fi.files.item(i));
reader.onloadend = function () {
var text = reader.result;
$("#fileToUpload").val(trimXml(text));
}
}
}
}
function trimXml(unsafeXml) {
return unsafeXml.replace(/'/g, '\'')
.replace(/"/g, '"')
.replace(/>/g, '>')
.replace(/</g, '<')
.replace(/&/g, '&');
}
function open_ft_with_logging(docNum, publisher_url, new_window,
logOpenAccessUrl, content_type, viewType, linksGatewayIdentifier) {
if (publisher_url.indexOf('GoogleScholar') > 0) {
publisher_url = publisher_url + '&link_type=google_scholar';
}
var isComingFromLinkGateway = true;
if (publisher_url.indexOf(linksGatewayIdentifier) < 0) {
isComingFromLinkGateway = false;
}
var isProductKJD = false;
if (publisher_url.indexOf('product=KJD') > 0) {
isProductKJD = true;
}
var isProductRSCI = false;
if (publisher_url.indexOf('product=RSCI') > 0) {
isProductRSCI = true;
}
var isProductARCI = false;
if (publisher_url.indexOf('product=ARCI') > 0) {
isProductARCI = true;
}
open_location(publisher_url, "full_text");
var coll_id = "coll_id_" + docNum;
var url = '';
url = $('#' + coll_id).attr('value');
if (url == 'SCIELO') {
return open_ft_with_logging_scielo(docNum, publisher_url, new_window,
logOpenAccessUrl, content_type, viewType, linksGatewayIdentifier);
} else {
if (publisher_url.indexOf('GoogleScholar') > 0) {
content_type = 'google_scholar';
}
var id = "for_fulltext_logging_" + docNum + "_1";
if (isProductRSCI || isProductKJD || isProductARCI) {
if ('full_text' === content_type && 'summary' === viewType) {
id = "for_fulltext_logging_on_summary_" + docNum + "_1";
}
}
var idGotten = document.getElementById(id);
if (idGotten) {
var ut = $('#' + id).attr('ut');
var publisherId = $('#' + id).attr('publisher_id');
var journalId = $('#' + id).attr('journal_id');
var docId = $('#' + id).attr('doc_id');
if (logOpenAccessUrl) {
var baseLogOpenAccessUrl = logOpenAccessUrl
+ '&oaType=' + content_type + '&publisherId=' + publisherId
+ '&journalId=' + journalId + '&ut=' + ut + '&docId=' +docId;
var targetLogOpenAccessUrl = baseLogOpenAccessUrl;
if ('fullRecord' === viewType) {
if (isComingFromLinkGateway) {
targetLogOpenAccessUrl = baseLogOpenAccessUrl + '&includeEventConfig=eventsForFullTxtFromFullRec';
} else {
targetLogOpenAccessUrl = baseLogOpenAccessUrl + '&includeEventConfig=forNonLinkGatewayFromFullRec';
if ('ncbi_db'===content_type){
//since ncbi link is special to use 'LinksService.do',but it actually go through links gateway
targetLogOpenAccessUrl = baseLogOpenAccessUrl + '&includeEventConfig=eventsForFullTxtFromFullRec';
}
}
}
if ('summary' === viewType) {
if (isComingFromLinkGateway) {
//nothing here
} else {
targetLogOpenAccessUrl = baseLogOpenAccessUrl + '&includeEventConfig=forNonLinkGatewayFromSummary';
}
}
$.ajax({
type : 'GET',
url : targetLogOpenAccessUrl,
data : null,
async : true,
success : function(data) {
},
error : function(data) {
}
});
}
return;
}
if ('fullRecord' === viewType) {
if (logOpenAccessUrl) {
logOpenAccessUrl = logOpenAccessUrl + '&includeEventConfig=eventsForFullTxtFromFullRec';
$.ajax({
type : 'GET',
url : logOpenAccessUrl,
data : null,
async : true,
success : function(data) {
},
error : function(data) {
}
});
}
return;
}
}
}
function open_ft_with_logging_scielo(docNum, publisher_url, new_window,
logOpenAccessUrl, content_type, viewType, linksGatewayIdentifier) {
open_location(publisher_url, "full_text");
var id = "for_scielo_fulltext_logging_" + docNum;
if (publisher_url.indexOf('GoogleScholar') > 0) {
content_type = 'google_scholar';
}
var isComingFromLinkGateway = true;
if (publisher_url.indexOf(linksGatewayIdentifier) < 0) {
isComingFromLinkGateway = false;
}
var idGotten = document.getElementById(id);
if (idGotten) {
var ut = $('#' + id).attr('ut');
var publisherId = $('#' + id).attr('publisher_id');
var journalId = $('#' + id).attr('journal_id');
var docId = $('#' + id).attr('doc_id');
var targetContentType = 'gold';
if (publisher_url.indexOf('GoogleScholar') > 0) {
targetContentType = 'google_scholar';
}
if (logOpenAccessUrl) {
var targetLogOpenAccessUrl = logOpenAccessUrl + '&oaType=' + targetContentType
+ '&publisherId=' + publisherId + '&journalId=' + journalId
+ '&ut=' + ut + '&docId=' +docId;
if ('fullRecord' === viewType) {
if (isComingFromLinkGateway) {
targetLogOpenAccessUrl = targetLogOpenAccessUrl + '&includeEventConfig=eventsForFullTxtFromFullRec';
} else {
targetLogOpenAccessUrl = targetLogOpenAccessUrl + '&includeEventConfig=forNonLinkGatewayFromFullRec';
}
}
if ('summary' === viewType) {
if (isComingFromLinkGateway) {
//nothing here
} else {
targetLogOpenAccessUrl = targetLogOpenAccessUrl + '&includeEventConfig=forNonLinkGatewayFromSummary';
}
}
$.ajax({
type : 'GET',
url : targetLogOpenAccessUrl,
data : null,
async : true,
success : function(data) {
},
error : function(data) {
}
});
}
}
}
$(function() {
if (typeof String.prototype.endsWith != 'function') {
String.prototype.endsWith = function (str) {
return this.match(new RegExp(str + "$"));
};
}
var sort_value = $("#selected_sortBy").first().text();
var sort_by_options = sort_value.split(";", 1);
var firstOptBtn = sort_by_options[0];
if(firstOptBtn.endsWith(".en") == true){
var firstOptNoDotEnBtn = firstOptBtn.slice(0,firstOptBtn.lastIndexOf(".en") );
}
if(firstOptBtn == 'AU.A' || firstOptBtn == 'AU.D' || firstOptBtn == 'SO.A' || firstOptBtn == 'SO.D'){
var firstOptAddDotEn = firstOptBtn + ".en" ;
}
var sort_btn_selected;
sort_btn_selected = $('li[name="sort"]').filter(function() {
sort_btn_values = $(this).attr('id');
var sort_opt_btn_value = sort_btn_values.split(";",1);
return $(this).attr('id') == sort_value || sort_opt_btn_value[0] == firstOptBtn || sort_opt_btn_value[0] == firstOptNoDotEnBtn || sort_opt_btn_value[0] == firstOptAddDotEn;
}).addClass('sorttype-sub-nav_list-item-active');
});
var graphsInitialized = false;
$(document).ready(function() {
$('#value\\(input1\\)')
.on("paste input", function() {
if($(document.getElementById('value(input1)')).val() != "" && $('#fieldCount').val() == "1"){
enableReset();
}
else if($('#select1').val() == "TS" && $(document.getElementById('value(input1)')).val() == "" && $('#fieldCount').val() == "1"){
disableReset();
}
});
$("[id='clearIcon1']").click (function(){
if($('#select1').val() == "TS" && $('#fieldCount').val() == "1"){
disableReset();
}
});
$(".tooltiptrigger").on('mouseover focus', function(){
$(".tooltip").attr("aria-hidden","false");
});
$(".tooltiptrigger").on ('mouseleave focusout', function(){
var tooltipDismissDelayTime = $(".tooltip").attr("dismiss-delay");
if (tooltipDismissDelayTime) {
setTimeout(function(){
$(".tooltip").attr("aria-hidden","true");
}, parseInt(tooltipDismissDelayTime));
} else {
$(".tooltip").attr("aria-hidden","true");
}
});
$(".tooltiptrigger").keydown(function(ev){
if (ev.which ==27) {
$(".tooltip").attr("aria-hidden","true");
ev.preventDefault();
return false;
}
});
$('[ra-tooltip-content]').on('mouseenter focusin', function () {
var content = $(this).attr('ra-tooltip-content');
var xPosition = $(this).position().left;
var yPosition = $(this).position().top;
if (xPosition + 300 >= $(window).width()) {
xPosition = $(window).width() - 300;
};
var style = { left: xPosition + 'px', top: yPosition + 'px', display: 'none' };
var box = $('', { class: 'ra-tooltip-box' }).html(content).css(style);
box.appendTo($(this)).fadeIn(200);
});
$('[ra-tooltip-content]').on('mouseleave focusout', function () { $('.ra-tooltip-box').fadeOut(200, function () { $(this).remove(); }); }).blur();
$(".ra-select li button").keypress(function(e){
if(e.which == 13) { //Enter key pressed
setRaSelected(e);
}
});
if(document.getElementById("saveToMenu") != null)
document.getElementById("saveToMenu").value = $('#selectedQOFormat').val();
if ($('#alert_deleted_local').length >0 ) {
alert_deleted_local = $('#alert_deleted_local').attr('value');
if (alert_deleted_local == 'yes') {
save_alert = document.getElementById('savehist');
if (typeof save_alert !== undefined && save_alert !== null) {
save_alert.setAttribute("disabled", "disabled");
}
save_alert = document.getElementById('createAlertRSS');
if (typeof save_alert !== undefined && save_alert !== null){
save_alert.setAttribute("disabled", "disabled");
}
}
}
});
function setRaSelected(e) {
$('.ra-select').find('button[selected]').removeAttr('selected');
$(e.currentTarget).attr('selected', true);
var field_value=$('.ra-select').find('button[selected]').val();
$('#field').val(field_value);
var yearSort=$('.ra-select').find('button[selected]').attr("yearSort");
if (typeof yearSort !== typeof undefined && yearSort == "true") {
$('#yearSort').val(yearSort);
} else {
$('#yearSort').val("false");
}
$('#wos-busy-indicator').css('visibility', 'visible');
var labelData = $(e.target).text().trim();
trackSnowplowEventSE('ra-categories-click',labelData);
submitAnalyzeResultsForm();
};
function hideBusyIndicator() {
$('#wos-busy-indicator').css('visibility', 'hidden');
var qstring = $("body").attr("data-querystring");
$('#WosQueryString').html(qstring);
var hstring = $("body").attr("data-historystring");
if (hstring) {
$('#WosHistoryString').html(hstring);
}
var noticenorecords = $("body").attr("data-noticenorecords");
$('#noticeNorecordsMsg').html(noticenorecords);
$('.ra-select li button').blur();
};
function submitAnalyzeResultsForm() {
var product=$('input[name=product]').val();
var SID=$('input[name=SID]').val();
var fieldValue = $('#field').val();
var yearSort=$('input[name=yearSort]').val();
var self_base_url=$('input[name=self_base_url]').val();
var analyzeUrl = self_base_url+'/analyze.do?product='+product+'&SID='+SID+'&field='+fieldValue+'&yearSort='+yearSort;
document.location.href = analyzeUrl;
};
function ValidateUpdateRecsInRA(initialSortType, initialThreshold,
initialMaxrows, initialMaxrecs, product) {
var finalMaxRows = document.getElementById("refineMaxRows").value;
var finalThreshold = document.getElementById("refineThreshold").value;
var finalSortType = document.getElementById("refineSortType").value;
if (product == 'DIIDW') {
var finalMaxRecs = document.getElementById("refineMaxRecs").value;
if (initialSortType != finalSortType
|| initialThreshold != finalThreshold
|| initialMaxrows != finalMaxRows
|| initialMaxrecs != finalMaxRecs) {
saveFormElements('analyzeForm');
setTimeout(function() { submitAnalyzeResultsForm(); }, 750);
}
} else if (initialSortType != finalSortType
|| initialThreshold != finalThreshold
|| initialMaxrows != finalMaxRows) {
saveFormElements('analyzeForm');
setTimeout(function() { submitAnalyzeResultsForm(); }, 750);
}
trackSnowplowEventSE('ra-update-click', finalThreshold);
}
function submitAnalyzeForEnterKeyRA(event, initialThreshold) {
var finalThreshold = document.getElementById("refineThreshold").value;
if (!event) var event = window.event;
if (event.keyCode == 13) {
if (initialThreshold != finalThreshold) {
saveFormElements('analyzeForm');
setTimeout(function() { submitAnalyzeResultsForm(); }, 1500);
}
}
}
function showCitationReport() {
$("#citation-report-display").removeClass('hide-cr-graph')
$("#citation-report-display").show();
$('#citation-report-display-header').show();
$("#cr-display-show-icon-container").hide();
$('input[name="isCRHidden"]').each(function(){
$(this).val('false')
})
$('.paginationNext, .paginationPrev, .tcPerYear a').each(function(){
var paginationURL = $(this).attr('href');
if(paginationURL && paginationURL != "javascript: void(0)"){
$(this).attr('href', paginationURL.split('&isCRHidden')[0])
}
})
if(!graphsInitialized) {
crCharts.initialize('raw_pi_data', 'raw_tc_data');
graphsInitialized = true;
}
}
function hideCitationReport() {
$("#citation-report-display").removeClass('hide-cr-graph')
$("#citation-report-display").hide();
$("#cr-display-show-icon-container").show();
$('input[name="isCRHidden"]').each(function(){
$(this).val('true')
})
$('.paginationNext, .paginationPrev, .tcPerYear a').each(function(){
var paginationURL = $(this).attr('href').split('&isCRHidden')[0];
if(paginationURL && paginationURL != "javascript: void(0)"){
$(this).attr('href', paginationURL+'&isCRHidden=true')
}
})
}
function switchContent() {
if ($('.l-column-content input[name="view"]:checked').val() === 'en') {
$(".l-column-content").addClass('enRoot');
$(".l-column-content").removeClass('arRoot');
$('#ARCILang').val("english");
saveOutputForm('UA_output_input_form');
//$(".l-column-content").prop("dir", "ltr");
} else if ($('.NEWfullRecordDataContainer input[name="view"]:checked').val() === 'ar') {
$(".l-column-content").addClass('arRoot');
$(".l-column-content").removeClass('enRoot');
$('#ARCILang').val("arabic");
saveOutputForm('UA_output_input_form');
//$(".l-column-content").prop("dir", "rtl");
}
}
/**
* Show Publons badge container if badge is present (container is hidden by default)
*
* Publons may not have data on a record despite its journal being a Publons-supported journal
*
*/
function checkPublonsBadgeCardDisplay() {
var publonsPeerReviewsCard = $("#publons-peer-reviews-card");
var showPublonsBadge = $("#show-publons-badge");
if(publonsPeerReviewsCard.length && showPublonsBadge.length && showPublonsBadge.val() === "true") {
const config = { childList: true, subtree: true };
const badgeCallback = function(mutationsList, observer) {
if($(".publons-badge-inner").length) {
var publonsBadge = $(".publons-badge-inner");
var badgeImgSrc = $(".publons-badge-inner > .publons-badge-icon > img").attr("src").toLowerCase();
// badge appeared - disconnect observer
observer.disconnect();
// only display badge with peer reviews, represented by blue badge (gray badges have no peer reviews)
if(publonsBadge.css("display") === "block" && badgeImgSrc.indexOf("blue") > -1) {
publonsPeerReviewsCard.css("display", "block");
trackSnowplowEvents();
}
} else {
setTimeout(function() {
observer.disconnect();
}, 100);
}
};
const badgeContainerCallback = function(mutationsList, observer) {
if($(".publons-badge").length) {
var publonsBadgeContainer = document.querySelector(".publons-badge");
// badge container appeared - disconnect observer
observer.disconnect();
badgeObserver = new MutationObserver(badgeCallback);
// wait for badge to appear inside badge container
badgeObserver.observe(publonsBadgeContainer, config);
} else {
setTimeout(function() {
observer.disconnect();
}, 100);
}
};
var sidebar = document.querySelector("#sidebar-container");
var badgeObserver = new MutationObserver(badgeContainerCallback);
// wait for badge container to appear inside sidebar
badgeObserver.observe(sidebar, config);
const trackSnowplowEvents = function() {
var viewName = $('input[name="colName"]').val() + '-' + $('#viewType').val();
var product = $('#product_sp').first().text();
var search_mode = $('#search_mode_sp').first().text();
var pageName = viewName;
if(viewName == product + "-" + "fullRecord"){
pageName = product + "-" + search_mode + "-" + "fullRecord";
} else {
pageName = viewName;
}
trackPage(pageName);
trackSnowplowEventSE("view-publons-peer-reviewed-fullrecord-page");
};
}
}
//Fix to reload safari's bfcache (WOSVX-12865)
$(window).bind("pageshow", function(event) {
if (event.originalEvent.persisted) {
window.location.reload()
}
});