-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
long overdue update of this plugins git repo
- Loading branch information
Showing
4 changed files
with
357 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,57 @@ | ||
|
||
|
||
/** | ||
* jQuery for Media Categories plugin | ||
* | ||
* @author Eddie Moya | ||
* @since 1.1 | ||
* | ||
*/ | ||
|
||
jQuery(document).ready(function($){ | ||
|
||
$('tr.category_metabox input').live('click', function(){ | ||
|
||
var form_fields = $(this).closest("tbody"); | ||
|
||
var checked = form_fields.find(".category_metabox input:checked"); | ||
var slug_list = ''; | ||
|
||
checked.each(function(index){ | ||
|
||
if(slug_list.length > 0) | ||
slug_list += ',' + $(this).val(); | ||
else | ||
slug_list += $(this).val(); | ||
$.each(taxonomy, function(index, tax){ | ||
|
||
$('.media-upload-form tr.'+ tax + '').hide(); | ||
$('.media-upload-form tr.' + tax + '_metabox input').live('click', function(){ | ||
|
||
var form_fields = $(this).closest("tbody"); | ||
|
||
var checked = form_fields.find("." + tax + "_metabox input:checked"); | ||
var slug_list = ''; | ||
|
||
checked.each(function(index){ | ||
|
||
if(slug_list.length > 0) | ||
slug_list += ',' + $(this).val(); | ||
else | ||
slug_list += $(this).val(); | ||
}); | ||
|
||
form_fields.find("tr."+ tax +" > td.field > input.text").val(slug_list); | ||
}) | ||
|
||
$.extend($.expr[":"], { | ||
"icontains": function(elem, i, match, array) { | ||
return (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; | ||
} | ||
}); | ||
/** | ||
* The following javascript is borrowed (with few modifications) from Jason Corradino's | ||
* 'Searchable Categories' plugin. It allows the category metabox to be filtered | ||
* as the user types. To do this with your category meta boxes on pages and posts, | ||
* download his plugin. | ||
* | ||
* http://wordpress.org/extend/plugins/searchable-categories/ | ||
*/ | ||
|
||
$('#' + tax + '-search').keyup(function() { | ||
var val = $('#' + tax + '-search').val(); | ||
var lis = $("#"+ tax +"checklist li"); | ||
lis.hide(); | ||
|
||
// find li labels's containing term, then back to parent li | ||
var containingLabels = $("#"+ tax +"checklist label:icontains('" + val + "')"); | ||
containingLabels.closest('li').find('li').andSelf().show(); | ||
containingLabels.parents('#'+ tax +'checklist li').show(); | ||
}); | ||
|
||
form_fields.find("tr.category > td.field > input.text").val(slug_list); | ||
}) | ||
|
||
$.extend($.expr[":"], { | ||
"icontains": function(elem, i, match, array) { | ||
return (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; | ||
} | ||
}); | ||
/** | ||
* The following javascript is borrowed from Jason Corradino's 'Searchable Categories' plugin. | ||
* It allows the category metabox to be filtered as the user types. To do this with your | ||
* category meta boxes on pages and posts, download his plugin. | ||
* | ||
* http://wordpress.org/extend/plugins/searchable-categories/ | ||
*/ | ||
|
||
$('#catsearch').keyup(function() { | ||
var val = $('#catsearch').val(), lis = $("#categorychecklist li"); | ||
|
||
lis.hide(); | ||
|
||
// find li labels's containing term, then back to parent li | ||
var containingLabels = $("#categorychecklist label:icontains('" + val + "')"); | ||
containingLabels.closest('li').find('li').andSelf().show(); | ||
containingLabels.parents('#categorychecklist li').show(); | ||
}); | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.