Plugin Directory

Changeset 577263


Ignore:
Timestamp:
07/25/2012 04:46:45 PM (14 years ago)
Author:
danielshields
Message:

Added arrow key navigation, clicking images to advance. New admin options for each

Location:
ds-gallery/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ds-gallery/trunk/ds-gallery-admin.php

    r576781 r577263  
    3838        update_option('dsGalIncludejQuery',$dsGalIncludejQuery);
    3939       
     40        $dsGalArrowKeys = $_POST['dsGalArrowKeys'];
     41        update_option('dsGalArrowKeys',$dsGalArrowKeys);
     42       
     43        $dsGalImgClick = $_POST['dsGalImgClick'];
     44        update_option('dsGalImgClick',$dsGalImgClick);
     45       
    4046        ?>
    4147        <div class="updated"><p><strong><?php _e('Options saved.' ); ?></strong></p></div>
     
    5561        $dsGalArrowTouch = get_option('dsGalArrowTouch');
    5662        $dsGalIncludejQuery = get_option('dsGalIncludejQuery');
     63        $dsGalArrowKeys = get_option('dsGalArrowKeys');
     64        $dsGalImgClick = get_option('dsGalImgClick');
    5765    }
    5866   
     
    8189    <p><?php _e("Gallery height: " ); ?><input type="text" name="dsgal_height" value="<?php echo $dsgal_height; ?>" size="5"><?php _e(" ex: 350px, defaults to 450px" ); ?></p>
    8290    <p><?php _e("Include jQuery?"); ?> <input type="checkbox" name="dsGalIncludejQuery" value="Yes"<?php if($dsGalIncludejQuery=="Yes"){ print " checked"; }?>> &nbsp; (Select this if you're not already loading jQuery up in your theme)</p>
     91    <p><?php _e("Use arrowkeys to navigate images?"); ?> <input type="checkbox" name="dsGalArrowKeys" value="Yes"<?php if($dsGalArrowKeys=="Yes"){ print " checked"; }?>> &nbsp; (Left and Right arrow keys will do the same as prev and next arrows)</p>
     92    <p><?php _e("Advance to the next slide when the slideshow image is clicked?"); ?> <input type="checkbox" name="dsGalImgClick" value="Yes"<?php if($dsGalImgClick=="Yes"){ print " checked"; }?>></p>
    8393    <hr style="background-color:#bcbcbc;border:none;height:5px;overflow:hidden;margin:25px 0;" />
    8494    <h3>Advanced Settings</h3>
  • ds-gallery/trunk/ds-gallery.php

    r576781 r577263  
    3232        global $post;
    3333        // Gather plugin options
     34        $extraClass = "";
    3435        $showthumbs = get_option('dsgal_showthumbs');
    3536        $transition = get_option('dsgal_transition');
     
    4445        $dsGalArrowTouch = get_option('dsGalArrowTouch');
    4546        $dsGalIncludejQuery = get_option('dsGalIncludejQuery');
     47        $dsGalArrowKeys = get_option('dsGalArrowKeys'); if($dsGalArrowKeys == "Yes"){ $extraClass .= " arrowKeysOn"; }
     48        $dsGalImgClick = get_option('dsGalImgClick'); if($dsGalImgClick == "Yes"){ $extraClass .= " imgClickOn"; }
    4649        if($smSize == ""){ $smSize = "thumbnail"; }
    4750
     
    5053        $attachments = get_posts($args);
    5154        if ($attachments && count($attachments)>1) {
    52             echo "<div class=\"ds-gallery-full clearfix ds-gal-".$transition." touch-arrows-" . $dsGalArrowTouch . "\" style=\"";
     55            echo "<div class=\"ds-gallery-full clearfix ds-gal-".$transition." touch-arrows-" . $dsGalArrowTouch . $extraClass . "\" style=\"";
    5356            if($dsgal_width != ""){ print "width:".$dsgal_width."; "; }
    5457            if($dsgal_height != ""){ print "height:".$dsgal_height."; "; }
  • ds-gallery/trunk/js/script.js

    r576781 r577263  
    3939                dsGal.doImgChange();
    4040            })
     41            if($(".ds-gallery-full").hasClass("arrowKeysOn")){
     42                $(document).keydown(function(e){
     43                    if (e.keyCode == 37) {
     44                        dsGal.moveLeft();
     45                        dsGal.doImgChange();
     46                        return false;
     47                    }
     48                    if (e.keyCode == 39) {
     49                        dsGal.moveRight();
     50                        dsGal.doImgChange();
     51                        return false;
     52                    }
     53                });
     54            }
     55            if($(".ds-gallery-full").hasClass("imgClickOn")){
     56                $(".ds-gallery-large img, .overImgLayer").live("click",function(){
     57                    dsGal.moveRight();
     58                    dsGal.doImgChange();
     59                })
     60            }
    4161            dsGal.dsLoadImages();
    4262            dsGal.initEvents();
     
    102122            dsGal.dsGalCurrentImg--;
    103123            if(dsGal.dsGalCurrentImg < 1){ dsGal.dsGalCurrentImg = dsGal.dsGalTotalImg; }
     124            dsGal.setNewActive(dsGal.dsGalCurrentImg);
    104125        },
    105126        moveRight:function(){
    106127            dsGal.dsGalCurrentImg++;
    107128            if(dsGal.dsGalCurrentImg > dsGal.dsGalTotalImg){ dsGal.dsGalCurrentImg = 1; }
     129            dsGal.setNewActive(dsGal.dsGalCurrentImg);
    108130        },
    109131        goBack: function(){
  • ds-gallery/trunk/readme.txt

    r576784 r577263  
    4444
    4545== Changelog ==
     46= 0.2 =
     47Added arrow key navigation, clicking images to advance. New admin options for each
     48
    4649= 0.1 =
    4750Initial Commit
Note: See TracChangeset for help on using the changeset viewer.