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

clean code, add some options

Location:
extensions/Front2Back/template
Files:
1 added
1 deleted
2 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}
  • extensions/Front2Back/template/admin.tpl

    r9784 r11217  
     1{combine_css path=$F2B_PATH|@cat:"template/style.css"}
     2
     3{footer_script require='jquery'}{literal}
     4jQuery().ready( function () {
     5  jQuery('select[name="lang_desc_select"]').change(function () {
     6    jQuery('[id^="link_name"]').hide();
     7    jQuery("#link_name_"+this.options[this.selectedIndex].value).show();
     8  });
     9  jQuery('[id^="link_name_"]').keyup(function () {
     10    arr = jQuery(this).attr("id").split("link_name_");
     11    id = arr[1];
     12    opt = jQuery('select[name="lang_desc_select"] option[id="opt_'+id+'"]');
     13    if (this.value != '')
     14      opt.html(opt.html().replace("\u2718", "\u2714"));
     15    else
     16      opt.html(opt.html().replace("\u2714", "\u2718"));
     17  });
     18});
     19
     20jQuery('.lang_help').tipTip();
     21{/literal}{/footer_script}
     22
    123<div class="titrePage">
    2         <h2>Front2Back</h2>
     24  <h2>Front2Back</h2>
    325</div>
    426
    527<form method="post" action="" class="properties" ENCTYPE="multipart/form-data">
    6         <fieldset>
    7                 <legend>{'Configuration'|@translate}</legend>     
    8                 <ul>                   
     28  <fieldset>
     29    <legend>{'Configuration'|@translate}</legend>   
     30    <ul>     
     31      <li>
     32        <span class="property">{'Back sides folder'|@translate}</span>
     33        <input type="text" name="path" value="{$PATH}"/>
     34      </li>
     35      <li>
     36        <span class="property">{'Web sized pics sub-folder'|@translate}</span>
     37        <input type="text" name="parent" value="{$PARENT}"/>
     38      </li>   
     39      <li>
     40        <span class="property">{'HD pics sub-folder'|@translate}</span>
     41        <input type="text" name="hd_parent" value="{$HD_PARENT}"/>
     42      </li>
     43      <li>
     44        <span class="property">{'Suffix'|@translate}</span>
     45        <input type="text" name="suffix" value="{$SUFFIX}"/>
     46      </li>
     47     
     48      <li>
     49        <span class="property">{'Link position'|@translate}</span>
     50        <label><input type="radio" name="position" value="top" {if $POSITION == 'top'}checked="checked"{/if}/> {'Top'|@translate}</label>
     51        <label><input type="radio" name="position" value="bottom" {if $POSITION == 'bottom'}checked="checked"{/if}/> {'Bottom'|@translate}</label>
     52        <label><input type="radio" name="position" value="toolbar" {if $POSITION == 'toolbar'}checked="checked"{/if}/> {'Toolbar'|@translate}</label>
     53      </li>
    954                        <li>
    10                                 <span class="property">{'f2b_path'|@translate}</span>
    11                                 <input type="text" name="path" value="{$PATH}"/>
     55                                <span class="property">{'Switch mode'|@translate}</span>
     56                                <label><input type="radio" name="switch_mode" value="click" {if $SWITCH_MODE == 'click'}checked="checked"{/if}/> {'Click'|@translate}</label>
     57                                <label><input type="radio" name="switch_mode" value="hover" {if $SWITCH_MODE == 'hover'}checked="checked"{/if}/> {'Mouseover'|@translate}</label>
    1258                        </li>
    1359                        <li>
    14                                 <span class="property">{'f2b_parent'|@translate}</span>
    15                                 <input type="text" name="parent" value="{$PARENT}"/>
    16                         </li>           
    17                         <li>
    18                                 <span class="property">{'f2b_hd_parent'|@translate}</span>
    19                                 <input type="text" name="hd_parent" value="{$HD_PARENT}"/>
     60                                <span class="property">{'Transition'|@translate}</span>
     61                                <label><input type="radio" name="transition" value="none" {if $TRANSITION == 'none'}checked="checked"{/if}/> {'None'|@translate}</label>
     62                                <label><input type="radio" name="transition" value="fade" {if $TRANSITION == 'fade'}checked="checked"{/if}/> {'Fade'|@translate}</label>
    2063                        </li>
    21                         <li>
    22                                 <span class="property">{'f2b_suffix'|@translate}</span>
    23                                 <input type="text" name="suffix" value="{$SUFFIX}"/>
    24                         </li>
    25                 </ul>
    26         </fieldset>
    27                
    28         <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p>
     64     
     65      <li>
     66        <span class="property">{'Link name'|@translate}</span>
     67        <select name="lang_desc_select">
     68          {foreach from=$link_name item=lang}
     69            <option value="{$lang.LANGUAGE_CODE}" id="opt_{$lang.LANGUAGE_CODE}">{if empty($lang.VALUE)}&#x2718;{else}&#x2714;{/if} &nbsp;{$lang.LANGUAGE_NAME}</option>
     70          {/foreach}
     71        </select>
     72        {foreach from=$link_name item=lang}
     73          <input type="text" size="30" name="link_name[{$lang.LANGUAGE_CODE}]" id="link_name_{$lang.LANGUAGE_CODE}" value="{$lang.VALUE}" style="{if $lang.LANGUAGE_CODE != 'default'}display:none; {/if}margin-left:10px;">
     74        {/foreach}
     75
     76        <a class="lang_help" title="{'Seperate the two labels with the | symbol. Leave blank to use default translation.'|@translate}">i</a>
     77      </li>
     78    </ul>
     79  </fieldset>
     80   
     81  <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p>
    2982</form>
    3083
Note: See TracChangeset for help on using the changeset viewer.