o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1337815045.053479:@value"ô{I"
class:EFI"ProcessedAsset; FI"logical_path; F"jquery.taglist.jsI"
pathname; F"…/Users/josiahivey/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/browsercms-3.5.0.alpha/app/assets/javascripts/jquery.taglist.jsI"content_type; FI"application/javascript; FI"
mtime; FI"2012-05-15T13:58:23-05:00; FI"length; FiLI"digest; F"%6524ce7f8e0214f41684a04b30c531ffI"source; FI"L/*
jQuery taglist plugin
Defines a widget for allowing users to selecting tags in BrowserCMS. This is part of the BrowserCMS core project.
Please see the accompanying LICENSE.txt for licensing information.
*/
(function($){
$.fn.tagList = function(tags) {
var tagListInput = this;
var tagSeparator = " ";
var getTagList = function() {
return $('#'+$(tagListInput).attr('id')+'-tag-list');
}
var getCurrentTag = function() {
var value = $(tagListInput).val();
if(value == "" || value.match(/\s$/)) {
return ""
} else {
var tags = value.split(tagSeparator)
return tags[tags.length-1]
}
}
var getSelectedTag = function() {
return getTagList().find('li.selected')
}
var getFirstTag = function() {
return getTagList().find('li:first')
}
var positionAndSizeTagList = function() {
getTagList().css('top', $(tagListInput).offset().top+$(tagListInput).outerHeight())
.css('left', $(tagListInput).offset().left)
.css('width', $(tagListInput).outerWidth())
}
var createEmptyTagList = function() {
var id = $(tagListInput).attr('id') + '-tag-list';
$(tagListInput).after('
')
positionAndSizeTagList()
}
var matchesInputValue = function(tag, value) {
return tag && value && (tag.toLowerCase().indexOf(value.toLowerCase()) == 0);
}
var showTagList = function(value) {
var html = []
$.each(tags, function(i, tag){
if(matchesInputValue(tag, value)) {
html.push(''+tag+'');
}
})
getTagList().html(html.join("\n")).show()
getTagList().find('li').click(function(){
selectTag(this);
acceptTag();
return false;
});
}
var updateTagList = function() {
var value = getCurrentTag()
if(value && value != "") {
showTagList(value)
} else {
getTagList().hide();
}
}
var handleNavKeys = function(event) {
switch(event.keyCode) {
case 38: //Up Arrow
selectPrevTag()
break;
case 40: //Down Arrow
selectNextTag()
break;
case 9: //Tab
case 13: //Return
return !getTagList().is(':visible') || acceptTag();
}
}
var handleInput = function(event) {
switch(event.keyCode) {
case 9:
case 13:
case 38:
case 40:
break;
default:
updateTagList();
}
}
var selectTag = function(tag) {
getTagList().find('li').removeClass('selected')
$(tag).addClass('selected')
}
var selectPrevTag = function() {
if(getSelectedTag().length > 0 && getSelectedTag().prev().length > 0) {
selectTag(getSelectedTag().prev())
} else {
selectTag(getFirstTag())
}
}
var selectNextTag = function() {
if(getSelectedTag().length > 0 && getSelectedTag().next().length > 0) {
selectTag(getSelectedTag().next())
} else {
selectTag(getFirstTag())
}
}
var acceptTag = function() {
if(getSelectedTag().length == 0) {
if(getTagList().find('li').length > 0) {
selectTag(getFirstTag())
} else {
return true;
}
}
var tags = $(tagListInput).val().split(tagSeparator)
tags.pop()
tags.push(getSelectedTag().text())
$(tagListInput).val(tags.join(tagSeparator))
getTagList().hide()
return false;
}
createEmptyTagList()
$(this).keydown(handleNavKeys).keyup(handleInput)
$(this).attr('autocomplete', 'off') //Disable autofill on FF
$(this).blur(function(){getTagList().hide()})
}
})(jQuery);
; FI"dependency_digest; F"%1a88e4787f1ad626dbd4f5e0c6a11994I"required_paths; F["…/Users/josiahivey/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/browsercms-3.5.0.alpha/app/assets/javascripts/jquery.taglist.jsI"dependency_paths; F[{I" path; F"…/Users/josiahivey/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/browsercms-3.5.0.alpha/app/assets/javascripts/jquery.taglist.jsI"
mtime; FI"2012-05-15T13:58:23-05:00; FI"digest; F"%02c27e583df7a539c787f205e8be66d0I"
_version; F"%9f3b95dd7ea3030dc35985c0a8020862