Make WordPress Core

Changeset 26738


Ignore:
Timestamp:
12/06/2013 07:41:19 PM (11 years ago)
Author:
nacin
Message:

Themes: If a theme only has a very-old-school 300px-wide screenshot (or narrower), don't stretch it.

props matveb.
fixes #26459.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/wp-admin.css

    r26737 r26738  
    68956895    width: 100%;
    68966896}
     6897/* Handles old 300px screenshots */
     6898.theme-overlay.small-screenshot .theme-screenshots {
     6899    position: absolute;
     6900    width: 302px;
     6901}
     6902.theme-overlay.small-screenshot .theme-info {
     6903    margin-left: 350px;
     6904    width: auto;
     6905}
    68976906
    68986907/* Other screenshots, shown small and square */
     
    71627171    .theme-browser .theme .theme-actions {
    71637172        padding: 5px 10px 4px 10px;
     7173    }
     7174    .theme-overlay.small-screenshot .theme-screenshots {
     7175        position: static;
     7176        float: none;
     7177        max-width: 302px;
     7178    }
     7179    .theme-overlay.small-screenshot .theme-info {
     7180        margin-left: 0;
     7181        width: auto;
    71647182    }
    71657183}
  • trunk/src/wp-admin/js/theme.js

    r26728 r26738  
    251251        // Set up navigation events
    252252        this.navigation();
     253        // Checks screenshot size
     254        this.screenshotCheck( this.$el );
    253255    },
    254256
     
    353355        var self = this;
    354356        self.trigger( 'theme:previous', self.model.cid );
     357    },
     358
     359    // Checks if the theme screenshot is the old 300px width version
     360    // and adds a corresponding class if it's true
     361    screenshotCheck: function( el ) {
     362        var screenshot, image, width;
     363
     364        screenshot = el.find( '.screenshot img' );
     365        image = new Image();
     366        image.src = screenshot.attr( 'src' );
     367
     368        // Width check
     369        if ( image.width <= 300 ) {
     370            el.addClass( 'small-screenshot' );
     371        }
    355372    }
    356373});
Note: See TracChangeset for help on using the changeset viewer.