2011-01-24 21:21:09 +00:00
|
|
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
2012-11-16 16:00:56 -05:00
|
|
|
|
|
|
|
$.extend(this, individualLocalName);
|
|
|
|
|
2011-01-24 21:21:09 +00:00
|
|
|
// "more"/"less" HTML truncator for showing more or less content in data property core:overview
|
2011-01-26 22:17:19 +00:00
|
|
|
$('.overview-value').truncate({max_length: 500});
|
2011-01-24 21:21:09 +00:00
|
|
|
|
2011-09-28 15:12:39 +00:00
|
|
|
$.fn.exists = function () {
|
|
|
|
return this.length !== 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$.fn.moreLess = function () {
|
|
|
|
$(this).each
|
|
|
|
}
|
|
|
|
|
|
|
|
var togglePropDisplay = {
|
|
|
|
showMore: function($toggleLink, $itemContainer) {
|
|
|
|
$toggleLink.click(function() {
|
|
|
|
$itemContainer.show();
|
|
|
|
$(this).attr('href', '#show less content');
|
|
|
|
$(this).text('less');
|
|
|
|
togglePropDisplay.showLess($toggleLink, $itemContainer);
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
showLess: function($toggleLink, $itemContainer) {
|
|
|
|
$toggleLink.click(function() {
|
|
|
|
$itemContainer.hide();
|
|
|
|
$(this).attr('href', '#show more content');
|
2011-10-04 22:01:25 +00:00
|
|
|
$(this).text('more...');
|
2011-09-28 15:12:39 +00:00
|
|
|
togglePropDisplay.showMore($toggleLink, $itemContainer);
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-10-04 22:01:25 +00:00
|
|
|
// var $propList = $('.property-list').not('>li>ul');
|
2011-09-28 15:12:39 +00:00
|
|
|
var $propList = $('.property-list:not(:has(>li>ul))');
|
|
|
|
$propList.each(function() {
|
2011-10-27 15:20:26 +00:00
|
|
|
var $additionalItems = $(this).find('li:gt(4)');
|
2011-09-28 15:12:39 +00:00
|
|
|
if ( $additionalItems.exists() ) {
|
|
|
|
// create container for additional elements
|
|
|
|
var $itemContainer = $('<div class="additionalItems" />').appendTo(this);
|
|
|
|
|
2011-10-04 22:01:25 +00:00
|
|
|
// create toggle link
|
|
|
|
var $toggleLink = $('<a class="more-less" href="#show more content">more...</a>').appendTo(this);
|
|
|
|
|
2011-09-28 15:12:39 +00:00
|
|
|
$additionalItems.appendTo($itemContainer);
|
|
|
|
|
|
|
|
$itemContainer.hide();
|
|
|
|
|
|
|
|
togglePropDisplay.showMore($toggleLink, $itemContainer);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-10-04 22:01:25 +00:00
|
|
|
var $subPropList = $('.subclass-property-list');
|
|
|
|
$subPropList.each(function() {
|
2011-10-27 15:20:26 +00:00
|
|
|
var $additionalItems = $(this).find('li:gt(4)');
|
2011-10-04 22:01:25 +00:00
|
|
|
if ( $additionalItems.exists() ) {
|
|
|
|
// create container for additional elements
|
|
|
|
var $itemContainer = $('<div class="additionalItems" />').appendTo(this);
|
|
|
|
|
|
|
|
// create toggle link
|
|
|
|
var $toggleLink = $('<a class="more-less" href="#show more content">more...</a>').appendTo(this);
|
|
|
|
|
|
|
|
$additionalItems.appendTo($itemContainer);
|
|
|
|
|
|
|
|
$itemContainer.hide();
|
|
|
|
|
|
|
|
togglePropDisplay.showMore($toggleLink, $itemContainer);
|
2011-09-28 15:12:39 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2011-10-04 22:01:25 +00:00
|
|
|
var $subPropSibs = $subPropList.closest('li').last().nextAll();
|
|
|
|
var $subPropParent = $subPropList.closest('li').last().parent();
|
|
|
|
var $additionalItems = $subPropSibs.slice(3);
|
|
|
|
if ( $additionalItems.length > 0 ) {
|
|
|
|
// create container for additional elements
|
|
|
|
var $itemContainer = $('<div class="additionalItems" />').appendTo($subPropParent);
|
|
|
|
|
|
|
|
// create toggle link
|
|
|
|
var $toggleLink = $('<a class="more-less" href="#show more content">more...</a>').appendTo($subPropParent);
|
|
|
|
|
|
|
|
$additionalItems.appendTo($itemContainer);
|
|
|
|
|
|
|
|
$itemContainer.hide();
|
|
|
|
|
|
|
|
togglePropDisplay.showMore($toggleLink, $itemContainer);
|
|
|
|
}
|
|
|
|
|
2011-03-14 19:20:33 +00:00
|
|
|
// Change background color button when verbose mode is off
|
2011-03-22 03:30:45 +00:00
|
|
|
$('a#verbosePropertySwitch:contains("Turn off")').addClass('verbose-off');
|
2011-04-11 15:47:44 +00:00
|
|
|
|
2011-06-24 09:50:49 +00:00
|
|
|
// Reveal vCard QR code when QR icon is clicked
|
|
|
|
$('#qrIcon, .qrCloseLink').click(function() {
|
2011-06-28 18:21:14 +00:00
|
|
|
$('#qrCodeImage').toggleClass('hidden');
|
2011-06-24 09:50:49 +00:00
|
|
|
return false;
|
|
|
|
});
|
2012-08-07 19:37:11 +00:00
|
|
|
|
|
|
|
// For pubs and grants on the foaf:person profile, and affiliated people
|
|
|
|
// on the foaf:organization profile -- if a pub/grant/person has been hidden
|
|
|
|
// via the "manage" link, we need to ensure that the subclass heading gets removed
|
|
|
|
// if there are no items to display for that subclass.
|
|
|
|
$.each($('h3'), function() {
|
|
|
|
if ( $(this).next().attr('class') == "subclass-property-list hideThis" ) {
|
|
|
|
if ( $(this).next().children().length == 0 ) {
|
|
|
|
$(this).closest('li').remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// if there are no selected pubs, hide the manage link; same for grants
|
|
|
|
// and affiliated people on the org profile page
|
|
|
|
if ( $('ul#authorInAuthorshipList').children('li').length < 1 && $('h3#authorInAuthorship').attr('class') != "hiddenPubs" ) {
|
|
|
|
$('a#managePubLink').hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $('ul#hasResearcherRoleList').children('li').length < 1 &&
|
|
|
|
$('ul#hasPrincipalInvestigatorRoleList').children('li').length < 1 &&
|
|
|
|
$('ul#hasCo-PrincipalInvestigatorRoleList').children('li').length < 1 &&
|
|
|
|
$('ul#hasInvestigatorRoleList').children('li').length < 1 &&
|
|
|
|
$('h3#hasResearcherRole').attr('class') != "hiddenGrants" ) {
|
|
|
|
$('a#manageGrantLink').hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( $('ul#organizationForPositionList').children('li').length < 1 && $('h3#organizationForPosition').attr('class') != "hiddenPeople" ) {
|
|
|
|
$('a#managePeopleLink').hide();
|
|
|
|
}
|
2012-11-16 16:00:56 -05:00
|
|
|
|
|
|
|
// if there are webpages but no contacts (email/phone), extend
|
|
|
|
// the webpage border the full width. Used with "standard" profile view.
|
|
|
|
if ( $('h2#contactHeading').length < 1 ) {
|
|
|
|
$('div#webpagesContainer').css('width', '100%').css('clear','both');
|
|
|
|
}
|
2011-10-27 15:20:26 +00:00
|
|
|
});
|