mp-wp_genesis 1 jQuery(function($) {
mp-wp_genesis 2 var gallerySortable;
mp-wp_genesis 3 var gallerySortableInit = function() {
mp-wp_genesis 4 gallerySortable = $('#media-items').sortable( {
mp-wp_genesis 5 items: '.media-item',
mp-wp_genesis 6 placeholder: 'sorthelper',
mp-wp_genesis 7 axis: 'y',
mp-wp_genesis 8 distance: 2,
mp-wp_genesis 9 update: galleryReorder
mp-wp_genesis 10 } );
mp-wp_genesis 11 }
mp-wp_genesis 12
mp-wp_genesis 13 // When an update has occurred, adjust the order for each item
mp-wp_genesis 14 var galleryReorder = function(e, sort) {
mp-wp_genesis 15 jQuery.each(sort['element'].sortable('toArray'), function(i, id) {
mp-wp_genesis 16 jQuery('#' + id + ' .menu_order input')[0].value = (1+i);
mp-wp_genesis 17 });
mp-wp_genesis 18 }
mp-wp_genesis 19
mp-wp_genesis 20 // initialize sortable
mp-wp_genesis 21 gallerySortableInit();
mp-wp_genesis 22 });
mp-wp_genesis 23
mp-wp_genesis 24 jQuery(document).ready(function($){
mp-wp_genesis 25 $('.menu_order_input').each(function(){
mp-wp_genesis 26 if ( this.value == '0' ) this.value = '';
mp-wp_genesis 27 });
mp-wp_genesis 28
mp-wp_genesis 29 if ( $('#media-items>*').length > 1 ) {
mp-wp_genesis 30 var w = wpgallery.getWin();
mp-wp_genesis 31
mp-wp_genesis 32 $('#save-all, #gallery-settings').show();
mp-wp_remove-tiny... 33 $('#insert-gallery').show();
mp-wp_genesis 34 }
mp-wp_genesis 35 });
mp-wp_genesis 36
mp-wp_genesis 37 var wpgallery = {
mp-wp_genesis 38 editor : {},
mp-wp_genesis 39 dom : {},
mp-wp_genesis 40 is_update : false,
mp-wp_genesis 41 el : {},
mp-wp_genesis 42
mp-wp_genesis 43 I : function(e) {
mp-wp_genesis 44 return document.getElementById(e);
mp-wp_genesis 45 },
mp-wp_genesis 46
mp-wp_genesis 47 getWin : function() {
mp-wp_genesis 48 return window.dialogArguments || opener || parent || top;
mp-wp_genesis 49 },
mp-wp_genesis 50
mp-wp_genesis 51 getSettings : function() {
mp-wp_genesis 52 var I = this.I, s = '';
mp-wp_genesis 53
mp-wp_genesis 54 if ( I('linkto-file').checked ) {
mp-wp_genesis 55 s += ' link="file"';
mp-wp_genesis 56 setUserSetting('galfile', '1');
mp-wp_genesis 57 }
mp-wp_genesis 58
mp-wp_genesis 59 if ( I('order-desc').checked ) {
mp-wp_genesis 60 s += ' order="DESC"';
mp-wp_genesis 61 setUserSetting('galdesc', '1');
mp-wp_genesis 62 }
mp-wp_genesis 63
mp-wp_genesis 64 if ( I('columns').value != 3 ) {
mp-wp_genesis 65 s += ' columns="'+I('columns').value+'"';
mp-wp_genesis 66 setUserSetting('galcols', I('columns').value);
mp-wp_genesis 67 }
mp-wp_genesis 68
mp-wp_genesis 69 if ( I('orderby').value != 'menu_order' ) {
mp-wp_genesis 70 s += ' orderby="'+I('orderby').value+'"';
mp-wp_genesis 71 setUserSetting('galord', I('orderby').value);
mp-wp_genesis 72 }
mp-wp_genesis 73
mp-wp_genesis 74 return s;
mp-wp_genesis 75 }
mp-wp_genesis 76 };