Convert xfn.js to jQuery. Make the calculated field readonly if js. props rmccue. fixes #12551
git-svn-id: http://svn.automattic.com/wordpress/trunk@13984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ecec297237
commit
2581314a95
|
@ -1,41 +1,16 @@
|
|||
function GetElementsWithClassName(elementName, className) {
|
||||
var allElements = document.getElementsByTagName(elementName), elemColl = new Array(), i;
|
||||
for (i = 0; i < allElements.length; i++) {
|
||||
if (allElements[i].className == className) {
|
||||
elemColl[elemColl.length] = allElements[i];
|
||||
jQuery(document).ready( function($) {
|
||||
$('#link_rel').attr('readonly', 'readonly');
|
||||
$('#linkxfndiv input').bind('click keyup', function() {
|
||||
var isMe = $('#me').is(':checked'), inputs = '';
|
||||
$('input.valinp').each( function() {
|
||||
if (isMe) {
|
||||
$(this).attr('disabled', 'disabled').parent().addClass('disabled');
|
||||
} else {
|
||||
$(this).removeAttr('disabled').parent().removeClass('disabled');
|
||||
if ( $(this).is(':checked') && $(this).val() != '')
|
||||
inputs += $(this).val() + ' ';
|
||||
}
|
||||
}
|
||||
return elemColl;
|
||||
}
|
||||
|
||||
function meChecked() {
|
||||
var undefined, eMe = document.getElementById('me');
|
||||
if (eMe == undefined) return false;
|
||||
else return eMe.checked;
|
||||
}
|
||||
|
||||
function upit() {
|
||||
var isMe = meChecked(), inputColl = GetElementsWithClassName('input', 'valinp'), results = document.getElementById('link_rel'), inputs = '', i;
|
||||
for (i = 0; i < inputColl.length; i++) {
|
||||
inputColl[i].disabled = isMe;
|
||||
inputColl[i].parentNode.className = isMe ? 'disabled' : '';
|
||||
if (!isMe && inputColl[i].checked && inputColl[i].value != '') {
|
||||
inputs += inputColl[i].value + ' ';
|
||||
}
|
||||
}
|
||||
inputs = inputs.substr(0,inputs.length - 1);
|
||||
if (isMe) inputs='me';
|
||||
results.value = inputs;
|
||||
}
|
||||
|
||||
function blurry() {
|
||||
if (!document.getElementById) return;
|
||||
|
||||
var aInputs = document.getElementsByTagName('input'), i;
|
||||
|
||||
for ( i = 0; i < aInputs.length; i++) {
|
||||
aInputs[i].onclick = aInputs[i].onkeyup = upit;
|
||||
}
|
||||
}
|
||||
|
||||
addLoadEvent(blurry);
|
||||
});
|
||||
$('#link_rel').val( (isMe) ? 'me' : inputs.substr(0,inputs.length - 1) );
|
||||
});
|
||||
});
|
|
@ -1 +1 @@
|
|||
function GetElementsWithClassName(a,c){var d=document.getElementsByTagName(a),e=new Array(),b;for(b=0;b<d.length;b++){if(d[b].className==c){e[e.length]=d[b]}}return e}function meChecked(){var b,a=document.getElementById("me");if(a==b){return false}else{return a.checked}}function upit(){var b=meChecked(),e=GetElementsWithClassName("input","valinp"),d=document.getElementById("link_rel"),a="",c;for(c=0;c<e.length;c++){e[c].disabled=b;e[c].parentNode.className=b?"disabled":"";if(!b&&e[c].checked&&e[c].value!=""){a+=e[c].value+" "}}a=a.substr(0,a.length-1);if(b){a="me"}d.value=a}function blurry(){if(!document.getElementById){return}var b=document.getElementsByTagName("input"),a;for(a=0;a<b.length;a++){b[a].onclick=b[a].onkeyup=upit}}addLoadEvent(blurry);
|
||||
jQuery(document).ready(function(a){a("#link_rel").attr("readonly","readonly");a("#linkxfndiv input").bind("click keyup",function(){var c=a("#me").is(":checked"),b="";a("input.valinp").each(function(){if(c){a(this).attr("disabled","disabled").parent().addClass("disabled")}else{a(this).removeAttr("disabled").parent().removeClass("disabled");if(a(this).is(":checked")&&a(this).val()!=""){b+=a(this).val()+" "}}});a("#link_rel").val((c)?"me":b.substr(0,b.length-1))})});
|
|
@ -274,7 +274,8 @@ function wp_default_scripts( &$scripts ) {
|
|||
'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])
|
||||
) );
|
||||
|
||||
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", false, '3517m' );
|
||||
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), '20100403' );
|
||||
$scripts->add_data( 'xfn', 'group', 1 );
|
||||
|
||||
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), '20091012' );
|
||||
$scripts->add_data( 'postbox', 'group', 1 );
|
||||
|
|
Loading…
Reference in New Issue