Plugin Directory

Changeset 478256


Ignore:
Timestamp:
12/20/2011 10:18:36 PM (14 years ago)
Author:
volmar
Message:

a bunch of changes to the JS-display for the complex covers.

Location:
my-record-collection/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • my-record-collection/trunk/css/mrc_style.css

    r478051 r478256  
    2424/* Jewel Case */
    2525ul.music li.jewel img{ width:72px; height:72px; top:3px; left:12px; }
    26 ul.music li.jewel a{ background:url(../gfx/jewel.png) 0 0 no-repeat; width:90px; height:82px; }
     26ul.music li.jewel a{ background:url(../gfx/jewel.png) 0 0 no-repeat; width:96px; height:82px; }
    2727ul.music li.jewel{ background:url(../gfx/blank_insert.gif) 12px 3px no-repeat; }
    2828
     
    5656ul.simple li:nth-child(odd) { background-color: #eee; }
    5757
     58/** MRC_info_tooltip **/
     59#MRC_info_tooltip { display: none; width: 230px; height: 103px; background: rgba(255,0,0,.5); position: absolute; top: 0px; left: 0px; -webkit-border-radius: 12px; }
     60
    5861
    5962.mrc_d_foot{clear: both; }
  • my-record-collection/trunk/js/mrc_scripts.js

    r478051 r478256  
    77
    88jQuery(document).ready(function($) {
     9   
     10    $('ul.music').MRCinfo();
    911
    1012    var music = $('#MyRecordCollection').find('ul.music').children();
     
    6264                sort = SettingsContainer.find('input[name=sort]:checked').val(),
    6365                way  = SettingsContainer.find('input[name=sortway]:checked').val(),
    64                 num  = SettingsContainer.find('#removenum').prop('checked')
     66                num  = SettingsContainer.find('#removenum').prop('checked'),
    6567                the  = SettingsContainer.find('#removethe').prop('checked');
    6668            if(mode && sort && way){
     
    8385    music.hover(
    8486        function(){
    85             //console.log('in');
     87            $('ul.music').MRCinfo('showInfo',$(this));
    8688        },
    8789        function(){
    88             //console.log('ut');
     90            $('ul.music').MRCinfo('hideInfo',$(this));
    8991        }
    9092    );
     
    9294});
    9395
     96var MRCsettings = {
     97    onEachRow: null,
     98    tt: $('#MRC_info_tooltip')
     99};
     100
     101(function( $ ){
     102    var methods = {
     103        init : function( options ) {
     104
     105            return this.each(function(){
     106
     107                var $this = $(this),
     108                data = $this.data('tooltip');
     109   
     110                MRCsettings.onEachRow = Math.floor($this.parent().width() / 110 );
     111
     112                $(document.body).append('<div id="MRC_info_tooltip"></div>');
     113            });
     114        },
     115        leftOrRight : function ( index, width, p ) {
     116            var mod = index % MRCsettings.onEachRow,
     117                 lor = (mod == MRCsettings.onEachRow-1 ? 'left' : 'right'),
     118                pos;
     119            if(lor == 'right'){
     120                pos = { left : (p.left -10), top: p.top - 12 };
     121            }else{
     122                pos = { right : (p.left + width + 10), top: p.top - 12 };
     123            }
     124            return pos;
     125        },
     126        getContent : function( elem ) {
     127            var artist = elem.find('.mrc_artist').text(),
     128                 title = elem.find('.mrc_title').text();
     129            return artist+'<br>'+title;
     130        },
     131        showInfo : function( elem ) {
     132            var lor = methods.leftOrRight(elem.index(),elem.width(),elem.offset());
     133            $('#MRC_info_tooltip').hide().html(methods.getContent(elem)).css(lor).show();       
     134           
     135        },
     136        hideInfo : function( ) {
     137            $('#MRC_info_tooltip').hide(); 
     138        },
     139        update : function( content ) { // ...
     140        }
     141    };
     142
     143$.fn.MRCinfo = function( method ) {
     144
     145    if ( methods[method] ) {
     146        return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
     147    } else if ( typeof method === 'object' || ! method ) {
     148        return methods.init.apply( this, arguments );
     149    } else {
     150        $.error( 'Method ' +  method + ' does not exist on jQuery.tooltip' );
     151    }   
     152
     153};
     154
     155})( jQuery );
    94156
    95157
     158
Note: See TracChangeset for help on using the changeset viewer.