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 ( ) {
// "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
// "more"/"less" HTML truncator for all properties
// $('.subclass-property-list li:gt(4)').hide();
// $('ul li:gt(4)').hide();
// $('.show_button').click(function() {
// $('ul li:gt(4)').show();
// });
// var propList = '.property-list:not(:has(>li>ul)) li:gt(4)';
$ . 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' ) ;
$ ( this ) . text ( 'more' ) ;
togglePropDisplay . showMore ( $toggleLink , $itemContainer ) ;
return false ;
} ) ;
}
} ;
var $propList = $ ( '.property-list:not(:has(>li>ul))' ) ;
$propList . each ( function ( ) {
var $additionalItems = $ ( this ) . find ( 'li:gt(2)' ) ;
if ( $additionalItems . exists ( ) ) {
// create toggle link
var $toggleLink = $ ( '<a class="more-less" href="#show more content">more</a>' ) . appendTo ( this ) ;
// create container for additional elements
var $itemContainer = $ ( '<div class="additionalItems" />' ) . appendTo ( this ) ;
$additionalItems . appendTo ( $itemContainer ) ;
$itemContainer . hide ( ) ;
togglePropDisplay . showMore ( $toggleLink , $itemContainer ) ;
// $wrappedItems.hide();
// var moreLess = $(this).find(':visible:last-child').after(' <a class="more-less" href="#show more content">more</a>');
// $(additionalItems).first().before(' <a class="more-less" href="#show more content">more</a>');
// $wrappedItems.before(' <a class="more-less" href="#show more content">more</a>');
// togglePropDisplay.showMore($wrappedItems);
// $('.more-less').click(function() {
// $(additionalItems).show();
// $('.more-less').attr('href', '#show less content').text('less');
//
// });
}
} ) ;
var subPropList = '.subclass-property-list' ;
$ ( subPropList ) . each ( function ( ) {
var additionalItems = $ ( this ) . find ( 'li:gt(4)' ) ;
if ( additionalItems . exists ( ) ) {
$ ( additionalItems ) . hide ( ) ;
$ ( this ) . append ( ' <a class="more-less" href="#show more content">more</a>' ) ;
}
} ) ;
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-07-05 19:19:10 +00:00
// This function creates and styles the "qTip" tooltip that displays the resource uri when the user clicks the uri icon.
2011-04-11 15:47:44 +00:00
$ ( '#uriIcon' ) . each ( function ( )
{
2011-07-08 12:50:29 +00:00
$ ( this ) . qtip (
{
content : {
prerender : true , // We need this for the .click() event listener on 'a.close'
text : '<h5>share the URI for this profile</h5> <input id="uriLink" type="text" value="' + $ ( '#uriIcon' ) . attr ( 'title' ) + '" /> <a class="close" href="#">close</a>'
} ,
position : {
corner : {
target : 'bottomLeft' ,
tooltip : 'topLeft'
}
} ,
show : {
when : { event : 'click' }
} ,
hide : {
fixed : true , // Make it fixed so it can be hovered over and interacted with
when : {
target : $ ( 'a.close' ) ,
event : 'click'
}
} ,
style : {
padding : '6px' ,
width : 380 ,
backgroundColor : '#f1f2ee'
}
} ) ;
} ) ;
// Prevent close link for URI qTip from requesting bogus '#' href
$ ( 'a.close' ) . click ( function ( ) {
$ ( '#uriIcon' ) . qtip ( "hide" ) ;
return false ;
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 ;
} ) ;
2011-01-24 21:21:09 +00:00
} ) ;