Show
Ignore:
Timestamp:
10/30/07 16:49:38 (1 year ago)
Author:
donncha
Message:

Merge with WordPress? 2.3.1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/js/cat.js

    r1125 r1139  
    1 jQuery( function($) { 
    2         $('#jaxcat').prepend('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" class="add:categorychecklist:jaxcat" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span><span id="cat-ajax-response"></span>') 
    3         var a = $('#categorychecklist').wpList( { alt: '', response: 'cat-ajax-response' } ); 
    4 } ); 
     1addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;}); 
     2addLoadEvent(newCatAddIn); 
     3function newCatAddIn() { 
     4        var jaxcat = $('jaxcat'); 
     5        if ( !jaxcat ) 
     6                return false; 
     7        // These multiple blank hidden inputs are needed: https://bugzilla.mozilla.org/show_bug.cgi?id=377815 , #3895 , #4664 
     8        Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how + '</span></span>'); 
     9        $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); }; 
     10        $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); }; 
     11
     12 
  • trunk/wp-admin/js/categories.js

    r1125 r1139  
    1 jQuery(function($) { 
    2         var options = document.forms['addcat'].category_parent.options; 
    3  
    4         var addAfter = function( r, settings ) { 
    5                 var name = $("<span>" + $('name', r).text() + "</span>").html(); 
    6                 var id = $('cat', r).attr('id'); 
     1addLoadEvent(function() { 
     2        if (!theList.theList) return false; 
     3        document.forms.addcat.submit.onclick = function(e) {return killSubmit('theList.ajaxAdder("cat", "addcat");', e); }; 
     4        theList.addComplete = function(what, where, update, transport) { 
     5                var name = getNodeValue(transport.responseXML, 'name').unescapeHTML(); 
     6                var id = transport.responseXML.getElementsByTagName(what)[0].getAttribute('id'); 
     7                var options = document.forms['addcat'].category_parent.options; 
    78                options[options.length] = new Option(name, id); 
    8         } 
    9  
    10         var delAfter = function( r, settings ) { 
    11                 var id = $('cat', r).attr('id'); 
     9        }; 
     10        theList.delComplete = function(what, id) { 
     11                var options = document.forms['addcat'].category_parent.options; 
    1212                for ( var o = 0; o < options.length; o++ ) 
    1313                        if ( id == options[o].value ) 
    1414                                options[o] = null; 
    15         } 
    16  
    17         var a = $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } ); 
     15        }; 
    1816}); 
  • trunk/wp-admin/js/custom-fields.js

    r1125 r1139  
    1 jQuery( function($) { 
    2         var before = function() { 
    3                 var nonce = $('#newmeta [@name=_ajax_nonce]').val(); 
    4                 var postId = $('#post_ID').val(); 
    5                 if ( !nonce || !postId ) { return false; } 
    6                 return [nonce,postId]; 
     1function customFieldsOnComplete( what, where, update, transport ) { 
     2        var pidEl = $('post_ID'); 
     3        pidEl.name = 'post_ID'; 
     4        pidEl.value = getNodeValue(transport.responseXML, 'postid'); 
     5        var aEl = $('hiddenaction') 
     6        if ( aEl.value == 'post' ) aEl.value = 'postajaxpost'; 
     7
     8addLoadEvent(customFieldsAddIn); 
     9function customFieldsAddIn() { 
     10        theList.showLink=0; 
     11        theList.addComplete = customFieldsOnComplete; 
     12        if (!theList.theList) return false; 
     13        inputs = theList.theList.getElementsByTagName('input'); 
     14        for ( var i=0; i < inputs.length; i++ ) { 
     15                if ('text' == inputs[i].type) { 
     16                        inputs[i].setAttribute('autocomplete', 'off'); 
     17                        inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); }; 
     18                } 
     19                if ('updatemeta' == inputs[i].className) { 
     20                        inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); }; 
     21                } 
    722        } 
    823 
    9         var addBefore = function( s ) { 
    10                 var b = before(); 
    11                 if ( !b ) { return false; } 
    12                 s.data = s.data.replace(/_ajax_nonce=[a-f0-9]+/, '_ajax_nonce=' + b[0]) + '&post_id=' + b[1]; 
    13                 return s; 
    14         }; 
    15  
    16         var addAfter = function( r, s ) { 
    17                 var postId = $('postid', r).text(); 
    18                 if ( !postId ) { return; } 
    19                 $('#post_ID').attr( 'name', 'post_ID' ).val( postId ); 
    20                 var h = $('#hiddenaction'); 
    21                 if ( 'post' == h.val() ) { h.val( 'postajaxpost' ); } 
    22         }; 
    23  
    24         var delBefore = function( s ) { 
    25                 var b = before(); if ( !b ) return false; 
    26                 s.data._ajax_nonce = b[0]; s.data.post_id = b[1]; 
    27                 return s; 
    28         } 
    29  
    30         $('#the-list') 
    31                 .wpList( { addBefore: addBefore, addAfter: addAfter, delBefore: delBefore } ) 
    32                 .find('.updatemeta, .deletemeta').attr( 'type', 'button' ); 
    33 } ); 
     24        $('metakeyinput').onkeypress = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); }; 
     25        $('updatemetasub').onclick = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); }; 
     26
  • trunk/wp-admin/js/edit-comments.js

    r1125 r1139  
    1 var list; var extra; 
    2 jQuery(function($) { 
     1addLoadEvent(function() { 
     2        theCommentList = new listMan('the-comment-list'); 
     3        if ( !theCommentList ) 
     4                return false; 
    35 
    4 var dimAfter = function( r, settings ) { 
    5         var a = $('#awaitmod'); 
    6         a.html( parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 ) ); 
    7 
    8  
    9 var delAfter = function( r, settings ) { 
    10         var a = $('#awaitmod'); 
    11         if ( $('#' + settings.element).is('.unapproved') && parseInt(a.html(),10) > 0 ) { 
    12                 a.html( parseInt(a.html(),10) - 1 ); 
     6        theExtraCommentList = new listMan('the-extra-comment-list'); 
     7        if ( theExtraCommentList ) { 
     8                theExtraCommentList.showLink = 0; 
     9                theExtraCommentList.altOffset = 1; 
     10                if ( theExtraCommentList.theList && theExtraCommentList.theList.childNodes ) 
     11                        var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length; 
     12                else 
     13                        var commentNum = 0; 
     14                var urlQ   = document.location.href.split('?'); 
     15                var params = urlQ[1] ? urlQ[1].toQueryParams() : []; 
     16                var search = params['s'] ? params['s'] : ''; 
     17                var page   = params['apage'] ? params['apage'] : 1; 
    1318        } 
    1419 
    15         if ( extra.size() == 0 || extra.children().size() == 0 ) { 
    16                 return; 
     20        theCommentList.dimComplete = function(what,id,dimClass) { 
     21                var m = document.getElementById('awaitmod'); 
     22                if ( document.getElementById(what + '-' + id).className.match(dimClass) ) 
     23                        m.innerHTML = parseInt(m.innerHTML,10) + 1; 
     24                else 
     25                        m.innerHTML = parseInt(m.innerHTML,10) - 1; 
    1726        } 
    1827 
    19         list[0].wpList.add( extra.children(':eq(0)').remove().clone() ); 
    20         $('#get-extra-comments').submit(); 
    21 
     28        theCommentList.delComplete = function(what,id) { 
     29                var m = document.getElementById('awaitmod'); 
     30                what = what.split('-')[0]; 
     31                if ( document.getElementById(what + '-' + id).className.match('unapproved') ) 
     32                        m.innerHTML = parseInt(m.innerHTML,10) - 1; 
     33                if ( theExtraCommentList && commentNum ) { 
     34                        var theMover = theExtraCommentList.theList.childNodes[0]; 
     35                        Element.removeClassName(theMover,'alternate'); 
     36                        theCommentList.theList.appendChild(theMover); 
     37                        theExtraCommentList.inputData += '&page=' + page; 
     38                        if ( search ) 
     39                                theExtraCommentList.inputData += '&s=' + search; // trust the URL not the search box 
     40                        theExtraCommentList.addComplete = function() { 
     41                                if ( theExtraCommentList.theList.childNodes ) 
     42                                        var commentNum = $A(theExtraCommentList.theList.childNodes).findAll( function(i) { return Element.visible(i) } ).length; 
     43                                else 
     44                                        var commentNum = 0; 
     45                        } 
     46                        theExtraCommentList.ajaxAdder( 'comment', 'ajax-response' ); // Dummy Request 
     47                } 
     48        } 
    2249 
    23 extra = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } ); 
    24 list = $('#the-comment-list').wpList( { dimAfter : dimAfter, delAfter : delAfter, addColor: 'none' } ); 
     50        if ( theList ) // the post list: edit.php 
     51                theList.delComplete = function() { 
     52                        var comments = document.getElementById('comments'); 
     53                        var commdel = encloseFunc(function(a){a.parentNode.removeChild(a);},comments); 
     54                        var listdel = encloseFunc(function(a){a.parentNode.removeChild(a);},theCommentList.theList); 
     55                        setTimeout(commdel,705); 
     56                        setTimeout(listdel,705); 
     57                } 
     58}); 
    2559 
    26 } ); 
  • trunk/wp-admin/js/link-cat.js

    r1125 r1139  
     1addLoadEvent(function(){linkcatList=new listMan('linkcategorychecklist');linkcatList.ajaxRespEl='jaxcat';linkcatList.topAdder=1;linkcatList.alt=0;linkcatList.showLink=0;}); 
     2addLoadEvent(newLinkCatAddIn); 
     3function newLinkCatAddIn() { 
     4        var jaxcat = $('jaxcat'); 
     5        if ( !jaxcat ) 
     6                return false; 
     7        Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + linkcatL10n.add + '"/><input type="hidden"/><span id="howto">' + linkcatL10n.how + '</span></span>'); 
     8        $('newcat').onkeypress = function(e) { return killSubmit("linkcatList.ajaxAdder('link-category','jaxcat');", e); }; 
     9        $('catadd').onclick = function() { linkcatList.ajaxAdder('link-category', 'jaxcat'); }; 
     10} 
     11 
  • trunk/wp-admin/js/users.js

    r1125 r1139  
    1 jQuery( function($) { 
    2         var userLists; var list; var addBefore; var addAfter; 
     1addLoadEvent(function() { 
     2        theListEls = document.getElementsByTagName('tbody'); 
     3        theUserLists = new Array(); 
     4        for ( var l = 0; l < theListEls.length; l++ ) { 
     5                if ( theListEls[l].id ) 
     6                        theUserLists[theListEls[l].id] = new listMan(theListEls[l].id); 
     7        } 
     8        addUserInputs = document.getElementById('adduser').getElementsByTagName('input'); 
     9        for ( var i = 0; i < addUserInputs.length; i++ ) { 
     10                addUserInputs[i].onkeypress = function(e) { return killSubmit('addUserSubmit();', e); } 
     11        } 
     12        document.getElementById('addusersub').onclick = function(e) { return killSubmit('addUserSubmit();', e); } 
     13
     14); 
    315 
    4         addBefore = function( s ) { 
    5                 if ( $( '#role-' + $('#role').val() ).size() ) 
    6                         return s; 
    7                 return false; 
    8         }; 
    9  
    10         addAfter = function( r, s ) { 
    11                 var roleTable = $( '#role-' + $('role', r).text() ); 
    12  
    13                 var e = $('#user-' + $('user', r).attr('id') ); 
    14                 if ( !roleTable.size() ) { return; } 
    15                 if ( !e.size() ) { return; } 
    16  
    17                 roleTable[0].wpList.add(e.remove().clone()); 
    18         };       
    19  
    20         userLists = $('.user-list').wpList(); 
    21         list = $('#user-list').wpList( { addBefore: addBefore, addAfter: addAfter } ); 
    22 } ); 
     16function addUserSubmit() { 
     17        var roleEl = document.getElementById('role'); 
     18        var role = roleEl.options[roleEl.selectedIndex].value; 
     19        if ( !theUserLists['role-' + role] ) return true; 
     20        return theUserLists['role-' + role].ajaxAdder('user', 'adduser'); 
     21