芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/timucuy.com/wp-admin/js/gallery.js
/** * @output wp-admin/js/gallery.js */ /* global unescape, getUserSetting, setUserSetting, wpgallery, tinymce */ jQuery( function($) { var gallerySortable, gallerySortableInit, sortIt, clearAll, w, desc = false; gallerySortableInit = function() { gallerySortable = $('#media-items').sortable( { items: 'div.media-item', placeholder: 'sorthelper', axis: 'y', distance: 2, handle: 'div.filename', stop: function() { // When an update has occurred, adjust the order for each item. var all = $('#media-items').sortable('toArray'), len = all.length; $.each(all, function(i, id) { var order = desc ? (len - i) : (1 + i); $('#' + id + ' .menu_order input').val(order); }); } } ); }; sortIt = function() { var all = $('.menu_order_input'), len = all.length; all.each(function(i){ var order = desc ? (len - i) : (1 + i); $(this).val(order); }); }; clearAll = function(c) { c = c || 0; $('.menu_order_input').each( function() { if ( this.value === '0' || c ) { this.value = ''; } }); }; $('#asc').on( 'click', function( e ) { e.preventDefault(); desc = false; sortIt(); }); $('#desc').on( 'click', function( e ) { e.preventDefault(); desc = true; sortIt(); }); $('#clear').on( 'click', function( e ) { e.preventDefault(); clearAll(1); }); $('#showall').on( 'click', function( e ) { e.preventDefault(); $('#sort-buttons span a').toggle(); $('a.describe-toggle-on').hide(); $('a.describe-toggle-off, table.slidetoggle').show(); $('img.pinkynail').toggle(false); }); $('#hideall').on( 'click', function( e ) { e.preventDefault(); $('#sort-buttons span a').toggle(); $('a.describe-toggle-on').show(); $('a.describe-toggle-off, table.slidetoggle').hide(); $('img.pinkynail').toggle(true); }); // Initialize sortable. gallerySortableInit(); clearAll(); if ( $('#media-items>*').length > 1 ) { w = wpgallery.getWin(); $('#save-all, #gallery-settings').show(); if ( typeof w.tinyMCE !== 'undefined' && w.tinyMCE.activeEditor && ! w.tinyMCE.activeEditor.isHidden() ) { wpgallery.mcemode = true; wpgallery.init(); } else { $('#insert-gallery').show(); } } }); jQuery(window).on( 'unload', function () { window.tinymce = window.tinyMCE = window.wpgallery = null; } ); // Cleanup. /* gallery settings */ window.tinymce = null; window.wpgallery = { mcemode : false, editor : {}, dom : {}, is_update : false, el : {}, I : function(e) { return document.getElementById(e); }, init: function() { var t = this, li, q, i, it, w = t.getWin(); if ( ! t.mcemode ) { return; } li = ('' + document.location.search).replace(/^\?/, '').split('&'); q = {}; for (i=0; i