Ignore:
Timestamp:
Jun 3, 2011, 1:57:17 PM (13 years ago)
Author:
mistic100
Message:

clean code, add some options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/Front2Back/template/Front2Back.tpl

    r9969 r11217  
    1 {combine_css path=$F2B_PATH|@cat:"template/Front2Back.css"}
     1{combine_css path=$F2B_PATH|@cat:"template/style.css"}
     2{combine_script id="jquery" load="header" path = "themes/default/js/jquery.min.js"}
    23
    34{footer_script require="jquery"}
    4         jQuery('.reverse').click(function() {ldelim}
    5                 if (jQuery(this).attr('name') == 'front') {ldelim}
    6                         /* picture attributes */
    7                         jQuery('#theImage img:first-child').attr({ldelim}
    8                                 src: '{$VERSO_URL}',
    9                                 style: 'width:;height:;',
    10                         });
    11                        
    12                         /* hd link atributes */
    13                         {if isset($VERSO_HD)}
    14                         jQuery('#theImage a:first-child').attr({ldelim}
    15                                 href: "javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
    16                         });
    17                         {/if}
    18                        
    19                         /* f2b link content */
    20                         jQuery(this).html('<img src="{$F2B_PATH}template/rotate_2.png"/> {'Front2Back_front'|@translate}');
    21                         jQuery(this).attr('name', 'back');
    22                        
    23                 } else if (jQuery(this).attr('name') == 'back') {ldelim}
    24                         jQuery('#theImage img:first-child').attr({ldelim}
    25                                 src: '{$SRC_IMG}',
    26                                 style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
    27                         });
    28                        
    29                         {if isset($VERSO_HD)}
    30                         jQuery('#theImage a:first-child').attr({ldelim}
    31                                 href: "javascript:phpWGOpenWindow('{$high.U_HIGH}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')')"
    32                         });
    33                         {/if}
    34                        
    35                         jQuery(this).html('<img src="{$F2B_PATH}template/rotate_1.png"/> {'Front2Back_back'|@translate}');
    36                         jQuery(this).attr('name', 'front');
    37                 }
    38         });
     5jQuery(document).ready(function () {ldelim}
     6
     7{if $F2B_switch_mode == 'click'}
     8  jQuery('.reverse').click(function() {ldelim}
     9    if (jQuery(this).attr('rel') == 'front') {ldelim}
     10{else}
     11  jQuery('.reverse').hover(function() {ldelim}
     12{/if}
     13
     14      /* picture switch */
     15    {if $F2B_transition == 'fade'}
     16      jQuery('img[alt="{$ALT_IMG}"]').animate({ldelim}
     17        opacity:0
     18      }, 400, function() {ldelim}
     19        jQuery(this).attr({ldelim}
     20          src: '{$VERSO_URL}',
     21          style: 'max-width:{$WIDTH_IMG}px;max-height:{$HEIGHT_IMG}px;',
     22        });
     23        jQuery(this).animate({ldelim}
     24          opacity:1
     25        }, 400);
     26      });
     27    {else}
     28      jQuery('img[alt="{$ALT_IMG}"]').attr({ldelim}
     29        src: '{$VERSO_URL}',
     30        style: 'max-width:{$WIDTH_IMG}px;max-height:{$HEIGHT_IMG}px;',
     31      });
     32    {/if}
     33
     34    {if $F2B_switch_mode == 'click'}
     35      /* hd link */
     36      {if isset($VERSO_HD)}
     37      jQuery('img[alt="{$ALT_IMG}"]').parent().attr({ldelim}
     38        href: "javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
     39      });
     40      {/if}
     41     
     42      /* f2b link content */
     43      jQuery(this).html('<img src="{$F2B_PATH}template/rotate_2.png"/> {$F2B_see_front}');
     44      jQuery(this).attr('rel', 'back');
     45    {/if}
     46     
     47{if $F2B_switch_mode == 'click'}
     48    } else if (jQuery(this).attr('rel') == 'back') {ldelim}
     49{else}
     50  }, function() {ldelim}
     51{/if}
     52      /* picture switch */
     53    {if $F2B_transition == 'fade'}
     54      jQuery('img[alt="{$ALT_IMG}"]').animate({ldelim}
     55        opacity:0
     56      }, 400, function() {ldelim}
     57        jQuery(this).attr({ldelim}
     58          src: '{$SRC_IMG}',
     59          style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
     60        });
     61        jQuery(this).animate({ldelim}
     62          opacity:1
     63        }, 400);
     64      });
     65    {else}
     66      jQuery('img[alt="{$ALT_IMG}"]').attr({ldelim}
     67        src: '{$SRC_IMG}',
     68        style: 'width:{$WIDTH_IMG}px;height:{$HEIGHT_IMG}px;',
     69      });
     70    {/if}
     71   
     72    {if $F2B_switch_mode == 'click'}
     73       /* hd link */
     74      {if isset($high.U_HIGH)}
     75      jQuery('img[alt="{$ALT_IMG}"]').parent().attr({ldelim}
     76        href: "javascript:phpWGOpenWindow('{$high.U_HIGH}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"
     77      });
     78      {/if}
     79     
     80      /* f2b link content */
     81      jQuery(this).html('<img src="{$F2B_PATH}template/rotate_1.png"/> {$F2B_see_back}');
     82      jQuery(this).attr('rel', 'front');
     83    {/if}
     84   
     85{if $F2B_switch_mode == 'click'}
     86    }
     87  });
     88{else}
     89  });
     90{/if}
     91 
     92});
    3993{/footer_script}
    4094
    41 <a class="reverse" name="front">
    42         <img src="{$F2B_PATH}template/rotate_1.png"/>
    43         {'Front2Back_back'|@translate}
     95<img src="{$VERSO_URL}" style="display:none;"/> {* <!-- force preload the verso --> *}
     96
     97{if $F2B_position != 'toolbar'}<div>{/if}
     98<a class="reverse" rel="front" {if $F2B_position == 'toolbar'}style="border:none !important;"{/if} {if $F2B_switch_mode == 'hover'}href="javascript:phpWGOpenWindow('{$VERSO_HD}','{$high.UUID}','scrollbars=yes,toolbar=no,status=no,resizable=yes')"{/if}>
     99  <img src="{$F2B_PATH}template/rotate_1.png"/> {$F2B_see_back}
    44100</a>
     101{if $F2B_position != 'toolbar'}</div>{/if}
Note: See TracChangeset for help on using the changeset viewer.