Plugin Directory

Changeset 3451114


Ignore:
Timestamp:
01/31/2026 05:51:00 PM (8 weeks ago)
Author:
johnjamesjacoby
Message:

WP Lightbox 2: Bump to 3.0.7.

Includes bug fixes general improvements.

Location:
wp-lightbox-2/trunk
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • wp-lightbox-2/trunk/I18n/howtouse.html

    r1093840 r3451114  
    11    <ol>
    2     <li>You can use WordPress image galleries and have them grouped and auto-lightboxed: <a href="http://codex.wordpress.org/Gallery_Shortcode"><code>[gallery link="file"]</code></a></li>     
     2    <li>You can use WordPress image galleries and have them grouped and auto-lightboxed: <a href="https://codex.wordpress.org/Gallery_Shortcode"><code>[gallery link="file"]</code></a></li>   
    33    <li>You can also add a <code>rel="lightbox"</code> attribute to any link tag to activate the lightbox. For example:
    44    <pre><code> &lt;a href=&quot;images/image-1.jpg&quot; rel=&quot;lightbox&quot; title=&quot;my caption&quot;&gt;image #1&lt;/a&gt;</code></pre>
  • wp-lightbox-2/trunk/I18n/wp-lightbox-2.pot

    r468317 r3451114  
    44msgstr ""
    55"Project-Id-Version:  \n"
    6 "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-lightbox-2\n"
     6"Report-Msgid-Bugs-To: https://wordpress.org/tag/wp-lightbox-2\n"
    77"POT-Creation-Date: 2011-11-27 17:40:12+00:00\n"
    88"MIME-Version: 1.0\n"
  • wp-lightbox-2/trunk/admin/admin_menu.php

    r1220099 r3451114  
    1 <?php
    2 require_once($this->plugin_path.'admin/general_settings.php');
     1<?php
    32
    4 class wp_lightbox_admin_menu{
    5    
    6     private $menu_name;
    7        
     3require_once $this->plugin_path . 'admin/general_settings.php';
     4
     5class wp_lightbox_admin_menu {
     6
     7    private $menu_name;
    88    private $databese_parametrs;
    9    
    109    private $plugin_url;
    11    
    1210    private $plugin_path;
    13    
    14     private $text_parametrs;
    1511
    16     public  $wp_lightbox_2_general_settings_page;
    17    
    18     function __construct($param){
    19         $this->menu_name='WP Lightbox 2';
    20         $this->databese_parametrs=$param['databese_parametrs']->get_general_settings;
    21            
    22         $this->wp_lightbox_2_general_settings_page  =new wp_lightbox_2_general_settings_page( array( 'plugin_url'=> $this->plugin_url, 'plugin_path' => $this->plugin_path,'databese_settings' =>$this->databese_parametrs));
    23        
     12    public $wp_lightbox_2_general_settings_page;
     13
     14    public function __construct( $param = array() ) {
     15        $this->menu_name          = 'WP Lightbox 2';
     16        $this->databese_parametrs = $param[ 'databese_parametrs' ]->get_general_settings;
     17
     18        $this->wp_lightbox_2_general_settings_page = new wp_lightbox_2_general_settings_page( array(
     19            'plugin_url'        => $this->plugin_url,
     20            'plugin_path'       => $this->plugin_path,
     21            'databese_settings' => $this->databese_parametrs
     22        ) );
     23
    2424        // set plugin url
    25         if(isset($param['plugin_url']))
    26             $this->plugin_url=$param['plugin_url'];
    27         else
    28             $this->plugin_url=trailingslashit(dirname(plugins_url('',__FILE__)));
     25        if ( isset( $param[ 'plugin_url' ] ) ) {
     26            $this->plugin_url = $param[ 'plugin_url' ];
     27        } else {
     28            $this->plugin_url = trailingslashit( dirname( plugins_url( '', __FILE__ ) ) );
     29        }
     30
    2931        // set plugin path
    30         if(isset($param['plugin_path']))
    31             $this->plugin_path=$param['plugin_path'];
    32         else
    33             $this->plugin_path=trailingslashit(dirname(plugin_dir_path(__FILE__)));
    34 
    35        
    36 
     32        if ( isset( $param[ 'plugin_path' ] ) ) {
     33            $this->plugin_path = $param[ 'plugin_path' ];
     34        } else {
     35            $this->plugin_path = trailingslashit( dirname( plugin_dir_path( __FILE__ ) ) );
     36        }
    3737    }
    3838
    39    
    40     /// function for registr new button
    41     function poll_button_register($plugin_array)
    42     {
    43         $url = $this->plugin_url.'admin/scripts/editor_plugin.js';
    44         $plugin_array["poll_mce"] = $url;
     39    public function poll_button_register( $plugin_array = array() ) {
     40        $url                        = $this->plugin_url . 'admin/scripts/editor_plugin.js';
     41        $plugin_array[ "poll_mce" ] = $url;
     42
    4543        return $plugin_array;
    46    
    4744    }
    4845
     46    public function create_menu() {
    4947
    50     public function window_for_inserting_contentt(){}
    51     public function create_menu(){
    52        
    53         $manage_page_main = add_menu_page( $this->menu_name, $this->menu_name, 'manage_options', str_replace( ' ', '-', $this->menu_name), array($this->wp_lightbox_2_general_settings_page, 'controller_page'),$this->plugin_url.'admin/images/icon_lightboxx2.png');
    54                             add_submenu_page( str_replace( ' ', '-', $this->menu_name), 'General settings', 'General settings', 'manage_options', str_replace( ' ', '-', $this->menu_name), array($this->wp_lightbox_2_general_settings_page, 'controller_page'));
    55         add_action('admin_print_styles-' .$manage_page_main, array($this,'menu_requeried_scripts'));
     48        $manage_page_main = add_menu_page(
     49            $this->menu_name,
     50            $this->menu_name,
     51            'manage_options',
     52            str_replace( ' ', '-', $this->menu_name ),
     53            array(
     54                $this->wp_lightbox_2_general_settings_page,
     55                'controller_page'
     56            ),
     57            $this->plugin_url . 'admin/images/icon_lightboxx2.png'
     58        );
     59
     60        add_submenu_page(
     61            str_replace( ' ', '-', $this->menu_name ),
     62            'General settings',
     63            'General settings',
     64            'manage_options',
     65            str_replace( ' ', '-', $this->menu_name ),
     66            array(
     67                $this->wp_lightbox_2_general_settings_page,
     68                'controller_page'
     69            )
     70        );
     71
     72        add_action(
     73            'admin_print_styles-' . $manage_page_main,
     74            array(
     75                $this,
     76                'menu_requeried_scripts'
     77            )
     78        );
    5679    }
    57     public function menu_requeried_scripts(){
    58         wp_enqueue_script('jquery-ui-style');
    59         wp_enqueue_script('jquery');   
    60         wp_enqueue_script('jquery-ui-core');
    61         wp_enqueue_script("jquery-ui-widget");
    62         wp_enqueue_script("jquery-ui-mouse");
    63         wp_enqueue_script("jquery-ui-slider");
    64         wp_enqueue_script("jquery-ui-sortable");
    65         wp_enqueue_script('wp-color-picker');   
    66         wp_enqueue_style("jquery-ui-style");
    67         wp_enqueue_style("admin_style_wp_lightbox");       
     80
     81    public function menu_requeried_scripts() {
     82        wp_enqueue_script( 'jquery-ui-style' );
     83        wp_enqueue_script( 'jquery' );
     84        wp_enqueue_script( 'jquery-ui-core' );
     85        wp_enqueue_script( 'jquery-ui-widget' );
     86        wp_enqueue_script( 'jquery-ui-mouse' );
     87        wp_enqueue_script( 'jquery-ui-slider' );
     88        wp_enqueue_script( 'jquery-ui-sortable' );
     89        wp_enqueue_script( 'wp-color-picker' );
     90
     91        wp_enqueue_style( 'jquery-ui-style' );
     92        wp_enqueue_style( 'admin_style_wp_lightbox' );
    6893        wp_enqueue_style( 'wp-color-picker' );
     94
    6995        add_thickbox();
    70            
    7196    }
    72    
    7397}
  • wp-lightbox-2/trunk/admin/general_settings.php

    r3108234 r3451114  
    11<?php
    22class wp_lightbox_2_general_settings_page{
    3     private $menu_name;
     3
    44    private $databese_settings;
    55    public  $initial_values;
     
    88    protected $plugin_path = '';
    99
    10     function __construct($params){
     10    public function __construct( $params = array() ) {
     11
    1112        // set plugin url
    12         if(isset($params['plugin_url']))
    13             $this->plugin_url=$params['plugin_url'];
    14         else
    15             $this->plugin_url=trailingslashit(dirname(plugins_url('',__FILE__)));
     13        if ( isset( $params['plugin_url'] ) ) {
     14            $this->plugin_url = $params['plugin_url'];
     15        } else {
     16            $this->plugin_url = trailingslashit(dirname(plugins_url('',__FILE__)));
     17        }
     18
    1619        // set plugin path
    17         if(isset($params['plugin_path']))
    18             $this->plugin_path=$params['plugin_path'];
    19         else
    20             $this->plugin_path=trailingslashit(dirname(plugin_dir_path('',__FILE__)));
    21 
    22         $this->databese_settings=$params['databese_settings'];
     20        if ( isset( $params['plugin_path'] ) ) {
     21            $this->plugin_path = $params['plugin_path'];
     22        } else {
     23            $this->plugin_path = trailingslashit(dirname(plugin_dir_path('',__FILE__)));
     24        }
     25
     26        $this->databese_settings = $params['databese_settings'];
    2327
    2428        /*ajax parametrs*/
    25         add_action( 'wp_ajax_save_in_databese_lightbox2', array($this,'save_parametrs') );
    26 
    27     }
    28     public function save_parametrs(){
    29          $initial_values= $this->databese_settings;
    30     $kk=1;
    31         if(isset($_POST['wp_lightbox_2_general_settings_page']) && wp_verify_nonce( $_POST['wp_lightbox_2_general_settings_page'],'wp_lightbox_2_general_settings_page')){
    32 
    33             foreach($initial_values as $key => $value){
    34                 if(isset($_POST[$key])){
    35                     update_option($key,stripslashes($_POST[$key]));
    36                 }
    37                 else{
    38                     $kk=0;
    39                     printf('error saving %s <br>',$key);
     29        add_action( 'wp_ajax_save_in_databese_lightbox2', array( $this,'save_parametrs' ) );
     30    }
     31
     32    public function save_parametrs() {
     33        $initial_values = $this->databese_settings;
     34        $kk = 1;
     35
     36        if ( ! current_user_can( 'manage_options' ) || ! wp_doing_ajax() ) {
     37            die('Authorization Problem');
     38        }
     39
     40        if ( isset( $_POST['wp_lightbox_2_general_settings_page'] ) && wp_verify_nonce( $_POST['wp_lightbox_2_general_settings_page'], 'wp_lightbox_2_general_settings_page' ) ) {
     41
     42            foreach ( $initial_values as $key => $value ) {
     43                if ( isset( $_POST[ $key ] ) ) {
     44                    update_option( $key, stripslashes( $_POST[ $key ] ) );
     45                } else {
     46                    $kk = 0;
     47
     48                    printf( 'error saving %s <br>', $key );
    4049                }
    4150            }
    42         }
    43         else{
    44             die('Authorization Problem ');
    45         }
    46         if($kk==0){
     51        } else {
     52            die('Authorization Problem');
     53        }
     54
     55        if ( empty( $kk ) ) {
    4756            exit;
    4857        }
     58
    4959        die('sax_normala');
    5060    }
    51     /*#################### CONTROLERRR ########################*/
    52     /*#################### CONTROLERRR ########################*/
    53     /*#################### CONTROLERRR ########################*/
    54     public function controller_page(){
    55 
    56             $this->display_table_list_answers();
    57     }
    58 
    59 
    60     private function display_table_list_answers(){
    61 
    62     $initial_values= $this->databese_settings;
    63     foreach($initial_values as $key => $value){
    64             $$key=esc_attr($value);
    65     }
    66     ?>
    67 
    68         <style>
    69         .popup_settings{
    70             <?php echo $youtube_plus_show_popup?'':'display:none;'; ?>
    71         }
    72         </style>
    73         <h2>Lightbox General Settings</h2>
    74         <div class="main_yutube_plus_params">
    75         <table class="wp-list-table widefat fixed posts wp_lightbox2_settings_table" style="width: 900px; min-width:320px !important;table-layout: fixed;">
    76             <thead>
    77                 <tr>
    78                     <th width="50%">
    79                         <span> Lightbox General Settings </span>
    80                     </th>
    81                     <th width="50%">
    82                         &nbsp;
    83                     </th>
    84                 </tr>
    85             </thead>
    86             <tbody>
    87                 <tr class="parametr_chechbox">
    88                     <td>
    89                         Use Lightbox for all image links: <span title="Enable or disable the lightbox." class="desription_class">?</span>
    90                     </td>
    91                     <td>
    92                         <input type="checkbox" name="jqlb_automate_checkbox" id="jqlb_automate_checkbox" <?php checked($jqlb_automate,'1'); ?> value="1">
    93                         <input type="hidden" name="jqlb_automate" id="jqlb_automate" value="<?php echo $jqlb_automate; ?>">
    94                     </td>
    95                 </tr>
    96                 <tr class="parametr_chechbox">
    97                     <td>
    98                         Enable lightbox in comments: <span title="This feature will enable lightbox for your comments. " class="desription_class">?</span>
    99                     </td>
    100                     <td>
    101                         <input type="checkbox" name="jqlb_comments_checkbox" id="jqlb_comments_checkbox" <?php checked($jqlb_comments,'1'); ?> value="1">
    102                         <input type="hidden" name="jqlb_comments" id="jqlb_comments" value="<?php echo $jqlb_comments; ?>">
    103                     </td>
    104                 </tr>
    105                 <tr class="parametr_chechbox">
    106                     <td>
    107                         Show download link: <span title="You can display download link." class="desription_class">?</span>
    108                     </td>
    109                     <td>
    110                         <input type="checkbox" name="jqlb_show_download_checkbox" id="jqlb_show_download_checkbox" <?php checked($jqlb_show_download,'1'); ?> value="1">
    111                         <input type="hidden" name="jqlb_show_download" id="jqlb_show_download" value="<?php echo $jqlb_show_download; ?>">
    112                     </td>
    113                 </tr>
    114                 <tr>
    115                     <td>
    116                         Overlay opacity: <span title="Set overlay opacity for lightbox." class="desription_class">?</span>
    117                     </td>
    118                     <td>
    119                         <input type="number" min="0" max="100" step="1" name="jqlb_overlay_opacity" id="jqlb_overlay_opacity" value="<?php echo $jqlb_overlay_opacity; ?>"><span class="befor_input_small_desc">%</span>
    120                     </td>
    121                 </tr>
    122                 <tr class="parametr_chechbox">
    123                     <td>
    124                         Show image info on top: <span title="Choose image info position." class="desription_class">?</span>
    125                     </td>
    126                     <td>
    127                         <input type="checkbox" name="jqlb_navbarOnTop_checkbox" id="jqlb_navbarOnTop_checkbox" <?php checked($jqlb_navbarOnTop,'1'); ?> value="1">
    128                         <input type="hidden" name="jqlb_navbarOnTop" id="jqlb_navbarOnTop" value="<?php echo $jqlb_navbarOnTop; ?>">
    129                     </td>
    130                 </tr>
    131                 <tr class="parametr_chechbox">
    132                     <td>
    133                         Reduce large images to fit smaller screens: <span title="We recommend to enable this option, it will reduce large images to fit smaller screens." class="desription_class">?</span>
    134                     </td>
    135                     <td>
    136                         <input type="checkbox" name="jqlb_resize_on_demand_checkbox" id="jqlb_resize_on_demand_checkbox" <?php checked($jqlb_resize_on_demand,'1'); ?> value="1">
    137                         <input type="hidden" name="jqlb_resize_on_demand" id="jqlb_resize_on_demand" value="<?php echo $jqlb_resize_on_demand; ?>">
    138                     </td>
    139                 </tr>
    140                 <tr>
    141                     <td>
    142                         Minimum margin from top:  <span title="You can change image position from top." class="desription_class">?</span>
    143                     </td>
    144                     <td>
    145                         <input type="number" min="0" max="999" step="1" name="jqlb_margin_size" id="jqlb_margin_size" value="<?php echo $jqlb_margin_size; ?>"><span class="befor_input_small_desc">(default: 0)</span>
    146                     </td>
    147                 </tr>
    148                 <tr>
    149                     <td>
    150                         Lightbox Animation duration: <span title="Type here animation duration for lightbox." class="desription_class">?</span>
    151                     </td>
    152                     <td>
    153                         <input type="number" min="0" max="9999999" step="1" name="jqlb_resize_speed" id="jqlb_resize_speed" value="<?php echo $jqlb_resize_speed; ?>"><span class="befor_input_small_desc">(milliseconds)</span>
    154                     </td>
    155                 </tr>
    156                 <tr>
    157                     <td>
    158                         Additional text below image info:  <span title="Type here text, and it will appear below images. " class="desription_class">?</span>
    159                     </td>
    160                     <td>
    161                         <input type="text" name="jqlb_help_text" id="jqlb_help_text" value="<?php echo $jqlb_help_text; ?>"><span class="befor_input_small_desc">(default: none)</span>
    162                     </td>
    163                 </tr>
    164             </tbody>
    165             <tfoot>
    166                 <tr>
    167                     <th colspan="2" width="100%"><button type="button" id="save_button_general" class="save_button button button-primary"><span class="save_button_span">Save Settings</span> <span class="saving_in_progress"> </span><span class="sucsses_save"> </span><span class="error_in_saving"> </span></button></th>
    168                 </tr>
    169             </tfoot>
     61
     62    public function controller_page() {
     63        $this->display_table_list_answers();
     64    }
     65
     66    private function display_table_list_answers() {
     67
     68        $initial_values = $this->databese_settings;
     69
     70        // Allow
     71        extract( $initial_values );
     72
     73        // jQuery settings
     74        $jquery_settings = '';
     75        $keys            = array_keys( $initial_values );
     76        foreach ( $keys as $key ) {
     77            $jquery_settings .= $key . ':jQuery("#' . $key . '").val(),';
     78        }
     79
     80        ?>
     81
     82        <h2>Lightbox General Settings</h2>
     83        <div class="main_yutube_plus_params">
     84        <table class="wp-list-table widefat fixed posts wp_lightbox2_settings_table" style="width: 900px; min-width:320px !important;table-layout: fixed;">
     85            <thead>
     86                <tr>
     87                    <th width="50%">
     88                        <span> Lightbox General Settings </span>
     89                    </th>
     90                    <th width="50%">
     91                        &nbsp;
     92                    </th>
     93                </tr>
     94            </thead>
     95            <tbody>
     96                <tr class="parametr_chechbox">
     97                    <td>
     98                        Use Lightbox for all image links: <span title="Enable or disable the lightbox." class="desription_class">?</span>
     99                    </td>
     100                    <td>
     101                        <input type="checkbox" name="jqlb_automate_checkbox" id="jqlb_automate_checkbox" <?php checked( $jqlb_automate, '1' ); ?> value="1">
     102                        <input type="hidden" name="jqlb_automate" id="jqlb_automate" value="<?php echo esc_attr( $jqlb_automate ); ?>">
     103                    </td>
     104                </tr>
     105                <tr class="parametr_chechbox">
     106                    <td>
     107                        Enable lightbox in comments: <span title="This feature will enable lightbox for your comments. " class="desription_class">?</span>
     108                    </td>
     109                    <td>
     110                        <input type="checkbox" name="jqlb_comments_checkbox" id="jqlb_comments_checkbox" <?php checked( $jqlb_comments, '1' ); ?> value="1">
     111                        <input type="hidden" name="jqlb_comments" id="jqlb_comments" value="<?php echo esc_attr( $jqlb_comments ); ?>">
     112                    </td>
     113                </tr>
     114                <tr class="parametr_chechbox">
     115                    <td>
     116                        Show download link: <span title="You can display download link." class="desription_class">?</span>
     117                    </td>
     118                    <td>
     119                        <input type="checkbox" name="jqlb_show_download_checkbox" id="jqlb_show_download_checkbox" <?php checked( $jqlb_show_download, '1' ); ?> value="1">
     120                        <input type="hidden" name="jqlb_show_download" id="jqlb_show_download" value="<?php echo esc_attr( $jqlb_show_download ); ?>">
     121                    </td>
     122                </tr>
     123                <tr>
     124                    <td>
     125                        Overlay opacity: <span title="Set overlay opacity for lightbox." class="desription_class">?</span>
     126                    </td>
     127                    <td>
     128                        <input type="number" min="0" max="100" step="1" name="jqlb_overlay_opacity" id="jqlb_overlay_opacity" value="<?php echo esc_attr( $jqlb_overlay_opacity ); ?>"><span class="befor_input_small_desc">%</span>
     129                    </td>
     130                </tr>
     131                <tr class="parametr_chechbox">
     132                    <td>
     133                        Show image info on top: <span title="Choose image info position." class="desription_class">?</span>
     134                    </td>
     135                    <td>
     136                        <input type="checkbox" name="jqlb_navbarOnTop_checkbox" id="jqlb_navbarOnTop_checkbox" <?php checked( $jqlb_navbarOnTop, '1' ); ?> value="1">
     137                        <input type="hidden" name="jqlb_navbarOnTop" id="jqlb_navbarOnTop" value="<?php echo esc_attr( $jqlb_navbarOnTop ); ?>">
     138                    </td>
     139                </tr>
     140                <tr class="parametr_chechbox">
     141                    <td>
     142                        Reduce large images to fit smaller screens: <span title="We recommend to enable this option, it will reduce large images to fit smaller screens." class="desription_class">?</span>
     143                    </td>
     144                    <td>
     145                        <input type="checkbox" name="jqlb_resize_on_demand_checkbox" id="jqlb_resize_on_demand_checkbox" <?php checked( $jqlb_resize_on_demand, '1' ); ?> value="1">
     146                        <input type="hidden" name="jqlb_resize_on_demand" id="jqlb_resize_on_demand" value="<?php echo esc_attr( $jqlb_resize_on_demand ); ?>">
     147                    </td>
     148                </tr>
     149                <tr>
     150                    <td>
     151                        Minimum margin from top: <span title="You can change image position from top." class="desription_class">?</span>
     152                    </td>
     153                    <td>
     154                        <input type="number" min="0" max="999" step="1" name="jqlb_margin_size" id="jqlb_margin_size" value="<?php echo esc_attr( $jqlb_margin_size ); ?>"><span class="befor_input_small_desc">(default: 0)</span>
     155                    </td>
     156                </tr>
     157                <tr>
     158                    <td>
     159                        Lightbox Animation duration: <span title="Animation duration for lightbox." class="desription_class">?</span>
     160                    </td>
     161                    <td>
     162                        <input type="number" min="0" max="9999999" step="1" name="jqlb_resize_speed" id="jqlb_resize_speed" value="<?php echo esc_attr( $jqlb_resize_speed ); ?>"><span class="befor_input_small_desc">(milliseconds)</span>
     163                    </td>
     164                </tr>
     165                <tr>
     166                    <td>
     167                        Additional text below image info: <span title="Text only (no HTML) that will appear below images. " class="desription_class">?</span>
     168                    </td>
     169                    <td>
     170                        <input type="text" name="jqlb_help_text" id="jqlb_help_text" value="<?php echo esc_attr( $jqlb_help_text ); ?>"><span class="befor_input_small_desc">(default: none)</span>
     171                    </td>
     172                </tr>
     173            </tbody>
     174            <tfoot>
     175                <tr>
     176                    <th colspan="2" width="100%">
     177                        <button type="button" id="save_button_general" class="save_button button button-primary">
     178                            <span class="save_button_span">Save Settings</span>
     179                            <span class="saving_in_progress"></span>
     180                            <span class="sucsses_save"></span>
     181                            <span class="error_in_saving"></span>
     182                        </button>
     183                    </th>
     184                </tr>
     185            </tfoot>
    170186        </table>
     187
    171188        <ol>
    172     <li>You can use WordPress image galleries and have them grouped and auto-lightboxed: <a href="http://codex.wordpress.org/Gallery_Shortcode"><code>[gallery link="file"]</code></a></li>
    173     <li>You can also add a <code>rel="lightbox"</code> attribute to any link tag to activate the lightbox. For example:
    174     <pre><code> &lt;a href=&quot;images/image-1.jpg&quot; rel=&quot;lightbox&quot; title=&quot;my caption&quot;&gt;image #1&lt;/a&gt;</code></pre>
    175     <em>Optional:</em> Use the <code>title</code> attribute if you want to show a caption.
    176     </li>
    177     <li>If you have a set of related images that you would like to group, simply include a group name in the rel attribute. For example:
    178     <pre><code> &lt;a href=&quot;images/image-1.jpg&quot; rel=&quot;lightbox[roadtrip]&quot;&gt;image #1&lt;/a&gt;
    179     &lt;a href=&quot;images/image-2.jpg&quot; rel=&quot;lightbox[roadtrip]&quot;&gt;image #2&lt;/a&gt;
    180     &lt;a href=&quot;images/image-3.jpg&quot; rel=&quot;lightbox[roadtrip]&quot;&gt;image #3&lt;/a&gt;</code></pre>
    181     No limits to the number of image sets per page or how many images are allowed in each set. Go nuts!</li>
    182     <li>To <strong>disable</strong> lightboxing of an image link, just set any other rel-attribute: <code>rel="nobox"</code></li>
    183     </ol>
    184 
    185          <?php wp_nonce_field('wp_lightbox_2_general_settings_page','wp_lightbox_2_general_settings_page'); ?>
    186     </div><br /><br /><span class="error_massage"></span>
    187 
    188         <script>
    189 
    190 
    191 
    192         jQuery(document).ready(function(e) {
    193 
    194              jQuery('#save_button_general').click(function(){
    195 
    196                     jQuery('#save_button_general').addClass('padding_loading');
    197                     jQuery("#save_button_general").prop('disabled', true);
    198                     jQuery('.saving_in_progress').css('display','inline-block');
    199                     generete_checkbox('parametr_chechbox');
    200 
    201                     jQuery.ajax({
    202                         type:'POST',
    203                         url: "<?php echo admin_url( 'admin-ajax.php?action=save_in_databese_lightbox2' ); ?>",
    204                         data: {wp_lightbox_2_general_settings_page:jQuery('#wp_lightbox_2_general_settings_page').val()<?php foreach($initial_values as $key => $value){echo ','.$key.':jQuery("#'.$key.'").val()';} ?>},
    205                     }).done(function(date) {
    206                         if(date=='sax_normala'){
    207                             console.log
     189            <li>You can use WordPress image galleries and have them grouped and auto-lightboxed: <a href="https://codex.wordpress.org/Gallery_Shortcode"><code>[gallery link="file"]</code></a></li>
     190            <li>You can also add a <code>rel="lightbox"</code> attribute to any link tag to activate the lightbox. For example:
     191                <pre>&lt;a href=&quot;images/image-1.jpg&quot; rel=&quot;lightbox&quot; title=&quot;my caption&quot;&gt;image #1&lt;/a&gt;</pre>
     192                <em>Optional:</em> Use the <code>title</code> attribute if you want to show a caption.
     193            </li>
     194            <li>If you have a set of related images that you would like to group, simply include a group name in the rel attribute. For example:
     195                <pre>&lt;a href=&quot;images/image-1.jpg&quot; rel=&quot;lightbox[roadtrip]&quot;&gt;image #1&lt;/a&gt;
     196&lt;a href=&quot;images/image-2.jpg&quot; rel=&quot;lightbox[roadtrip]&quot;&gt;image #2&lt;/a&gt;
     197&lt;a href=&quot;images/image-3.jpg&quot; rel=&quot;lightbox[roadtrip]&quot;&gt;image #3&lt;/a&gt;</pre>
     198                No limits to the number of image sets per page or how many images are allowed in each set. Go nuts!
     199            </li>
     200            <li>To <strong>disable</strong> lightboxing of an image link, just set any other rel-attribute: <code>rel="nobox"</code></li>
     201        </ol>
     202
     203        <?php wp_nonce_field( 'wp_lightbox_2_general_settings_page', 'wp_lightbox_2_general_settings_page' ); ?>
     204    </div>
     205
     206    <br /><br /><span class="error_massage"></span>
     207
     208    <script>
     209
     210        jQuery(document).ready(function() {
     211
     212            jQuery('#save_button_general').click(function(){
     213
     214                jQuery('#save_button_general').addClass('padding_loading');
     215                jQuery("#save_button_general").prop('disabled', true);
     216                jQuery('.saving_in_progress').css('display','inline-block');
     217
     218                generete_checkbox('parametr_chechbox');
     219
     220                jQuery.ajax({
     221                    type:'POST',
     222                    url: "<?php echo admin_url( 'admin-ajax.php?action=save_in_databese_lightbox2' ); ?>",
     223                    data: {
     224                        wp_lightbox_2_general_settings_page:jQuery('#wp_lightbox_2_general_settings_page').val(),
     225                        <?php echo $jquery_settings; ?>
     226                    }
     227                }).done(function(date) {
     228                    if(date==='sax_normala'){
    208229                        jQuery('.saving_in_progress').css('display','none');
    209230                        jQuery('.sucsses_save').css('display','inline-block');
    210                         setTimeout(function(){jQuery('.sucsses_save').css('display','none');jQuery('#save_button_general').removeClass('padding_loading');jQuery("#save_button_general").prop('disabled', false);},2500);
    211                         }else{
    212                             jQuery('.saving_in_progress').css('display','none');
    213                             jQuery('.error_in_saving').css('display','inline-block');
    214                             jQuery('.error_massage').css('display','inline-block');
    215                             jQuery('.error_massage').html(date);
    216                             setTimeout(function(){jQuery('#save_button_general').removeClass('padding_loading');jQuery("#save_button_general").prop('disabled', false);},5000);
    217                         }
    218 
    219                     });
     231
     232                        setTimeout( function() {
     233                            jQuery('.sucsses_save').css('display','none');
     234                            jQuery('#save_button_general').removeClass('padding_loading');
     235                            jQuery("#save_button_general").prop('disabled', false);
     236                        },2500 );
     237                    }else{
     238                        jQuery('.saving_in_progress').css('display','none');
     239                        jQuery('.error_in_saving').css('display','inline-block');
     240                        jQuery('.error_massage').css('display','inline-block');
     241                        jQuery('.error_massage').html(date);
     242
     243                        setTimeout( function() {
     244                            jQuery('#save_button_general').removeClass('padding_loading');
     245                            jQuery("#save_button_general").prop('disabled', false);
     246                        }, 5000 );
     247                    }
    220248                });
    221                 function generete_radio_input(radio_class){
    222                     jQuery('.'+radio_class).each(function(index, element) {
    223                        jQuery(this).find('input[type=hidden]').val(jQuery(this).find('input[type=radio]:checked').val())
    224                     });
    225                 }
    226                 function generete_checkbox(checkbox_class){
    227                     jQuery('.'+checkbox_class).each(function(index, element) {
    228                         if(jQuery(this).find('input[type=checkbox]').prop('checked'))
    229                             jQuery(this).find('input[type=hidden]').val(jQuery(this).find('input[type=checkbox]:checked').val());
    230                         else
    231                             jQuery(this).find('input[type=hidden]').val(0);
    232                     });
    233                 }
     249            });
     250
     251            function generete_checkbox(checkbox_class){
     252                jQuery('.'+checkbox_class).each(function(index, element) {
     253                    if(jQuery(this).find('input[type=checkbox]').prop('checked'))
     254                        jQuery(this).find('input[type=hidden]').val(jQuery(this).find('input[type=checkbox]:checked').val());
     255                    else
     256                        jQuery(this).find('input[type=hidden]').val(0);
     257                });
     258            }
    234259
    235260        });
    236261
    237         </script>
     262    </script>
    238263
    239264        <?php
    240265    }
    241 
    242266}
    243 
    244 
    245  ?>
  • wp-lightbox-2/trunk/admin/scripts/angular.min.js

    r1093840 r3451114  
    11/*
    22 AngularJS v1.2.26
    3  (c) 2010-2014 Google, Inc. http://angularjs.org
     3 (c) 2010-2014 Google, Inc. https://angularjs.org
    44 License: MIT
    55*/
    6 (function(W,X,t){'use strict';function C(b){return function(){var a=arguments[0],c,a="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.2.26/"+(b?b+"/":"")+a;for(c=1;c<arguments.length;c++)a=a+(1==c?"?":"&")+"p"+(c-1)+"="+encodeURIComponent("function"==typeof arguments[c]?arguments[c].toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof arguments[c]?"undefined":"string"!=typeof arguments[c]?JSON.stringify(arguments[c]):arguments[c]);return Error(a)}}function Pa(b){if(null==b||Ga(b))return!1;
     6(function(W,X,t){'use strict';function C(b){return function(){var a=arguments[0],c,a="["+(b?b+":":"")+a+"] https://errors.angularjs.org/1.2.26/"+(b?b+"/":"")+a;for(c=1;c<arguments.length;c++)a=a+(1==c?"?":"&")+"p"+(c-1)+"="+encodeURIComponent("function"==typeof arguments[c]?arguments[c].toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof arguments[c]?"undefined":"string"!=typeof arguments[c]?JSON.stringify(arguments[c]):arguments[c]);return Error(a)}}function Pa(b){if(null==b||Ga(b))return!1;
    77var a=b.length;return 1===b.nodeType&&a?!0:v(b)||J(b)||0===a||"number"===typeof a&&0<a&&a-1 in b}function r(b,a,c){var d;if(b)if(P(b))for(d in b)"prototype"==d||("length"==d||"name"==d||b.hasOwnProperty&&!b.hasOwnProperty(d))||a.call(c,b[d],d);else if(J(b)||Pa(b))for(d=0;d<b.length;d++)a.call(c,b[d],d);else if(b.forEach&&b.forEach!==r)b.forEach(a,c);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],d);return b}function Zb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function Tc(b,
    88a,c){for(var d=Zb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function $b(b){return function(a,c){b(c,a)}}function hb(){for(var b=ma.length,a;b;){b--;a=ma[b].charCodeAt(0);if(57==a)return ma[b]="A",ma.join("");if(90==a)ma[b]="0";else return ma[b]=String.fromCharCode(a+1),ma.join("")}ma.unshift("0");return ma.join("")}function ac(b,a){a?b.$$hashKey=a:delete b.$$hashKey}function D(b){var a=b.$$hashKey;r(arguments,function(a){a!==b&&r(a,function(a,c){b[c]=a})});ac(b,a);return b}function U(b){return parseInt(b,
  • wp-lightbox-2/trunk/admin/styles/admin_themplate.css

    r1093840 r3451114  
    1 .div_included_slider{
    2     padding-top:3px;
     1.div_included_slider {
     2    padding-top: 3px;
    33}
    4 .slider_parametrs{
    5     padding-left:5px;
    6     width:180px;
    7     float:left;
    8     margin-top:2px;
     4.slider_parametrs {
     5    padding-left: 5px;
     6    width: 180px;
     7    float: left;
     8    margin-top: 2px;
    99}
    10 .slider_input{
    11     display:none;
     10.slider_input {
     11    display: none;
    1212}
    13 wp_lightbox2_settings_table > tbody >tr:nth-child(odd){
    14     background-color:#000000;
     13.main_yutube_plus_params pre {
     14    background: #ddd;
     15    width: max-content;
     16    padding: 12px;
    1517}
    16 .slider_span{   
     18
     19.slider_span {
    1720    margin-left: 13px;
    1821}
    19 .desription_class{
    20     float:right;
    21     cursor:default;
    22     color:#0074a2;
    23     font-size:18px;
    24     font-weight:bold;
    25     border:1px solid #000000;
    26     border-radius:200px;
    27     height:20px;
    28     padding-left: 6px;
    29     padding-right: 6px;
    30     margin-left:15px;
     22.desription_class {
     23    float: right;
     24    cursor: default;
     25    color: #0074a2;
     26    font-size: 12px;
     27    font-weight: bold;
     28    border: 1px solid #ddd;
     29    background: #fafafa;
     30    border-radius: 200px;
     31    height: 20px;
     32    width: 20px;
     33    padding: 0;
     34    margin: 0;
     35    text-align: center;
     36    vertical-align: middle;
     37    cursor: help;
    3138}
    3239
    33 .wp-picker-holder{
    34     position:absolute;
    35     z-index:999999;
     40.wp-picker-holder {
     41    position: absolute;
     42    z-index: 999999;
    3643}
    3744
    38 .not_paramter{
    39     color:#B33F41;
    40     font-size:14px;
     45.not_paramter {
     46    color: #B33F41;
     47    font-size: 14px;
    4148}
    4249
    4350/* SAVE BUTTON*/
    44 button{
    45     webkit-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
     51button {
     52    -webkit-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
    4653    -moz-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
    4754    -ms-transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
     
    4956    transition:0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) all !important;
    5057 }
    51 #save_button,#save_button_general{
    52     width: 100px;
     58#save_button,#save_button_general {
     59    max-width: 200px;
    5360    text-align: left;
    54     overflow:hidden;
     61    overflow: hidden;
    5562}
    56 #save_button_general{
    57     width: 100px;
     63#save_button_general {
     64    max-width: 200px;
    5865}
    59 .padding_loading{
    60     width: 130px !important;
    61 }
    62 #save_button_general.padding_loading{
    63     width: 130px !important;
    64    
    65 }
    66  .saving_in_progress{
     66
     67.sucsses_save,
     68.saving_in_progress,
     69.error_in_saving {
    6770    position: relative;
    68     display:none;
     71    display: none;
    6972    width: 18px;
    7073    height: 18px;
    71     margin-left: 12px;
     74    margin: 0 0 0 6px;
    7275    top: 4px;
    73     background-image: url(../images/loading.gif);
    74     background-size:100% 100%;
     76    background-size: 100% 100%;
    7577 }
    76  .sucsses_save{
    77     position: relative;
    78     display:none;
    79     width: 18px;
    80     height: 18px;
    81     margin-left: 12px;
    82     top: 4px;
     78 .saving_in_progress {
     79     background-image: url(../images/loading.gif);
     80 }
     81.sucsses_save {
    8382    background-image: url(../images/success.png);
    84     background-size:100% 100%;
    8583}
    86 .error_in_saving{
    87     position: relative;
    88     display:none;
    89     width: 18px;
    90     height: 18px;
    91     margin-left: 12px;
    92     top: 4px;
     84.error_in_saving {
    9385    background-image: url(../images/remove_element.png);
    94     background-size:100% 100%;
    9586}
    96 .error_massage{
     87.error_massage {
    9788    color: #BB1E1E;
    9889    font-size: 18px;
  • wp-lightbox-2/trunk/admin/styles/jquery-ui.css

    r1093840 r3451114  
    11/*! jQuery UI - v1.11.2 - 2014-10-16
    2 * http://jqueryui.com
     2* https://jqueryui.com
    33* Includes: core.css, accordion.css, autocomplete.css, button.css, datepicker.css, dialog.css, draggable.css, menu.css, progressbar.css, resizable.css, selectable.css, selectmenu.css, slider.css, sortable.css, spinner.css, tabs.css, tooltip.css, theme.css
    4 * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS%2CTahoma%2CVerdana%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=gloss_wave&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=highlight_soft&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=glass&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=glass&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=highlight_soft&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=diagonals_thick&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=diagonals_thick&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=flat&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
     4* To view and modify this theme, visit https://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS%2CTahoma%2CVerdana%2CArial%2Csans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=gloss_wave&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=highlight_soft&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=glass&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=glass&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=highlight_soft&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=diagonals_thick&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=diagonals_thick&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=flat&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
    55* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
    66
  • wp-lightbox-2/trunk/includes/install_database.php

    r1220099 r3451114  
    1 <?php 
     1<?php
    22
     3class wp_lightbox2_database_params {
    34
     5    public $installed_options; // all standart_options
     6    public $get_general_settings;
     7    public $get_design_settings;
     8    private $plugin_url;
    49
    5 class wp_lightbox2_database_params{
    6    
    7     public $installed_options; // all standart_options
    8     private $plugin_url;
    9     public  $get_general_settings;
    10     public  $get_design_settings;
    11     function __construct(){
    12        
    13         if(isset($params['plugin_url']))
    14             $this->plugin_url=$params['plugin_url'];
    15         else
    16             $this->plugin_url=trailingslashit(dirname(plugins_url('',__FILE__)));   
    17         $general_settings=array(
    18             'jqlb_overlay_opacity'=>'80',
    19             'jqlb_help_text'=>'',
    20             'jqlb_margin_size'=>0,         
    21             'jqlb_automate'=>1,
    22             'jqlb_comments'=>1,
    23             'jqlb_resize_on_demand'=>0,
    24             'jqlb_show_download'=>0,
    25             'jqlb_navbarOnTop'=>0,
    26             'jqlb_resize_speed'=>400,
     10    public function __construct( $params = array() ) {
     11
     12        if ( isset( $params[ 'plugin_url' ] ) ) {
     13            $this->plugin_url = $params[ 'plugin_url' ];
     14        } else {
     15            $this->plugin_url = trailingslashit( dirname( plugins_url( '', __FILE__ ) ) );
     16        }
     17
     18        $general_settings = array(
     19            'jqlb_overlay_opacity'  => '80',
     20            'jqlb_help_text'        => '',
     21            'jqlb_margin_size'      => 0,
     22            'jqlb_automate'         => 1,
     23            'jqlb_comments'         => 1,
     24            'jqlb_resize_on_demand' => 0,
     25            'jqlb_show_download'    => 0,
     26            'jqlb_navbarOnTop'      => 0,
     27            'jqlb_resize_speed'     => 400,
    2728        );
    28         foreach($general_settings as $key => $value){
    29             if(!(get_option($key,12365498798465132148947984651)==12365498798465132148947984651)){
    30                 $general_settings[$key]=get_option($key);               
     29        foreach ( $general_settings as $key => $value ) {
     30            if ( !(get_option( $key, 12365498798465132148947984651 ) == 12365498798465132148947984651) ) {
     31                $general_settings[ $key ] = get_option( $key );
     32            } else {
     33                $general_settings[ $key ] = $value;
    3134            }
    32             else{
    33                 $general_settings[$key]=$value;
    34             }           
    35         }   
    36          $this->get_general_settings=$general_settings;
    37          $locale = jqlb_get_locale();
    38          $folder='';
    39          switch($locale){
     35        }
     36        $this->get_general_settings = $general_settings;
     37        $locale                     = jqlb_get_locale();
     38        $folder                     = '';
     39        switch ( $locale ) {
    4040            case 'cs_CZ':
    41                 $folder='cs_CZ/';
    42             break;
     41                $folder = 'cs_CZ/';
     42                break;
    4343            case 'ru_RU':
    44                 $folder='ru_RU/';
    45             break;
     44                $folder = 'ru_RU/';
     45                break;
    4646            case 'pl_PL':
    47                 $folder='pl_PL/';
    48             break;
     47                $folder = 'pl_PL/';
     48                break;
    4949            case 'he_IL':
    50                 $folder='he_IL/';
    51             break;
     50                $folder = 'he_IL/';
     51                break;
    5252        }
    5353
    5454        // Note: Deprecated 3.0.5+
    55         $design_settings=array(
    56             'jqlb_overlay_opacity'=>'80',
    57             'jqlb_overlay_color'=>'#000000',
    58             'jqlb_overlay_close'=>'1',         
    59             'jqlb_border_width'=>'10',
    60             'jqlb_border_color'=>'#ffffff',
    61             'jqlb_border_radius'=>'0',         
    62             'jqlb_image_info_background_transparency'=>'100',
    63             'jqlb_image_info_bg_color'=>'#ffffff',
    64             'jqlb_image_info_text_color'=>'#000000',
    65             'jqlb_image_info_text_fontsize'=>'10',
    66             'jqlb_show_text_for_image'=>'1',
    67             'jqlb_next_image_title'=> __('next image', 'jqlb'),
    68             'jqlb_previous_image_title'=>__('previous image', 'jqlb'),
    69             'jqlb_next_button_image'=>$this->plugin_url.'styles/images/'.$folder.'next.gif',
    70             'jqlb_previous_button_image'=>$this->plugin_url.'styles/images/'.$folder.'prev.gif',
    71             'jqlb_maximum_width'=>'',
    72             'jqlb_maximum_height'=>'',
    73             'jqlb_show_close_button'=>'1',
    74             'jqlb_close_image_title'=>__('close image gallery', 'jqlb'),
    75             'jqlb_close_image_max_heght'=>'22',         
    76             'jqlb_image_for_close_lightbox'=>$this->plugin_url.'styles/images/'.$folder.'closelabel.gif',   
    77             'jqlb_keyboard_navigation'=>'1',
    78             'jqlb_popup_size_fix'=>'0',         
    79         ); 
    80         foreach($design_settings as $key => $value){
    81             if(!(get_option($key,12365498798465132148947984651)==12365498798465132148947984651)){
    82                 $design_settings[$key]=get_option($key);               
     55        $design_settings = array(
     56            'jqlb_overlay_opacity'                    => '80',
     57            'jqlb_overlay_color'                      => '#000000',
     58            'jqlb_overlay_close'                      => '1',
     59            'jqlb_border_width'                       => '10',
     60            'jqlb_border_color'                       => '#ffffff',
     61            'jqlb_border_radius'                      => '0',
     62            'jqlb_image_info_background_transparency' => '100',
     63            'jqlb_image_info_bg_color'                => '#ffffff',
     64            'jqlb_image_info_text_color'              => '#000000',
     65            'jqlb_image_info_text_fontsize'           => '10',
     66            'jqlb_show_text_for_image'                => '1',
     67            'jqlb_next_image_title'                   => __( 'next image', 'jqlb' ),
     68            'jqlb_previous_image_title'               => __( 'previous image', 'jqlb' ),
     69            'jqlb_next_button_image'                  => $this->plugin_url . 'styles/images/' . $folder . 'next.gif',
     70            'jqlb_previous_button_image'              => $this->plugin_url . 'styles/images/' . $folder . 'prev.gif',
     71            'jqlb_maximum_width'                      => '',
     72            'jqlb_maximum_height'                     => '',
     73            'jqlb_show_close_button'                  => '1',
     74            'jqlb_close_image_title'                  => __( 'close image gallery', 'jqlb' ),
     75            'jqlb_close_image_max_heght'              => '22',
     76            'jqlb_image_for_close_lightbox'           => $this->plugin_url . 'styles/images/' . $folder . 'closelabel.gif',
     77            'jqlb_keyboard_navigation'                => '1',
     78            'jqlb_popup_size_fix'                     => '0',
     79        );
     80
     81        foreach ( $design_settings as $key => $value ) {
     82            if ( !(get_option( $key, 12365498798465132148947984651 ) == 12365498798465132148947984651) ) {
     83                $design_settings[ $key ] = get_option( $key );
     84            } else {
     85                $design_settings[ $key ] = $value;
    8386            }
    84             else{
    85                 $design_settings[$key]=$value;
    86             }           
    87         }   
    88           $this->get_design_settings=$design_settings;
    89                
     87        }
     88        $this->get_design_settings = $design_settings;
    9089    }
    91    
    92 
    9390}
  • wp-lightbox-2/trunk/js/dist/wp-lightbox-2.js

    r3306679 r3451114  
    66
    77(function($){
    8     $.fn.lightbox = {};
    9     $.fn.lightbox.parseJsonData = function(data) {
    10         var imageArray = [];
    11         $.each(data, function () {
    12             imageArray.push(new Array(this.url, this.title));
    13         });
    14         return imageArray;
    15     };
    16     $.fn.lightbox.defaults = {
     8    $.fn.lightbox = {};
     9    $.fn.lightbox.parseJsonData = function(data) {
     10        var imageArray = [];
     11        $.each(data, function () {
     12            imageArray.push(new Array(this.url, this.title));
     13        });
     14        return imageArray;
     15    };
     16    $.fn.lightbox.defaults = {
    1717        adminBarHeight:28,
    18         overlayOpacity: 0.8,
    19         borderSize: 10,
    20         imageArray: new Array,
    21         activeImage: null,
    22         inprogress: false, //this is an internal state variable. don't touch.
    23         widthCurrent: 250,
    24         heightCurrent: 250,
    25         xScale: 1,
    26         yScale: 1,
    27         displayTitle: true,
    28         disableNavbarLinks: true,
    29         loopImages: true,
    30         imageClickClose: true,
    31         jsonData: null,
    32         jsonDataParser: null,
    33         followScroll: false,
    34         isIE8: false  //toyNN:internal value only
    35     };
     18        overlayOpacity: 0.8,
     19        borderSize: 10,
     20        imageArray: new Array,
     21        activeImage: null,
     22        inprogress: false, //this is an internal state variable. don't touch.
     23        widthCurrent: 250,
     24        heightCurrent: 250,
     25        xScale: 1,
     26        yScale: 1,
     27        displayTitle: true,
     28        disableNavbarLinks: true,
     29        loopImages: true,
     30        imageClickClose: true,
     31        jsonData: null,
     32        jsonDataParser: null,
     33        followScroll: false,
     34        isIE8: false  //toyNN:internal value only
     35    };
    3636    $(document).ready(function($){
    3737        var haveConf = (typeof JQLBSettings == 'object');
     
    5252            of: ' of ',
    5353            download: 'Download'
    54         };
    55         new Lightbox($('a[rel^="lightbox"]'), {
     54        };
     55        new Lightbox($('a[rel^="lightbox"]'), {
    5656            adminBarHeight: $('#wpadminbar').height() || 0,
    5757            linkTarget: (haveConf && JQLBSettings.linkTarget.length) ? JQLBSettings.linkTarget : '_self',
     
    6464            //followScroll: (haveConf && JQLBSettings.followScroll == '0') ? false : true,
    6565            strings: (haveConf && typeof JQLBSettings.help == 'string') ? JQLBSettings : default_strings
    66         });
     66        });
    6767    });
    68 })(jQuery);
    69 },{"./lightbox/Lightbox":6}],3:[function(require,module,exports){
    70 const $ = window.jQuery;
    71 
    72 
    73 class Display {
    74     constructor(config, helper) {
    75         this.config = config;
    76         this.helper = helper;
    77     }
    78     changeImage(imageNum) {
    79         if (this.config.inprogress == false) {
    80             this.config.inprogress = true;
    81             this.config.activeImage = imageNum;
    82             // hide elements during transition
    83             const loading = document.getElementById('loading');
    84             const lightboxImage = document.getElementById('lightboxImage');
    85             const hoverNav = document.getElementById('hoverNav');
    86             const prevLink = document.getElementById('prevLink');
    87             const nextLink = document.getElementById('nextLink');
    88             if (loading) {
    89                 this.helper.show(loading);
    90             }
    91             if (lightboxImage) {
    92                 this.helper.hide(lightboxImage);
    93             }
    94             if (hoverNav) {
    95                 this.helper.hide(hoverNav);
    96             }
    97             if (prevLink) {
    98                 this.helper.hide(prevLink);
    99             }
    100             if (nextLink) {
    101                 this.helper.hide(nextLink);
    102             }
    103             this.doChangeImage();
    104         }
    105     };
    106 
    107 
    108     doChangeImage() {
    109         this.config.imgPreloader = new Image();
    110         this.config.imgPreloader.onload = _ => {
    111             const lightboxImage = document.getElementById('lightboxImage');
    112             if (lightboxImage) {
    113                 lightboxImage.src = this.config.imageArray[this.config.activeImage][0];
    114             }
    115             this.doScale();  // once image is preloaded, resize image container
    116             this.preloadNeighborImages();
    117         };
    118         this.config.imgPreloader.src = this.config.imageArray[this.config.activeImage][0];
    119     };
    120 
    121     doScale() {
    122         this.updateDetails(); //Kevin: moved updateDetails() here, seems to work fine.
    123         const overlay = document.getElementById('overlay');
    124         if (!overlay || !this.config.imgPreloader) {
    125             return;
    126         }
    127         var newWidth = this.config.imgPreloader.width;
    128         var newHeight = this.config.imgPreloader.height;
    129         var arrayPageSize = this.helper.getPageSize();
    130         var noScrollWidth = (arrayPageSize.pageWindowWidth < arrayPageSize.pageDocumentWidth) ? arrayPageSize.pageDocumentWidth : arrayPageSize.pageWindowWidth; //if viewport is smaller than page, use page width.
    131         overlay.style.width = noScrollWidth + 'px';
    132         overlay.style.height = arrayPageSize.pageDocumentHeight + 'px';
    133         const imageDataContainer = document.getElementById('imageDataContainer');
    134         var maxHeight = (arrayPageSize.viewportHeight) - (imageDataContainer.offsetHeight + (2 * this.config.borderSize));
    135         var maxWidth = (arrayPageSize.pageWindowWidth) - (2 * this.config.borderSize);
    136         if (this.config.fitToScreen) {
    137             var displayHeight = maxHeight - this.config.marginSize;
    138             var displayWidth = maxWidth - this.config.marginSize;
    139             var ratio = 1;
    140             if (newHeight > displayHeight) {
    141                 ratio = displayHeight / newHeight; //ex. 600/1024 = 0.58
    142             }
    143             newWidth = newWidth * ratio;
    144             newHeight = newHeight * ratio;
    145             ratio = 1;
    146             if (newWidth > displayWidth) {
    147                 ratio = displayWidth / newWidth; //ex. 800/1280 == 0.62
    148             }
    149             newWidth = Math.round(newWidth * ratio);
    150             newHeight = Math.round(newHeight * ratio);
    151         }
    152         var arrayPageScroll = this.helper.getPageScroll();
    153         var centerY = arrayPageScroll.yScroll + (maxHeight * 0.5);
    154         var newTop = centerY - newHeight * 0.5;
    155         var newLeft = arrayPageScroll.xScroll;
    156         const lightbox = document.getElementById('lightboxImage');
    157         lightbox.style.width = newWidth;
    158         lightbox.style.height = newHeight;
    159         this.resizeImageContainer(newWidth, newHeight, newTop, newLeft);
    160     }
    161     /*2.28.4 -  Compatible with wordpress 3.6.*/
    162     resizeImageContainer(imgWidth, imgHeight, lightboxTop, lightboxLeft) {
    163         const outerImageContainer = document.getElementById("outerImageContainer");
    164         const imageDataContainer = document.getElementById("imageDataContainer");
    165         if (!outerImageContainer || !imageDataContainer) {
    166             return;
    167         }
    168         this.config.widthCurrent = outerImageContainer.offsetWidth;
    169         this.config.heightCurrent = outerImageContainer.offsetHeight;
    170         var widthNew = Math.max(350, imgWidth + ((this.config.borderSize || 0) * 2));
    171         var heightNew = (imgHeight + ((this.config.borderSize || 0) * 2));
    172         // scalars based on change from old to new
    173         this.config.xScale = (widthNew / this.config.widthCurrent) * 100;
    174         this.config.yScale = (heightNew / this.config.heightCurrent) * 100;
    175         this.helper.setLightBoxPos(lightboxTop, lightboxLeft);
    176 
    177         $('#imageDataContainer').animate({ width: widthNew }, this.config.resizeSpeed, 'linear');
    178         $('#outerImageContainer').animate({ width: widthNew }, this.config.resizeSpeed, 'linear', _ => {
    179             $('#outerImageContainer').animate({ height: heightNew }, this.config.resizeSpeed, 'linear', _=> {
    180                 this.showImage();
    181             });
    182         });
    183 
    184         this.showNavigationElements();
    185         if (document.getElementById("prevLink"))
    186             document.getElementById("prevLink").style.height = imgHeight;
    187         if (document.getElementById("nextLink"))
    188             document.getElementById("nextLink").style.height = imgHeight;
    189     };
    190 
    191     showImage() {
    192         //assumes updateDetails have been called earlier!
    193         this.helper.show(document.getElementById("imageData"));
    194         this.helper.show(document.getElementById('caption'));
    195         //$('#imageDataContainer').slideDown(400);
    196         //$("#imageDetails").hide().fadeIn(400);
    197         this.helper.hide(document.getElementById("loading"));
    198         if (this.config.resizeSpeed > 0) {
    199             $('#lightboxImage').fadeIn("fast");
    200         } else {
    201             this.helper.show(document.getElementById("lightboxImage"));
    202         }
    203         this.config.inprogress = false;
    204     };
    205 
    206     preloadNeighborImages() {
    207         if (this.config.loopImages && this.config.imageArray.length > 1) {
    208             let preloadNextImage = new Image();
    209             preloadNextImage.src = this.config.imageArray[(this.config.activeImage == (this.config.imageArray.length - 1)) ? 0 : this.config.activeImage + 1][0]
    210             let preloadPrevImage = new Image();
    211             preloadPrevImage.src = this.config.imageArray[(this.config.activeImage == 0) ? (this.config.imageArray.length - 1) : this.config.activeImage - 1][0]
    212         } else {
    213             if ((this.config.imageArray.length - 1) > this.config.activeImage) {
    214                 let preloadNextImage = new Image();
    215                 preloadNextImage.src = this.config.imageArray[this.config.activeImage + 1][0];
    216             }
    217             if (this.config.activeImage > 0) {
    218                 let preloadPrevImage = new Image();
    219                 preloadPrevImage.src = this.config.imageArray[this.config.activeImage - 1][0];
    220             }
    221         }
    222     };
    223 
    224 
    225     updateDetails() {
    226         const numberDisplay = document.getElementById('numberDisplay');
    227         if (numberDisplay) {
    228             numberDisplay.innerHTML = '';
    229         }
    230         const caption = document.getElementById('caption');
    231         if (caption) {
    232             caption.innerHTML = '';
    233             this.helper.hide(caption);
    234             if (this.config.imageArray[this.config.activeImage][1]) {
    235                 caption.innerHTML = this.config.imageArray[this.config.activeImage][1];
    236                 this.helper.show();
    237             }
    238         }
    239         var nav_html = '';
    240         var prev = '';
    241         var pos = (this.config.imageArray.length > 1) ? this.config.strings.image + (this.config.activeImage + 1) + this.config.strings.of + this.config.imageArray.length : '';
    242         var link = (this.config.displayDownloadLink) ? '<a href="' + this.config.imageArray[this.config.activeImage][0] + '" id="downloadLink" target="' + this.config.linkTarget + '">' + this.config.strings.download + '</a>' : '';
    243         var next = '';
    244         if (this.config.imageArray.length > 1 && !this.config.disableNavbarLinks) {  // display previous / next text links
    245             if ((this.config.activeImage) > 0 || this.config.loopImages) {
    246                 prev = '<a title="' + this.config.strings.prevLinkTitle + '" href="#" id="prevLinkText">' + this.config.strings.prevLinkText + "</a>";
    247             }
    248             if (((this.config.activeImage + 1) < this.config.imageArray.length) || this.config.loopImages) {
    249                 next += '<a title="' + this.config.strings.nextLinkTitle + '" href="#" id="nextLinkText">' + this.config.strings.nextLinkText + "</a>";
    250             }
    251         }
    252         nav_html = prev + nav_html + pos + link + next;
    253         if (nav_html != '') {
    254             if (document.getElementById("numberDisplay")) {
    255                 document.getElementById("numberDisplay").innerHTML = nav_html;
    256                 this.helper.show(document.getElementById("numberDisplay"));
    257             }
    258         }
    259     };
    260 
    261 
    262     showNavigationElements() {
    263         const prevLink = document.getElementById("prevLink");
    264         const prevLinkText = document.getElementById("prevLinkText");
    265         const nextLink = document.getElementById("nextLink");
    266         const nextLinkText = document.getElementById("nextLinkText");
    267         if (this.config.imageArray.length > 1) {
    268             this.helper.show(document.getElementById("hoverNav"));
    269             // if loopImages is true, always show next and prev image buttons
    270             if (this.config.loopImages) {
    271                 this.helper.show(prevLink);
    272                 this.helper.show(prevLinkText);
    273                 this.helper.show(nextLink);
    274                 this.helper.show(nextLinkText);
    275 
    276             } else {
    277                 // if not first image in set, display prev image button
    278                 if (this.config.activeImage != 0) {
    279                     this.helper.show(prevLink);
    280                     this.helper.show(prevLinkText);
    281                 }
    282                 // if not last image in set, display next image button
    283                 if (this.config.activeImage != (this.config.imageArray.length - 1)) {
    284                     this.helper.show(nextLink);
    285                     this.helper.show(nextLink);
    286                 }
    287             }
    288             //this.enableKeyboardNav();
    289         }
    290     };
    291 }
    292 
    293 module.exports = Display;
    294 },{}],4:[function(require,module,exports){
    295 class Events {
    296     constructor(config, parent) {
    297         this.config = config;
    298         this.parent = parent;
    299     }
    300 
    301     bindNavigationButtons(callback) {
    302         const prevLink = document.getElementById("prevLink");
    303         const prevLinkText = document.getElementById("prevLinkText");
    304         const nextLink = document.getElementById("nextLink");
    305         const nextLinkText = document.getElementById("nextLinkText");
    306         if(prevLink) {
    307             prevLink.addEventListener('click', this.onNavigationButtonClick.bind(this, callback, 'prev'));
    308         }
    309         if(prevLinkText) {
    310             prevLinkText.addEventListener('click', this.onNavigationButtonClick.bind(this, callback, 'prev'));
    311         }
    312         if(nextLink) {
    313             nextLink.addEventListener('click', this.onNavigationButtonClick.bind(this, callback, 'next'));
    314         }
    315         if(nextLinkText) {
    316             nextLinkText.addEventListener('click', this.onNavigationButtonClick.bind(this, callback, 'next'));
    317         }
    318     }
    319 
    320     onNavigationButtonClick(callback, direction, e) {
    321         e.stopPropagation()
    322         e.preventDefault();
    323         if(direction === 'prev') {
    324             const index = (this.config.activeImage == 0) ? (this.config.imageArray.length - 1) : this.config.activeImage - 1;
    325             callback(index);
    326         }
    327         if(direction === 'next') {
    328             const index = (this.config.activeImage == (this.config.imageArray.length - 1)) ? 0 : this.config.activeImage + 1;
    329             callback(index);
    330         }
    331     }
    332 
    333 
    334     enableKeyboardNav(callback) {
    335         document.addEventListener('keydown', this.keyboardAction.bind(this, callback));
    336     }
    337 
    338     keyboardAction(callback, e) {
    339         var config = this.config;
    340         var keycode = e.keyCode;
    341         var escapeKey = 27;
    342         var key = String.fromCharCode(keycode).toLowerCase();
    343         if ((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)) { // close lightbox
    344             this.parent.end();
    345         } else if ((key == 'p') || (keycode == 37)) { // display previous image
    346             if (config.loopImages) {
    347                 callback((config.activeImage == 0) ? (config.imageArray.length - 1) : config.activeImage - 1);
    348             }
    349             else if (config.activeImage != 0) {
    350                 callback(config.activeImage - 1);
    351             }
    352         } else if ((key == 'n') || (keycode == 39)) { // display next image
    353             if (this.config.loopImages) {
    354                 callback((config.activeImage == (config.imageArray.length - 1)) ? 0 : config.activeImage + 1);
    355             }
    356             else if (config.activeImage != (config.imageArray.length - 1)) {
    357                 callback(config.activeImage + 1);
    358             }
    359         }
    360         return false;
    361     };
    362 
    363 }
    364 
    365 module.exports = Events;
    366 },{}],5:[function(require,module,exports){
    367 const $ = window.jQuery;
    368 
    369 class Helper {
    370     constructor(config) {
    371         this.config = config;
    372     }
    373     hide(element) {
    374         if (element) {
    375             element.style.display = 'none';
    376         }
    377     };
    378     show(element) {
    379         if (element) {
    380             element.style.display = 'block';
    381         }
    382     };
    383     getPageSize() {
    384         const pageDocumentHeight = document.documentElement.scrollHeight;
    385         const pageDocumentWidth = document.documentElement.scrollWidth;
    386         if (this.config.isIE8 && pageDocumentHeight > 4096) {
    387             pageDocumentHeight = 4096;
    388         }
    389         var viewportHeight = document.documentElement.clientHeight - this.config.adminBarHeight;
    390         var pageWindowWidth = document.documentElement.clientWidth;
    391         const pageSize = {
    392             pageDocumentWidth: pageDocumentWidth,
    393             pageDocumentHeight: pageDocumentHeight,
    394             pageWindowWidth: pageWindowWidth,
    395             viewportHeight: viewportHeight,
    396             documentScrollHeight: document.documentElement.scrollHeight
    397         };
    398         return pageSize;
    399     };
    400     isIE8() {
    401         var isBuggy = false;
    402         if (document.createElement) {
    403             var el = document.createElement("div");
    404             if (el && el.querySelectorAll) {
    405                 el.innerHTML = "<object><param name=\"\"></object>";
    406                 isBuggy = el.querySelectorAll("param").length != 1;
    407             }
    408             el = null;
    409         }
    410         return isBuggy;
    411     };
    412     getPageScroll() {
    413         var xScroll = 0; var yScroll = 0;
    414         if (self.pageYOffset) {
    415             yScroll = self.pageYOffset;
    416             xScroll = self.pageXOffset;
    417         } else if (document.documentElement && document.documentElement.scrollTop) {  // Explorer 6 Strict
    418             yScroll = document.documentElement.scrollTop;
    419             xScroll = document.documentElement.scrollLeft;
    420         } else if (document.body) {// all other Explorers
    421             yScroll = document.body.scrollTop;
    422             xScroll = document.body.scrollLeft;
    423         }
    424         const wpadminbar = document.getElementById("wpadminbar");
    425         if (wpadminbar) {
    426             const style = window.getComputedStyle(wpadminbar);
    427             const top = style.getPropertyValue('top');
    428             if (this.config.adminBarHeight && parseInt(top, 10) === 0) {
    429                 yScroll += this.config.adminBarHeight;
    430             }
    431         }
    432         return {xScroll, yScroll};
    433     };
    434     setLightBoxPos(newTop, newLeft) {
    435         if (this.config.resizeSpeed > 0) {
    436             $('#lightbox').animate({ top: newTop }, 250, 'linear');
    437             return $('#lightbox').animate({ left: newLeft }, 250, 'linear').show();
    438         }
    439         return $('#lightbox').css({ top: newTop + 'px', left: newLeft + 'px' }).show();
    440     }
    441 }
    442 
    443 module.exports = Helper;
    444 },{}],6:[function(require,module,exports){
    445 const $ = window.jQuery;
    446 const Helper = require("./Helper");
    447 const Display = require("./Display");
    448 const Events = require("./Events");
    449 
    450 class Lightbox {
    451     constructor(element, config) {
    452         this.config = $.extend({}, $.fn.lightbox.defaults, config);
    453         this.helper = new Helper(this.config);
    454         this.display = new Display(this.config, this.helper);
    455         this.events = new Events(this.config, this);
    456         this.loader(element);
    457     }
    458     loader(element) {
    459         for (let i = 0; i < element.length; i++) {
    460             element[i].addEventListener('click', this.onClick.bind(this, element[i]));
    461         }
    462     }
    463     onClick(element, event) {
    464         event.preventDefault();
    465         this.initialize();
    466         this.start(element);
    467     }
     68    })(jQuery);
     69    },{"./lightbox/Lightbox":6}],3:[function(require,module,exports){
     70    const $ = window.jQuery;
     71
     72
     73    class Display {
     74    constructor(config, helper) {
     75        this.config = config;
     76        this.helper = helper;
     77    }
     78    changeImage(imageNum) {
     79        if (this.config.inprogress == false) {
     80            this.config.inprogress = true;
     81            this.config.activeImage = imageNum;
     82            // hide elements during transition
     83            const loading = document.getElementById('loading');
     84            const lightboxImage = document.getElementById('lightboxImage');
     85            const hoverNav = document.getElementById('hoverNav');
     86            const prevLink = document.getElementById('prevLink');
     87            const nextLink = document.getElementById('nextLink');
     88            if (loading) {
     89                this.helper.show(loading);
     90            }
     91            if (lightboxImage) {
     92                this.helper.hide(lightboxImage);
     93            }
     94            if (hoverNav) {
     95                this.helper.hide(hoverNav);
     96            }
     97            if (prevLink) {
     98                this.helper.hide(prevLink);
     99            }
     100            if (nextLink) {
     101                this.helper.hide(nextLink);
     102            }
     103            this.doChangeImage();
     104        }
     105    };
     106
     107
     108    doChangeImage() {
     109        this.config.imgPreloader = new Image();
     110        this.config.imgPreloader.onload = _ => {
     111            const lightboxImage = document.getElementById('lightboxImage');
     112            if (lightboxImage) {
     113                lightboxImage.src = this.config.imageArray[this.config.activeImage][0];
     114            }
     115            this.doScale();  // once image is preloaded, resize image container
     116            this.preloadNeighborImages();
     117        };
     118        this.config.imgPreloader.src = this.config.imageArray[this.config.activeImage][0];
     119    };
     120
     121    doScale() {
     122        this.updateDetails(); //Kevin: moved updateDetails() here, seems to work fine.
     123        const overlay = document.getElementById('overlay');
     124        if (!overlay || !this.config.imgPreloader) {
     125            return;
     126        }
     127        var newWidth = this.config.imgPreloader.width;
     128        var newHeight = this.config.imgPreloader.height;
     129        var arrayPageSize = this.helper.getPageSize();
     130        var noScrollWidth = (arrayPageSize.pageWindowWidth < arrayPageSize.pageDocumentWidth) ? arrayPageSize.pageDocumentWidth : arrayPageSize.pageWindowWidth; //if viewport is smaller than page, use page width.
     131        overlay.style.width = noScrollWidth + 'px';
     132        overlay.style.height = arrayPageSize.pageDocumentHeight + 'px';
     133        const imageDataContainer = document.getElementById('imageDataContainer');
     134        var maxHeight = (arrayPageSize.viewportHeight) - (imageDataContainer.offsetHeight + (2 * this.config.borderSize));
     135        var maxWidth = (arrayPageSize.pageWindowWidth) - (2 * this.config.borderSize);
     136        if (this.config.fitToScreen) {
     137            var displayHeight = maxHeight - this.config.marginSize;
     138            var displayWidth = maxWidth - this.config.marginSize;
     139            var ratio = 1;
     140            if (newHeight > displayHeight) {
     141                ratio = displayHeight / newHeight; //ex. 600/1024 = 0.58
     142            }
     143            newWidth = newWidth * ratio;
     144            newHeight = newHeight * ratio;
     145            ratio = 1;
     146            if (newWidth > displayWidth) {
     147                ratio = displayWidth / newWidth; //ex. 800/1280 == 0.62
     148            }
     149            newWidth = Math.round(newWidth * ratio);
     150            newHeight = Math.round(newHeight * ratio);
     151        }
     152        var arrayPageScroll = this.helper.getPageScroll();
     153        var centerY = arrayPageScroll.yScroll + (maxHeight * 0.5);
     154        var newTop = centerY - newHeight * 0.5;
     155        var newLeft = arrayPageScroll.xScroll;
     156        const lightbox = document.getElementById('lightboxImage');
     157        lightbox.style.width = newWidth;
     158        lightbox.style.height = newHeight;
     159        this.resizeImageContainer(newWidth, newHeight, newTop, newLeft);
     160    }
     161    /*2.28.4 -  Compatible with wordpress 3.6.*/
     162    resizeImageContainer(imgWidth, imgHeight, lightboxTop, lightboxLeft) {
     163        const outerImageContainer = document.getElementById("outerImageContainer");
     164        const imageDataContainer = document.getElementById("imageDataContainer");
     165        if (!outerImageContainer || !imageDataContainer) {
     166            return;
     167        }
     168        this.config.widthCurrent = outerImageContainer.offsetWidth;
     169        this.config.heightCurrent = outerImageContainer.offsetHeight;
     170        var widthNew = Math.max(350, imgWidth + ((this.config.borderSize || 0) * 2));
     171        var heightNew = (imgHeight + ((this.config.borderSize || 0) * 2));
     172        // scalars based on change from old to new
     173        this.config.xScale = (widthNew / this.config.widthCurrent) * 100;
     174        this.config.yScale = (heightNew / this.config.heightCurrent) * 100;
     175        this.helper.setLightBoxPos(lightboxTop, lightboxLeft);
     176
     177        $('#imageDataContainer').animate({ width: widthNew }, this.config.resizeSpeed, 'linear');
     178        $('#outerImageContainer').animate({ width: widthNew }, this.config.resizeSpeed, 'linear', _ => {
     179            $('#outerImageContainer').animate({ height: heightNew }, this.config.resizeSpeed, 'linear', _=> {
     180                this.showImage();
     181            });
     182        });
     183
     184        this.showNavigationElements();
     185        if (document.getElementById("prevLink"))
     186            document.getElementById("prevLink").style.height = imgHeight;
     187        if (document.getElementById("nextLink"))
     188            document.getElementById("nextLink").style.height = imgHeight;
     189    };
     190
     191    showImage() {
     192        //assumes updateDetails have been called earlier!
     193        this.helper.show(document.getElementById("imageData"));
     194        this.helper.show(document.getElementById('caption'));
     195        //$('#imageDataContainer').slideDown(400);
     196        //$("#imageDetails").hide().fadeIn(400);
     197        this.helper.hide(document.getElementById("loading"));
     198        if (this.config.resizeSpeed > 0) {
     199            $('#lightboxImage').fadeIn("fast");
     200        } else {
     201            this.helper.show(document.getElementById("lightboxImage"));
     202        }
     203        this.config.inprogress = false;
     204    };
     205
     206    preloadNeighborImages() {
     207        if (this.config.loopImages && this.config.imageArray.length > 1) {
     208            let preloadNextImage = new Image();
     209            preloadNextImage.src = this.config.imageArray[(this.config.activeImage == (this.config.imageArray.length - 1)) ? 0 : this.config.activeImage + 1][0]
     210            let preloadPrevImage = new Image();
     211            preloadPrevImage.src = this.config.imageArray[(this.config.activeImage == 0) ? (this.config.imageArray.length - 1) : this.config.activeImage - 1][0]
     212        } else {
     213            if ((this.config.imageArray.length - 1) > this.config.activeImage) {
     214                let preloadNextImage = new Image();
     215                preloadNextImage.src = this.config.imageArray[this.config.activeImage + 1][0];
     216            }
     217            if (this.config.activeImage > 0) {
     218                let preloadPrevImage = new Image();
     219                preloadPrevImage.src = this.config.imageArray[this.config.activeImage - 1][0];
     220            }
     221        }
     222    };
     223
     224
     225    updateDetails() {
     226        const numberDisplay = document.getElementById('numberDisplay');
     227        if (numberDisplay) {
     228            numberDisplay.innerHTML = '';
     229        }
     230        const caption = document.getElementById('caption');
     231        if (caption) {
     232            caption.innerHTML = '';
     233            this.helper.hide(caption);
     234            if (this.config.imageArray[this.config.activeImage][1]) {
     235                caption.innerHTML = this.config.imageArray[this.config.activeImage][1];
     236                this.helper.show();
     237            }
     238        }
     239        var nav_html = '';
     240        var prev = '';
     241        var pos = (this.config.imageArray.length > 1) ? this.config.strings.image + (this.config.activeImage + 1) + this.config.strings.of + this.config.imageArray.length : '';
     242        var link = (this.config.displayDownloadLink) ? '<a href="' + this.config.imageArray[this.config.activeImage][0] + '" id="downloadLink" target="' + this.config.linkTarget + '">' + this.config.strings.download + '</a>' : '';
     243        var next = '';
     244        if (this.config.imageArray.length > 1 && !this.config.disableNavbarLinks) {  // display previous / next text links
     245            if ((this.config.activeImage) > 0 || this.config.loopImages) {
     246                prev = '<a title="' + this.config.strings.prevLinkTitle + '" href="#" id="prevLinkText">' + this.config.strings.prevLinkText + "</a>";
     247            }
     248            if (((this.config.activeImage + 1) < this.config.imageArray.length) || this.config.loopImages) {
     249                next += '<a title="' + this.config.strings.nextLinkTitle + '" href="#" id="nextLinkText">' + this.config.strings.nextLinkText + "</a>";
     250            }
     251        }
     252        nav_html = prev + nav_html + pos + link + next;
     253        if (nav_html != '') {
     254            if (document.getElementById("numberDisplay")) {
     255                document.getElementById("numberDisplay").innerHTML = nav_html;
     256                this.helper.show(document.getElementById("numberDisplay"));
     257            }
     258        }
     259    };
     260
     261
     262    showNavigationElements() {
     263        const prevLink = document.getElementById("prevLink");
     264        const prevLinkText = document.getElementById("prevLinkText");
     265        const nextLink = document.getElementById("nextLink");
     266        const nextLinkText = document.getElementById("nextLinkText");
     267        if (this.config.imageArray.length > 1) {
     268            this.helper.show(document.getElementById("hoverNav"));
     269            // if loopImages is true, always show next and prev image buttons
     270            if (this.config.loopImages) {
     271                this.helper.show(prevLink);
     272                this.helper.show(prevLinkText);
     273                this.helper.show(nextLink);
     274                this.helper.show(nextLinkText);
     275
     276            } else {
     277                // if not first image in set, display prev image button
     278                if (this.config.activeImage != 0) {
     279                    this.helper.show(prevLink);
     280                    this.helper.show(prevLinkText);
     281                }
     282                // if not last image in set, display next image button
     283                if (this.config.activeImage != (this.config.imageArray.length - 1)) {
     284                    this.helper.show(nextLink);
     285                    this.helper.show(nextLink);
     286                }
     287            }
     288            //this.enableKeyboardNav();
     289        }
     290    };
     291    }
     292
     293    module.exports = Display;
     294    },{}],4:[function(require,module,exports){
     295    class Events {
     296    constructor(config, parent) {
     297        this.config = config;
     298        this.parent = parent;
     299    }
     300
     301    bindNavigationButtons(callback) {
     302        const prevLink = document.getElementById("prevLink");
     303        const prevLinkText = document.getElementById("prevLinkText");
     304        const nextLink = document.getElementById("nextLink");
     305        const nextLinkText = document.getElementById("nextLinkText");
     306        if(prevLink) {
     307            prevLink.addEventListener('click', this.onNavigationButtonClick.bind(this, callback, 'prev'));
     308        }
     309        if(prevLinkText) {
     310            prevLinkText.addEventListener('click', this.onNavigationButtonClick.bind(this, callback, 'prev'));
     311        }
     312        if(nextLink) {
     313            nextLink.addEventListener('click', this.onNavigationButtonClick.bind(this, callback, 'next'));
     314        }
     315        if(nextLinkText) {
     316            nextLinkText.addEventListener('click', this.onNavigationButtonClick.bind(this, callback, 'next'));
     317        }
     318    }
     319
     320    onNavigationButtonClick(callback, direction, e) {
     321        e.stopPropagation()
     322        e.preventDefault();
     323        if(direction === 'prev') {
     324            const index = (this.config.activeImage == 0) ? (this.config.imageArray.length - 1) : this.config.activeImage - 1;
     325            callback(index);
     326        }
     327        if(direction === 'next') {
     328            const index = (this.config.activeImage == (this.config.imageArray.length - 1)) ? 0 : this.config.activeImage + 1;
     329            callback(index);
     330        }
     331    }
     332
     333
     334    enableKeyboardNav(callback) {
     335        document.addEventListener('keydown', this.keyboardAction.bind(this, callback));
     336    }
     337
     338    keyboardAction(callback, e) {
     339        var config = this.config;
     340        var keycode = e.keyCode;
     341        var escapeKey = 27;
     342        var key = String.fromCharCode(keycode).toLowerCase();
     343        if ((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)) { // close lightbox
     344            this.parent.end();
     345        } else if ((key == 'p') || (keycode == 37)) { // display previous image
     346            if (config.loopImages) {
     347                callback((config.activeImage == 0) ? (config.imageArray.length - 1) : config.activeImage - 1);
     348            }
     349            else if (config.activeImage != 0) {
     350                callback(config.activeImage - 1);
     351            }
     352        } else if ((key == 'n') || (keycode == 39)) { // display next image
     353            if (this.config.loopImages) {
     354                callback((config.activeImage == (config.imageArray.length - 1)) ? 0 : config.activeImage + 1);
     355            }
     356            else if (config.activeImage != (config.imageArray.length - 1)) {
     357                callback(config.activeImage + 1);
     358            }
     359        }
     360        return false;
     361    };
     362
     363    }
     364
     365    module.exports = Events;
     366    },{}],5:[function(require,module,exports){
     367    const $ = window.jQuery;
     368
     369    class Helper {
     370    constructor(config) {
     371        this.config = config;
     372    }
     373    hide(element) {
     374        if (element) {
     375            element.style.display = 'none';
     376        }
     377    };
     378    show(element) {
     379        if (element) {
     380            element.style.display = 'block';
     381        }
     382    };
     383    getPageSize() {
     384        const pageDocumentHeight = document.documentElement.scrollHeight;
     385        const pageDocumentWidth = document.documentElement.scrollWidth;
     386        if (this.config.isIE8 && pageDocumentHeight > 4096) {
     387            pageDocumentHeight = 4096;
     388        }
     389        var viewportHeight = document.documentElement.clientHeight - this.config.adminBarHeight;
     390        var pageWindowWidth = document.documentElement.clientWidth;
     391        const pageSize = {
     392            pageDocumentWidth: pageDocumentWidth,
     393            pageDocumentHeight: pageDocumentHeight,
     394            pageWindowWidth: pageWindowWidth,
     395            viewportHeight: viewportHeight,
     396            documentScrollHeight: document.documentElement.scrollHeight
     397        };
     398        return pageSize;
     399    };
     400    isIE8() {
     401        var isBuggy = false;
     402        if (document.createElement) {
     403            var el = document.createElement("div");
     404            if (el && el.querySelectorAll) {
     405                el.innerHTML = "<object><param name=\"\"></object>";
     406                isBuggy = el.querySelectorAll("param").length != 1;
     407            }
     408            el = null;
     409        }
     410        return isBuggy;
     411    };
     412    getPageScroll() {
     413        var xScroll = 0; var yScroll = 0;
     414        if (self.pageYOffset) {
     415            yScroll = self.pageYOffset;
     416            xScroll = self.pageXOffset;
     417        } else if (document.documentElement && document.documentElement.scrollTop) {  // Explorer 6 Strict
     418            yScroll = document.documentElement.scrollTop;
     419            xScroll = document.documentElement.scrollLeft;
     420        } else if (document.body) {// all other Explorers
     421            yScroll = document.body.scrollTop;
     422            xScroll = document.body.scrollLeft;
     423        }
     424        const wpadminbar = document.getElementById("wpadminbar");
     425        if (wpadminbar) {
     426            const style = window.getComputedStyle(wpadminbar);
     427            const top = style.getPropertyValue('top');
     428            if (this.config.adminBarHeight && parseInt(top, 10) === 0) {
     429                yScroll += this.config.adminBarHeight;
     430            }
     431        }
     432        return {xScroll, yScroll};
     433    };
     434    setLightBoxPos(newTop, newLeft) {
     435        if (this.config.resizeSpeed > 0) {
     436            $('#lightbox').animate({ top: newTop }, 250, 'linear');
     437            return $('#lightbox').animate({ left: newLeft }, 250, 'linear').show();
     438        }
     439        return $('#lightbox').css({ top: newTop + 'px', left: newLeft + 'px' }).show();
     440    }
     441    }
     442
     443    module.exports = Helper;
     444    },{}],6:[function(require,module,exports){
     445    const $ = window.jQuery;
     446    const Helper = require("./Helper");
     447    const Display = require("./Display");
     448    const Events = require("./Events");
     449
     450    class Lightbox {
     451    constructor(element, config) {
     452        this.config = $.extend({}, $.fn.lightbox.defaults, config);
     453        this.helper = new Helper(this.config);
     454        this.display = new Display(this.config, this.helper);
     455        this.events = new Events(this.config, this);
     456        this.loader(element);
     457    }
     458    loader(element) {
     459        for (let i = 0; i < element.length; i++) {
     460            element[i].addEventListener('click', this.onClick.bind(this, element[i]));
     461        }
     462    }
     463    onClick(element, event) {
     464        event.preventDefault();
     465        this.initialize();
     466        this.start(element);
     467    }
    468468    escapeHTML(input) {
    469469        const div = document.createElement('div');
     
    471471        return div.innerHTML;
    472472    }
    473     initialize() {
    474         window.addEventListener('orientationchange', this.resizeListener.bind(this));
    475         window.addEventListener('resize', this.resizeListener.bind(this));
    476         //            $(window).bind('orientationchange', resizeListener);
    477         //          $(window).bind('resize', resizeListener);
    478         // if (opts.followScroll) { $(window).bind('scroll', orientListener); }
    479         document.getElementById('overlay') ? document.getElementById('overlay').remove() : false;
    480         document.getElementById('lightbox') ? document.getElementById('lightbox').remove() : false;
    481         this.config.isIE8 = this.helper.isIE8(); // //http://www.grayston.net/2011/internet-explorer-v8-and-opacity-issues/
    482         this.config.inprogress = false;
    483         // if jsonData, build the imageArray from data provided in JSON format
    484         if (this.config.jsonData && this.config.jsonData.length > 0) {
    485             var parser = this.config.jsonDataParser ? this.config.jsonDataParser : $.fn.lightbox.parseJsonData;
    486             this.config.imageArray = [];
    487             this.config.imageArray = parser(this.config.jsonData);
    488         }
    489         var outerImage = '<div id="outerImageContainer"><div id="imageContainer"><img id="lightboxImage"><div id="hoverNav"><a href="javascript:void(0);" title="' + this.config.strings.prevLinkTitle + '" id="prevLink"></a><a href="javascript:void(0);" id="nextLink" title="' + this.config.strings.nextLinkTitle + '"></a></div><div id="loading"><a href="javascript:void(0);" id="loadingLink"><div id="jqlb_loading"></div></a></div></div></div>';
    490         var imageData = '<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';
    491         if (this.config.displayHelp) {
    492             imageData += '<span id="helpDisplay">' + this.config.strings.help + '</span>';
    493         }
    494         imageData += '<a href="javascript:void(0);" id="bottomNavClose" title="' + this.config.strings.closeTitle + '"><div id="jqlb_closelabel"></div></a></div></div></div>';
    495         var string;
    496         if (this.config.navbarOnTop) {
    497             string = '<div id="overlay"></div><div id="lightbox">' + imageData + outerImage + '</div>';
    498             $("body").append(string);
    499             $("#imageDataContainer").addClass('ontop');
    500         } else {
    501             string = '<div id="overlay"></div><div id="lightbox">' + outerImage + imageData + '</div>';
    502             $("body").append(string);
    503         }
    504         const overlay = document.getElementById('overlay');
    505         const lightbox = document.getElementById('lightbox');
    506         const loadingLink = document.getElementById('loadingLink');
    507         const bottomNavClose = document.getElementById('bottomNavClose');
    508         const outerImageContainer = document.getElementById('outerImageContainer');
    509         const imageDataContainer = document.getElementById('imageDataContainer');
    510         const lightboxImage = document.getElementById('lightboxImage');
    511         const hoverNav = document.getElementById('hoverNav');
    512 
    513         if (overlay) {
    514             overlay.addEventListener('click', _ => this.end());
    515             this.helper.hide(overlay);
    516         }
    517         if (lightbox) {
    518             lightbox.addEventListener('click', _ => this.end());
    519             this.helper.hide(lightbox);
    520         }
    521         if (loadingLink) {
    522             loadingLink.addEventListener('click', _ => this.end());
    523         }
    524         if (bottomNavClose) {
    525             bottomNavClose.addEventListener('click', _ => this.end());
    526         }
    527 
    528         this.events.bindNavigationButtons(this.display.changeImage.bind(this.display));
    529         this.events.enableKeyboardNav(this.display.changeImage.bind(this.display));
    530 
    531         if (outerImageContainer) {
    532             outerImageContainer.style.width = this.config.widthCurrent + "px";
    533             outerImageContainer.style.height = this.config.heightCurrent + "px";
    534         }
    535         if (imageDataContainer) {
    536             imageDataContainer.style.width = this.config.widthCurrent + "px";
    537         }
    538         /*
    539         if (!opts.imageClickClose) {
    540             if(lightboxImage) {
    541                 lightboxImage.addEventListener('click', _ => end());
    542             }
    543             if(hoverNav) {
    544                 hoverNav.addEventListener('click', _ => end());
    545             }
    546         }
    547         */
    548     };
    549 
    550     resizeListener(e) {
    551         if (this.config.resizeTimeout) {
    552             clearTimeout(this.config.resizeTimeout);
    553             this.config.resizeTimeout = false;
    554         }
    555         this.config.resizeTimeout = setTimeout(_ => { this.display.doScale(false); }, 50); //a delay to avoid duplicate event calls.
    556     }
    557 
    558     //code for IE8 check provided by http://kangax.github.com/cft/
    559 
    560     // JQuery Call
    561     start(imageLink) {
    562         document.querySelectorAll("select, embed, object").forEach(element => {
    563             this.helper.hide(element);
    564         });
    565         var arrayPageSize = this.helper.getPageSize();
    566         var arrayPagePos = this.helper.getPageScroll();
    567         var newTop = 0;
    568         const overlay = document.getElementById("overlay");
    569         $("#overlay").hide().css({ width: arrayPageSize.pageDocumentWidth + 'px', height: arrayPageSize.pageDocumentHeight + 'px', opacity: this.config.overlayOpacity }).fadeIn(400);
    570         if (this.config.isIE8 && arrayPageSize.pageDocumentHeight == 4096) {
    571             if (arrayPagePos.yScroll >= 1000) {
    572                 newTop = arrayPagePos.yScroll - 1000;
    573                 if ((arrayPageSize.documentScrollHeight - (arrayPagePos.yScroll + 3096)) < 0) {
    574                     newTop -= (arrayPagePos.yScroll + 3096) - arrayPageSize.documentScrollHeight;
    575                 }
    576                 overlay.style.top = newTop + 'px';
    577             }
    578         }
    579         let imageNum = 0;
    580         // if data is not provided by jsonData parameter
    581         if (!this.config.jsonData) {
    582             this.config.imageArray = [];
    583             // if image is NOT part of a set..
    584             if (!imageLink.rel || (imageLink.rel == '')) {
    585                 // add single image to Lightbox.imageArray
    586                 var s = imageLink.title || imageLink.parentElement.firstChild.title || '';
    587                 /*
    588                                     if (imageLink.title) {
    589                                         s = imageLink.title;
    590                                     } else if ($(this).children(':first-child').attr('title')) {
    591                                         s = $(this).children(':first-child').attr('title');
    592                                     }
    593                                     */
    594                                    console.log(imageLink);
    595                 this.config.imageArray.push([imageLink.href, this.config.displayTitle ? s : '']);
    596             } else {
    597                 document.querySelectorAll("a").forEach(a => {
    598                     if (a.href && (a.rel === imageLink.rel)) {
    599                         let title = '';
    600                         let alternative_title = a.parentElement.querySelector("img:first-of-type");
    601                         if (a.title) {
    602                             title = a.title;
    603                         } else if (alternative_title) {
    604                             title = alternative_title.title;
    605                         }
    606 
    607                         let caption = '';
    608                         let captionText = '';
    609                         const galleryCaptionElement = a.parentElement.parentElement.querySelector('.gallery-caption');
    610                         const captionElement = a.parentElement.querySelector('.wp-caption-text');
    611                         if (galleryCaptionElement) {
    612                             caption = galleryCaptionElement.textContent;
    613                             captionText = galleryCaptionElement.innerHTML;
    614                         } else if (captionElement) {
    615                             caption = captionElement.textContent;
    616                             captionText = captionElement.innerHTML;
    617                         }
    618                         title = title.trim();
    619                         captionText = captionText.trim();
    620                         if (title.toLowerCase() === captionText.toLowerCase()) {
    621                             title = captionText;
    622                             caption = '';
    623                         }
    624                         let s = '';
    625                         if (title != '') {
    626                             s = '<span id="titleText">' + this.escapeHTML(title) + '</span>';
    627                         }
    628                         if (caption != '') {
    629                             if (title != '') {
    630                                 s += '<br />';
    631                             }
    632                             s += '<span id="captionText">' + this.escapeHTML(caption) + '</span>';
    633                         }
    634                         this.config.imageArray.push([
    635                             a.href,
    636                             this.config.displayTitle ? s : ''
    637                         ]);
    638                     }
    639                 });
    640             }
    641         }
    642         if (this.config.imageArray.length > 1) {
    643             for (let i = 0; i < this.config.imageArray.length; i++) {
    644                 for (let j = this.config.imageArray.length - 1; j > i; j--) {
    645                     if (this.config.imageArray[i][0] == this.config.imageArray[j][0]) {
    646                         this.config.imageArray.splice(j, 1);
    647                     }
    648                 }
    649             }
    650             while (this.config.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
    651         }
    652         // calculate top and left offset for the lightbox
    653         this.helper.setLightBoxPos(arrayPagePos[1], arrayPagePos[0]);
    654         this.display.changeImage(imageNum);
    655     };
    656 
    657     end() {
    658         document.getElementById("lightbox").remove();
    659         $('#overlay').fadeOut(_ => {
    660             document.getElementById("overlay").remove();
    661         });
    662         document.querySelectorAll("select, embed, object").forEach(element => {
    663             this.helper.show(element);
    664         });
    665     };
    666 
     473    initialize() {
     474        window.addEventListener('orientationchange', this.resizeListener.bind(this));
     475        window.addEventListener('resize', this.resizeListener.bind(this));
     476        //            $(window).bind('orientationchange', resizeListener);
     477        //          $(window).bind('resize', resizeListener);
     478        // if (opts.followScroll) { $(window).bind('scroll', orientListener); }
     479        document.getElementById('overlay') ? document.getElementById('overlay').remove() : false;
     480        document.getElementById('lightbox') ? document.getElementById('lightbox').remove() : false;
     481        this.config.isIE8 = this.helper.isIE8(); // //https://www.grayston.net/2011/internet-explorer-v8-and-opacity-issues/
     482        this.config.inprogress = false;
     483        // if jsonData, build the imageArray from data provided in JSON format
     484        if (this.config.jsonData && this.config.jsonData.length > 0) {
     485            var parser = this.config.jsonDataParser ? this.config.jsonDataParser : $.fn.lightbox.parseJsonData;
     486            this.config.imageArray = [];
     487            this.config.imageArray = parser(this.config.jsonData);
     488        }
     489        var outerImage = '<div id="outerImageContainer"><div id="imageContainer"><img id="lightboxImage"><div id="hoverNav"><a href="javascript:void(0);" title="' + this.config.strings.prevLinkTitle + '" id="prevLink"></a><a href="javascript:void(0);" id="nextLink" title="' + this.config.strings.nextLinkTitle + '"></a></div><div id="loading"><a href="javascript:void(0);" id="loadingLink"><div id="jqlb_loading"></div></a></div></div></div>';
     490        var imageData = '<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';
     491        if (this.config.displayHelp) {
     492            imageData += '<span id="helpDisplay">' + this.config.strings.help + '</span>';
     493        }
     494        imageData += '<a href="javascript:void(0);" id="bottomNavClose" title="' + this.config.strings.closeTitle + '"><div id="jqlb_closelabel"></div></a></div></div></div>';
     495        var string;
     496        if (this.config.navbarOnTop) {
     497            string = '<div id="overlay"></div><div id="lightbox">' + imageData + outerImage + '</div>';
     498            $("body").append(string);
     499            $("#imageDataContainer").addClass('ontop');
     500        } else {
     501            string = '<div id="overlay"></div><div id="lightbox">' + outerImage + imageData + '</div>';
     502            $("body").append(string);
     503        }
     504        const overlay = document.getElementById('overlay');
     505        const lightbox = document.getElementById('lightbox');
     506        const loadingLink = document.getElementById('loadingLink');
     507        const bottomNavClose = document.getElementById('bottomNavClose');
     508        const outerImageContainer = document.getElementById('outerImageContainer');
     509        const imageDataContainer = document.getElementById('imageDataContainer');
     510        const lightboxImage = document.getElementById('lightboxImage');
     511        const hoverNav = document.getElementById('hoverNav');
     512
     513        if (overlay) {
     514            overlay.addEventListener('click', _ => this.end());
     515            this.helper.hide(overlay);
     516        }
     517        if (lightbox) {
     518            lightbox.addEventListener('click', _ => this.end());
     519            this.helper.hide(lightbox);
     520        }
     521        if (loadingLink) {
     522            loadingLink.addEventListener('click', _ => this.end());
     523        }
     524        if (bottomNavClose) {
     525            bottomNavClose.addEventListener('click', _ => this.end());
     526        }
     527
     528        this.events.bindNavigationButtons(this.display.changeImage.bind(this.display));
     529        this.events.enableKeyboardNav(this.display.changeImage.bind(this.display));
     530
     531        if (outerImageContainer) {
     532            outerImageContainer.style.width = this.config.widthCurrent + "px";
     533            outerImageContainer.style.height = this.config.heightCurrent + "px";
     534        }
     535        if (imageDataContainer) {
     536            imageDataContainer.style.width = this.config.widthCurrent + "px";
     537        }
     538        /*
     539        if (!opts.imageClickClose) {
     540            if(lightboxImage) {
     541                lightboxImage.addEventListener('click', _ => end());
     542            }
     543            if(hoverNav) {
     544                hoverNav.addEventListener('click', _ => end());
     545            }
     546        }
     547        */
     548    };
     549
     550    resizeListener(e) {
     551        if (this.config.resizeTimeout) {
     552            clearTimeout(this.config.resizeTimeout);
     553            this.config.resizeTimeout = false;
     554        }
     555        this.config.resizeTimeout = setTimeout(_ => { this.display.doScale(false); }, 50); //a delay to avoid duplicate event calls.
     556    }
     557
     558    //code for IE8 check provided by https://kangax.github.com/cft/
     559
     560    // JQuery Call
     561    start(imageLink) {
     562        document.querySelectorAll("select, embed, object").forEach(element => {
     563            this.helper.hide(element);
     564        });
     565        var arrayPageSize = this.helper.getPageSize();
     566        var arrayPagePos = this.helper.getPageScroll();
     567        var newTop = 0;
     568        const overlay = document.getElementById("overlay");
     569        $("#overlay").hide().css({ width: arrayPageSize.pageDocumentWidth + 'px', height: arrayPageSize.pageDocumentHeight + 'px', opacity: this.config.overlayOpacity }).fadeIn(400);
     570        if (this.config.isIE8 && arrayPageSize.pageDocumentHeight == 4096) {
     571            if (arrayPagePos.yScroll >= 1000) {
     572                newTop = arrayPagePos.yScroll - 1000;
     573                if ((arrayPageSize.documentScrollHeight - (arrayPagePos.yScroll + 3096)) < 0) {
     574                    newTop -= (arrayPagePos.yScroll + 3096) - arrayPageSize.documentScrollHeight;
     575                }
     576                overlay.style.top = newTop + 'px';
     577            }
     578        }
     579        let imageNum = 0;
     580        // if data is not provided by jsonData parameter
     581        if (!this.config.jsonData) {
     582            this.config.imageArray = [];
     583            // if image is NOT part of a set..
     584            if (!imageLink.rel || (imageLink.rel == '')) {
     585                // add single image to Lightbox.imageArray
     586                var s = imageLink.title || imageLink.parentElement.firstChild.title || '';
     587                /*
     588                                    if (imageLink.title) {
     589                                        s = imageLink.title;
     590                                    } else if ($(this).children(':first-child').attr('title')) {
     591                                        s = $(this).children(':first-child').attr('title');
     592                                    }
     593                                    */
     594                                   console.log(imageLink);
     595                this.config.imageArray.push([imageLink.href, this.config.displayTitle ? s : '']);
     596            } else {
     597                document.querySelectorAll("a").forEach(a => {
     598                    if (a.href && (a.rel === imageLink.rel)) {
     599                        let title = '';
     600                        let alternative_title = a.parentElement.querySelector("img:first-of-type");
     601                        if (a.title) {
     602                            title = a.title;
     603                        } else if (alternative_title) {
     604                            title = alternative_title.title;
     605                        }
     606
     607                        let caption = '';
     608                        let captionText = '';
     609                        const galleryCaptionElement = a.parentElement.parentElement.querySelector('.gallery-caption');
     610                        const captionElement = a.parentElement.querySelector('.wp-caption-text');
     611                        if (galleryCaptionElement) {
     612                            caption = galleryCaptionElement.textContent;
     613                            captionText = galleryCaptionElement.innerHTML;
     614                        } else if (captionElement) {
     615                            caption = captionElement.textContent;
     616                            captionText = captionElement.innerHTML;
     617                        }
     618                        title = title.trim();
     619                        captionText = captionText.trim();
     620                        if (title.toLowerCase() === captionText.toLowerCase()) {
     621                            title = captionText;
     622                            caption = '';
     623                        }
     624                        let s = '';
     625                        if (title != '') {
     626                            s = '<span id="titleText">' + this.escapeHTML(title) + '</span>';
     627                        }
     628                        if (caption != '') {
     629                            if (title != '') {
     630                                s += '<br />';
     631                            }
     632                            s += '<span id="captionText">' + this.escapeHTML(caption) + '</span>';
     633                        }
     634                        this.config.imageArray.push([
     635                            a.href,
     636                            this.config.displayTitle ? s : ''
     637                        ]);
     638                    }
     639                });
     640            }
     641        }
     642        if (this.config.imageArray.length > 1) {
     643            for (let i = 0; i < this.config.imageArray.length; i++) {
     644                for (let j = this.config.imageArray.length - 1; j > i; j--) {
     645                    if (this.config.imageArray[i][0] == this.config.imageArray[j][0]) {
     646                        this.config.imageArray.splice(j, 1);
     647                    }
     648                }
     649            }
     650            while (this.config.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
     651        }
     652        // calculate top and left offset for the lightbox
     653        this.helper.setLightBoxPos(arrayPagePos[1], arrayPagePos[0]);
     654        this.display.changeImage(imageNum);
     655    };
     656
     657    end() {
     658        document.getElementById("lightbox").remove();
     659        $('#overlay').fadeOut(_ => {
     660            document.getElementById("overlay").remove();
     661        });
     662        document.querySelectorAll("select, embed, object").forEach(element => {
     663            this.helper.show(element);
     664        });
     665    };
    667666}
    668667
  • wp-lightbox-2/trunk/js/dist/wp-lightbox-2.min.js

    r3306679 r3451114  
    1 "use strict";(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c){return c(i,!0)}if(u){return u(i,!0)}var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i+=1){o(t[i])}return o}return r})()({1:[function(require,module,exports){const Lightbox=require("./lightbox")},{"./lightbox":2}],2:[function(require,module,exports){const Lightbox=require("./lightbox/Lightbox");(function($){$.fn.lightbox={};$.fn.lightbox.parseJsonData=function(data){var imageArray=[];$.each(data,function(){imageArray.push([this.url,this.title])});return imageArray};$.fn.lightbox.defaults={adminBarHeight:28,overlayOpacity:0.8,borderSize:10,imageArray:new Array,activeImage:null,inprogress:false,widthCurrent:250,heightCurrent:250,xScale:1,yScale:1,displayTitle:true,disableNavbarLinks:true,loopImages:true,imageClickClose:true,jsonData:null,jsonDataParser:null,followScroll:false,isIE8:false };$(document).ready(function($){var haveConf=(typeof JQLBSettings=='object');if(haveConf&&JQLBSettings.resizeSpeed){JQLBSettings.resizeSpeed=parseInt(JQLBSettings.resizeSpeed)}if(haveConf&&JQLBSettings.marginSize){JQLBSettings.marginSize=parseInt(JQLBSettings.marginSize)}var default_strings={help:' Browse images with your keyboard: Arrows or P(revious)/N(ext) and X/C/ESC for close.',prevLinkTitle:'previous image',nextLinkTitle:'next image',prevLinkText:'&laquo; Previous',nextLinkText:'Next &raquo;',closeTitle:'close image gallery',image:'Image ',of:' of ',download:'Download'};new Lightbox($('a[rel^="lightbox"]'),{adminBarHeight:$('#wpadminbar').height()||0,linkTarget:(haveConf&&JQLBSettings.linkTarget.length)?JQLBSettings.linkTarget:'_self',displayHelp:(haveConf&&JQLBSettings.help.length)?true:false,marginSize:(haveConf&&JQLBSettings.marginSize)?JQLBSettings.marginSize:0,fitToScreen:(haveConf&&JQLBSettings.fitToScreen=='1')?true:false,resizeSpeed:(haveConf&&JQLBSettings.resizeSpeed>=0)?JQLBSettings.resizeSpeed:400,displayDownloadLink:(haveConf&&JQLBSettings.displayDownloadLink=='0')?false:true,navbarOnTop:(haveConf&&JQLBSettings.navbarOnTop=='0')?false:true,strings:(haveConf&&typeof JQLBSettings.help=='string')?JQLBSettings:default_strings})})})(jQuery)},{"./lightbox/Lightbox":6}],3:[function(require,module,exports){const $=window.jQuery;class Display{constructor(config,helper){this.config=config;this.helper=helper}changeImage(imageNum){if(this.config.inprogress==false){this.config.inprogress=true;this.config.activeImage=imageNum;const loading=document.getElementById('loading');const lightboxImage=document.getElementById('lightboxImage');const hoverNav=document.getElementById('hoverNav');const prevLink=document.getElementById('prevLink');const nextLink=document.getElementById('nextLink');if(loading){this.helper.show(loading)}if(lightboxImage){this.helper.hide(lightboxImage)}if(hoverNav){this.helper.hide(hoverNav)}if(prevLink){this.helper.hide(prevLink)}if(nextLink){this.helper.hide(nextLink)}this.doChangeImage()}};doChangeImage(){this.config.imgPreloader=new Image();this.config.imgPreloader.onload=_=>{const lightboxImage=document.getElementById('lightboxImage');if(lightboxImage){lightboxImage.src=this.config.imageArray[this.config.activeImage][0]}this.doScale();this.preloadNeighborImages()};this.config.imgPreloader.src=this.config.imageArray[this.config.activeImage][0]};doScale(){this.updateDetails();const overlay=document.getElementById('overlay');if(!overlay||!this.config.imgPreloader){return}var newWidth=this.config.imgPreloader.width;var newHeight=this.config.imgPreloader.height;var arrayPageSize=this.helper.getPageSize();var noScrollWidth=(arrayPageSize.pageWindowWidth<arrayPageSize.pageDocumentWidth)?arrayPageSize.pageDocumentWidth:arrayPageSize.pageWindowWidth;overlay.style.width=noScrollWidth+'px';overlay.style.height=arrayPageSize.pageDocumentHeight+'px';const imageDataContainer=document.getElementById('imageDataContainer');var maxHeight=(arrayPageSize.viewportHeight)-(imageDataContainer.offsetHeight+(2*this.config.borderSize));var maxWidth=(arrayPageSize.pageWindowWidth)-(2*this.config.borderSize);if(this.config.fitToScreen){var displayHeight=maxHeight-this.config.marginSize;var displayWidth=maxWidth-this.config.marginSize;var ratio=1;if(newHeight>displayHeight){ratio=displayHeight/newHeight;}newWidth=newWidth*ratio;newHeight=newHeight*ratio;ratio=1;if(newWidth>displayWidth){ratio=displayWidth/newWidth;}newWidth=Math.round(newWidth*ratio);newHeight=Math.round(newHeight*ratio)}var arrayPageScroll=this.helper.getPageScroll();var centerY=arrayPageScroll.yScroll+(maxHeight*0.5);var newTop=centerY-newHeight*0.5;var newLeft=arrayPageScroll.xScroll;const lightbox=document.getElementById('lightboxImage');lightbox.style.width=newWidth;lightbox.style.height=newHeight;this.resizeImageContainer(newWidth,newHeight,newTop,newLeft)}resizeImageContainer(imgWidth,imgHeight,lightboxTop,lightboxLeft){const outerImageContainer=document.getElementById("outerImageContainer");const imageDataContainer=document.getElementById("imageDataContainer");if(!outerImageContainer||!imageDataContainer){return}this.config.widthCurrent=outerImageContainer.offsetWidth;this.config.heightCurrent=outerImageContainer.offsetHeight;var widthNew=Math.max(350,imgWidth+((this.config.borderSize||0)*2));var heightNew=(imgHeight+((this.config.borderSize||0)*2));this.config.xScale=(widthNew/this.config.widthCurrent)*100;this.config.yScale=(heightNew/this.config.heightCurrent)*100;this.helper.setLightBoxPos(lightboxTop,lightboxLeft);$('#imageDataContainer').animate({width:widthNew},this.config.resizeSpeed,'linear');$('#outerImageContainer').animate({width:widthNew},this.config.resizeSpeed,'linear',_=>{$('#outerImageContainer').animate({height:heightNew},this.config.resizeSpeed,'linear',_=>{this.showImage()})});this.showNavigationElements();if(document.getElementById("prevLink")){document.getElementById("prevLink").style.height=imgHeight}if(document.getElementById("nextLink")){document.getElementById("nextLink").style.height=imgHeight}}showImage(){this.helper.show(document.getElementById("imageData"));this.helper.show(document.getElementById('caption'));this.helper.hide(document.getElementById("loading"));if(this.config.resizeSpeed>0){$('#lightboxImage').fadeIn("fast")}else{this.helper.show(document.getElementById("lightboxImage"))}this.config.inprogress=false};preloadNeighborImages(){if(this.config.loopImages&&this.config.imageArray.length>1){let preloadNextImage=new Image();preloadNextImage.src=this.config.imageArray[(this.config.activeImage==(this.config.imageArray.length-1))?0:this.config.activeImage+1][0];let preloadPrevImage=new Image();preloadPrevImage.src=this.config.imageArray[(this.config.activeImage==0)?(this.config.imageArray.length-1):this.config.activeImage-1][0]}else{if((this.config.imageArray.length-1)>this.config.activeImage){let preloadNextImage=new Image();preloadNextImage.src=this.config.imageArray[this.config.activeImage+1][0]}if(this.config.activeImage>0){let preloadPrevImage=new Image();preloadPrevImage.src=this.config.imageArray[this.config.activeImage-1][0]}}};updateDetails(){const numberDisplay=document.getElementById('numberDisplay');if(numberDisplay){numberDisplay.innerHTML=''}const caption=document.getElementById('caption');if(caption){caption.innerHTML='';this.helper.hide(caption);if(this.config.imageArray[this.config.activeImage][1]){caption.innerHTML=this.config.imageArray[this.config.activeImage][1];this.helper.show()}}var nav_html='';var prev='';var pos=(this.config.imageArray.length>1)?this.config.strings.image+(this.config.activeImage+1)+this.config.strings.of+this.config.imageArray.length:'';var link=(this.config.displayDownloadLink)?'<a href="'+this.config.imageArray[this.config.activeImage][0]+'" id="downloadLink" target="'+this.config.linkTarget+'">'+this.config.strings.download+'</a>':'';var next='';if(this.config.imageArray.length>1&&!this.config.disableNavbarLinks){if((this.config.activeImage)>0||this.config.loopImages){prev='<a title="'+this.config.strings.prevLinkTitle+'" href="#" id="prevLinkText">'+this.config.strings.prevLinkText+"</a>"}if(((this.config.activeImage+1)<this.config.imageArray.length)||this.config.loopImages){next+='<a title="'+this.config.strings.nextLinkTitle+'" href="#" id="nextLinkText">'+this.config.strings.nextLinkText+"</a>"}}nav_html=prev+nav_html+pos+link+next;if(nav_html!=''){if(document.getElementById("numberDisplay")){document.getElementById("numberDisplay").innerHTML=nav_html;this.helper.show(document.getElementById("numberDisplay"))}}};showNavigationElements(){const prevLink=document.getElementById("prevLink");const prevLinkText=document.getElementById("prevLinkText");const nextLink=document.getElementById("nextLink");const nextLinkText=document.getElementById("nextLinkText");if(this.config.imageArray.length>1){this.helper.show(document.getElementById("hoverNav"));if(this.config.loopImages){this.helper.show(prevLink);this.helper.show(prevLinkText);this.helper.show(nextLink);this.helper.show(nextLinkText)}else{if(this.config.activeImage!=0){this.helper.show(prevLink);this.helper.show(prevLinkText)}if(this.config.activeImage!=(this.config.imageArray.length-1)){this.helper.show(nextLink);this.helper.show(nextLink)}}}}}module.exports=Display},{}],4:[function(require,module,exports){class Events{constructor(config,parent){this.config=config;this.parent=parent}bindNavigationButtons(callback){const prevLink=document.getElementById("prevLink");const prevLinkText=document.getElementById("prevLinkText");const nextLink=document.getElementById("nextLink");const nextLinkText=document.getElementById("nextLinkText");if(prevLink){prevLink.addEventListener('click',this.onNavigationButtonClick.bind(this,callback,'prev'))}if(prevLinkText){prevLinkText.addEventListener('click',this.onNavigationButtonClick.bind(this,callback,'prev'))}if(nextLink){nextLink.addEventListener('click',this.onNavigationButtonClick.bind(this,callback,'next'))}if(nextLinkText){nextLinkText.addEventListener('click',this.onNavigationButtonClick.bind(this,callback,'next'))}}onNavigationButtonClick(callback,direction,e){e.stopPropagation();e.preventDefault();if(direction==='prev'){const index=(this.config.activeImage==0)?(this.config.imageArray.length-1):this.config.activeImage-1;callback(index)}if(direction==='next'){const index=(this.config.activeImage==(this.config.imageArray.length-1))?0:this.config.activeImage+1;callback(index)}}enableKeyboardNav(callback){document.addEventListener('keydown',this.keyboardAction.bind(this,callback))}keyboardAction(callback,e){var config=this.config;var keycode=e.keyCode;var escapeKey=27;var key=String.fromCharCode(keycode).toLowerCase();if((key=='x')||(key=='o')||(key=='c')||(keycode==escapeKey)){this.parent.end()}else if((key=='p')||(keycode==37)){if(config.loopImages){callback((config.activeImage==0)?(config.imageArray.length-1):config.activeImage-1)}else if(config.activeImage!=0){callback(config.activeImage-1)}}else if((key=='n')||(keycode==39)){if(this.config.loopImages){callback((config.activeImage==(config.imageArray.length-1))?0:config.activeImage+1)}else if(config.activeImage!=(config.imageArray.length-1)){callback(config.activeImage+1)}}return false}}module.exports=Events},{}],5:[function(require,module,exports){const $=window.jQuery;class Helper{constructor(config){this.config=config}hide(element){if(element){element.style.display='none'}};show(element){if(element){element.style.display='block'}};getPageSize(){const pageDocumentHeight=document.documentElement.scrollHeight;const pageDocumentWidth=document.documentElement.scrollWidth;if(this.config.isIE8&&pageDocumentHeight>4096){pageDocumentHeight=4096}var viewportHeight=document.documentElement.clientHeight-this.config.adminBarHeight;var pageWindowWidth=document.documentElement.clientWidth;const pageSize={pageDocumentWidth:pageDocumentWidth,pageDocumentHeight:pageDocumentHeight,pageWindowWidth:pageWindowWidth,viewportHeight:viewportHeight,documentScrollHeight:document.documentElement.scrollHeight};return pageSize};isIE8(){var isBuggy=false;if(document.createElement){var el=document.createElement("div");if(el&&el.querySelectorAll){el.innerHTML="<object><param name=\"\"></object>";isBuggy=el.querySelectorAll("param").length!=1}el=null}return isBuggy};getPageScroll(){var xScroll=0;var yScroll=0;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft}const wpadminbar=document.getElementById("wpadminbar");if(wpadminbar){const style=window.getComputedStyle(wpadminbar);const top=style.getPropertyValue('top');if(this.config.adminBarHeight&&parseInt(top,10)===0){yScroll+=this.config.adminBarHeight}}return{xScroll,yScroll}};setLightBoxPos(newTop,newLeft){if(this.config.resizeSpeed>0){$('#lightbox').animate({top:newTop},250,'linear');return $('#lightbox').animate({left:newLeft},250,'linear').show()}return $('#lightbox').css({top:newTop+'px',left:newLeft+'px'}).show()}}module.exports=Helper},{}],6:[function(require,module,exports){const $=window.jQuery;const Helper=require("./Helper");const Display=require("./Display");const Events=require("./Events");class Lightbox{constructor(element,config){this.config=$.extend({},$.fn.lightbox.defaults,config);this.helper=new Helper(this.config);this.display=new Display(this.config,this.helper);this.events=new Events(this.config,this);this.loader(element)}loader(element){for(let i=0;i<element.length;i+=1){element[i].addEventListener('click',this.onClick.bind(this,element[i]))}}onClick(element,event){event.preventDefault();this.initialize();this.start(element)}escapeHTML(input){const div=document.createElement('div');div.textContent=input;return div.innerHTML}initialize(){window.addEventListener('orientationchange',this.resizeListener.bind(this));window.addEventListener('resize',this.resizeListener.bind(this));document.getElementById('overlay')?document.getElementById('overlay').remove():false;document.getElementById('lightbox')?document.getElementById('lightbox').remove():false;this.config.isIE8=this.helper.isIE8();this.config.inprogress=false;if(this.config.jsonData&&this.config.jsonData.length>0){var parser=this.config.jsonDataParser?this.config.jsonDataParser:$.fn.lightbox.parseJsonData;this.config.imageArray=[];this.config.imageArray=parser(this.config.jsonData)}var outerImage='<div id="outerImageContainer"><div id="imageContainer"><img id="lightboxImage"><div id="hoverNav"><a href="javascript:void(0);" title="'+this.config.strings.prevLinkTitle+'" id="prevLink"></a><a href="javascript:void(0);" id="nextLink" title="'+this.config.strings.nextLinkTitle+'"></a></div><div id="loading"><a href="javascript:void(0);" id="loadingLink"><div id="jqlb_loading"></div></a></div></div></div>';var imageData='<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';if(this.config.displayHelp){imageData+='<span id="helpDisplay">'+this.config.strings.help+'</span>'}imageData+='<a href="javascript:void(0);" id="bottomNavClose" title="'+this.config.strings.closeTitle+'"><div id="jqlb_closelabel"></div></a></div></div></div>';var string;if(this.config.navbarOnTop){string='<div id="overlay"></div><div id="lightbox">'+imageData+outerImage+'</div>';$("body").append(string);$("#imageDataContainer").addClass('ontop')}else{string='<div id="overlay"></div><div id="lightbox">'+outerImage+imageData+'</div>';$("body").append(string)}const overlay=document.getElementById('overlay');const lightbox=document.getElementById('lightbox');const loadingLink=document.getElementById('loadingLink');const bottomNavClose=document.getElementById('bottomNavClose');const outerImageContainer=document.getElementById('outerImageContainer');const imageDataContainer=document.getElementById('imageDataContainer');const lightboxImage=document.getElementById('lightboxImage');const hoverNav=document.getElementById('hoverNav');if(overlay){overlay.addEventListener('click',_=>this.end());this.helper.hide(overlay)}if(lightbox){lightbox.addEventListener('click',_=>this.end());this.helper.hide(lightbox)}if(loadingLink){loadingLink.addEventListener('click',_=>this.end())}if(bottomNavClose){bottomNavClose.addEventListener('click',_=>this.end())}this.events.bindNavigationButtons(this.display.changeImage.bind(this.display));this.events.enableKeyboardNav(this.display.changeImage.bind(this.display));if(outerImageContainer){outerImageContainer.style.width=this.config.widthCurrent+"px";outerImageContainer.style.height=this.config.heightCurrent+"px"}if(imageDataContainer){imageDataContainer.style.width=this.config.widthCurrent+"px"}};resizeListener(e){if(this.config.resizeTimeout){clearTimeout(this.config.resizeTimeout);this.config.resizeTimeout=false}this.config.resizeTimeout=setTimeout(_=>{this.display.doScale(false)},50);}start(imageLink){document.querySelectorAll("select, embed, object").forEach(element=>{this.helper.hide(element)});var arrayPageSize=this.helper.getPageSize();var arrayPagePos=this.helper.getPageScroll();var newTop=0;const overlay=document.getElementById("overlay");$("#overlay").hide().css({width:arrayPageSize.pageDocumentWidth+'px',height:arrayPageSize.pageDocumentHeight+'px',opacity:this.config.overlayOpacity}).fadeIn(400);if(this.config.isIE8&&arrayPageSize.pageDocumentHeight==4096){if(arrayPagePos.yScroll>=1000){newTop=arrayPagePos.yScroll-1000;if((arrayPageSize.documentScrollHeight-(arrayPagePos.yScroll+3096))<0){newTop-=(arrayPagePos.yScroll+3096)-arrayPageSize.documentScrollHeight}overlay.style.top=newTop+'px'}}let imageNum=0;if(!this.config.jsonData){this.config.imageArray=[];if(!imageLink.rel||(imageLink.rel=='')){var s=imageLink.title||imageLink.parentElement.firstChild.title||'';console.log(imageLink);this.config.imageArray.push([imageLink.href,this.config.displayTitle?s:''])}else{document.querySelectorAll("a").forEach(a=>{if(a.href&&(a.rel===imageLink.rel)){let title='';let alternative_title=a.parentElement.querySelector("img:first-of-type");if(a.title){title=a.title}else if(alternative_title){title=alternative_title.title}let caption='';let captionText='';const galleryCaptionElement=a.parentElement.parentElement.querySelector('.gallery-caption');const captionElement=a.parentElement.querySelector('.wp-caption-text');if(galleryCaptionElement){caption=galleryCaptionElement.textContent;captionText=galleryCaptionElement.innerHTML}else if(captionElement){caption=captionElement.textContent;captionText=captionElement.innerHTML}title=title.trim();captionText=captionText.trim();if(title.toLowerCase()===captionText.toLowerCase()){title=captionText;caption=''}let s='';if(title!=''){s='<span id="titleText">'+this.escapeHTML(title)+'</span>'}if(caption!=''){if(title!=''){s+='<br />'}s+='<span id="captionText">'+this.escapeHTML(caption)+'</span>'}this.config.imageArray.push([a.href,this.config.displayTitle?s:''])}})}}if(this.config.imageArray.length>1){for(let i=0;i<this.config.imageArray.length;i+=1){for(let j=this.config.imageArray.length-1;j>i;j-=1){if(this.config.imageArray[i][0]==this.config.imageArray[j][0]){this.config.imageArray.splice(j,1)}}}while(this.config.imageArray[imageNum][0]!=imageLink.href){imageNum+=1}}this.helper.setLightBoxPos(arrayPagePos[1],arrayPagePos[0]);this.display.changeImage(imageNum)};end(){document.getElementById("lightbox").remove();$('#overlay').fadeOut(_=>{document.getElementById("overlay").remove()});document.querySelectorAll("select, embed, object").forEach(element=>{this.helper.show(element)})}}module.exports=Lightbox},{"./Display":3,"./Events":4,"./Helper":5}]},{},[1]);
     1!function e(t,i,n){function o(s,r){if(!i[s]){if(!t[s]){var g="function"==typeof require&&require;if(!r&&g)return g(s,!0);if(a)return a(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var l=i[s]={exports:{}};t[s][0].call(l.exports,function(e){return o(t[s][1][e]||e)},l,l.exports,e,t,i,n)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(e,t,i){e("./lightbox")},{"./lightbox":2}],2:[function(e,t,i){const n=e("./lightbox/Lightbox");var o;(o=jQuery).fn.lightbox={},o.fn.lightbox.parseJsonData=function(e){var t=[];return o.each(e,function(){t.push(new Array(this.url,this.title))}),t},o.fn.lightbox.defaults={adminBarHeight:28,overlayOpacity:.8,borderSize:10,imageArray:new Array,activeImage:null,inprogress:!1,widthCurrent:250,heightCurrent:250,xScale:1,yScale:1,displayTitle:!0,disableNavbarLinks:!0,loopImages:!0,imageClickClose:!0,jsonData:null,jsonDataParser:null,followScroll:!1,isIE8:!1},o(document).ready(function(e){var t="object"==typeof JQLBSettings;t&&JQLBSettings.resizeSpeed&&(JQLBSettings.resizeSpeed=parseInt(JQLBSettings.resizeSpeed)),t&&JQLBSettings.marginSize&&(JQLBSettings.marginSize=parseInt(JQLBSettings.marginSize)),new n(e('a[rel^="lightbox"]'),{adminBarHeight:e("#wpadminbar").height()||0,linkTarget:t&&JQLBSettings.linkTarget.length?JQLBSettings.linkTarget:"_self",displayHelp:!(!t||!JQLBSettings.help.length),marginSize:t&&JQLBSettings.marginSize?JQLBSettings.marginSize:0,fitToScreen:!(!t||"1"!=JQLBSettings.fitToScreen),resizeSpeed:t&&JQLBSettings.resizeSpeed>=0?JQLBSettings.resizeSpeed:400,displayDownloadLink:!t||"0"!=JQLBSettings.displayDownloadLink,navbarOnTop:!t||"0"!=JQLBSettings.navbarOnTop,strings:t&&"string"==typeof JQLBSettings.help?JQLBSettings:{help:" Browse images with your keyboard: Arrows or P(revious)/N(ext) and X/C/ESC for close.",prevLinkTitle:"previous image",nextLinkTitle:"next image",prevLinkText:"&laquo; Previous",nextLinkText:"Next &raquo;",closeTitle:"close image gallery",image:"Image ",of:" of ",download:"Download"}})})},{"./lightbox/Lightbox":6}],3:[function(e,t,i){const n=window.jQuery;t.exports=class{constructor(e,t){this.config=e,this.helper=t}changeImage(e){if(0==this.config.inprogress){this.config.inprogress=!0,this.config.activeImage=e;const t=document.getElementById("loading"),i=document.getElementById("lightboxImage"),n=document.getElementById("hoverNav"),o=document.getElementById("prevLink"),a=document.getElementById("nextLink");t&&this.helper.show(t),i&&this.helper.hide(i),n&&this.helper.hide(n),o&&this.helper.hide(o),a&&this.helper.hide(a),this.doChangeImage()}}doChangeImage(){this.config.imgPreloader=new Image,this.config.imgPreloader.onload=e=>{const t=document.getElementById("lightboxImage");t&&(t.src=this.config.imageArray[this.config.activeImage][0]),this.doScale(),this.preloadNeighborImages()},this.config.imgPreloader.src=this.config.imageArray[this.config.activeImage][0]}doScale(){this.updateDetails();const e=document.getElementById("overlay");if(!e||!this.config.imgPreloader)return;var t=this.config.imgPreloader.width,i=this.config.imgPreloader.height,n=this.helper.getPageSize(),o=n.pageWindowWidth<n.pageDocumentWidth?n.pageDocumentWidth:n.pageWindowWidth;e.style.width=o+"px",e.style.height=n.pageDocumentHeight+"px";const a=document.getElementById("imageDataContainer");var s=n.viewportHeight-(a.offsetHeight+2*this.config.borderSize),r=n.pageWindowWidth-2*this.config.borderSize;if(this.config.fitToScreen){var g=s-this.config.marginSize,h=r-this.config.marginSize,l=1;i>g&&(l=g/i),t*=l,i*=l,l=1,t>h&&(l=h/t),t=Math.round(t*l),i=Math.round(i*l)}var c=this.helper.getPageScroll(),d=c.yScroll+.5*s-.5*i,m=c.xScroll;const f=document.getElementById("lightboxImage");f.style.width=t,f.style.height=i,this.resizeImageContainer(t,i,d,m)}resizeImageContainer(e,t,i,o){const a=document.getElementById("outerImageContainer"),s=document.getElementById("imageDataContainer");if(a&&s){this.config.widthCurrent=a.offsetWidth,this.config.heightCurrent=a.offsetHeight;var r=Math.max(350,e+2*(this.config.borderSize||0)),g=t+2*(this.config.borderSize||0);this.config.xScale=r/this.config.widthCurrent*100,this.config.yScale=g/this.config.heightCurrent*100,this.helper.setLightBoxPos(i,o),n("#imageDataContainer").animate({width:r},this.config.resizeSpeed,"linear"),n("#outerImageContainer").animate({width:r},this.config.resizeSpeed,"linear",e=>{n("#outerImageContainer").animate({height:g},this.config.resizeSpeed,"linear",e=>{this.showImage()})}),this.showNavigationElements(),document.getElementById("prevLink")&&(document.getElementById("prevLink").style.height=t),document.getElementById("nextLink")&&(document.getElementById("nextLink").style.height=t)}}showImage(){this.helper.show(document.getElementById("imageData")),this.helper.show(document.getElementById("caption")),this.helper.hide(document.getElementById("loading")),this.config.resizeSpeed>0?n("#lightboxImage").fadeIn("fast"):this.helper.show(document.getElementById("lightboxImage")),this.config.inprogress=!1}preloadNeighborImages(){if(this.config.loopImages&&this.config.imageArray.length>1){(new Image).src=this.config.imageArray[this.config.activeImage==this.config.imageArray.length-1?0:this.config.activeImage+1][0],(new Image).src=this.config.imageArray[0==this.config.activeImage?this.config.imageArray.length-1:this.config.activeImage-1][0]}else{if(this.config.imageArray.length-1>this.config.activeImage){(new Image).src=this.config.imageArray[this.config.activeImage+1][0]}if(this.config.activeImage>0){(new Image).src=this.config.imageArray[this.config.activeImage-1][0]}}}updateDetails(){const e=document.getElementById("numberDisplay");e&&(e.innerHTML="");const t=document.getElementById("caption");t&&(t.innerHTML="",this.helper.hide(t),this.config.imageArray[this.config.activeImage][1]&&(t.innerHTML=this.config.imageArray[this.config.activeImage][1],this.helper.show()));var i="",n="",o=this.config.imageArray.length>1?this.config.strings.image+(this.config.activeImage+1)+this.config.strings.of+this.config.imageArray.length:"",a=this.config.displayDownloadLink?'<a href="'+this.config.imageArray[this.config.activeImage][0]+'" id="downloadLink" target="'+this.config.linkTarget+'">'+this.config.strings.download+"</a>":"",s="";this.config.imageArray.length>1&&!this.config.disableNavbarLinks&&((this.config.activeImage>0||this.config.loopImages)&&(n='<a title="'+this.config.strings.prevLinkTitle+'" href="#" id="prevLinkText">'+this.config.strings.prevLinkText+"</a>"),(this.config.activeImage+1<this.config.imageArray.length||this.config.loopImages)&&(s+='<a title="'+this.config.strings.nextLinkTitle+'" href="#" id="nextLinkText">'+this.config.strings.nextLinkText+"</a>")),""!=(i=n+i+o+a+s)&&document.getElementById("numberDisplay")&&(document.getElementById("numberDisplay").innerHTML=i,this.helper.show(document.getElementById("numberDisplay")))}showNavigationElements(){const e=document.getElementById("prevLink"),t=document.getElementById("prevLinkText"),i=document.getElementById("nextLink"),n=document.getElementById("nextLinkText");this.config.imageArray.length>1&&(this.helper.show(document.getElementById("hoverNav")),this.config.loopImages?(this.helper.show(e),this.helper.show(t),this.helper.show(i),this.helper.show(n)):(0!=this.config.activeImage&&(this.helper.show(e),this.helper.show(t)),this.config.activeImage!=this.config.imageArray.length-1&&(this.helper.show(i),this.helper.show(i))))}}},{}],4:[function(e,t,i){t.exports=class{constructor(e,t){this.config=e,this.parent=t}bindNavigationButtons(e){const t=document.getElementById("prevLink"),i=document.getElementById("prevLinkText"),n=document.getElementById("nextLink"),o=document.getElementById("nextLinkText");t&&t.addEventListener("click",this.onNavigationButtonClick.bind(this,e,"prev")),i&&i.addEventListener("click",this.onNavigationButtonClick.bind(this,e,"prev")),n&&n.addEventListener("click",this.onNavigationButtonClick.bind(this,e,"next")),o&&o.addEventListener("click",this.onNavigationButtonClick.bind(this,e,"next"))}onNavigationButtonClick(e,t,i){if(i.stopPropagation(),i.preventDefault(),"prev"===t){e(0==this.config.activeImage?this.config.imageArray.length-1:this.config.activeImage-1)}if("next"===t){e(this.config.activeImage==this.config.imageArray.length-1?0:this.config.activeImage+1)}}enableKeyboardNav(e){document.addEventListener("keydown",this.keyboardAction.bind(this,e))}keyboardAction(e,t){var i=this.config,n=t.keyCode,o=String.fromCharCode(n).toLowerCase();return"x"==o||"o"==o||"c"==o||27==n?this.parent.end():"p"==o||37==n?i.loopImages?e(0==i.activeImage?i.imageArray.length-1:i.activeImage-1):0!=i.activeImage&&e(i.activeImage-1):"n"!=o&&39!=n||(this.config.loopImages?e(i.activeImage==i.imageArray.length-1?0:i.activeImage+1):i.activeImage!=i.imageArray.length-1&&e(i.activeImage+1)),!1}}},{}],5:[function(e,t,i){const n=window.jQuery;t.exports=class{constructor(e){this.config=e}hide(e){e&&(e.style.display="none")}show(e){e&&(e.style.display="block")}getPageSize(){const e=document.documentElement.scrollHeight,t=document.documentElement.scrollWidth;this.config.isIE8&&e>4096&&(e=4096);var i=document.documentElement.clientHeight-this.config.adminBarHeight;return{pageDocumentWidth:t,pageDocumentHeight:e,pageWindowWidth:document.documentElement.clientWidth,viewportHeight:i,documentScrollHeight:document.documentElement.scrollHeight}}isIE8(){var e=!1;if(document.createElement){var t=document.createElement("div");t&&t.querySelectorAll&&(t.innerHTML='<object><param name=""></object>',e=1!=t.querySelectorAll("param").length),t=null}return e}getPageScroll(){var e=0,t=0;self.pageYOffset?(t=self.pageYOffset,e=self.pageXOffset):document.documentElement&&document.documentElement.scrollTop?(t=document.documentElement.scrollTop,e=document.documentElement.scrollLeft):document.body&&(t=document.body.scrollTop,e=document.body.scrollLeft);const i=document.getElementById("wpadminbar");if(i){const e=window.getComputedStyle(i).getPropertyValue("top");this.config.adminBarHeight&&0===parseInt(e,10)&&(t+=this.config.adminBarHeight)}return{xScroll:e,yScroll:t}}setLightBoxPos(e,t){return this.config.resizeSpeed>0?(n("#lightbox").animate({top:e},250,"linear"),n("#lightbox").animate({left:t},250,"linear").show()):n("#lightbox").css({top:e+"px",left:t+"px"}).show()}}},{}],6:[function(e,t,i){const n=window.jQuery,o=e("./Helper"),a=e("./Display"),s=e("./Events");t.exports=class{constructor(e,t){this.config=n.extend({},n.fn.lightbox.defaults,t),this.helper=new o(this.config),this.display=new a(this.config,this.helper),this.events=new s(this.config,this),this.loader(e)}loader(e){for(let t=0;t<e.length;t++)e[t].addEventListener("click",this.onClick.bind(this,e[t]))}onClick(e,t){t.preventDefault(),this.initialize(),this.start(e)}escapeHTML(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}initialize(){if(window.addEventListener("orientationchange",this.resizeListener.bind(this)),window.addEventListener("resize",this.resizeListener.bind(this)),document.getElementById("overlay")&&document.getElementById("overlay").remove(),document.getElementById("lightbox")&&document.getElementById("lightbox").remove(),this.config.isIE8=this.helper.isIE8(),this.config.inprogress=!1,this.config.jsonData&&this.config.jsonData.length>0){var e=this.config.jsonDataParser?this.config.jsonDataParser:n.fn.lightbox.parseJsonData;this.config.imageArray=[],this.config.imageArray=e(this.config.jsonData)}var t,i='<div id="outerImageContainer"><div id="imageContainer"><img id="lightboxImage"><div id="hoverNav"><a href="javascript:void(0);" title="'+this.config.strings.prevLinkTitle+'" id="prevLink"></a><a href="javascript:void(0);" id="nextLink" title="'+this.config.strings.nextLinkTitle+'"></a></div><div id="loading"><a href="javascript:void(0);" id="loadingLink"><div id="jqlb_loading"></div></a></div></div></div>',o='<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';this.config.displayHelp&&(o+='<span id="helpDisplay">'+this.config.strings.help+"</span>"),o+='<a href="javascript:void(0);" id="bottomNavClose" title="'+this.config.strings.closeTitle+'"><div id="jqlb_closelabel"></div></a></div></div></div>',this.config.navbarOnTop?(t='<div id="overlay"></div><div id="lightbox">'+o+i+"</div>",n("body").append(t),n("#imageDataContainer").addClass("ontop")):(t='<div id="overlay"></div><div id="lightbox">'+i+o+"</div>",n("body").append(t));const a=document.getElementById("overlay"),s=document.getElementById("lightbox"),r=document.getElementById("loadingLink"),g=document.getElementById("bottomNavClose"),h=document.getElementById("outerImageContainer"),l=document.getElementById("imageDataContainer");document.getElementById("lightboxImage"),document.getElementById("hoverNav");a&&(a.addEventListener("click",e=>this.end()),this.helper.hide(a)),s&&(s.addEventListener("click",e=>this.end()),this.helper.hide(s)),r&&r.addEventListener("click",e=>this.end()),g&&g.addEventListener("click",e=>this.end()),this.events.bindNavigationButtons(this.display.changeImage.bind(this.display)),this.events.enableKeyboardNav(this.display.changeImage.bind(this.display)),h&&(h.style.width=this.config.widthCurrent+"px",h.style.height=this.config.heightCurrent+"px"),l&&(l.style.width=this.config.widthCurrent+"px")}resizeListener(e){this.config.resizeTimeout&&(clearTimeout(this.config.resizeTimeout),this.config.resizeTimeout=!1),this.config.resizeTimeout=setTimeout(e=>{this.display.doScale(!1)},50)}start(e){document.querySelectorAll("select, embed, object").forEach(e=>{this.helper.hide(e)});var t=this.helper.getPageSize(),i=this.helper.getPageScroll(),o=0;const a=document.getElementById("overlay");n("#overlay").hide().css({width:t.pageDocumentWidth+"px",height:t.pageDocumentHeight+"px",opacity:this.config.overlayOpacity}).fadeIn(400),this.config.isIE8&&4096==t.pageDocumentHeight&&i.yScroll>=1e3&&(o=i.yScroll-1e3,t.documentScrollHeight-(i.yScroll+3096)<0&&(o-=i.yScroll+3096-t.documentScrollHeight),a.style.top=o+"px");let s=0;if(!this.config.jsonData)if(this.config.imageArray=[],e.rel&&""!=e.rel)document.querySelectorAll("a").forEach(t=>{if(t.href&&t.rel===e.rel){let e="",i=t.parentElement.querySelector("img:first-of-type");t.title?e=t.title:i&&(e=i.title);let n="",o="";const a=t.parentElement.parentElement.querySelector(".gallery-caption"),s=t.parentElement.querySelector(".wp-caption-text");a?(n=a.textContent,o=a.innerHTML):s&&(n=s.textContent,o=s.innerHTML),e=e.trim(),o=o.trim(),e.toLowerCase()===o.toLowerCase()&&(e=o,n="");let r="";""!=e&&(r='<span id="titleText">'+this.escapeHTML(e)+"</span>"),""!=n&&(""!=e&&(r+="<br />"),r+='<span id="captionText">'+this.escapeHTML(n)+"</span>"),this.config.imageArray.push([t.href,this.config.displayTitle?r:""])}});else{var r=e.title||e.parentElement.firstChild.title||"";console.log(e),this.config.imageArray.push([e.href,this.config.displayTitle?r:""])}if(this.config.imageArray.length>1){for(let e=0;e<this.config.imageArray.length;e++)for(let t=this.config.imageArray.length-1;t>e;t--)this.config.imageArray[e][0]==this.config.imageArray[t][0]&&this.config.imageArray.splice(t,1);for(;this.config.imageArray[s][0]!=e.href;)s++}this.helper.setLightBoxPos(i[1],i[0]),this.display.changeImage(s)}end(){document.getElementById("lightbox").remove(),n("#overlay").fadeOut(e=>{document.getElementById("overlay").remove()}),document.querySelectorAll("select, embed, object").forEach(e=>{this.helper.show(e)})}}},{"./Display":3,"./Events":4,"./Helper":5}]},{},[1]);
  • wp-lightbox-2/trunk/readme.txt

    r3306679 r3451114  
    66Requires at least: 3.0
    77Tested up to:      6.9
    8 Stable tag:        3.0.6.8
     8Stable tag:        3.0.7
    99License:           GPLv2 or later
    10 License URI:       http://www.gnu.org/licenses/gpl-3.0.html
     10License URI:       https://www.gnu.org/licenses/gpl-3.0.html
    1111
    1212WP Lightbox 2 adds stunning lightbox effects to images and galleries on your WordPress site.
     
    8484Use another theme, or change your theme Cascading Style Sheets (CSS).
    8585
    86 This plugin was created by <a href="https://syedbalkhi.com" rel="friend" title="Syed Balkhi">Syed Balkhi</a> and <a href="http://thomasgriffin.io" rel="me" title="WordPress Developer - Thomas Griffin">Thomas Griffin</a>. Check out some of our other products, including <a href="http://soliloquywp.com/" rel="friend" title="Soliloquy - the best responsive WordPress slider plugin">Soliloquy - the best responsive WordPress slider plugin</a>, <a href="http://enviragallery.com/" rel="friend" title="Envira Gallery - the best responsive WordPress gallery plugin">Envira Gallery - the best responsive WordPress gallery plugin</a> and <a href="http://optinmonster.com/" rel="friend" title="OptinMonster">OptinMonster</a>.
     86This plugin was created by <a href="https://syedbalkhi.com" rel="friend" title="Syed Balkhi">Syed Balkhi</a> and <a href="https://thomasgriffin.io" rel="me" title="WordPress Developer - Thomas Griffin">Thomas Griffin</a>. Check out some of our other products, including <a href="https://soliloquywp.com/" rel="friend" title="Soliloquy - the best responsive WordPress slider plugin">Soliloquy - the best responsive WordPress slider plugin</a>, <a href="https://enviragallery.com/" rel="friend" title="Envira Gallery - the best responsive WordPress gallery plugin">Envira Gallery - the best responsive WordPress gallery plugin</a> and <a href="https://optinmonster.com/" rel="friend" title="OptinMonster">OptinMonster</a>.
    8787
    8888== Screenshots ==
     
    9696== Changelog ==
    9797
     98= 3.0.7 =
     99* Fix: Improved sanitization of plugin settings.
     100* Fix: Improve escaping of JavaScript output.
     101* Fix: Add capability check to AJAX settings save.
     102* Fix: Remove variable variable usage.
     103* Fix: Remove unused class variables, methods, and hooks.
     104* Fix: Remove error control operators.
     105* Fix: Prefer late-escaping variable output.
     106* Fix: Prefer wp_rand() over rand().
     107* Fix: Prefer strict comparisons.
     108* Fix: Prefer https over http in URLs.
     109
    98110= 3.0.6.8 =
    99111* Fix: Improved sanitization of plugin settings.
     
    220232= 2.28 =
    221233
    222 *Use wp_enqueue_scripts instead.  [Check support thread](http://wordpress.org/support/topic/please-stop-using-the-wp_print_scripts-action-hook-to-load-your-javascript).
     234*Use wp_enqueue_scripts instead.  [Check support thread](https://wordpress.org/support/topic/please-stop-using-the-wp_print_scripts-action-hook-to-load-your-javascript).
    223235
    224236= 2.27 =
     
    254266= 2.2 =
    255267
    256 * Bug Fixed [Can't install update](http://wordpress.org/support/topic/plugin-wp-lightbox-2-cant-installa-update).
     268* Bug Fixed [Can't install update](https://wordpress.org/support/topic/plugin-wp-lightbox-2-cant-installa-update).
    257269
    258270= 2.1 =
     
    308320*  Fix position for lightbox - That's mean your lightbox shouldn't change position when users scroll up or down.
    309321
    310 This plugin was created by <a href="https://syedbalkhi.com" rel="friend" title="Syed Balkhi">Syed Balkhi</a> and <a href="http://thomasgriffin.io" rel="me" title="WordPress Developer - Thomas Griffin">Thomas Griffin</a>. Check out some of our other products, including <a href="http://soliloquywp.com/" rel="friend" title="Soliloquy - the best responsive WordPress slider plugin">Soliloquy - the best responsive WordPress slider plugin</a>, <a href="http://enviragallery.com/" rel="friend" title="Envira Gallery - the best responsive WordPress gallery plugin">Envira Gallery - the best responsive WordPress gallery plugin</a> and <a href="http://optinmonster.com/" rel="friend" title="OptinMonster">OptinMonster</a>.
     322This plugin was created by <a href="https://syedbalkhi.com" rel="friend" title="Syed Balkhi">Syed Balkhi</a> and <a href="https://thomasgriffin.io" rel="me" title="WordPress Developer - Thomas Griffin">Thomas Griffin</a>. Check out some of our other products, including <a href="https://soliloquywp.com/" rel="friend" title="Soliloquy - the best responsive WordPress slider plugin">Soliloquy - the best responsive WordPress slider plugin</a>, <a href="https://enviragallery.com/" rel="friend" title="Envira Gallery - the best responsive WordPress gallery plugin">Envira Gallery - the best responsive WordPress gallery plugin</a> and <a href="https://optinmonster.com/" rel="friend" title="OptinMonster">OptinMonster</a>.
  • wp-lightbox-2/trunk/styles/lightbox.css

    r2449433 r3451114  
    22 * WP jQuery Lightbox
    33 * Version 1.3.4 - 2011-12-29
    4  * http://wordpress.org/extend/plugins/wp-jquery-lightbox/
     4 * https://wordpress.org/extend/plugins/wp-jquery-lightbox/
    55 */
    66#lightbox{
  • wp-lightbox-2/trunk/styles/lightbox.min.css

    r2449433 r3451114  
    22 * WP jQuery Lightbox
    33 * Version 1.3.4 - 2011-12-29
    4  * http://wordpress.org/extend/plugins/wp-jquery-lightbox/
     4 * https://wordpress.org/extend/plugins/wp-jquery-lightbox/
    55 */
    66#lightbox{
  • wp-lightbox-2/trunk/wp-lightbox-2.js

    r1076422 r3451114  
    11/**
    22 * Plugin Name: WP Lightbox 2
    3  * Plugin URI: http://yepinol.com/lightbox-2-plugin-wordpress/
     3 * Plugin URI:  https://yepinol.com/lightbox-2-plugin-wordpress/
    44 * Description: This plugin used to add the lightbox (overlay) effect to the current page images on your WordPress blog.
    5  * Version:       2.28.9.2.1
    6  * Author:        Pankaj Jha
    7  * Author URI:    http://onlinewebapplication.com/
    8  * License:       GNU General Public License, v2 (or newer)
    9  * License URI:  http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     5 * Version:     2.28.9.2.1
     6 * Author:      Pankaj Jha
     7 * Author URI:  https://onlinewebapplication.com/
     8 * License:     GNU General Public License, v2 (or newer)
     9 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1010 */
    1111/*  Copyright 2011 Pankaj Jha (onlinewebapplication.com)
     
    3232 * For full license information, see LICENSE.TXT
    3333 *
    34  * Based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
     34 * Based on Lightbox 2 by Lokesh Dhakar (https://www.huddletogether.com/projects/lightbox2/)
    3535 * Originally written to make use of the Prototype framework, and Script.acalo.us, now altered to use jQuery.
    3636 **/
     
    5656            $('#overlay').remove();
    5757            $('#lightbox').remove();
    58             opts.isIE8 = isIE8(); // //http://www.grayston.net/2011/internet-explorer-v8-and-opacity-issues/
     58            opts.isIE8 = isIE8(); // //https://www.grayston.net/2011/internet-explorer-v8-and-opacity-issues/
    5959            opts.inprogress = false;
    6060            // if jsonData, build the imageArray from data provided in JSON format
     
    126126            return new Array($(document).width(), pgDocHeight, $(window).width(), viewportHeight, $(document).height());
    127127        };
    128         //code for IE8 check provided by http://kangax.github.com/cft/
     128        //code for IE8 check provided by https://kangax.github.com/cft/
    129129        function isIE8() {
    130130            var isBuggy = false;
  • wp-lightbox-2/trunk/wp-lightbox-2.min.js

    r1093840 r3451114  
    11/**
    22 * Plugin Name: WP Lightbox 2
    3  * Plugin URI: http://yepinol.com/lightbox-2-plugin-wordpress/
     3 * Plugin URI:  https://yepinol.com/lightbox-2-plugin-wordpress/
    44 * Description: This plugin used to add the lightbox (overlay) effect to the current page images on your WordPress blog.
    5  * Version:       2.28.9.2.1
    6  * Author:        Pankaj Jha
    7  * Author URI:    http://onlinewebapplication.com/
    8  * License:       GNU General Public License, v2 (or newer)
    9  * License URI:  http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     5 * Version:     2.28.9.2.1
     6 * Author:      Pankaj Jha
     7 * Author URI:  https://onlinewebapplication.com/
     8 * License:     GNU General Public License, v2 (or newer)
     9 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1010 */
    1111/*  Copyright 2011 Pankaj Jha (onlinewebapplication.com)
     
    3232 * For full license information, see LICENSE.TXT
    3333 *
    34  * Based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
     34 * Based on Lightbox 2 by Lokesh Dhakar (https://www.huddletogether.com/projects/lightbox2/)
    3535 * Originally written to make use of the Prototype framework, and Script.acalo.us, now altered to use jQuery.
    3636 **/
    3737 /** toyNN: davidtg@comtrya.com: fixed IE7-8 incompatabilities in 1.3.* branch **/
    3838(function($){
    39     $.fn.lightbox = function(options) {
    40         var opts = $.extend({}, $.fn.lightbox.defaults, options);
     39    $.fn.lightbox = function(options) {
     40        var opts = $.extend({}, $.fn.lightbox.defaults, options);
    4141        function onClick() {
    42             initialize();
    43             start(this);
    44             return false;
    45         }   
     42            initialize();
     43            start(this);
     44            return false;
     45        }   
    4646        if(parseFloat($().jquery) >= 1.7){
    4747            return $(this).on("click", onClick);
    48         }else{
     48        }else{
    4949            return $(this).live("click", onClick); //deprecated since 1.7
    5050        }       
    51        
     51
    5252        function initialize() {
    53             $(window).bind('orientationchange', resizeListener);
    54             $(window).bind('resize', resizeListener);
    55             // if (opts.followScroll) { $(window).bind('scroll', orientListener); }
    56             $('#overlay').remove();
    57             $('#lightbox').remove();
    58             opts.isIE8 = isIE8(); // //http://www.grayston.net/2011/internet-explorer-v8-and-opacity-issues/
    59             opts.inprogress = false;
    60             // if jsonData, build the imageArray from data provided in JSON format
    61             if (opts.jsonData && opts.jsonData.length > 0) {
    62                 var parser = opts.jsonDataParser ? opts.jsonDataParser : $.fn.lightbox.parseJsonData;
    63                 opts.imageArray = [];
    64                 opts.imageArray = parser(opts.jsonData);
    65             }
    66             var outerImage = '<div id="outerImageContainer"><div id="imageContainer"><iframe id="lightboxIframe" /><img id="lightboxImage"><div id="hoverNav"><a href="javascript://" title="' + opts.strings.prevLinkTitle + '" id="prevLink"></a><a href="javascript://" id="nextLink" title="' + opts.strings.nextLinkTitle + '"></a></div><div id="loading"><a href="javascript://" id="loadingLink"><div id="jqlb_loading"></div></a></div></div></div>';
    67             var imageData = '<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';
    68             if (opts.displayHelp) {
    69                 imageData += '<span id="helpDisplay">' + opts.strings.help + '</span>';
    70             }
     53            $(window).bind('orientationchange', resizeListener);
     54            $(window).bind('resize', resizeListener);
     55            // if (opts.followScroll) { $(window).bind('scroll', orientListener); }
     56            $('#overlay').remove();
     57            $('#lightbox').remove();
     58            opts.isIE8 = isIE8(); // //https://www.grayston.net/2011/internet-explorer-v8-and-opacity-issues/
     59            opts.inprogress = false;
     60            // if jsonData, build the imageArray from data provided in JSON format
     61            if (opts.jsonData && opts.jsonData.length > 0) {
     62                var parser = opts.jsonDataParser ? opts.jsonDataParser : $.fn.lightbox.parseJsonData;
     63                opts.imageArray = [];
     64                opts.imageArray = parser(opts.jsonData);
     65            }
     66            var outerImage = '<div id="outerImageContainer"><div id="imageContainer"><iframe id="lightboxIframe" /><img id="lightboxImage"><div id="hoverNav"><a href="javascript://" title="' + opts.strings.prevLinkTitle + '" id="prevLink"></a><a href="javascript://" id="nextLink" title="' + opts.strings.nextLinkTitle + '"></a></div><div id="loading"><a href="javascript://" id="loadingLink"><div id="jqlb_loading"></div></a></div></div></div>';
     67            var imageData = '<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';
     68            if (opts.displayHelp) {
     69                imageData += '<span id="helpDisplay">' + opts.strings.help + '</span>';
     70            }
    7171            if(JQLBSettings['jqlb_show_close_button']=='1'){
    72                 imageData += '<a href="javascript://" id="bottomNavClose" title="' + opts.strings.closeTitle + '"><img src="'+JQLBSettings['jqlb_image_for_close_lightbox']+'" id="jqlb_closelabel"/></a>';
     72                imageData += '<a href="javascript://" id="bottomNavClose" title="' + opts.strings.closeTitle + '"><img src="'+JQLBSettings['jqlb_image_for_close_lightbox']+'" id="jqlb_closelabel"/></a>';
    7373            }
    7474            imageData +='</div></div></div>';
    75             var string;
    76             if (opts.navbarOnTop) {
    77                 string = '<div id="overlay"></div><div id="lightbox">' + imageData + outerImage + '</div>';
    78                 $("body").append(string);
    79                 $("#imageDataContainer").addClass('ontop');
    80             } else {
    81                 string = '<div id="overlay"></div><div id="lightbox">' + outerImage + imageData + '</div>';
    82                 $("body").append(string);
    83             }
     75            var string;
     76            if (opts.navbarOnTop) {
     77                string = '<div id="overlay"></div><div id="lightbox">' + imageData + outerImage + '</div>';
     78                $("body").append(string);
     79                $("#imageDataContainer").addClass('ontop');
     80            } else {
     81                string = '<div id="overlay"></div><div id="lightbox">' + outerImage + imageData + '</div>';
     82                $("body").append(string);
     83            }
    8484            var gago=1;
    85             $("#overlay").click(function () { end(); }).hide();
     85            $("#overlay").click(function () { end(); }).hide();
    8686            if(JQLBSettings['jqlb_overlay_close']=='1')     
    87             $("#lightbox").click(function () { if(gago){end();} gago=1 }).hide().children('#imageDataContainer').click(function(e) { gago=0; console.log(e)  });;
    88             $("#loadingLink").click(function () { end(); return false; });
    89             $("#bottomNavClose").click(function () { end(); return false; });
    90             $('#outerImageContainer').width(opts.widthCurrent).height(opts.heightCurrent);
    91             $('#imageDataContainer').width(opts.widthCurrent);
    92             if (!opts.imageClickClose) {
    93                 $("#lightboxImage").click(function () { return false; });
    94                 $("#hoverNav").click(function () { return false; });
    95             }
    96         };
    97         //allow image to reposition & scale if orientation change or resize occurs.
     87            $("#lightbox").click(function () { if(gago){end();} gago=1 }).hide().children('#imageDataContainer').click(function(e) { gago=0; console.log(e)  });;
     88            $("#loadingLink").click(function () { end(); return false; });
     89            $("#bottomNavClose").click(function () { end(); return false; });
     90            $('#outerImageContainer').width(opts.widthCurrent).height(opts.heightCurrent);
     91            $('#imageDataContainer').width(opts.widthCurrent);
     92            if (!opts.imageClickClose) {
     93                $("#lightboxImage").click(function () { return false; });
     94                $("#hoverNav").click(function () { return false; });
     95            }
     96        };
     97        //allow image to reposition & scale if orientation change or resize occurs.
    9898        /*2.21 - Image Map, Shrink large images to fit smaller screens*/
    9999        /*2.23 - Updated jQuery calls for faster load*/
     
    105105        /*2.28.8.2 - Compatible with wordpress 3.8.1*/
    106106        /*2.28.8.3 - Fixed full screen image close issue*/
    107             /*2.28.8.4 - Compatible with wordpress 3.9*/
    108                 /*2.28.8.5 - Fixed Responsiveness Issue */
    109                 /*2.28.8.6 - Compatible with wordpress 3.9.1*/
     107            /*2.28.8.4 - Compatible with wordpress 3.9*/
     108                /*2.28.8.5 - Fixed Responsiveness Issue */
     109                /*2.28.8.6 - Compatible with wordpress 3.9.1*/
    110110        /*2.28.8.7 - Fixed Image Galary and other HTML issue minor fix*/
    111111        /*2.28.8.8 - Compatible with wordpress 3.9.2*/
     
    115115        /*2.28.9.2 - Compatible with wordpress 4.1*/
    116116        /*2.28.9.2.1 - Fixed: Broken shortcodes with WordPress 4.1*/
    117         function resizeListener(e) {
    118             if (opts.resizeTimeout) {
    119                 clearTimeout(opts.resizeTimeout);
    120                 opts.resizeTimeout = false;
    121             }
    122             opts.resizeTimeout = setTimeout(function () { doScale(false); }, 50); //a delay to avoid duplicate event calls.     
    123         }
    124         function getPageSize(){           
    125             var pgDocHeight = $(document).height();
    126             if (opts.isIE8 && pgDocHeight > 4096) {
    127                 pgDocHeight = 4096;
    128             }
     117        function resizeListener(e) {
     118            if (opts.resizeTimeout) {
     119                clearTimeout(opts.resizeTimeout);
     120                opts.resizeTimeout = false;
     121            }
     122            opts.resizeTimeout = setTimeout(function () { doScale(false); }, 50); //a delay to avoid duplicate event calls.     
     123        }
     124        function getPageSize(){           
     125            var pgDocHeight = $(document).height();
     126            if (opts.isIE8 && pgDocHeight > 4096) {
     127                pgDocHeight = 4096;
     128            }
    129129            var viewportHeight = $(window).height() - opts.adminBarHeight;         
    130130            //$(document).width() returns width of HTML document
    131             return new Array($(document).width(), pgDocHeight, $(window).width(), viewportHeight, $(document).height());
    132         };
    133         //code for IE8 check provided by http://kangax.github.com/cft/
    134         function isIE8() {
    135             var isBuggy = false;
    136             if (document.createElement) {
    137                 var el = document.createElement("div");
    138                 if (el && el.querySelectorAll) {
    139                     el.innerHTML = "<object><param name=\"\"></object>";
    140                     isBuggy = el.querySelectorAll("param").length != 1;
    141                 }
    142                 el = null;
    143             }
    144             return isBuggy;
    145         };
    146         function getPageScroll() {
    147             var xScroll = 0; var yScroll = 0;
    148             if (self.pageYOffset) {
    149                 yScroll = self.pageYOffset;
    150                 xScroll = self.pageXOffset;
    151             } else if (document.documentElement && document.documentElement.scrollTop) {  // Explorer 6 Strict
    152                 yScroll = document.documentElement.scrollTop;
    153                 xScroll = document.documentElement.scrollLeft;
    154             } else if (document.body) {// all other Explorers
    155                 yScroll = document.body.scrollTop;
    156                 xScroll = document.body.scrollLeft;
    157             }
     131            return new Array($(document).width(), pgDocHeight, $(window).width(), viewportHeight, $(document).height());
     132        };
     133        //code for IE8 check provided by https://kangax.github.com/cft/
     134        function isIE8() {
     135            var isBuggy = false;
     136            if (document.createElement) {
     137                var el = document.createElement("div");
     138                if (el && el.querySelectorAll) {
     139                    el.innerHTML = "<object><param name=\"\"></object>";
     140                    isBuggy = el.querySelectorAll("param").length != 1;
     141                }
     142                el = null;
     143            }
     144            return isBuggy;
     145        };
     146        function getPageScroll() {
     147            var xScroll = 0; var yScroll = 0;
     148            if (self.pageYOffset) {
     149                yScroll = self.pageYOffset;
     150                xScroll = self.pageXOffset;
     151            } else if (document.documentElement && document.documentElement.scrollTop) {  // Explorer 6 Strict
     152                yScroll = document.documentElement.scrollTop;
     153                xScroll = document.documentElement.scrollLeft;
     154            } else if (document.body) {// all other Explorers
     155                yScroll = document.body.scrollTop;
     156                xScroll = document.body.scrollLeft;
     157            }
    158158            if(opts.adminBarHeight && parseInt($('#wpadminbar').css('top'), 10) === 0){
    159159                yScroll += opts.adminBarHeight;
    160160            }   
    161             return new Array(xScroll, yScroll);
    162         };
    163 // JQuery Call
     161            return new Array(xScroll, yScroll);
     162        };
     163    // JQuery Call
    164164        function start(imageLink) {
    165             $("select, embed, object").hide();
    166             var arrayPageSize = getPageSize();
    167             var arrayPagePos = getPageScroll();
    168             var newTop = 0;
    169             $("#overlay").hide().css({width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px', opacity: opts.overlayOpacity}).fadeIn(400);
    170             if (opts.isIE8 && arrayPageSize[1] == 4096) {
    171                 if (arrayPagePos[1] >= 1000) {
    172                     newTop = arrayPagePos[1] - 1000;
    173                     if ((arrayPageSize[4] - (arrayPagePos[1] + 3096)) < 0) {
    174                         newTop -= (arrayPagePos[1] + 3096) - arrayPageSize[4];
    175                     }
    176                     $("#overlay").css({ top: newTop + 'px' });
    177                 }
    178             }
    179             imageNum = 0;
    180             // if data is not provided by jsonData parameter
    181             if (!opts.jsonData) {
    182                 opts.imageArray = [];
    183                 // if image is NOT part of a set..             
    184                 if (!imageLink.rel || (imageLink.rel == '')) {
    185                     // add single image to Lightbox.imageArray
    186                     var s = '';
    187                     if (imageLink.title) {
    188                         s = imageLink.title;
    189                     } else if ($(this).children(':first-child').attr('title')) {
    190                         s = $(this).children(':first-child').attr('title');
    191                     }
    192                     opts.imageArray.push(new Array(imageLink.href, opts.displayTitle ? s : ''));
    193                 } else {
    194                     // if image is part of a set..
    195                     $("a").each(function () {
    196                         if (this.href && (this.rel == imageLink.rel)) {
    197                             var title = '';
    198                             var caption = '';
    199                             var captionText = '';
    200                             var jqThis = $(this);
    201                             if (this.title) {
    202                                 title = this.title;
    203                             } else if (jqThis.children('img:first-child').attr('title')) {
    204                                 title = jqThis.children('img:first-child').attr('title'); //grab the title from the image if the link lacks one
    205                             }
    206                             if (jqThis.parent().next('.gallery-caption').html()) {
    207                                 var jq = jqThis.parent().next('.gallery-caption');
    208                                 caption = jq.html();
    209                                 captionText = jq.text();
    210                             } else if (jqThis.next('.wp-caption-text').html()) {
    211                                 caption = jqThis.next('.wp-caption-text').html();
    212                                 captionText = jqThis.next('.wp-caption-text').text();
    213                             }
    214                             title = $.trim(title);
    215                             captionText = $.trim(captionText);
    216                             if (title.toLowerCase() == captionText.toLowerCase()) {
    217                                 title = caption; //to keep linked captions
    218                                 caption = ''; //but not duplicate the text                             
    219                             }
     165            $("select, embed, object").hide();
     166            var arrayPageSize = getPageSize();
     167            var arrayPagePos = getPageScroll();
     168            var newTop = 0;
     169            $("#overlay").hide().css({width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px', opacity: opts.overlayOpacity}).fadeIn(400);
     170            if (opts.isIE8 && arrayPageSize[1] == 4096) {
     171                if (arrayPagePos[1] >= 1000) {
     172                    newTop = arrayPagePos[1] - 1000;
     173                    if ((arrayPageSize[4] - (arrayPagePos[1] + 3096)) < 0) {
     174                        newTop -= (arrayPagePos[1] + 3096) - arrayPageSize[4];
     175                    }
     176                    $("#overlay").css({ top: newTop + 'px' });
     177                }
     178            }
     179            imageNum = 0;
     180            // if data is not provided by jsonData parameter
     181            if (!opts.jsonData) {
     182                opts.imageArray = [];
     183                // if image is NOT part of a set..             
     184                if (!imageLink.rel || (imageLink.rel == '')) {
     185                    // add single image to Lightbox.imageArray
     186                    var s = '';
     187                    if (imageLink.title) {
     188                        s = imageLink.title;
     189                    } else if ($(this).children(':first-child').attr('title')) {
     190                        s = $(this).children(':first-child').attr('title');
     191                    }
     192                    opts.imageArray.push(new Array(imageLink.href, opts.displayTitle ? s : ''));
     193                } else {
     194                    // if image is part of a set..
     195                    $("a").each(function () {
     196                        if (this.href && (this.rel == imageLink.rel)) {
     197                            var title = '';
     198                            var caption = '';
     199                            var captionText = '';
     200                            var jqThis = $(this);
     201                            if (this.title) {
     202                                title = this.title;
     203                            } else if (jqThis.children('img:first-child').attr('title')) {
     204                                title = jqThis.children('img:first-child').attr('title'); //grab the title from the image if the link lacks one
     205                            }
     206                            if (jqThis.parent().next('.gallery-caption').html()) {
     207                                var jq = jqThis.parent().next('.gallery-caption');
     208                                caption = jq.html();
     209                                captionText = jq.text();
     210                            } else if (jqThis.next('.wp-caption-text').html()) {
     211                                caption = jqThis.next('.wp-caption-text').html();
     212                                captionText = jqThis.next('.wp-caption-text').text();
     213                            }
     214                            title = $.trim(title);
     215                            captionText = $.trim(captionText);
     216                            if (title.toLowerCase() == captionText.toLowerCase()) {
     217                                title = caption; //to keep linked captions
     218                                caption = ''; //but not duplicate the text                             
     219                            }
    220220                            var s = '';
    221221                            if (title != '') {
     
    228228                                s += '<span id="captionText">' + caption +'</span>';
    229229                            }
    230                             opts.imageArray.push(new Array(this.href, opts.displayTitle ? s : ''));
    231                         }
    232                     });
    233                 }
    234             }
    235             if (opts.imageArray.length > 1) {
    236                 for (i = 0; i < opts.imageArray.length; i++) {
    237                     for (j = opts.imageArray.length - 1; j > i; j--) {
    238                         if (opts.imageArray[i][0] == opts.imageArray[j][0]) {
    239                             opts.imageArray.splice(j, 1);
    240                         }
    241                     }
    242                 }
    243                 while (opts.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
    244             }
    245             // calculate top and left offset for the lightbox
     230                            opts.imageArray.push(new Array(this.href, opts.displayTitle ? s : ''));
     231                        }
     232                    });
     233                }
     234            }
     235            if (opts.imageArray.length > 1) {
     236                for (i = 0; i < opts.imageArray.length; i++) {
     237                    for (j = opts.imageArray.length - 1; j > i; j--) {
     238                        if (opts.imageArray[i][0] == opts.imageArray[j][0]) {
     239                            opts.imageArray.splice(j, 1);
     240                        }
     241                    }
     242                }
     243                while (opts.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
     244            }
     245            // calculate top and left offset for the lightbox
    246246            if(JQLBSettings['jqlb_popup_size_fix']=='1')
    247247            setLightBoxPos(10, arrayPagePos[0]).show();
    248248            else
    249                 setLightBoxPos(arrayPagePos[1], arrayPagePos[0]).show();
    250             changeImage(imageNum);
    251         };
    252        
     249                setLightBoxPos(arrayPagePos[1], arrayPagePos[0]).show();
     250            changeImage(imageNum);
     251        };
     252
    253253        function setLightBoxPos(newTop, newLeft) {       
    254             if (opts.resizeSpeed > 0) {         
    255                 $('#lightbox').animate({ top: newTop }, 250, 'linear');
    256                 return $('#lightbox').animate({ left: newLeft }, 250, 'linear');
    257             }
    258             return $('#lightbox').css({ top: newTop + 'px', left: newLeft + 'px' });
    259         }
    260        
    261         function changeImage(imageNum) {
    262             if (opts.inprogress == false) {
    263                 opts.inprogress = true;
    264                 opts.activeImage = imageNum;
    265                 // hide elements during transition
    266                 $('#loading').show();
    267                 $('#lightboxImage').hide();
    268                 $('#hoverNav').hide();
    269                 $('#prevLink').hide();
    270                 $('#nextLink').hide();
    271                 doChangeImage();
    272             }
    273         };
    274 
    275         function doChangeImage() {
    276             opts.imgPreloader = new Image();
    277             opts.imgPreloader.onload = function () {
    278                 $('#lightboxImage').attr('src', opts.imageArray[opts.activeImage][0]);
    279                 doScale();  // once image is preloaded, resize image container
    280                 preloadNeighborImages();
    281             };
    282             opts.imgPreloader.src = opts.imageArray[opts.activeImage][0];
    283         };
    284 
    285         function doScale() {
    286             if (!opts.imgPreloader) {
    287                 return;
    288             }
    289             var newWidth = opts.imgPreloader.width;
    290             var newHeight = opts.imgPreloader.height;
     254            if (opts.resizeSpeed > 0) {         
     255                $('#lightbox').animate({ top: newTop }, 250, 'linear');
     256                return $('#lightbox').animate({ left: newLeft }, 250, 'linear');
     257            }
     258            return $('#lightbox').css({ top: newTop + 'px', left: newLeft + 'px' });
     259        }
     260
     261        function changeImage(imageNum) {
     262            if (opts.inprogress == false) {
     263                opts.inprogress = true;
     264                opts.activeImage = imageNum;
     265                // hide elements during transition
     266                $('#loading').show();
     267                $('#lightboxImage').hide();
     268                $('#hoverNav').hide();
     269                $('#prevLink').hide();
     270                $('#nextLink').hide();
     271                doChangeImage();
     272            }
     273        };
     274
     275        function doChangeImage() {
     276            opts.imgPreloader = new Image();
     277            opts.imgPreloader.onload = function () {
     278                $('#lightboxImage').attr('src', opts.imageArray[opts.activeImage][0]);
     279                doScale();  // once image is preloaded, resize image container
     280                preloadNeighborImages();
     281            };
     282            opts.imgPreloader.src = opts.imageArray[opts.activeImage][0];
     283        };
     284
     285        function doScale() {
     286            if (!opts.imgPreloader) {
     287                return;
     288            }
     289            var newWidth = opts.imgPreloader.width;
     290            var newHeight = opts.imgPreloader.height;
    291291            var seted_widt_max=parseInt(JQLBSettings['jqlb_maximum_width']);
    292292            var seted_height_max=parseInt(JQLBSettings['jqlb_maximum_height']);
    293             var arrayPageSize = getPageSize(); 
     293            var arrayPageSize = getPageSize(); 
    294294            var noScrollWidth = (arrayPageSize[2] < arrayPageSize[0]) ? arrayPageSize[0] : arrayPageSize[2]; //if viewport is smaller than page, use page width.
    295295            $("#overlay").css({ width: noScrollWidth + 'px', height: arrayPageSize[1] + 'px' }); 
    296             var maxHeight = (arrayPageSize[3]) - ($("#imageDataContainer").height() + (2 * opts.borderSize));
    297             var maxWidth = (arrayPageSize[2]) - (2*opts.borderSize);   
     296            var maxHeight = (arrayPageSize[3]) - ($("#imageDataContainer").height() + (2 * opts.borderSize));
     297            var maxWidth = (arrayPageSize[2]) - (2*opts.borderSize);   
    298298            if (opts.fitToScreen){
    299299                var displayWidth = maxWidth-opts.marginSize;   
     
    303303                if(seted_height_max<maxHeight && seted_height_max>0)
    304304                    displayHeight = seted_height_max-opts.marginSize;   
    305                 var ratio = 1;
    306                 if (newHeight > displayHeight) {
    307                     ratio = displayHeight / newHeight; //ex. 600/1024 = 0.58                   
    308                 }
    309                 newWidth = newWidth * ratio;
    310                 newHeight = newHeight * ratio;
    311                 ratio = 1;
    312                 if (newWidth > displayWidth) {
    313                     ratio = displayWidth / newWidth; //ex. 800/1280 == 0.62                 
    314                 }
    315                 newWidth = Math.round(newWidth * ratio);
    316                 newHeight = Math.round(newHeight * ratio);
    317             }       
     305                var ratio = 1;
     306                if (newHeight > displayHeight) {
     307                    ratio = displayHeight / newHeight; //ex. 600/1024 = 0.58                   
     308                }
     309                newWidth = newWidth * ratio;
     310                newHeight = newHeight * ratio;
     311                ratio = 1;
     312                if (newWidth > displayWidth) {
     313                    ratio = displayWidth / newWidth; //ex. 800/1280 == 0.62                 
     314                }
     315                newWidth = Math.round(newWidth * ratio);
     316                newHeight = Math.round(newHeight * ratio);
     317            }       
    318318            var arrayPageScroll = getPageScroll();
    319319            var centerY = arrayPageScroll[1] + (maxHeight * 0.5);
     
    325325            $('#lightboxImage').width(newWidth).height(newHeight);
    326326            resizeImageContainer(newWidth, newHeight, newTop, newLeft);           
    327         }
    328 /*2.28.4 -  Compatible with wordpress 3.6.*/
    329         function resizeImageContainer(imgWidth, imgHeight, lightboxTop, lightboxLeft) {
    330             opts.widthCurrent = $("#outerImageContainer").outerWidth();
     327        }
     328    /*2.28.4 -  Compatible with wordpress 3.6.*/
     329        function resizeImageContainer(imgWidth, imgHeight, lightboxTop, lightboxLeft) {
     330            opts.widthCurrent = $("#outerImageContainer").outerWidth();
    331331            if(parseInt(JQLBSettings['jqlb_maximum_width']) && parseInt(JQLBSettings['jqlb_maximum_width'])>0){
    332332                if(parseInt(JQLBSettings['jqlb_maximum_width'])<opts.widthCurrent){
     
    334334                }
    335335            }
    336            
    337             opts.heightCurrent = $("#outerImageContainer").outerHeight();
     336
     337            opts.heightCurrent = $("#outerImageContainer").outerHeight();
    338338            if(parseInt(JQLBSettings['jqlb_maximum_height']) && parseInt(JQLBSettings['jqlb_maximum_height'])>0){
    339339                if(parseInt(JQLBSettings['jqlb_maximum_height'])<opts.heightCurrent){
     
    341341                }
    342342            }
    343             var widthNew = Math.max(350, imgWidth + (opts.borderSize * 2));
    344             var heightNew = (imgHeight + (opts.borderSize * 2));
    345             // scalars based on change from old to new
    346             opts.xScale = (widthNew / opts.widthCurrent) * 100;
    347             opts.yScale = (heightNew / opts.heightCurrent) * 100;           
    348             setLightBoxPos(lightboxTop, lightboxLeft);                   
    349             updateDetails(); //toyNN: moved updateDetails() here, seems to work fine.   
     343            var widthNew = Math.max(350, imgWidth + (opts.borderSize * 2));
     344            var heightNew = (imgHeight + (opts.borderSize * 2));
     345            // scalars based on change from old to new
     346            opts.xScale = (widthNew / opts.widthCurrent) * 100;
     347            opts.yScale = (heightNew / opts.heightCurrent) * 100;           
     348            setLightBoxPos(lightboxTop, lightboxLeft);                   
     349            updateDetails(); //toyNN: moved updateDetails() here, seems to work fine.   
    350350            $('#imageDataContainer').animate({ width: widthNew }, opts.resizeSpeed, 'linear');
    351351            $('#outerImageContainer').animate({ width: widthNew }, opts.resizeSpeed, 'linear', function () {
     
    355355            });
    356356            updateNav();
    357             $('#prevLink').height(imgHeight);
    358             $('#nextLink').height(imgHeight);
    359         };
    360 
    361         function showImage() {
    362             //assumes updateDetails have been called earlier!
    363             $("#imageData").show();
    364             $('#caption').show();
    365             //$('#imageDataContainer').slideDown(400);
    366             //$("#imageDetails").hide().fadeIn(400);       
    367             $('#loading').hide();
    368             if (opts.resizeSpeed > 0) {
    369                 $('#lightboxImage').fadeIn("fast");
    370             } else {
    371                 $('#lightboxImage').show();
    372             }
    373             opts.inprogress = false;
    374         };
    375        
     357            $('#prevLink').height(imgHeight);
     358            $('#nextLink').height(imgHeight);
     359        };
     360
     361        function showImage() {
     362            //assumes updateDetails have been called earlier!
     363            $("#imageData").show();
     364            $('#caption').show();
     365            //$('#imageDataContainer').slideDown(400);
     366            //$("#imageDetails").hide().fadeIn(400);       
     367            $('#loading').hide();
     368            if (opts.resizeSpeed > 0) {
     369                $('#lightboxImage').fadeIn("fast");
     370            } else {
     371                $('#lightboxImage').show();
     372            }
     373            opts.inprogress = false;
     374        };
     375
    376376        function preloadNeighborImages() {
    377             if (opts.loopImages && opts.imageArray.length > 1) {
    378                 preloadNextImage = new Image();
    379                 preloadNextImage.src = opts.imageArray[(opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1][0]
    380                 preloadPrevImage = new Image();
    381                 preloadPrevImage.src = opts.imageArray[(opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1][0]
    382             } else {
    383                 if ((opts.imageArray.length - 1) > opts.activeImage) {
    384                     preloadNextImage = new Image();
    385                     preloadNextImage.src = opts.imageArray[opts.activeImage + 1][0];
    386                 }
    387                 if (opts.activeImage > 0) {
    388                     preloadPrevImage = new Image();
    389                     preloadPrevImage.src = opts.imageArray[opts.activeImage - 1][0];
    390                 }
    391             }
    392         };
    393 
    394 
    395         function updateDetails() {
    396             $('#numberDisplay').html('');
    397             $('#caption').html('').hide();
    398             if (opts.imageArray[opts.activeImage][1]) {
    399                 $('#caption').html(opts.imageArray[opts.activeImage][1]).show();
    400             }
    401             var nav_html = '';
    402             var prev = '';
    403             var pos = (opts.imageArray.length > 1) ? opts.strings.image + (opts.activeImage + 1) + opts.strings.of + opts.imageArray.length : '';
    404             var link = (opts.displayDownloadLink) ? '<a href="' + opts.imageArray[opts.activeImage][0] + '" id="downloadLink" download="'+opts.imageArray[opts.activeImage][0].replace(/^.*\/|\.[^.]*$/g, '')+'.'+opts.imageArray[opts.activeImage][0].split('.').pop()+'" target="'+opts.linkTarget+'">' + opts.strings.download + '</a>' : '';
    405             var next = '';
    406             if (opts.imageArray.length > 1 && !opts.disableNavbarLinks) {    // display previous / next text links                         
    407                 if ((opts.activeImage) > 0 || opts.loopImages) {
    408                     prev = '<a title="' + opts.strings.prevLinkTitle + '" href="#" id="prevLinkText">' + opts.strings.prevLinkText + "</a>";
    409                 }
    410                 if (((opts.activeImage + 1) < opts.imageArray.length) || opts.loopImages) {
    411                     next += '<a title="' + opts.strings.nextLinkTitle + '" href="#" id="nextLinkText">' + opts.strings.nextLinkText + "</a>";
    412                 }
    413             }
    414             nav_html = prev + nav_html + pos + link + next;
    415             if (nav_html != '' && JQLBSettings['jqlb_show_text_for_image']=='1') {
    416                 $('#numberDisplay').html(nav_html).show();
    417             }
    418         };
    419 
    420         function updateNav() {
    421             if (opts.imageArray.length > 1) {
    422                 $('#hoverNav').show();
    423                 // if loopImages is true, always show next and prev image buttons
    424                 if (opts.loopImages) {
    425                     $('#prevLink,#prevLinkText').show().click(function () {
    426                         changeImage((opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1); return false;
    427                     });
    428                     $('#nextLink,#nextLinkText').show().click(function () {
    429                         changeImage((opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1); return false;
    430                     });
    431                 } else {
    432                     // if not first image in set, display prev image button
    433                     if (opts.activeImage != 0) {
    434                         $('#prevLink,#prevLinkText').show().click(function () {
    435                             changeImage(opts.activeImage - 1); return false;
    436                         });
    437                     }
    438                     // if not last image in set, display next image button
    439                     if (opts.activeImage != (opts.imageArray.length - 1)) {
    440                         $('#nextLink,#nextLinkText').show().click(function () {
    441                             changeImage(opts.activeImage + 1); return false;
    442                         });
    443                     }
    444                 }
     377            if (opts.loopImages && opts.imageArray.length > 1) {
     378                preloadNextImage = new Image();
     379                preloadNextImage.src = opts.imageArray[(opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1][0]
     380                preloadPrevImage = new Image();
     381                preloadPrevImage.src = opts.imageArray[(opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1][0]
     382            } else {
     383                if ((opts.imageArray.length - 1) > opts.activeImage) {
     384                    preloadNextImage = new Image();
     385                    preloadNextImage.src = opts.imageArray[opts.activeImage + 1][0];
     386                }
     387                if (opts.activeImage > 0) {
     388                    preloadPrevImage = new Image();
     389                    preloadPrevImage.src = opts.imageArray[opts.activeImage - 1][0];
     390                }
     391            }
     392        };
     393
     394
     395        function updateDetails() {
     396            $('#numberDisplay').html('');
     397            $('#caption').html('').hide();
     398            if (opts.imageArray[opts.activeImage][1]) {
     399                $('#caption').html(opts.imageArray[opts.activeImage][1]).show();
     400            }
     401            var nav_html = '';
     402            var prev = '';
     403            var pos = (opts.imageArray.length > 1) ? opts.strings.image + (opts.activeImage + 1) + opts.strings.of + opts.imageArray.length : '';
     404            var link = (opts.displayDownloadLink) ? '<a href="' + opts.imageArray[opts.activeImage][0] + '" id="downloadLink" download="'+opts.imageArray[opts.activeImage][0].replace(/^.*\/|\.[^.]*$/g, '')+'.'+opts.imageArray[opts.activeImage][0].split('.').pop()+'" target="'+opts.linkTarget+'">' + opts.strings.download + '</a>' : '';
     405            var next = '';
     406            if (opts.imageArray.length > 1 && !opts.disableNavbarLinks) {    // display previous / next text links                         
     407                if ((opts.activeImage) > 0 || opts.loopImages) {
     408                    prev = '<a title="' + opts.strings.prevLinkTitle + '" href="#" id="prevLinkText">' + opts.strings.prevLinkText + "</a>";
     409                }
     410                if (((opts.activeImage + 1) < opts.imageArray.length) || opts.loopImages) {
     411                    next += '<a title="' + opts.strings.nextLinkTitle + '" href="#" id="nextLinkText">' + opts.strings.nextLinkText + "</a>";
     412                }
     413            }
     414            nav_html = prev + nav_html + pos + link + next;
     415            if (nav_html != '' && JQLBSettings['jqlb_show_text_for_image']=='1') {
     416                $('#numberDisplay').html(nav_html).show();
     417            }
     418        };
     419
     420        function updateNav() {
     421            if (opts.imageArray.length > 1) {
     422                $('#hoverNav').show();
     423                // if loopImages is true, always show next and prev image buttons
     424                if (opts.loopImages) {
     425                    $('#prevLink,#prevLinkText').show().click(function () {
     426                        changeImage((opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1); return false;
     427                    });
     428                    $('#nextLink,#nextLinkText').show().click(function () {
     429                        changeImage((opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1); return false;
     430                    });
     431                } else {
     432                    // if not first image in set, display prev image button
     433                    if (opts.activeImage != 0) {
     434                        $('#prevLink,#prevLinkText').show().click(function () {
     435                            changeImage(opts.activeImage - 1); return false;
     436                        });
     437                    }
     438                    // if not last image in set, display next image button
     439                    if (opts.activeImage != (opts.imageArray.length - 1)) {
     440                        $('#nextLink,#nextLinkText').show().click(function () {
     441                            changeImage(opts.activeImage + 1); return false;
     442                        });
     443                    }
     444                }
    445445                if(JQLBSettings ['jqlb_keyboard_navigation']=='1'){
    446                     enableKeyboardNav();
    447                 }
    448             }
    449         };
    450 
    451         function end() {
    452             disableKeyboardNav();
    453             $('#lightbox').hide();
    454             $('#overlay').fadeOut();
    455             $('select, object, embed').show();
    456         };
    457 
    458         function keyboardAction(e) {
    459             var o = e.data.opts;
    460             var keycode = e.keyCode;
    461             var escapeKey = 27;
    462             var key = String.fromCharCode(keycode).toLowerCase();
    463             if ((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)) { // close lightbox
    464                 end();
    465             } else if ((key == 'p') || (keycode == 37)) { // display previous image
    466                 if (o.loopImages) {
    467                     disableKeyboardNav();
    468                     changeImage((o.activeImage == 0) ? (o.imageArray.length - 1) : o.activeImage - 1);
    469                 }
    470                 else if (o.activeImage != 0) {
    471                     disableKeyboardNav();
    472                     changeImage(o.activeImage - 1);
    473                 }
    474             } else if ((key == 'n') || (keycode == 39)) { // display next image
    475                 if (opts.loopImages) {
    476                     disableKeyboardNav();
    477                     changeImage((o.activeImage == (o.imageArray.length - 1)) ? 0 : o.activeImage + 1);
    478                 }
    479                 else if (o.activeImage != (o.imageArray.length - 1)) {
    480                     disableKeyboardNav();
    481                     changeImage(o.activeImage + 1);
    482                 }
    483             }         
    484             return false;
    485         };
    486         function enableKeyboardNav() {         
     446                    enableKeyboardNav();
     447                }
     448            }
     449        };
     450
     451        function end() {
     452            disableKeyboardNav();
     453            $('#lightbox').hide();
     454            $('#overlay').fadeOut();
     455            $('select, object, embed').show();
     456        };
     457
     458        function keyboardAction(e) {
     459            var o = e.data.opts;
     460            var keycode = e.keyCode;
     461            var escapeKey = 27;
     462            var key = String.fromCharCode(keycode).toLowerCase();
     463            if ((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)) { // close lightbox
     464                end();
     465            } else if ((key == 'p') || (keycode == 37)) { // display previous image
     466                if (o.loopImages) {
     467                    disableKeyboardNav();
     468                    changeImage((o.activeImage == 0) ? (o.imageArray.length - 1) : o.activeImage - 1);
     469                }
     470                else if (o.activeImage != 0) {
     471                    disableKeyboardNav();
     472                    changeImage(o.activeImage - 1);
     473                }
     474            } else if ((key == 'n') || (keycode == 39)) { // display next image
     475                if (opts.loopImages) {
     476                    disableKeyboardNav();
     477                    changeImage((o.activeImage == (o.imageArray.length - 1)) ? 0 : o.activeImage + 1);
     478                }
     479                else if (o.activeImage != (o.imageArray.length - 1)) {
     480                    disableKeyboardNav();
     481                    changeImage(o.activeImage + 1);
     482                }
     483            }         
     484            return false;
     485        };
     486        function enableKeyboardNav() {         
    487487            $(document).bind('keydown', {opts: opts}, keyboardAction);
    488         };
    489         function disableKeyboardNav() {
    490             $(document).unbind('keydown');
    491         };
    492     };
    493     $.fn.lightbox.parseJsonData = function(data) {
    494         var imageArray = [];
    495         $.each(data, function () {
    496             imageArray.push(new Array(this.url, this.title));
    497         });
    498         return imageArray;
    499     };
    500     $.fn.lightbox.defaults = {
     488        };
     489        function disableKeyboardNav() {
     490            $(document).unbind('keydown');
     491        };
     492    };
     493    $.fn.lightbox.parseJsonData = function(data) {
     494        var imageArray = [];
     495        $.each(data, function () {
     496            imageArray.push(new Array(this.url, this.title));
     497        });
     498        return imageArray;
     499    };
     500    $.fn.lightbox.defaults = {
    501501        adminBarHeight:28,
    502         overlayOpacity: (JQLBSettings['jqlb_overlay_opacity']/100),
    503         borderSize: (JQLBSettings['jqlb_border_width']),
    504         imageArray: new Array,
    505         activeImage: null,
    506         inprogress: false, //this is an internal state variable. don't touch.
    507         widthCurrent: 250,
    508         heightCurrent: 250,
    509         xScale: 1,
    510         yScale: 1,
    511         displayTitle: true,
    512         disableNavbarLinks: true,
    513         loopImages: true,
    514         imageClickClose: true,
    515         jsonData: null,
    516         jsonDataParser: null,
    517         followScroll: false,
    518         isIE8: false  //toyNN:internal value only
    519     };
     502        overlayOpacity: (JQLBSettings['jqlb_overlay_opacity']/100),
     503        borderSize: (JQLBSettings['jqlb_border_width']),
     504        imageArray: new Array,
     505        activeImage: null,
     506        inprogress: false, //this is an internal state variable. don't touch.
     507        widthCurrent: 250,
     508        heightCurrent: 250,
     509        xScale: 1,
     510        yScale: 1,
     511        displayTitle: true,
     512        disableNavbarLinks: true,
     513        loopImages: true,
     514        imageClickClose: true,
     515        jsonData: null,
     516        jsonDataParser: null,
     517        followScroll: false,
     518        isIE8: false  //toyNN:internal value only
     519    };
    520520    $(document).ready(function($){
    521521        var haveConf = (typeof JQLBSettings == 'object');
  • wp-lightbox-2/trunk/wp-lightbox-2.php

    r3306700 r3451114  
    22/**
    33 * Plugin Name: WP Lightbox 2
    4  * Plugin URI:  http://wpdevart.com/wordpress-lightbox-plugin
     4 * Plugin URI:  https://wpdevart.com/wordpress-lightbox-plugin
    55 * Description: WP Lightbox 2 adds stunning lightbox effects to images and galleries on your WordPress site.
    6  * Version:     3.0.6.8
     6 * Version:     3.0.7
    77 * Author:      Syed Balkhi
    8  * Author URI:  http://syedbalkhi.com
     8 * Author URI:  https://syedbalkhi.com
    99 * License:     GNU General Public License, v2 (or newer)
    10  * License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     10 * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1111 */
    12 /*  Copyright 2015 Syed Balkhi 
     12/*  Copyright 2015 Syed Balkhi
    1313
    1414    This program is free software; you can redistribute it and/or modify
     
    2727
    2828add_action( 'plugins_loaded', 'jqlb_init' );
     29
    2930function jqlb_init() {
    30     if(!defined('ULFBEN_DONATE_URL')){
    31         define('ULFBEN_DONATE_URL', 'http://onlinewebapplication.com/');
    32     }
    33 
    34     define('JQLB_SCRIPT', 'js/dist/wp-lightbox-2.min.js');
    35     load_plugin_textdomain('jqlb', false, dirname( plugin_basename( __FILE__ ) ) . '/I18n/');   
     31
     32    if ( ! defined( 'JQLB_SCRIPT' ) ) {
     33        define('JQLB_SCRIPT', 'js/dist/wp-lightbox-2.min.js');
     34    }
     35
     36    load_plugin_textdomain( 'jqlb', false, dirname( plugin_basename( __FILE__ ) ) . '/I18n/' );
     37
    3638    add_action('admin_init', 'jqlb_register_settings');
    37     //add_action('admin_menu', 'jqlb_register_menu_item');
    38     add_action('wp_enqueue_scripts', 'jqlb_css');   
     39    add_action('wp_enqueue_scripts', 'jqlb_css');
    3940    add_action('wp_enqueue_scripts', 'jqlb_js');
    40     //add_filter('plugin_row_meta',     'jqlb_set_plugin_meta', 2, 10);
     41
    4142    add_filter('the_content', 'jqlb_autoexpand_rel_wlightbox', 99);
    42     if(get_option('jqlb_comments') == 1){
     43
     44    if ( 1 === (int) get_option('jqlb_comments') ) {
    4345        remove_filter('pre_comment_content', 'wp_rel_nofollow');
    4446        add_filter('comment_text', 'jqlb_lightbox_comment', 99);
     
    4648}
    4749
    48 function jqlb_set_plugin_meta( $links, $file ) { // Add a link to this plugin's settings page
    49     static $this_plugin;
    50     if(!$this_plugin) $this_plugin = plugin_basename(__FILE__);
    51     if($file == $this_plugin) {
    52         $settings_link = '<a href="options-general.php?page=jquery-lightbox-options">'.__('Settings', 'jqlb').'</a>';   
    53         array_unshift($links, $settings_link);
    54     }
    55     return $links;
    56 }
    57 function jqlb_add_admin_footer(){ //shows some plugin info in the footer of the config screen.
    58     $plugin_data = get_plugin_data(__FILE__);
    59    
    60 }   
    61 function jqlb_register_settings(){
    62     register_setting( 'jqlb-settings-group', 'jqlb_automate', 'jqlb_bool_intval');
    63     register_setting( 'jqlb-settings-group', 'jqlb_comments', 'jqlb_bool_intval');
    64     register_setting( 'jqlb-settings-group', 'jqlb_resize_on_demand', 'jqlb_bool_intval');
    65     register_setting( 'jqlb-settings-group', 'jqlb_show_download', 'jqlb_bool_intval');
    66     register_setting( 'jqlb-settings-group', 'jqlb_navbarOnTop', 'jqlb_bool_intval');
    67     register_setting( 'jqlb-settings-group', 'jqlb_margin_size', 'floatval');
    68     register_setting( 'jqlb-settings-group', 'jqlb_resize_speed', 'jqlb_pos_intval');
    69     register_setting( 'jqlb-settings-group', 'jqlb_help_text');
    70 
    71    
    72     //register_setting( 'jqlb-settings-group', 'jqlb_follow_scroll', 'jqlb_bool_intval');
    73     add_option('jqlb_help_text', '');
    74 
    75     add_option('jqlb_automate', 1); //default is to auto-lightbox.
    76     add_option('jqlb_comments', 1);
    77     add_option('jqlb_resize_on_demand', 0);
    78     add_option('jqlb_show_download', 0);
    79     add_option('jqlb_navbarOnTop', 0);
    80     add_option('jqlb_resize_speed', 400);
    81     //add_option('jqlb_follow_scroll', 0); 
    82 }
    83 function jqlb_register_menu_item() {       
     50function jqlb_register_settings() {
     51    register_setting( 'jqlb-settings-group', 'jqlb_automate',         'jqlb_bool_intval' );
     52    register_setting( 'jqlb-settings-group', 'jqlb_comments',         'jqlb_bool_intval' );
     53    register_setting( 'jqlb-settings-group', 'jqlb_resize_on_demand', 'jqlb_bool_intval' );
     54    register_setting( 'jqlb-settings-group', 'jqlb_show_download',    'jqlb_bool_intval' );
     55    register_setting( 'jqlb-settings-group', 'jqlb_navbarOnTop',      'jqlb_bool_intval' );
     56    register_setting( 'jqlb-settings-group', 'jqlb_resize_speed',     'jqlb_pos_intval' );
     57    register_setting( 'jqlb-settings-group', 'jqlb_margin_size',      'floatval' );
     58    register_setting( 'jqlb-settings-group', 'jqlb_help_text',        'jplb_help_kses' );
     59
     60    add_option( 'jqlb_automate', 1 );
     61    add_option( 'jqlb_comments', 1 );
     62    add_option( 'jqlb_resize_on_demand', 0 );
     63    add_option( 'jqlb_show_download', 0 );
     64    add_option( 'jqlb_margin_size', 0 );
     65    add_option( 'jqlb_navbarOnTop', 0 );
     66    add_option( 'jqlb_resize_speed', 400 );
     67    add_option( 'jqlb_help_text', '' );
     68}
     69function jqlb_register_menu_item() {
    8470    add_options_page('WP Lightbox Options', 'WP Lightbox 2', 'manage_options', 'jquery-lightbox-options', 'jqlb_options_panel');
    8571}
    86 function jqlb_get_locale(){
    87     //$lang_locales and ICL_LANGUAGE_CODE are defined in the WPML plugin (http://wpml.org/)
     72function jqlb_get_locale() {
     73    //$lang_locales and ICL_LANGUAGE_CODE are defined in the WPML plugin (https://wpml.org/)
    8874    global $lang_locales;
    89     if (defined('ICL_LANGUAGE_CODE') && isset($lang_locales[ICL_LANGUAGE_CODE])){
     75
     76    if (defined('ICL_LANGUAGE_CODE') && isset($lang_locales[ICL_LANGUAGE_CODE])) {
    9077        $locale = $lang_locales[ICL_LANGUAGE_CODE];
    9178    } else {
    9279        $locale = get_locale();
    9380    }
     81
    9482    return $locale;
    9583}
    96 function jqlb_css(){   
    97     if(is_admin() || is_feed()){return;}
    98     $locale = jqlb_get_locale();
    99     $fileName = "lightbox.min.{$locale}.css";   
    100     $path = plugin_dir_path(__FILE__)."styles/{$fileName}";
    101 
    102     if(!is_readable($path)){
     84function jqlb_css() {
     85    if ( is_admin() || is_feed() || wp_doing_ajax() ) {
     86        return;
     87    }
     88
     89    $locale   = jqlb_get_locale();
     90    $fileName = "lightbox.min.{$locale}.css";
     91    $path     = plugin_dir_path(__FILE__) . "styles/{$fileName}";
     92
     93    if ( ! is_readable( $path ) ) {
    10394        $fileName = 'lightbox.min.css';
    10495    }
    105     wp_enqueue_style('wp-lightbox-2.min.css', plugin_dir_url(__FILE__).'styles/'.$fileName, false, '1.3.4');
    106     // add custom (dinamic) styles for wp lightbox 2
    107     ?>
    108 
    109       <?php
    110 }
    111 function jqlb_js() {               
    112     if(is_admin() || is_feed()){return;}
    113     wp_enqueue_script('jquery', '', array(), '1.7.1', true);           
     96
     97    wp_enqueue_style('wp-lightbox-2.min.css', plugin_dir_url(__FILE__) . 'styles/' . $fileName, false, '1.3.4');
     98}
     99function jqlb_js() {
     100    if ( is_admin() || is_feed() || wp_doing_ajax() ) {
     101        return;
     102    }
     103
     104    wp_enqueue_script('jquery', '', array(), '1.7.1', true);
    114105    wp_enqueue_script('wp-jquery-lightbox', plugins_url(JQLB_SCRIPT, __FILE__ ),  Array('jquery'), '1.3.4.1', true);
     106
    115107    global $wp_lightbox_2;
    116108    $wp_lightbox_2->parametrs;
    117109
    118     $parametrs_array=array(
    119         'fitToScreen' => get_option('jqlb_resize_on_demand'),
    120         'resizeSpeed' => get_option('jqlb_resize_speed'),
    121         'displayDownloadLink' => get_option('jqlb_show_download'),
    122         'navbarOnTop' => get_option('jqlb_navbarOnTop'),
    123         'loopImages' => get_option('jqlb_loopImages'),
    124         'resizeCenter' => get_option('jqlb_resizeCenter'),
    125         'marginSize' => get_option('jqlb_margin_size'),
    126         'linkTarget' => get_option('jqlb_link_target'),
    127         'help' => __(get_option('jqlb_help_text'), 'jqlb'),
    128         'prevLinkTitle' => $wp_lightbox_2->parametrs->get_design_settings['jqlb_previous_image_title'],
    129         'nextLinkTitle' => $wp_lightbox_2->parametrs->get_design_settings['jqlb_next_image_title'],
    130         'prevLinkText' =>  __('&laquo; Previous', 'jqlb'),
    131         'nextLinkText' => __('Next &raquo;', 'jqlb'),
    132         'closeTitle' => $wp_lightbox_2->parametrs->get_design_settings['jqlb_close_image_title'],
    133         'image' => __('Image ', 'jqlb'),
    134         'of' => __(' of ', 'jqlb'),
    135         'download' => __('Download', 'jqlb')
     110    $parametrs_array = array(
     111        'fitToScreen'         => (int) get_option('jqlb_resize_on_demand'),
     112        'resizeSpeed'         => (int) get_option('jqlb_resize_speed'),
     113        'displayDownloadLink' => (int) get_option('jqlb_show_download'),
     114        'navbarOnTop'         => (int) get_option('jqlb_navbarOnTop'),
     115        'loopImages'          => (int) get_option('jqlb_loopImages'),
     116        'resizeCenter'        => (int) get_option('jqlb_resizeCenter'),
     117        'marginSize'          => (int) get_option('jqlb_margin_size'),
     118        'linkTarget'          => esc_js( get_option('jqlb_link_target') ),
     119        'help'                => esc_js( get_option('jqlb_help_text') ),
     120        'prevLinkTitle'       => esc_js( $wp_lightbox_2->parametrs->get_design_settings['jqlb_previous_image_title'] ),
     121        'nextLinkTitle'       => esc_js( $wp_lightbox_2->parametrs->get_design_settings['jqlb_next_image_title'] ),
     122        'closeTitle'          => esc_js( $wp_lightbox_2->parametrs->get_design_settings['jqlb_close_image_title'] ),
     123        'prevLinkText'        => __( '&laquo; Previous', 'jqlb' ),
     124        'nextLinkText'        => __( 'Next &raquo;', 'jqlb' ),
     125        'image'               => __( 'Image ', 'jqlb' ),
     126        'of'                  => __( ' of ', 'jqlb' ),
     127        'download'            => __( 'Download', 'jqlb' )
    136128    );
    137129
    138     foreach($wp_lightbox_2->parametrs->get_design_settings as $key =>$value){
    139         $parametrs_array[$key]  =$value;
    140     }
    141     wp_localize_script('wp-jquery-lightbox', 'JQLBSettings', $parametrs_array);
    142 }
    143 
    144 function jqlb_lightbox_comment($comment){
     130    foreach ( $wp_lightbox_2->parametrs->get_design_settings as $key => $value ) {
     131        $parametrs_array[ $key ] = $value;
     132    }
     133
     134    wp_localize_script(
     135        'wp-jquery-lightbox',
     136        'JQLBSettings',
     137        $parametrs_array
     138    );
     139}
     140
     141function jqlb_lightbox_comment( $comment = '' ) {
    145142    $comment = str_replace('rel=\'external nofollow\'','', $comment);
    146143    $comment = str_replace('rel=\'nofollow\'','', $comment);
    147144    $comment = str_replace('rel="external nofollow"','', $comment);
    148145    $comment = str_replace('rel="nofollow"','', $comment);
     146
    149147    return jqlb_autoexpand_rel_wlightbox($comment);
    150148}
    151149
    152 function jqlb_autoexpand_rel_wlightbox($content) {
    153     if(get_option('jqlb_automate') == 1){
    154         global $post;   
     150function jqlb_autoexpand_rel_wlightbox( $content = '' ) {
     151    if ( 1 === (int) get_option('jqlb_automate') ) {
     152        global $post;
    155153        $id = ($post->ID) ? $post->ID : -1;
    156154        $content = jqlb_do_regexp($content, $id); //legacy regex function when images don't have rel tags
    157155        $content = wplbtwo_do_regexp($content, $id);
    158     }           
     156    }
    159157    return $content;
    160158}
    161 function jqlb_apply_lightbox($content, $id = -1){
    162     if(!isset($id) || $id === -1){
    163         $id = time().rand(0, 32768);
     159function jqlb_apply_lightbox($content, $id = -1) {
     160    if(!isset($id) || $id === -1) {
     161        $id = time() . wp_rand( 0, 32768 );
    164162    }
    165163    return jqlb_do_regexp($content, $id);
     
    168166/* automatically insert rel="lightbox[nameofpost]" to every image with no manual work.
    169167    if there are already rel="lightbox[something]" attributes, they are not clobbered.
    170     Michael Tyson, you are a regular expressions god! - http://atastypixel.com */
    171 function jqlb_do_regexp($content, $id){
    172     $id = esc_attr($id);
     168    Michael Tyson, you are a regular expressions god! - https://atastypixel.com */
     169function jqlb_do_regexp($content, $id) {
    173170    $pattern = "/(<a(?![^>]*?rel=['\"]lightbox.*)(?![^>]*?rel=.*)[^>]*?href=['\"][^'\"]+?\.(?:bmp|gif|jpg|jpeg|png)\?{0,1}\S{0,}['\"][^\>]*)>/i";
    174     $replacement = '$1 rel="lightbox['.$id.']">';
     171    $replacement = '$1 rel="lightbox[' . esc_attr( $id ) . ']">';
     172
    175173    return preg_replace($pattern, $replacement, $content);
    176174}
     
    186184 * @since 3.0.6.2
    187185 */
    188 function wplbtwo_do_regexp($content, $id){
    189     $id = esc_attr($id);
     186function wplbtwo_do_regexp($content, $id) {
    190187    $pattern = "/(<a(?![^>]*?rel=['\"]lightbox.*)[^>]*?href=['\"][^'\"]+?\.(?:bmp|gif|jpg|jpeg|png)\?{0,1}\S{0,}['\"][^\>]*)(rel=['\"])(.*?)>/i";
    191     $replacement = '$1 $2lightbox['.$id.'] $3>';
     188    $replacement = '$1 $2lightbox[' . esc_attr( $id ) . '] $3>';
     189
    192190    return preg_replace($pattern, $replacement, $content);
    193191}
    194192
    195 function jqlb_bool_intval($v){
    196     return $v == 1 ? '1' : '0';
    197 }
    198 
    199 function jqlb_pos_intval($v){
     193function jqlb_bool_intval( $v = 0 ) {
     194    return ( 1 === (int) $v ) ? '1' : '0';
     195}
     196
     197function jqlb_pos_intval($v) {
    200198    return abs(intval($v));
    201199}
    202 function jqlb_options_panel(){
    203     if(!function_exists('current_user_can') || !current_user_can('manage_options')){
    204             die(__('Cheatin&#8217; uh?', 'jqlb'));
    205     }
    206     add_action('in_admin_footer', 'jqlb_add_admin_footer');
     200
     201function jplb_help_kses($t) {
     202    return wp_kses_post($t);
     203}
     204
     205function jqlb_options_panel() {
     206
     207    if ( ! function_exists( 'current_user_can' ) || ! current_user_can( 'manage_options' ) ) {
     208        die(__('Cheatin&#8217; uh?', 'jqlb'));
     209    }
     210
    207211    ?>
    208    
     212
    209213    <div class="wrap">
    210     <h2>WP Lightbox 2</h2> 
    211     <?php include_once(plugin_dir_path(__FILE__).'about.php'); ?>
     214    <h2>WP Lightbox 2</h2>
     215    <?php include_once plugin_dir_path(__FILE__) . 'about.php'; ?>
    212216    <form method="post" action="options.php">
    213217        <table>
    214         <?php settings_fields('jqlb-settings-group'); ?>
     218            <?php settings_fields('jqlb-settings-group'); ?>
    215219            <tr valign="baseline" colspan="2">
    216220                <td colspan="">
    217                     <?php $check = get_option('jqlb_automate') ? ' checked="yes" ' : ''; ?>
    218                     <input type="checkbox" id="jqlb_automate" name="jqlb_automate" value="1" <?php echo $check; ?>/>
     221                    <input type="checkbox" id="jqlb_automate" name="jqlb_automate" value="1" <?php checked( (bool) get_option('jqlb_automate') ); ?> />
    219222                    <label for="jqlb_automate" title="<?php _e('Let the plugin add necessary html to image links', 'jqlb') ?>"> <?php _e('Auto-lightbox image links', 'jqlb') ?></label>
    220223                </td>
     
    222225            <tr valign="baseline" colspan="2">
    223226                <td colspan="2">
    224                     <?php $check = get_option('jqlb_comments') ? ' checked="yes" ' : ''; ?>
    225                     <input type="checkbox" id="jqlb_comments" name="jqlb_comments" value="1" <?php echo $check; ?>/>
    226                     <label for="jqlb_comments" title="<?php _e('Note: this will disable the nofollow-attribute of comment links, that otherwise interfere with the lightbox.', 'jqlb') ?>"> <?php _e('Enable lightbox in comments (disables <a href="http://codex.wordpress.org/Nofollow">the nofollow attribute!</a>)', 'jqlb') ?></label>
    227                 </td>
    228             </tr>
    229             <tr valign="baseline" colspan="2">
    230                 <td>
    231                     <?php $check = get_option('jqlb_show_download') ? ' checked="yes" ' : ''; ?>
    232                     <input type="checkbox" id="jqlb_show_download" name="jqlb_show_download" value="1" <?php echo $check; ?> />
     227                    <input type="checkbox" id="jqlb_comments" name="jqlb_comments" value="1" <?php checked( (bool) get_option('jqlb_comments') ); ?> />
     228                    <label for="jqlb_comments" title="<?php _e('Note: this will disable the nofollow-attribute of comment links, that otherwise interfere with the lightbox.', 'jqlb') ?>"> <?php _e('Enable lightbox in comments (disables <a href="https://codex.wordpress.org/Nofollow">the nofollow attribute!</a>)', 'jqlb') ?></label>
     229                </td>
     230            </tr>
     231            <tr valign="baseline" colspan="2">
     232                <td>
     233                    <input type="checkbox" id="jqlb_show_download" name="jqlb_show_download" value="1" <?php checked( (bool) get_option('jqlb_show_download') ); ?> />
    233234                    <label for="jqlb_show_download"> <?php _e('Show download link', 'jqlb') ?> </label>
    234             </td>
    235                 <td>
    236                 <?php $target = get_option('jqlb_link_target'); ?>
    237                 <label for="jqlb_link_target" title="<?php _e('_blank: open the image in a new window or tab
     235                </td>
     236                <td>
     237                    <label for="jqlb_link_target" title="<?php _e('_blank: open the image in a new window or tab
    238238_self: open the image in the same frame as it was clicked (default)
    239239_parent: open the image in the parent frameset
    240 _top: open the image in the full body of the window', 'jqlb') ?>"><?php _e('Target for download link:', 'jqlb'); ?></label>
    241                 <select id="jqlb_link_target" name="jqlb_link_target">
    242                     <option <?php if ('_blank' == $target)echo 'selected="selected"'; ?>>_blank</option>
    243                     <option <?php if ('_self' == $target)echo 'selected="selected"'; ?>>_self</option>
    244                     <option <?php if ('_top' == $target)echo 'selected="selected"'; ?>>_top</option>
    245                     <option <?php if ('_parent' == $target)echo 'selected="selected"'; ?>>_parent</option>
    246                 </select>                           
    247                 </td>
    248             </tr>
    249       <tr valign="baseline" colspan="2">
    250         <td colspan="2">
    251           <?php $check = get_option('jqlb_navbarOnTop') ? ' checked="yes" ' : ''; ?>
    252           <input type="checkbox" id="jqlb_navbarOnTop" name="jqlb_navbarOnTop" value="1" <?php echo $check; ?> />
    253           <label for="jqlb_navbarOnTop">
    254             <?php _e('Show image info on top', 'jqlb') ?>
    255           </label>
    256         </td>
    257       </tr>
    258       <tr valign="baseline" colspan="2">
    259             <td>
    260                 <?php $check = get_option('jqlb_resize_on_demand') ? ' checked="yes" ' : ''; ?>
    261                 <input type="checkbox" id="jqlb_resize_on_demand" name="jqlb_resize_on_demand" value="1" <?php echo $check; ?> />
    262                 <label for="jqlb_resize_on_demand"><?php _e('Shrink large images to fit smaller screens', 'jqlb') ?></label>
    263             </td>
    264             <?php IF($check != ''): ?>
    265             <td>                   
    266                 <input type="text" id="jqlb_margin_size" name="jqlb_margin_size" value="<?php echo floatval(get_option('jqlb_margin_size')) ?>" size="3" />
    267                 <label for="jqlb_margin_size" title="<?php _e('Keep a distance between the image and the screen edges.', 'jqlb') ?>"><?php _e('Minimum margin to screen edge (default: 0)', 'jqlb') ?></label>         
    268             </td>
    269             <?php ENDIF; ?>
    270         </tr>                   
    271         <tr valign="baseline" colspan="2">
    272             <td colspan="2">                   
    273                 <input type="text" id="jqlb_resize_speed" name="jqlb_resize_speed" value="<?php echo intval(get_option('jqlb_resize_speed')) ?>" size="3" />
    274                 <label for="jqlb_resize_speed"><?php _e('Animation duration (in milliseconds) ', 'jqlb') ?></label>         
    275             </td>
    276         </tr>
    277         <tr valign="baseline" colspan="2">         
    278             <td>
    279                 <input type="text" id="jqlb_help_text" name="jqlb_help_text" value="<?php echo get_option('jqlb_help_text'); ?>" size="30" />       
    280                 <label for="jqlb_help_text"><?php _e('Help text (default: none) ', 'jqlb'); ?></label>                     
    281             </td>           
    282         </tr>           
    283          </table>
    284         <p style="font-size:xx-small;font-style:italic;"><?php _e('Browse images with your keyboard: Arrows or P(revious)/N(ext) and X/C/ESC for close.', 'jqlb'); ?></p>
    285         <p class="submit">
    286           <input type="submit" name="Submit" value="<?php _e('Save Changes', 'jqlb') ?>" />
    287         </p>
    288     </form>
     240_top: open the image in the full body of the window', 'jqlb') ?>"><?php _e('Target for download link:', 'jqlb'); ?></label>
     241                    <select id="jqlb_link_target" name="jqlb_link_target">
     242                        <option <?php selected( get_option('jqlb_link_target'), '_blank'  ); ?>>_blank</option>
     243                        <option <?php selected( get_option('jqlb_link_target'), '_self'   ); ?>>_self</option>
     244                        <option <?php selected( get_option('jqlb_link_target'), '_top'    ); ?>>_top</option>
     245                        <option <?php selected( get_option('jqlb_link_target'), '_parent' ); ?>>_parent</option>
     246                    </select>
     247                </td>
     248            </tr>
     249            <tr valign="baseline" colspan="2">
     250                <td colspan="2">
     251                    <input type="checkbox" id="jqlb_navbarOnTop" name="jqlb_navbarOnTop" value="1" <?php checked( (bool) get_option('jqlb_navbarOnTop') ); ?> />
     252                    <label for="jqlb_navbarOnTop">
     253                        <?php _e('Show image info on top', 'jqlb') ?>
     254                    </label>
     255                </td>
     256            </tr>
     257            <tr valign="baseline" colspan="2">
     258                <td>
     259                    <input type="checkbox" id="jqlb_resize_on_demand" name="jqlb_resize_on_demand" value="1" <?php checked( (bool) get_option('jqlb_resize_on_demand') ); ?> />
     260                    <label for="jqlb_resize_on_demand"><?php _e('Shrink large images to fit smaller screens', 'jqlb') ?></label>
     261                </td>
     262                <?php if ( get_option('jqlb_resize_on_demand') ) : ?>
     263                <td>
     264                    <input type="text" id="jqlb_margin_size" name="jqlb_margin_size" value="<?php echo floatval(get_option('jqlb_margin_size')) ?>" size="3" />
     265                    <label for="jqlb_margin_size" title="<?php _e('Keep a distance between the image and the screen edges.', 'jqlb') ?>"><?php _e('Minimum margin to screen edge (default: 0)', 'jqlb') ?></label>
     266                </td>
     267                <?php endif; ?>
     268            </tr>
     269            <tr valign="baseline" colspan="2">
     270                <td colspan="2">
     271                    <input type="text" id="jqlb_resize_speed" name="jqlb_resize_speed" value="<?php echo intval(get_option('jqlb_resize_speed')) ?>" size="3" />
     272                    <label for="jqlb_resize_speed"><?php _e('Animation duration (in milliseconds) ', 'jqlb') ?></label>
     273                </td>
     274            </tr>
     275            <tr valign="baseline" colspan="2">
     276                <td>
     277                    <input type="text" id="jqlb_help_text" name="jqlb_help_text" value="<?php echo get_option('jqlb_help_text'); ?>" size="30" />
     278                    <label for="jqlb_help_text"><?php _e('Help text (default: none) ', 'jqlb'); ?></label>
     279                </td>
     280            </tr>
     281             </table>
     282            <p style="font-size:xx-small;font-style:italic;"><?php _e('Browse images with your keyboard: Arrows or P(revious)/N(ext) and X/C/ESC for close.', 'jqlb'); ?></p>
     283            <p class="submit">
     284              <input type="submit" name="Submit" value="<?php _e('Save Changes', 'jqlb') ?>" />
     285            </p>
     286        </form>
    289287    <?php
    290288        $locale = jqlb_get_locale();
    291289        $diskfile = plugin_dir_path(__FILE__)."I18n/howtouse-{$locale}.html";
    292         if (!file_exists($diskfile)){
     290        if (!file_exists($diskfile)) {
    293291            $diskfile = plugin_dir_path(__FILE__).'I18n/howtouse.html';
    294292        }
    295293        $text = false;
    296         if(function_exists('file_get_contents')){
    297             $text = @file_get_contents($diskfile);
     294        if(function_exists('file_get_contents')) {
     295            $text = file_get_contents($diskfile);
    298296        } else {
    299             $text = @file($diskfile);
    300             if($text !== false){
     297            $text = file($diskfile);
     298            if($text !== false) {
    301299                $text = implode("", $text);
    302               }
     300            }
    303301        }
    304         if($text === false){
    305             $text = '<p>The documentation files are missing! Try <a href="http://wordpress.org/extend/plugins/wp-lightbox-2/">downloading</a> and <a href="http://wordpress.org/extend/plugins/wp-lightbox-2/installation/">re-installing</a> this lightbox plugin.</p>';
     302        if($text === false) {
     303            $text = '<p>The documentation files are missing! Try <a href="https://wordpress.org/extend/plugins/wp-lightbox-2/">downloading</a> and <a href="https://wordpress.org/extend/plugins/wp-lightbox-2/installation/">re-installing</a> this lightbox plugin.</p>';
    306304        }
    307305        echo $text;
    308306    ?>
    309     </div> 
     307    </div>
    310308<?php }
     309
    311310function jqlb_hex2rgba($color, $opacity = false) {
    312311
    313312    $default = 'rgb(0,0,0)';
    314     if(empty($color))
    315           return $default;
    316 
    317         if ($color[0] == '#' ) {
    318             $color = substr( $color, 1 );
    319         }
    320 
    321         if (strlen($color) == 6) {
    322                 $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
    323         } elseif ( strlen( $color ) == 3 ) {
    324                 $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
    325         } else {
    326                 return $default;
    327         }
    328 
    329         $rgb =  array_map('hexdec', $hex);
    330 
    331         if($opacity){
    332             if(abs($opacity) > 1)
    333                 $opacity = 1.0;
    334             $output = 'rgba('.implode(",",$rgb).','.$opacity.')';
    335         } else {
    336             $output = 'rgb('.implode(",",$rgb).')';
    337         }
    338         return $output;
     313
     314    if(empty($color)) {
     315        return $default;
     316    }
     317
     318    if ($color[0] == '#' ) {
     319        $color = substr( $color, 1 );
     320    }
     321
     322    if (strlen($color) == 6) {
     323        $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
     324    } elseif ( strlen( $color ) == 3 ) {
     325        $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
     326    } else {
     327        return $default;
     328    }
     329
     330    $rgb =  array_map('hexdec', $hex);
     331
     332    if($opacity) {
     333        if(abs($opacity) > 1) {
     334            $opacity = 1.0;
     335        }
     336        $output = 'rgba('.implode(",",$rgb).','.$opacity.')';
     337    } else {
     338        $output = 'rgb('.implode(",",$rgb).')';
     339    }
     340
     341    return $output;
    339342}
    340343class wp_lightbox_2{
    341     // required variables
    342    
     344
    343345    private $plugin_url;
    344    
    345346    private $plugin_path;
    346    
    347347    private $version;
    348    
     348
    349349    public $options;
    350    
    351     public $parametrs; 
    352    
    353     function __construct(){
    354        
     350    public $parametrs;
     351
     352    public function __construct() {
     353
    355354        $this->plugin_url  = trailingslashit( plugins_url('', __FILE__ ) );
    356355        $this->plugin_path = trailingslashit( plugin_dir_path( __FILE__ ) );
    357356        $this->version     = 1.0;
    358         require_once($this->plugin_path.'includes/install_database.php');       
    359         $this->parametrs = new wp_lightbox2_database_params(); 
     357
     358        require_once $this->plugin_path . 'includes/install_database.php';
     359
     360        $this->parametrs = new wp_lightbox2_database_params();
     361
    360362        $this->call_base_filters();
    361         $this->create_admin_menu();
    362 
    363     }
    364    
    365     private function create_admin_menu(){
    366        
    367         require_once($this->plugin_path.'admin/admin_menu.php');
    368        
    369         $admin_menu = new wp_lightbox_admin_menu(array('plugin_url' => $this->plugin_url,'plugin_path' => $this->plugin_path,'databese_parametrs' =>$this->parametrs));
    370        
    371         add_action('admin_menu', array($admin_menu,'create_menu'));
    372        
    373     }   
    374     public function registr_requeried_scripts(){       
    375         wp_register_script('angularejs',$this->plugin_url.'admin/scripts/angular.min.js');
    376         //wp_register_script('youtube_front_end_api_js',$this->plugin_url.'fornt_end/scripts/youtube_plus_front_end.js',array('jquery'));
    377         //wp_register_script('youtube_api_js',"https://www.youtube.com/iframe_api",array('youtube_front_end_api_js'));
    378         wp_register_style('admin_style_wp_lightbox',$this->plugin_url.'admin/styles/admin_themplate.css');
    379         wp_register_style('jquery-ui-style',$this->plugin_url.'admin/styles/jquery-ui.css');       
    380     }
    381     public function enqueue_requeried_scripts(){   
     363        $this->create_admin_menu();
     364    }
     365    private function create_admin_menu() {
     366
     367        require_once $this->plugin_path.'admin/admin_menu.php';
     368
     369        $admin_menu = new wp_lightbox_admin_menu( array(
     370            'plugin_url'         => $this->plugin_url,
     371            'plugin_path'        => $this->plugin_path,
     372            'databese_parametrs' => $this->parametrs
     373        ) );
     374
     375        add_action('admin_menu', array( $admin_menu, 'create_menu' ) );
     376    }
     377    public function registr_requeried_scripts() {
     378        wp_register_script('angularejs',$this->plugin_url . 'admin/scripts/angular.min.js');
     379        wp_register_style('admin_style_wp_lightbox',$this->plugin_url . 'admin/styles/admin_themplate.css');
     380        wp_register_style('jquery-ui-style',$this->plugin_url . 'admin/styles/jquery-ui.css');
     381    }
     382    public function enqueue_requeried_scripts() {
    382383        wp_enqueue_style("jquery-ui-style");
    383384        wp_enqueue_script("jquery-ui-slider");
    384385    }
    385     public function call_base_filters(){
     386    public function call_base_filters() {
    386387        add_action( 'init',  array($this,'registr_requeried_scripts') );
    387388        add_action( 'admin_head',  array($this,'enqueue_requeried_scripts') );
    388389    }
    389    
    390 
    391 }
     390}
     391
    392392$wp_lightbox_2 = new wp_lightbox_2();
Note: See TracChangeset for help on using the changeset viewer.