Ignore:
Timestamp:
Jun 2, 2014, 10:44:01 PM (10 years ago)
Author:
rvelices
Message:
  • modus icons compatible with batch downloader, language switch
  • better photo auto size on first time hit with retina devices
File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/modus/themeconf.inc.php

    r28454 r28601  
    99*/
    1010$themeconf = array(
    11         'name'  => 'modus',
     11        'name' => 'modus',
    1212        'parent' => 'default',
    1313);
     
    108108function rv_cdn_combined_script($url, $script)
    109109{
    110         if (!$script->is_remote() /*&& strpos($script->path,'thumb.arrange')===false*/)
     110        if (!$script->is_remote())
    111111                $url = RVCDN_ROOT_URL.$script->path;
    112112        return $url;
     
    120120        $all = $template->scriptLoader->get_all();
    121121        if ( ($jq = @$all['jquery']) )
    122         {
    123122                $jq->set_path(RVPT_JQUERY_SRC);
    124         }
    125123}
    126124
     
    129127{
    130128        global $conf;
    131         include_once(dirname(__FILE__).'/functions.inc.php');
    132   $template->smarty->unregisterPlugin('modifier', 'cssGradient');
    133         $template->smarty->registerPlugin('modifier', 'cssGradient', 'modus_css_gradient');
     129        if (!is_callable('modus_css_gradient')) {
     130                include_once(dirname(__FILE__).'/functions.inc.php');
     131                $template->smarty->registerPlugin('modifier', 'cssGradient', 'modus_css_gradient');
     132        }
    134133
    135134        include( dirname(__FILE__).'/skins/'.$conf['modus_theme']['skin'].'.inc.php' );
     
    139138                'MODUS_ALBUM_THUMB_SIZE' => intval(@$conf['modus_theme']['album_thumb_size']),
    140139                'SQUARE_WIDTH' => ImageStdParams::get_by_type(IMG_SQUARE)->max_width(),
     140                'loaded_plugins' => $GLOBALS['pwg_loaded_plugins']
    141141                ));
    142142}
     
    240240                        $a_style=' style="top:'.floor(($row_height-$csize[1])/2).'px"';
    241241                elseif ($csize[1] > $row_height)
    242                 {
    243242                        $csize = $c->get_scaled_size(9999, $row_height);
    244                 }
    245243?>
    246244<li style=width:<?=$csize[0]?>px;height:<?=$row_height?>px><a href="<?=$item['URL']?>"<?=$a_style?>><img src="<?=$c->get_url()?>" width=<?=$csize[0]?> height=<?=$csize[1]?> alt="<?=$item['TN_ALT']?>" data-pop='{"w":<?=$popsize[0]?>,"h":<?=$popsize[1]?>,"url":"<?=$pop->get_url()?>"}'></a><b class=popDesc><b><?=$item['NAME']?></b><?=$new?><br><?=$item['DESCRIPTION']?></b></li>
     
    280278        }
    281279        if($req!=null)
    282         {
    283                 $my_base_name = basename(dirname(__FILE__));
    284     $template->scriptLoader->add('modus.pop', 2, array($req), 'themes/'.$my_base_name."/js/thumb.pop.js", 0);
    285         }
     280                $template->scriptLoader->add('modus.pop', 2, array($req), 'themes/'.basename(dirname(__FILE__))."/js/thumb.pop.js", 0);
    286281}
    287282
     
    357352                        $styles = array();
    358353                if ($l<-1 || $l>1)
    359                 {
    360                         //$styles[] = 'left:'.$l.'px';
    361354                        $styles[] = 'left:'.(100*$l/$wh).'%';
    362                 }
     355
    363356                if ($t<-1 || $t>1)
    364357                        $styles[] = 'top:'.$t.'px';
     
    388381}
    389382
    390 add_event_handler('loc_end_picture', 'modus_loc_end_picture');
    391 function modus_loc_end_picture()
    392 {
    393         global $template, $picture;
    394 }
    395 
    396383add_event_handler('render_element_content', 'modus_picture_content', EVENT_HANDLER_PRIORITY_NEUTRAL-1, 2 );
    397384function modus_picture_content($content, $element_info)
     
    399386        global $conf, $picture, $template;
    400387
    401         if ( !empty($content) )
    402         {// someone hooked us - so we skip;
     388        if ( !empty($content) ) // someone hooked us - so we skip;
    403389                return $content;
    404         }
    405390
    406391        $unique_derivatives = array();
     
    426411        $selected_derivative = null;
    427412        if (isset($_COOKIE['phavsz']))
    428         {
    429413                $available_size = explode('x', $_COOKIE['phavsz']);
    430                 if (empty($available_size[2]))
    431                         $available_size[2] = 1;
    432 
     414        elseif ( $caps=pwg_get_session_var('caps') && $caps[0]>1 )
     415                $available_size = array($caps[0]*$caps[1], $caps[0]*($caps[2]-100), $caps[0]);
     416
     417        if (isset($available_size))
     418        {
    433419                foreach($unique_derivatives as $derivative)
    434420                {
     
    438424
    439425                        if ($size[0] <= $available_size[0] and $size[1] <= $available_size[1])
    440                         {
    441426                                $selected_derivative = $derivative;
    442                         }
    443427                        else
    444428                        {
     
    490474                                $template->assign('U_PREFETCH', $derivative->get_url() );
    491475                }
    492 
    493476        }
    494477
     
    501484
    502485
    503 
    504486        if ($show_original)
    505         {
    506487                $template->assign( 'U_ORIGINAL', $element_info['element_url'] );
    507         }
    508488
    509489        $template->append('current', array(
Note: See TracChangeset for help on using the changeset viewer.