Plugin Directory

Changeset 960616


Ignore:
Timestamp:
08/05/2014 04:34:13 PM (12 years ago)
Author:
jethin
Message:

Tagging v 1.1; added ability to choose image size when selecting images; v 1.0 housecleaning

Location:
home-page-slideshow
Files:
2 deleted
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • home-page-slideshow/tags/1.1/hss-admin.css

    r960030 r960616  
    3939}
    4040
    41 .attachment-display-settings label.setting{
     41.attachment-display-settings label.setting:nth-child(2){
    4242    display:none !important;   
    4343}
  • home-page-slideshow/tags/1.1/hss-admin.js

    r960030 r960616  
    44    var result;
    55    var slide_count = $('.form-table').length;
     6    var save_notices = 0;
    67   
    78    $('.hss-image-preview').each(function(){
     
    6667            target.find('input').not('.hss-index, .button').val('');
    6768            target.find('.hss-image-preview').attr('src', '');
    68             alert('Save changes to commit edit.');
     69            if( save_notices == 0 ){
     70                alert('Save changes to commit edit(s).');
     71                save_notices++;
     72            }
    6973        }
    7074    });
     
    7781                $(this).remove();
    7882                reorder();
    79                 alert('Save changes to commit edit.');
     83                if( save_notices == 0 ){
     84                    alert('Save changes to commit edit(s).');
     85                save_notices++;
     86                }
    8087            });
    8188        return false;
     
    8693    $('.hss-select-image').click(function(e) {
    8794        e.preventDefault();
     95       
    8896        current_id = 'slide-' + $(this).closest('tr').prev().find('.hss-index').val();
    89        
    9097        var current_slide = $(this).closest('.form-table');
    91         console.log(current_slide);
    9298       
    9399        var insertImage = wp.media.controller.Library.extend({
     
    114120            var state = frame.state('insert-image');
    115121            var selection = state.get('selection');
    116             var imageArray = [];
    117122       
    118123            if ( !selection ) return;
    119        
    120             //to get right side attachment UI info, such as: size and alignments
    121             //org code from /wp-includes/js/media-editor.js, arround `line 603 -- send: { ... attachment: function( props, attachment ) { ... `
     124
    122125            selection.each(function( attachment ) {
    123                 var display = state.display( attachment ).toJSON();
    124                 var obj_attachment = attachment.toJSON()
    125                 var caption = obj_attachment.caption, options, html;
    126        
    127                 // If captions are disabled, clear the caption.
    128                 if ( !wp.media.view.settings.captions )
    129                     delete obj_attachment.caption;
    130        
    131                 display = wp.media.string.props( display, obj_attachment );
    132        
    133                 options = {
    134                     id: obj_attachment.id,
    135                     post_content: obj_attachment.description,
    136                     post_excerpt: caption
    137                 };
    138        
    139                 if ( display.linkUrl )
    140                     options.url = display.linkUrl;
    141        
    142                 //attach info to attachment.attributes object
    143                 attachment.attributes['nonce'] = wp.media.view.settings.nonce.sendToEditor;
    144                 attachment.attributes['attachment'] = options;
    145                 // attachment.attributes['html'] = html;
    146                 attachment.attributes['post_id'] = wp.media.view.settings.post.id;
    147        
    148                 // returned image attributes
    149                 // console.log(attachment.attributes['attachment']['url']);
    150                 // console.log(attachment.attributes);
     126                var display = state.display(attachment).toJSON();
     127                var img_info = attachment.toJSON();
     128                var selected_img = wp.media.string.props(display, img_info);
     129                var img_src = selected_img['src'];
     130                var link_url = selected_img['linkUrl'];
    151131               
    152                 current_slide.find('.hss-image').val(attachment.attributes['url']);
    153                 current_slide.find('.hss-image-preview').attr('src', attachment.attributes['url']);
     132                current_slide.find('.hss-image').val(img_src);
     133                current_slide.find('.hss-image-preview').attr('src', img_src);
    154134                current_slide.find('.hss-image-preview').css('display', 'block');
     135                current_slide.find('.hss-link').val(link_url);
     136                current_slide.find('.hss-link-preview').attr('href', link_url);
    155137               
    156                 if( typeof attachment.attributes['attachment']['url'] !== 'undefined' ){
    157                     current_slide.find('.hss-link').val(attachment.attributes['attachment']['url']);
    158                     current_slide.find('.hss-link-preview').attr('href', attachment.attributes['attachment']['url']);
    159                     current_slide.find('.hss-link-preview').css('display', 'inline');
    160                     is_valid_url( attachment.attributes['attachment']['url'], current_slide.find('.hss-link-error') );
     138                if( link_url != '' ){
     139                    current_slide.find('.hss-link-preview').css('visibility', 'visible');
     140                    is_valid_url( link_url, current_slide.find('.hss-link-error') );
     141                }
     142                else{
     143                    current_slide.find('.hss-link-preview').css('visibility', 'hidden');
    161144                }
    162145               
  • home-page-slideshow/tags/1.1/hss.php

    r960030 r960616  
    33 * Plugin Name: Home Page Slideshow
    44 * Description: Create a responsive slideshow with titles, subtitles and links for your site's home page.
    5  * Version: 1.0
     5 * Version: 1.1
    66 * Author: Jethin
    77 * License: GPL2
     
    216216function hss_scripts(){
    217217        wp_register_script( 'cycle2', plugins_url( 'jquery.cycle2.min.js' , __FILE__ ), array('jquery'), '2.1.5' );
    218         wp_register_script( 'hss_js', plugins_url( 'hss.js', __FILE__ ) );
     218        wp_register_script( 'hss_js', plugins_url( 'hss.js', __FILE__ ), array('cycle2') );
    219219        wp_register_style( 'hss_css', plugins_url( 'hss.css', __FILE__ ) );
    220220}
     
    297297function hss_admin_scripts(){
    298298    if ( isset($_GET['page']) && $_GET['page'] == 'hss-settings-admin' ) {
     299        // wp_enqueue_media() includes jquery-ui-core, jquery-ui-sortable -- no need to enqueue separately
    299300        wp_enqueue_media();
    300         wp_register_script('hss-jquery-ui', WP_PLUGIN_URL . '/home-page-slideshow/jquery-ui.min.js', array('jquery'));
    301         wp_enqueue_script('hss-jquery-ui');
    302301        wp_register_script('hss-admin-js', WP_PLUGIN_URL . '/home-page-slideshow/hss-admin.js', array('jquery'));
    303302        wp_enqueue_script('hss-admin-js');
  • home-page-slideshow/tags/1.1/readme.txt

    r960030 r960616  
    22Contributors: jethin
    33Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BUH36ZU4GVA78
    4 Tags: slideshow, gallery, home, front
     4Tags: slideshow, gallery, home, front, slider
    55Requires at least: 3.0
    66Tested up to: 3.9.1
    7 Stable tag: 1
     7Stable tag: 1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2525Slides include image (required) and optional title, subtitle and link.
    2626
    27 Links can be set when selecting image.
     27Links and image size can be set when selecting image. (Full size images recommended.)
    2828
    2929Slideshows and slides are 100% the width of their container. Upload images that are at least as wide as the slideshow you want them to appear in.
     
    5252== Changelog ==
    5353
     54= 1.1 =
     55* v. 1.0 housecleaning
     56
    5457= 1.0 =
    5558* Initial release.
     59
     60== Upgrade Notice ==
     61
     62= 1.1 =
     63Added ability to choose image size when selecting images; v 1.0 housecleaning
  • home-page-slideshow/trunk/hss-admin.css

    r960030 r960616  
    3939}
    4040
    41 .attachment-display-settings label.setting{
     41.attachment-display-settings label.setting:nth-child(2){
    4242    display:none !important;   
    4343}
  • home-page-slideshow/trunk/hss-admin.js

    r960030 r960616  
    44    var result;
    55    var slide_count = $('.form-table').length;
     6    var save_notices = 0;
    67   
    78    $('.hss-image-preview').each(function(){
     
    6667            target.find('input').not('.hss-index, .button').val('');
    6768            target.find('.hss-image-preview').attr('src', '');
    68             alert('Save changes to commit edit.');
     69            if( save_notices == 0 ){
     70                alert('Save changes to commit edit(s).');
     71                save_notices++;
     72            }
    6973        }
    7074    });
     
    7781                $(this).remove();
    7882                reorder();
    79                 alert('Save changes to commit edit.');
     83                if( save_notices == 0 ){
     84                    alert('Save changes to commit edit(s).');
     85                save_notices++;
     86                }
    8087            });
    8188        return false;
     
    8693    $('.hss-select-image').click(function(e) {
    8794        e.preventDefault();
     95       
    8896        current_id = 'slide-' + $(this).closest('tr').prev().find('.hss-index').val();
    89        
    9097        var current_slide = $(this).closest('.form-table');
    91         console.log(current_slide);
    9298       
    9399        var insertImage = wp.media.controller.Library.extend({
     
    114120            var state = frame.state('insert-image');
    115121            var selection = state.get('selection');
    116             var imageArray = [];
    117122       
    118123            if ( !selection ) return;
    119        
    120             //to get right side attachment UI info, such as: size and alignments
    121             //org code from /wp-includes/js/media-editor.js, arround `line 603 -- send: { ... attachment: function( props, attachment ) { ... `
     124
    122125            selection.each(function( attachment ) {
    123                 var display = state.display( attachment ).toJSON();
    124                 var obj_attachment = attachment.toJSON()
    125                 var caption = obj_attachment.caption, options, html;
    126        
    127                 // If captions are disabled, clear the caption.
    128                 if ( !wp.media.view.settings.captions )
    129                     delete obj_attachment.caption;
    130        
    131                 display = wp.media.string.props( display, obj_attachment );
    132        
    133                 options = {
    134                     id: obj_attachment.id,
    135                     post_content: obj_attachment.description,
    136                     post_excerpt: caption
    137                 };
    138        
    139                 if ( display.linkUrl )
    140                     options.url = display.linkUrl;
    141        
    142                 //attach info to attachment.attributes object
    143                 attachment.attributes['nonce'] = wp.media.view.settings.nonce.sendToEditor;
    144                 attachment.attributes['attachment'] = options;
    145                 // attachment.attributes['html'] = html;
    146                 attachment.attributes['post_id'] = wp.media.view.settings.post.id;
    147        
    148                 // returned image attributes
    149                 // console.log(attachment.attributes['attachment']['url']);
    150                 // console.log(attachment.attributes);
     126                var display = state.display(attachment).toJSON();
     127                var img_info = attachment.toJSON();
     128                var selected_img = wp.media.string.props(display, img_info);
     129                var img_src = selected_img['src'];
     130                var link_url = selected_img['linkUrl'];
    151131               
    152                 current_slide.find('.hss-image').val(attachment.attributes['url']);
    153                 current_slide.find('.hss-image-preview').attr('src', attachment.attributes['url']);
     132                current_slide.find('.hss-image').val(img_src);
     133                current_slide.find('.hss-image-preview').attr('src', img_src);
    154134                current_slide.find('.hss-image-preview').css('display', 'block');
     135                current_slide.find('.hss-link').val(link_url);
     136                current_slide.find('.hss-link-preview').attr('href', link_url);
    155137               
    156                 if( typeof attachment.attributes['attachment']['url'] !== 'undefined' ){
    157                     current_slide.find('.hss-link').val(attachment.attributes['attachment']['url']);
    158                     current_slide.find('.hss-link-preview').attr('href', attachment.attributes['attachment']['url']);
    159                     current_slide.find('.hss-link-preview').css('display', 'inline');
    160                     is_valid_url( attachment.attributes['attachment']['url'], current_slide.find('.hss-link-error') );
     138                if( link_url != '' ){
     139                    current_slide.find('.hss-link-preview').css('visibility', 'visible');
     140                    is_valid_url( link_url, current_slide.find('.hss-link-error') );
     141                }
     142                else{
     143                    current_slide.find('.hss-link-preview').css('visibility', 'hidden');
    161144                }
    162145               
  • home-page-slideshow/trunk/hss.php

    r960030 r960616  
    33 * Plugin Name: Home Page Slideshow
    44 * Description: Create a responsive slideshow with titles, subtitles and links for your site's home page.
    5  * Version: 1.0
     5 * Version: 1.1
    66 * Author: Jethin
    77 * License: GPL2
     
    216216function hss_scripts(){
    217217        wp_register_script( 'cycle2', plugins_url( 'jquery.cycle2.min.js' , __FILE__ ), array('jquery'), '2.1.5' );
    218         wp_register_script( 'hss_js', plugins_url( 'hss.js', __FILE__ ) );
     218        wp_register_script( 'hss_js', plugins_url( 'hss.js', __FILE__ ), array('cycle2') );
    219219        wp_register_style( 'hss_css', plugins_url( 'hss.css', __FILE__ ) );
    220220}
     
    297297function hss_admin_scripts(){
    298298    if ( isset($_GET['page']) && $_GET['page'] == 'hss-settings-admin' ) {
     299        // wp_enqueue_media() includes jquery-ui-core, jquery-ui-sortable -- no need to enqueue separately
    299300        wp_enqueue_media();
    300         wp_register_script('hss-jquery-ui', WP_PLUGIN_URL . '/home-page-slideshow/jquery-ui.min.js', array('jquery'));
    301         wp_enqueue_script('hss-jquery-ui');
    302301        wp_register_script('hss-admin-js', WP_PLUGIN_URL . '/home-page-slideshow/hss-admin.js', array('jquery'));
    303302        wp_enqueue_script('hss-admin-js');
  • home-page-slideshow/trunk/readme.txt

    r960030 r960616  
    22Contributors: jethin
    33Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BUH36ZU4GVA78
    4 Tags: slideshow, gallery, home, front
     4Tags: slideshow, gallery, home, front, slider
    55Requires at least: 3.0
    66Tested up to: 3.9.1
    7 Stable tag: 1
     7Stable tag: 1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2525Slides include image (required) and optional title, subtitle and link.
    2626
    27 Links can be set when selecting image.
     27Links and image size can be set when selecting image. (Full size images recommended.)
    2828
    2929Slideshows and slides are 100% the width of their container. Upload images that are at least as wide as the slideshow you want them to appear in.
     
    5252== Changelog ==
    5353
     54= 1.1 =
     55* v. 1.0 housecleaning
     56
    5457= 1.0 =
    5558* Initial release.
     59
     60== Upgrade Notice ==
     61
     62= 1.1 =
     63Added ability to choose image size when selecting images; v 1.0 housecleaning
Note: See TracChangeset for help on using the changeset viewer.